/* ============================================================
   BODY PRISON — Cinematic 3D Layer
   CSS 3D transforms · parallax · scroll-triggered depth
   Loaded AFTER style.css so these rules win on conflict.
   ============================================================ */

/* ============================================================
   FLOATING 3D PHYSICAL BOOK
   ============================================================ */
.hero-book { perspective: 1600px; }

/* Idle float lives on the scene wrapper so it never fights the
   JS-driven tilt on the inner .book3d element. */
.book3d-scene {
  position: relative;
  width: 300px; height: 430px;
  transform-style: preserve-3d;
  animation: bookFloat 7s ease-in-out infinite;
}
@keyframes bookFloat {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-18px); }
}

.book3d {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transform: rotateX(6deg) rotateY(-22deg);
  transition: transform 0.12s ease-out;
  will-change: transform;
  cursor: pointer;
  display: block;
}

.b3-face {
  position: absolute;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Front cover */
.b3-front {
  inset: 0;
  transform: translateZ(23px);
  border-radius: 3px 6px 6px 3px;
  overflow: hidden;
  background: linear-gradient(135deg, #0a1628, #0d1f38);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 0 60px rgba(0,0,0,0.5);
}
.b3-front img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.b3-front-fallback {
  position: absolute; inset: 0;
  display: none; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-head, 'Bebas Neue'), sans-serif;
  font-size: 46px; letter-spacing: 4px; color: var(--red, #e63946);
  text-align: center; line-height: 0.95;
}
.b3-front-fallback span {
  font-size: 13px; letter-spacing: 3px; color: var(--cyan, #00c8e0);
  font-family: var(--font-body, 'Inter'), sans-serif;
}

/* Moving sheen across the cover */
.b3-shine {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg,
    transparent 35%,
    rgba(255,255,255,0.18) 48%,
    rgba(255,255,255,0.04) 55%,
    transparent 68%);
  background-size: 250% 100%;
  background-position: var(--sheen, 120%) 0;
  mix-blend-mode: screen;
  transition: background-position 0.1s linear;
}

/* Spine (left edge) */
.b3-spine {
  width: 46px; height: 430px;
  left: 50%; margin-left: -23px;
  transform: rotateY(-90deg) translateZ(150px);
  background: linear-gradient(90deg, #050a12, #0c1a2e 60%, #081320);
  border-radius: 3px 0 0 3px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset -6px 0 14px rgba(0,0,0,0.6),
              inset 2px 0 0 rgba(230,57,70,0.5);
}
.b3-spine span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-head, 'Bebas Neue'), sans-serif;
  font-size: 16px; letter-spacing: 4px;
  color: rgba(240,248,255,0.65);
  white-space: nowrap;
}

/* Pages (right edge) — stacked sheets */
.b3-pages {
  width: 46px; height: 430px;
  left: 50%; margin-left: -23px;
  transform: rotateY(90deg) translateZ(150px);
  background:
    repeating-linear-gradient(90deg,
      #e8e2d2 0px, #e8e2d2 1px,
      #cfc8b6 1px, #cfc8b6 2px,
      #f2eee0 2px, #f2eee0 3px);
  border-radius: 0 6px 6px 0;
  box-shadow: inset -4px 0 10px rgba(0,0,0,0.25);
}

/* Top + bottom edges — thin page stacks */
.b3-top, .b3-bottom {
  width: 300px; height: 46px;
  left: 0; top: 50%; margin-top: -23px;
  background: repeating-linear-gradient(0deg,
    #e8e2d2 0px, #e8e2d2 1px,
    #cfc8b6 1px, #cfc8b6 2px,
    #f2eee0 2px, #f2eee0 3px);
}
.b3-top    { transform: rotateX(90deg)  translateZ(215px); }
.b3-bottom { transform: rotateX(-90deg) translateZ(215px); }

/* Back cover */
.b3-back {
  inset: 0;
  transform: rotateY(180deg) translateZ(23px);
  background: linear-gradient(135deg, #0a1420, #061018);
  border-radius: 6px 3px 3px 6px;
  border: 1px solid rgba(255,255,255,0.05);
}

/* Contact-shadow under the book */
.book3d-scene::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -54px;
  width: 240px; height: 40px;
  transform: translateX(-50%) rotateX(70deg);
  background: radial-gradient(ellipse, rgba(0,0,0,0.6), transparent 70%);
  filter: blur(6px);
  z-index: -1;
  animation: shadowPulse 7s ease-in-out infinite;
}
@keyframes shadowPulse {
  0%,100% { opacity: 0.55; transform: translateX(-50%) rotateX(70deg) scale(1); }
  50%     { opacity: 0.35; transform: translateX(-50%) rotateX(70deg) scale(0.86); }
}

/* ============================================================
   MOTION SAFETY + RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .book3d-scene { width: 220px; height: 312px; transform: scale(0.92); }
  .b3-front, .b3-back { } /* inset already fills */
  .b3-spine, .b3-pages { height: 312px; }
  .b3-top, .b3-bottom { width: 220px; }
  /* recompute translateZ for smaller book: W/2=110 H/2=156 D/2=18 */
  .b3-front  { transform: translateZ(18px); }
  .b3-back   { transform: rotateY(180deg) translateZ(18px); }
  .b3-spine  { width: 36px; margin-left: -18px; transform: rotateY(-90deg) translateZ(110px); }
  .b3-pages  { width: 36px; margin-left: -18px; transform: rotateY(90deg)  translateZ(110px); }
  .b3-top    { height: 36px; margin-top: -18px; transform: rotateX(90deg)  translateZ(156px); }
  .b3-bottom { height: 36px; margin-top: -18px; transform: rotateX(-90deg) translateZ(156px); }
  .hl-near { display: none; }
  .cine-grain { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .book3d-scene, .book3d-scene::after,
  .cine-grain { animation: none !important; }
  .book3d { transform: rotateY(-14deg); }
}
