/* ==========================================================================
   05 — DEPTH
   Flat photographs read as space. Layered planes + one masked displacement
   shader; scroll drives the dolly, pointer/tilt drives the parallax.
   ========================================================================== */

@font-face {
  font-family: "Fraunces";
  src: url("/vendor/fonts/Fraunces-Variable.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/vendor/fonts/Newsreader-Variable.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/vendor/fonts/Newsreader-Italic-Variable.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("/vendor/fonts/SpaceGrotesk-Variable.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/vendor/fonts/Inter-Variable.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink-0: #0a0805;
  --ink-1: #120d08;
  --stone: #cbb08a;
  --stone-dim: #a68f6c;
  --sky: #bcd3da;
  --paper: #f4ecdd;
  --paper-dim: #ac9f8b;
  --line: rgba(203, 176, 138, 0.18);
}

* { box-sizing: border-box; }
html { background: var(--ink-0); }
body {
  margin: 0;
  background: var(--ink-0);
  color: var(--paper);
  font-family: "Inter", sans-serif;
  overflow-x: hidden;
  cursor: default;
}

/* ---------- fixed WebGL layer + atmosphere ---------- */

#depthCanvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  display: block;
  opacity: 0;
  transition: opacity 1.1s ease;
}
#depthCanvas.ready { opacity: 1; }

.vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 45%, rgba(10, 8, 5, 0.55) 100%),
    linear-gradient(to bottom, rgba(10, 8, 5, 0.5) 0%, transparent 14%, transparent 78%, rgba(10, 8, 5, 0.65) 100%);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 140px 140px;
}

/* ---------- chrome ---------- */

.chrome {
  position: fixed;
  z-index: 20;
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-dim);
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.4s ease, color 0.4s ease;
}
.chrome-index { top: 22px; left: 24px; }
.chrome-room { top: 22px; right: 24px; }
a.chrome:hover, a.chrome:focus-visible { opacity: 1; color: var(--sky); }

.tilt-toggle, .sound-toggle {
  position: fixed;
  z-index: 20;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 6px 4px;
  cursor: pointer;
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-dim);
  opacity: 0.6;
  transition: opacity 0.4s ease, color 0.4s ease;
}
.tilt-toggle { left: 24px; }
.sound-toggle { right: 24px; }
.tilt-toggle:hover, .tilt-toggle:focus-visible,
.sound-toggle:hover, .sound-toggle:focus-visible { opacity: 1; color: var(--sky); }
.tilt-toggle.engaged { color: var(--sky); opacity: 0.9; }

.sound-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  transition: opacity 0.6s ease, box-shadow 0.6s ease;
}
.sound-toggle[aria-pressed="true"] .sound-dot {
  opacity: 1;
  box-shadow: 0 0 8px 2px var(--sky);
  animation: pulse 3.2s ease-in-out infinite;
}
.sound-toggle[aria-pressed="true"] .sound-label::after { content: " · playing"; opacity: 0.6; }
@keyframes pulse { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }

/* ---------- layout ---------- */

.field {
  position: relative;
  z-index: 5;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 8vw;
}

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1.1rem;
}
.eyebrow {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--stone-dim);
}
.title {
  margin: 0;
  font-family: "Fraunces", serif;
  font-weight: 380;
  font-size: clamp(3.4rem, 12vw, 9rem);
  line-height: 0.92;
  letter-spacing: -0.01em;
  color: var(--paper);
  font-variation-settings: "opsz" 90, "SOFT" 30, "WONK" 0;
}
.deck {
  margin: 0.6rem 0 0;
  font-family: "Newsreader", serif;
  font-style: italic;
  font-weight: 380;
  font-size: clamp(1.05rem, 1.9vw, 1.5rem);
  line-height: 1.6;
  max-width: 34ch;
  color: var(--paper);
  font-variation-settings: "opsz" 14;
}
.hint {
  margin-top: 2rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper-dim);
  animation: hintFloat 3.4s ease-in-out infinite;
}
@keyframes hintFloat {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(6px); opacity: 1; }
}

/* ---------- stages (the WebGL / static photo lives here) ---------- */

.stage {
  position: relative;
  min-height: 240vh;
}
.stage-delicate { min-height: 190vh; }

.stage-inner {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 9vh;
  pointer-events: none;
}

.static-photo { display: none; }

.stage-hint {
  margin: 0;
  font-family: "Newsreader", serif;
  font-style: italic;
  font-weight: 360;
  font-size: clamp(0.95rem, 1.7vw, 1.15rem);
  color: var(--paper);
  opacity: 0.75;
  text-align: center;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6);
  font-variation-settings: "opsz" 14;
}

/* ---------- captions between chapters ---------- */

.caption {
  position: relative;
  z-index: 5;
  min-height: 68vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  padding: 4vh 8vw;
}
.caption-text {
  margin: 0;
  font-family: "Newsreader", serif;
  font-style: italic;
  font-weight: 380;
  font-size: clamp(1.35rem, 3.1vw, 2.15rem);
  line-height: 1.5;
  max-width: 30ch;
  color: var(--paper);
  font-variation-settings: "opsz" 24;
}
.caption-sub {
  margin: 0;
  font-family: "Newsreader", serif;
  font-style: italic;
  font-size: clamp(0.9rem, 1.4vw, 1.05rem);
  color: var(--paper-dim);
  max-width: 32ch;
}
.caption-delicate .caption-text {
  font-size: clamp(1.15rem, 2.4vw, 1.7rem);
  opacity: 0.92;
  max-width: 26ch;
}

.outro {
  min-height: 66vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 8vw;
  position: relative;
  z-index: 5;
}
.outro-text {
  font-family: "Newsreader", serif;
  font-style: italic;
  font-size: clamp(1.15rem, 2.4vw, 1.7rem);
  line-height: 1.7;
  text-align: center;
  max-width: 42ch;
  color: var(--paper);
}

/* ---------- notes panel ---------- */

.notes {
  position: relative;
  z-index: 5;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 8vw 14vh;
}
.notes-toggle {
  font-family: "Space Grotesk", sans-serif;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper-dim);
  background: none;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 7px 16px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.3s ease, border-color 0.3s ease;
}
.notes-toggle:hover, .notes-toggle:focus-visible { opacity: 0.95; border-color: rgba(188, 211, 218, 0.4); }

.notes-panel {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  max-width: 66ch;
}
.notes-inner p {
  font-family: "Inter", sans-serif;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--paper-dim);
  opacity: 0.85;
  margin: 0 0 1em;
  font-variation-settings: "opsz" 14;
}
.notes-inner strong { color: var(--paper); font-weight: 600; opacity: 0.95; }

/* ---------- reduced motion / static fallback ---------- */

@media (prefers-reduced-motion: reduce) {
  /* keep .sound-toggle visible — the ambient bed is not a motion feature and
     works under reduced motion; only tilt (itself a motion feature) is hidden */
  #depthCanvas, .vignette, .grain, .tilt-toggle, .hint { display: none; }

  .stage { min-height: auto; }
  .stage-inner {
    position: static;
    height: auto;
    padding: 6vh 0;
    flex-direction: column;
    gap: 1.4rem;
    pointer-events: auto;
  }
  .static-photo {
    display: block;
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    border-radius: 2px;
    box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.7);
  }
  .stage-hint { text-shadow: none; opacity: 0.85; }
  body { background: var(--ink-1); }
}

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  .field { padding: 0 7vw; }
  .chrome-room { font-size: 10px; }
  .tilt-toggle { left: 20px; bottom: 20px; }
  .sound-toggle { right: 20px; bottom: 20px; }
  .stage { min-height: 200vh; }
  .stage-delicate { min-height: 165vh; }
}

@media (max-width: 640px) and (orientation: landscape) {
  .hero, .caption, .outro { min-height: auto; padding-top: 10vh; padding-bottom: 10vh; }
}
