/* ========================================================
   BOOKIFY ARCHIVE — 3D SHELF & ARC HERO
   Curved geometry, shading, play ring, caption masks & timeline
   ======================================================== */

/* Giant Background Kanji: 書物の記憶 (Memories of Books) */
.kanji-bg {
  position: fixed;
  z-index: 1;
  writing-mode: vertical-rl;
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 800;
  font-size: min(19vh, 12.5vw);
  line-height: 1.02;
  letter-spacing: 0.02em;
  pointer-events: none;
  user-select: none;
  color: transparent;
  background-clip: text;
  -webkit-background-clip: text;
  background-image: radial-gradient(circle at 50% 50%, rgba(64, 82, 138, 0.45) 0%, rgba(64, 82, 138, 0.45) 36%, transparent 40%);
  background-size: 3px 3px;
  background-color: rgba(110, 122, 160, 0.22);
  transition: opacity 0.4s;
}

.kanji-left {
  left: 2.4vw;
  top: 13vh;
}

.kanji-right {
  right: 2.4vw;
  top: 9vh;
}

/* Shelf Section & Floor Shadow */
.shelf-section {
  position: fixed;
  left: 0;
  width: 100%;
  top: calc(var(--cy) - var(--H) / 2 - 50px);
  height: calc(var(--H) + 100px);
  perspective: 1400px;
  perspective-origin: 50% 50%;
  z-index: 10;
  touch-action: pan-y;
  transition: opacity 0.4s;
}

.floor-shadow {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: calc(var(--cy) + var(--H) * 0.47);
  width: min(96vw, calc(var(--H) * 3.6));
  height: calc(var(--H) * 0.26);
  background: radial-gradient(50% 50% at 50% 40%, rgba(35, 26, 15, 0.35), rgba(35, 26, 15, 0.12) 55%, transparent 72%);
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.4s;
}

.stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
}

/* 3D Tape / Book */
.tape {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  will-change: transform;
  cursor: pointer;
}

.tape .face {
  position: absolute;
  height: var(--H);
  top: calc(var(--H) * -0.5);
  backface-visibility: hidden;
  border-radius: 3px;
  background-repeat: no-repeat;
  overflow: hidden;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.18);
}

.tape .face::after {
  content: '';
  position: absolute;
  inset: 0;
  background-color: #000;
  opacity: var(--shade, 0);
  pointer-events: none;
  border-radius: inherit;
}

/* Spine Face */
.tape .sp {
  width: var(--ws);
  left: calc(var(--ws) * -0.5);
  transform: translateZ(calc(var(--d) / 2));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 14px 4px;
  color: #ECE8E0;
  border-left: 1px solid rgba(255,255,255,0.22);
  border-right: 1px solid rgba(0,0,0,0.45);
  background-color: #1B3BA8;
}

.tape .sp .sp-author {
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: 0.88;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.tape .sp .sp-title {
  font-family: var(--display);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  max-height: 55%;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.tape .sp .sp-ribbon {
  width: 14px;
  height: 20px;
  border: 1px solid rgba(255,255,255,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7.5px;
  font-weight: 700;
  opacity: 0.85;
}

/* Cover Face */
.tape .cv {
  width: var(--d);
  left: calc(var(--d) * -0.5);
  transform: rotateY(90deg) translateZ(calc(var(--ws) / 2));
  box-shadow: 0 34px 60px -28px rgba(20, 16, 10, 0.65), 0 0 1px rgba(0,0,0,0.3);
  border-radius: 4px;
  background-color: #1B3BA8;
}

.cv-fallback-art {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px 24px;
  color: #ECE8E0;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.22);
  box-sizing: border-box;
  background: inherit;
}

.cv-fallback-art h3 {
  font-family: var(--display);
  font-size: 22px;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

.cv-fallback-art p {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.85;
}

/* Quick Read Ring */
.play-ring {
  position: fixed;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--cobalt);
  background: rgba(236, 232, 224, 0.9);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 25;
  cursor: pointer;
  transform-origin: center center;
  transition: transform 0.2s, background-color 0.2s;
}

.play-ring:hover {
  background: #FFFFFF;
  transform: scale(1.1) !important;
}

.play-ring svg {
  width: 18px;
  height: 18px;
  fill: var(--cobalt);
}

/* Bulletproof Sliding Caption Masks */
.caption-container {
  position: fixed;
  top: calc(var(--cy) + var(--H) / 2 + 4.2vh);
  left: 50%;
  transform: translateX(-50%);
  width: min(82vw, 680px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 20;
  pointer-events: none;
  transition: opacity 0.3s;
}

.caption-mask {
  overflow: hidden;
  position: relative;
  width: 100%;
}

.caption-mask.sub-mask {
  height: 16px;
}

.caption-mask.title-mask {
  height: clamp(34px, 4.4vw, 56px);
}

.caption-mask.meta-mask {
  height: 22px;
}

.caption-item {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
}

.caption-title {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(26px, 3.4vw, 44px);
  letter-spacing: -0.015em;
  color: var(--cobalt);
  line-height: 1;
}

.caption-subtitle {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: 0.24em;
  color: var(--cobalt);
  text-transform: uppercase;
  opacity: 0.9;
  line-height: 1;
}

.caption-rule {
  width: 22px;
  height: 1px;
  background: var(--cobalt);
  opacity: 0.8;
}

.caption-meta-line {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1;
}

.caption-price {
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  letter-spacing: 0.1em;
  background: rgba(27, 59, 168, 0.1);
  color: var(--cobalt);
}

.caption-price.free {
  background: rgba(35, 110, 68, 0.12);
  color: var(--green);
}

/* Navigation Arrows */
.nav-arrow {
  position: fixed;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--cobalt);
  z-index: 25;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: opacity 0.2s, transform 0.2s;
}

.nav-arrow:hover {
  opacity: 1;
  transform: scale(1.12);
}

.nav-arrow svg {
  width: 24px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.4px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Timeline */
.timeline-container {
  position: fixed;
  left: 36px;
  right: 36px;
  bottom: 56px;
  height: 40px;
  z-index: 20;
  cursor: pointer;
  touch-action: none;
  transition: opacity 0.3s;
}

.timeline-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 19px;
  height: 1px;
  background: var(--rule);
  opacity: 0.35;
}

.timeline-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.timeline-tick {
  position: absolute;
  top: 15px;
  width: 1px;
  background: var(--ink);
}

.timeline-tick.major {
  height: 9px;
  opacity: 0.8;
}

.timeline-tick.minor {
  height: 5px;
  top: 17px;
  opacity: 0.35;
}

.timeline-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.timeline-label {
  position: absolute;
  top: 28px;
  transform: translateX(-50%);
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.timeline-label.first { transform: translateX(0); }
.timeline-label.last { transform: translateX(-100%); }

.timeline-dot {
  position: absolute;
  top: 15px;
  left: 0%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cobalt);
  transform: translate(-50%, 0);
  box-shadow: 0 0 0 3px rgba(27, 59, 168, 0.22);
  pointer-events: none;
  will-change: left;
}

@media (max-width: 767px) {
  .timeline-container {
    left: 20px;
    right: 20px;
    bottom: 72px;
  }
  .timeline-label.hide-phone {
    display: none;
  }
}

/* Custom Cursor active on 3D Shelf Canvas */
@media (pointer: fine) {
  body:has(#cursor):not(:has(.modal-overlay.active)):not(:has(.detail-sheet.active)),
  body:has(#cursor):not(:has(.modal-overlay.active)):not(:has(.detail-sheet.active)) button,
  body:has(#cursor):not(:has(.modal-overlay.active)):not(:has(.detail-sheet.active)) a,
  body:has(#cursor):not(:has(.modal-overlay.active)):not(:has(.detail-sheet.active)) .clickable,
  body:has(#cursor):not(:has(.modal-overlay.active)):not(:has(.detail-sheet.active)) .play-ring,
  body:has(#cursor):not(:has(.modal-overlay.active)):not(:has(.detail-sheet.active)) .tape,
  body:has(#cursor):not(:has(.modal-overlay.active)):not(:has(.detail-sheet.active)) .timeline-container {
    cursor: none !important;
  }
}

