/* ============================================================
   NEURAL SANCTUARY — styles.css
   Palette: bg #0B0E1A · panels #141A30 · cards #1D2542
   ink #ECE7DC · teal #7FB5AD (#3D5A58 deep) · gold #D9A86A (#E9CBA0 soft)
   muted #9AA0B0
   ============================================================ */

:root {
  --bg: #0B0E1A;
  --panel: #141A30;
  --card: #1D2542;
  --ink: #ECE7DC;
  --teal: #7FB5AD;
  --teal-deep: #3D5A58;
  --gold: #D9A86A;
  --gold-soft: #E9CBA0;
  --muted: #9AA0B0;
  --display: "Cormorant Garamond", Georgia, serif;
  --body: "Manrope", system-ui, -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { overflow-x: clip; scroll-behavior: auto; }

body {
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

h2 { font-size: clamp(2rem, 4.5vw, 3.4rem); }

a { color: var(--ink); text-decoration: none; }

button { font-family: var(--body); cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection { background: rgba(217, 168, 106, 0.28); color: var(--ink); }

.eyebrow {
  font-family: var(--body);
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--teal);
}

/* ---------- skip link ---------- */
.skip-link {
  position: fixed;
  top: -100px;
  left: 1rem;
  z-index: 100;
  background: var(--panel);
  color: var(--gold);
  padding: 0.7rem 1.2rem;
  border: 1px solid var(--gold);
  border-radius: 3px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  transition: top 0.25s ease;
}
.skip-link:focus-visible { top: 1rem; }

/* ---------- grain overlay ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 120px 120px;
}

/* ---------- particle canvas ---------- */
#motes {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

/* ---------- nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem clamp(1.2rem, 4vw, 3rem);
  transition: background-color 0.5s ease, backdrop-filter 0.5s ease,
              transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav.is-solid {
  background: rgba(11, 14, 26, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.nav.is-hidden { transform: translateY(-110%); }

.nav__wordmark {
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.nav__links { display: flex; gap: clamp(1rem, 2.4vw, 2.2rem); }
.nav__links a {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.35s ease;
}
.nav__links a:hover { color: var(--gold); }

.nav__toggle {
  display: none;
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  position: relative;
  z-index: 46;
}
.nav__toggle span {
  display: block;
  width: 22px;
  height: 1px;
  background: var(--ink);
  margin: 5px auto;
  transition: transform 0.35s ease, opacity 0.35s ease;
}
.nav__toggle[aria-expanded="true"] span:first-child { transform: translateY(3px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:last-child { transform: translateY(-3px) rotate(-45deg); }

.nav-veil {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(11, 14, 26, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-veil[hidden] { display: none; }
.nav-veil nav { display: flex; flex-direction: column; gap: 2.2rem; text-align: center; }
.nav-veil a {
  font-family: var(--display);
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  color: var(--ink);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease, color 0.3s ease;
}
.nav-veil.is-open a { opacity: 1; transform: none; }
.nav-veil a:nth-child(1) { transition-delay: 0.05s; }
.nav-veil a:nth-child(2) { transition-delay: 0.12s; }
.nav-veil a:nth-child(3) { transition-delay: 0.19s; }
.nav-veil a:nth-child(4) { transition-delay: 0.26s; }
.nav-veil a:nth-child(5) { transition-delay: 0.33s; }
.nav-veil a:hover { color: var(--gold); }

/* ---------- enso progress ---------- */
.enso-progress {
  position: fixed;
  bottom: 1.6rem;
  right: 1.6rem;
  z-index: 55;
  width: 56px;
  height: 56px;
  background: none;
  border: none;
  padding: 0;
  opacity: 0.9;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.enso-progress:hover { opacity: 1; transform: scale(1.06); }
.enso-progress svg { width: 100%; height: 100%; display: block; }
.enso-progress__track { stroke: rgba(236, 231, 220, 0.12); stroke-width: 2; stroke-linecap: round; }
.enso-progress__fill {
  stroke: var(--gold);
  stroke-width: 2.4;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px rgba(217, 168, 106, 0.5));
}
.enso-progress__ghost { stroke: rgba(217, 168, 106, 0.18); stroke-width: 1; stroke-linecap: round; }
.enso-progress.is-away { opacity: 0; pointer-events: none; }

/* ============================================================
   SCENES — shared
   ============================================================ */
.scene { position: relative; }

/* ---------- S0 · THE GATE ---------- */
.scene--gate {
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  z-index: 5;
}
.gate__stack { position: absolute; inset: 0; }
.gate__layer {
  position: absolute;
  inset: -12% -6%;
  will-change: transform;
}
.gate__layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gate__layer--sky { z-index: 1; }
.gate__layer--far { z-index: 2; }
.gate__layer--far img { filter: brightness(0.75); }
.gate__layer--mist { z-index: 4; mix-blend-mode: screen; opacity: 0.9; }
.gate__layer--foliage { z-index: 6; mix-blend-mode: multiply; }
.gate__dim {
  position: absolute;
  inset: 0;
  z-index: 7;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
}

.gate__text {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 1.5rem;
}
.gate__text::before {
  /* legibility pool behind the arrival type — the dawn art is pale */
  content: "";
  position: absolute;
  inset: -12% -10%;
  z-index: -1;
  background: radial-gradient(ellipse 60% 42% at 50% 50%,
    rgba(6, 8, 18, 0.55) 0%,
    rgba(6, 8, 18, 0.3) 48%,
    transparent 74%);
  pointer-events: none;
}
.gate__eyebrow {
  opacity: 0;
  margin-bottom: 1.6rem;
  color: #A9D3CB;
  text-shadow: 0 1px 12px rgba(6, 8, 18, 0.8);
}
.gate__title {
  font-size: clamp(3rem, 11vw, 8.6rem);
  font-weight: 300;
  letter-spacing: 0.01em;
  color: var(--ink);
  min-height: 2.3em;
  text-shadow: 0 2px 18px rgba(6, 8, 18, 0.8), 0 2px 60px rgba(6, 8, 18, 0.55);
}
.gate__line { display: block; overflow: hidden; }
.gate__line-inner { display: inline-block; transform: translateY(110%); will-change: transform; }

.gate__cue {
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  opacity: 0;
}
.gate__rule {
  width: 1px;
  height: 64px;
  background: linear-gradient(to bottom, var(--gold), transparent);
  transform-origin: top;
  animation: cue-loop 2.8s ease-in-out infinite;
}
@keyframes cue-loop {
  0%, 100% { transform: scaleY(0.35); opacity: 0.5; }
  50% { transform: scaleY(1); opacity: 1; }
}
.gate__cue-label {
  font-size: 0.68rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: #C9CEDA;
  text-shadow: 0 1px 10px rgba(6, 8, 18, 0.8);
}

.gate__arrived {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.6rem, 3.6vw, 2.6rem);
  color: var(--gold-soft);
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 2px 16px rgba(6, 8, 18, 0.85), 0 2px 40px rgba(6, 8, 18, 0.6);
}

/* ---------- S1 · THE SLOWING ---------- */
.scene--slowing {
  position: relative;
  z-index: 4;
  padding: 22vh 1.5rem 26vh;
  margin-top: -18vh;
  background: var(--bg);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18vh);
  mask-image: linear-gradient(to bottom, transparent 0, #000 18vh);
  overflow: hidden;
}
.slowing__echo {
  position: absolute;
  inset: 0;
  background-image: url("img/sanctuary-far.jpg");
  background-size: cover;
  background-position: 50% 30%;
  opacity: 0.06;
  pointer-events: none;
}
.slowing__col {
  position: relative;
  max-width: 30ch;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.slowing__line {
  font-family: var(--display);
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  font-weight: 400;
  line-height: 1.5;
  color: var(--ink);
  text-shadow: 0 1px 14px rgba(6, 8, 18, 0.6);
}
.slowing__line:nth-child(1) { margin-bottom: 3.4rem; }
.slowing__line:nth-child(2) { margin-bottom: 3.85rem; letter-spacing: 0.005em; }
.slowing__line:nth-child(3) { margin-bottom: 3rem; }
.slowing__line:nth-child(5) { margin-bottom: 4.75rem; letter-spacing: 0.015em; }
.slowing__line:nth-child(6) { letter-spacing: 0.02em; color: var(--gold-soft); }
.slowing__path {
  width: 1px;
  height: 18vh;
  margin: 0 auto 3rem;
  background: linear-gradient(to bottom, var(--gold), rgba(217, 168, 106, 0.25));
  transform-origin: top;
  transform: scaleY(0);
}

/* ---------- S2 · THE BREATH ---------- */
.scene--breath {
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  z-index: 4;
  overflow: hidden;
}
.breath__stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
  text-align: center;
}
.breath__stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, transparent 30%, rgba(4, 6, 14, 0.75) 100%);
  pointer-events: none;
}
.breath__mist {
  position: absolute;
  inset: -14%;
  mix-blend-mode: screen;
  opacity: 0.25;
  pointer-events: none;
  will-change: transform;
}
.breath__mist img { width: 100%; height: 100%; object-fit: cover; }

.breath__intro {
  position: relative;
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.1rem, 2.2vw, 1.5rem);
  color: var(--muted);
  margin-bottom: 4vh;
}

.breath__orb-wrap {
  position: relative;
  width: min(38vh, 340px);
  height: min(38vh, 340px);
  display: grid;
  place-items: center;
}
.breath__orb {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 46% 42%,
      rgba(233, 203, 160, 0.5) 0%,
      rgba(217, 168, 106, 0.22) 26%,
      rgba(127, 181, 173, 0.14) 55%,
      transparent 72%);
  will-change: transform;
  animation: orb-shimmer 5s ease-in-out infinite;
}
@keyframes orb-shimmer {
  0%, 100% { filter: brightness(1) saturate(1); }
  50% { filter: brightness(1.12) saturate(1.12); }
}
.breath__enso { position: absolute; inset: -4%; width: 108%; height: 108%; }
.breath__enso-outer { stroke: rgba(217, 168, 106, 0.85); stroke-width: 2.6; stroke-linecap: round; }
.breath__enso-inner { stroke: rgba(217, 168, 106, 0.28); stroke-width: 1.1; stroke-linecap: round; }
.breath__enso-arc {
  stroke: var(--gold-soft);
  stroke-width: 3.2;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(233, 203, 160, 0.7));
}

.breath__lines {
  position: relative;
  margin-top: 4.5vh;
  min-height: 5.2em;
  display: grid;
  place-items: start center;
  max-width: 34ch;
}
.breath__line {
  grid-area: 1 / 1;
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.8vw, 1.9rem);
  font-weight: 400;
  line-height: 1.5;
  color: var(--ink);
  opacity: 0;
}
.breath__line--handoff { color: var(--gold-soft); font-style: italic; }

.breath__counter {
  position: relative;
  min-height: 1.4em;
  margin-top: 0.6rem;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--teal);
}

.breath__more {
  position: relative;
  margin-top: 2.2rem;
  background: none;
  border: 1px solid rgba(217, 168, 106, 0.55);
  color: var(--gold);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 0.85rem 2rem;
  border-radius: 100px;
  transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
  opacity: 0;
}
.breath__more:hover { background: rgba(217, 168, 106, 0.12); border-color: var(--gold); }
.breath__reduced { display: none; position: relative; margin-top: 2rem; color: var(--muted); font-size: 0.95rem; }

/* ---------- S3 · CHAMBERS INTRO ---------- */
.scene--chambers-intro {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14vh 1.5rem 10vh;
  background: var(--bg);
  z-index: 4;
}
.chambers-intro__title { margin: 1.4rem 0 1.2rem; }
.chambers-intro__body { max-width: 46ch; color: var(--muted); }

/* ---------- S3 · THE CHAMBERS ---------- */
.scene--chambers {
  position: relative;
  overflow: hidden;
  background: var(--bg);
  z-index: 4;
}
.corridor { display: flex; width: 400vw; will-change: transform; }
.chamber {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  flex-shrink: 0;
  overflow: hidden;
}
.chamber__bg {
  position: absolute;
  inset: 0 -7.5%;
  will-change: transform;
}
.chamber__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.5) saturate(0.9);
}
.chamber__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(11, 14, 26, 0.88) 0%, rgba(11, 14, 26, 0.55) 42%, rgba(11, 14, 26, 0.35) 100%);
}
.chamber__frame {
  position: absolute;
  inset: 4vh 4vw;
  border: 1px solid rgba(217, 168, 106, 0.28);
  pointer-events: none;
}
.chamber__frame::before, .chamber__frame::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
}
.chamber__frame::before {
  top: -1px; left: -1px;
  border-top: 1px solid rgba(217, 168, 106, 0.7);
  border-left: 1px solid rgba(217, 168, 106, 0.7);
}
.chamber__frame::after {
  bottom: -1px; right: -1px;
  border-bottom: 1px solid rgba(217, 168, 106, 0.7);
  border-right: 1px solid rgba(217, 168, 106, 0.7);
}

.chamber__inner {
  position: relative;
  z-index: 2;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 2fr;
  gap: 3vw;
  align-items: center;
  padding: 10vh 6vw 8vh;
}
.chamber__meta { position: relative; }
.chamber__numeral {
  position: absolute;
  top: -0.55em;
  left: -0.12em;
  font-family: var(--display);
  font-size: clamp(7rem, 16vw, 13rem);
  line-height: 1;
  color: var(--ink);
  opacity: 0.08;
  pointer-events: none;
  user-select: none;
}
.chamber__freq { margin-bottom: 1rem; }
.chamber__name {
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  font-style: italic;
  font-weight: 400;
  margin-bottom: 1rem;
}
.chamber__dedication {
  font-family: var(--display);
  font-size: 1.2rem;
  color: var(--gold-soft);
  margin-bottom: 0.8rem;
}
.chamber__desc { color: var(--muted); max-width: 34ch; margin-bottom: 1.4rem; }
.chamber__count {
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--teal);
}

/* video shelf */
.chamber__shelf {
  display: flex;
  gap: 1.4rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 1rem 0.2rem 1.6rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.chamber__shelf::-webkit-scrollbar { display: none; }

.video-card {
  flex: 0 0 clamp(260px, 24vw, 380px);
  scroll-snap-align: start;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  color: var(--ink);
  border-radius: 14px;
}
.video-card__poster {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
}
.video-card__poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1), filter 0.7s ease;
  filter: brightness(0.82);
}
.video-card:hover .video-card__poster img,
.video-card:focus-visible .video-card__poster img {
  transform: scale(1.07);
  filter: brightness(1);
}
.video-card__ring {
  position: absolute;
  top: 50%; left: 50%;
  width: 44px; height: 44px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.video-card__ring svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 0 8px rgba(217, 168, 106, 0.55)); }
.video-card__ring circle {
  fill: rgba(11, 14, 26, 0.45);
  stroke: var(--gold);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 118 13; /* 20° gap on r=21 circle */
  transition: stroke-dasharray 0.6s ease;
}
.video-card:hover .video-card__ring circle,
.video-card:focus-visible .video-card__ring circle { stroke-dasharray: 131 0; }
.video-card__ring path { fill: var(--gold-soft); }
.video-card__title {
  font-family: var(--display);
  font-size: 1.15rem;
  margin-top: 0.8rem;
  line-height: 1.3;
}
.video-card__sub {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.3rem;
}

/* chamber dots */
.chamber-dots {
  position: absolute;
  bottom: 3.2vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  gap: 1.1rem;
}
.chamber-dots button {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(217, 168, 106, 0.45);
  background: transparent;
  padding: 0;
  transition: background-color 0.4s ease, border-color 0.4s ease, transform 0.4s ease;
}
.chamber-dots button.is-active {
  background: var(--gold);
  border-color: var(--gold);
  transform: scale(1.15);
  box-shadow: 0 0 10px rgba(217, 168, 106, 0.6);
}

/* ---------- S4 · THE KEEPSAKES ---------- */
.scene--keepsakes {
  position: relative;
  z-index: 4;
  background: var(--bg);
}
.keepsakes__backdrop {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  pointer-events: none;
}
.keepsakes__garden {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.6);
  will-change: transform;
}
.keepsakes__haze {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  object-fit: cover;
  mix-blend-mode: screen;
  opacity: 0.18;
  will-change: transform;
}
.keepsakes__backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(11, 14, 26, 0.75) 0%, rgba(11, 14, 26, 0.3) 40%, rgba(11, 14, 26, 0.82) 100%);
}
.keepsakes__content {
  position: relative;
  z-index: 2;
  margin-top: -100vh;
  padding: 16vh clamp(1.5rem, 6vw, 6rem) 20vh;
}
.keepsakes__head { text-align: center; max-width: 56ch; margin: 0 auto 14vh; }
.keepsakes__head h2 { margin: 1.4rem 0 1.4rem; }
.keepsakes__body { color: var(--muted); }

.books {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 3vw;
  perspective: 1200px;
  max-width: 1400px;
  margin: 0 auto;
}
.book { position: relative; width: clamp(240px, 26vw, 340px); }
.book--dawn { margin-left: 2vw; }
.book--tide { margin-top: 14vh; }
.book--bloom { margin-right: 2vw; }

.book__tilt { transform-style: preserve-3d; will-change: transform; }
.book--dawn .book__tilt { transform: rotate(-3deg); }
.book--tide .book__tilt { transform: rotate(1.5deg); }
.book--bloom .book__tilt { transform: rotate(-2deg); }

.book__cover {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 6px 14px 14px 6px;
  overflow: hidden;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.5),
    0 24px 60px rgba(0, 0, 0, 0.45),
    0 8px 40px rgba(217, 168, 106, 0.12);
}
.book__cover::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 2px;
  background: rgba(236, 231, 220, 0.35);
  z-index: 3;
}
.book__cover img { width: 100%; height: 100%; object-fit: cover; }
.book__title-overlay {
  /* the generated covers carry their own typography; keep this for
     screen readers only so the object still announces its name */
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.book__sheen {
  position: absolute;
  inset: -40%;
  z-index: 2;
  background: linear-gradient(115deg, transparent 40%, rgba(233, 203, 160, 0.16) 50%, transparent 60%);
  pointer-events: none;
  will-change: transform;
}
.book__shadow {
  display: block;
  width: 70%;
  height: 18px;
  margin: 1.6rem auto 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  filter: blur(12px);
  will-change: transform, opacity;
}
.book__caption { text-align: center; margin-top: 1.6rem; }
.book__name { font-size: 1.5rem; font-style: italic; }
.book__label {
  font-size: 0.68rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0.5rem 0 0.8rem;
}
.book__line { color: var(--muted); font-size: 0.92rem; max-width: 32ch; margin: 0 auto 1rem; }
.book__price {
  font-family: var(--display);
  font-variant: small-caps;
  font-size: 1.3rem;
  color: var(--gold);
  letter-spacing: 0.1em;
  margin-bottom: 1.2rem;
}

.begin-btn {
  --mx: 50%;
  --my: 50%;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 2.2rem;
  border: 1px solid var(--gold);
  border-radius: 100px;
  font-size: 0.78rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  overflow: hidden;
  transition: color 0.45s ease;
  isolation: isolate;
}
.begin-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at var(--mx) var(--my), var(--gold) 0%, var(--gold) 40%, transparent 70%);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.45s ease, transform 0.55s ease;
}
.begin-btn:hover { color: var(--bg); }
.begin-btn:hover::before { opacity: 1; transform: scale(2.4); }
.begin-btn__enso {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.4px solid currentColor;
  border-top-color: transparent;
  transform: rotate(-45deg);
  transition: transform 0.6s ease, border-top-color 0.4s ease;
}
.begin-btn:hover .begin-btn__enso { transform: rotate(315deg); border-top-color: currentColor; }

.keepsakes__footnote {
  text-align: center;
  margin-top: 14vh;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* ---------- S5 · THE GROVE ---------- */
.scene--grove {
  position: relative;
  z-index: 4;
  background: #060812;
  overflow: hidden;
}
.grove__stage {
  position: relative;
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.grove__ambient {
  position: absolute;
  top: 12vh;
  left: 0; right: 0;
  text-align: center;
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  color: var(--muted);
  padding: 0 1.5rem;
}
.grove__island {
  position: relative;
  width: min(78vw, 900px);
  will-change: transform;
}
.grove__island img {
  width: 100%;
  -webkit-mask-image: radial-gradient(ellipse 62% 58% at 50% 48%, #000 55%, transparent 82%);
  mask-image: radial-gradient(ellipse 62% 58% at 50% 48%, #000 55%, transparent 82%);
}
.lantern {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(233, 203, 160, 0.75) 0%, rgba(217, 168, 106, 0.28) 40%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}
.lantern--1 { top: 38%; left: 24%; }
.lantern--2 { top: 30%; left: 52%; width: 44px; height: 44px; }
.lantern--3 { top: 46%; left: 72%; }

.grove__plate {
  position: absolute;
  bottom: 9vh;
  left: 0; right: 0;
  text-align: center;
  padding: 0 1.5rem;
  will-change: transform;
}
.grove__plate h2 { max-width: 22ch; margin: 1.2rem auto 0; }

.grove__features {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: 14vh clamp(1.5rem, 5vw, 4rem) 16vh;
}
.feature {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  margin-bottom: 12vh;
}
.feature--flip .feature__art { order: 2; }
.feature__art {
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  background-image: url("img/app-world.jpg");
  background-size: 260%;
  border: 1px solid rgba(127, 181, 173, 0.14);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.feature__art--bonsai { background-position: 42% 28%; }
.feature__art--lanterns { background-position: 78% 55%; }
.feature__art--koi { background-position: 30% 82%; }
.feature__copy h3 {
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  font-style: italic;
  margin-bottom: 1rem;
}
.feature__copy p { color: var(--muted); max-width: 44ch; }

.grove__bridge {
  text-align: center;
  font-family: var(--display);
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  color: var(--gold-soft);
  margin: 4vh 0 5vh;
}
.grove__stores {
  display: flex;
  justify-content: center;
  gap: 1.4rem;
  flex-wrap: wrap;
}
.store-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--card);
  border: 1px solid rgba(154, 160, 176, 0.22);
  border-radius: 100px;
  padding: 0.85rem 1.8rem;
  transition: border-color 0.4s ease, transform 0.4s ease, box-shadow 0.4s ease;
}
.store-pill:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 24px rgba(217, 168, 106, 0.1);
}
.store-pill svg { width: 22px; height: 22px; color: var(--ink); flex-shrink: 0; }
.store-pill span { display: flex; flex-direction: column; line-height: 1.25; font-weight: 500; font-size: 0.95rem; }
.store-pill small {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
}
.grove__micro {
  text-align: center;
  margin-top: 2.4rem;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* ---------- S6 · THE RETURN ---------- */
.scene--return {
  position: relative;
  z-index: 4;
  min-height: 120vh;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18vh 1.5rem 10vh;
}
.return__sky {
  position: absolute;
  inset: 0;
  transform: scaleY(-1);
  -webkit-mask-image: linear-gradient(to top, transparent 40%, #000 100%);
  mask-image: linear-gradient(to top, transparent 40%, #000 100%);
  opacity: 0.55;
  pointer-events: none;
}
.return__sky img { width: 100%; height: 100%; object-fit: cover; }
.return__gate {
  position: absolute;
  bottom: 4vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(38vw, 380px);
  opacity: 0.08;
  pointer-events: none;
}
.return__mote {
  position: absolute;
  bottom: 0;
  left: 30%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px 2px rgba(217, 168, 106, 0.6);
  animation: mote-rise 11s linear infinite;
  pointer-events: none;
}
@keyframes mote-rise {
  0% { transform: translate(0, 0); opacity: 0; }
  8% { opacity: 0.9; }
  100% { transform: translate(9vw, -118vh); opacity: 0; }
}

.return__content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.return__enso { width: 180px; height: 180px; margin-bottom: 3rem; }
#returnEnso { stroke: var(--gold); stroke-width: 3; stroke-linecap: round; }
.return__enso-ghost { stroke: rgba(217, 168, 106, 0.2); stroke-width: 1.2; stroke-linecap: round; }
.return__enso.is-pulsed #returnEnso { filter: drop-shadow(0 0 14px rgba(217, 168, 106, 0.8)); }

.return__body { color: var(--muted); margin: 1.6rem 0 2rem; }
.return__channel {
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 1px solid rgba(217, 168, 106, 0.4);
  padding-bottom: 0.3rem;
  transition: border-color 0.35s ease;
}
.return__channel:hover { border-color: var(--gold); }

.return__form { margin: 5rem 0 4rem; width: min(100%, 420px); }
.return__form-label {
  display: block;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.15rem;
  margin-bottom: 1.4rem;
  color: var(--ink);
}
.return__form-row { display: flex; gap: 1rem; align-items: flex-end; }
.return__form input {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 1px solid var(--teal-deep);
  color: var(--ink);
  font-family: var(--body);
  font-size: 0.95rem;
  padding: 0.6rem 0.1rem;
  border-radius: 0;
  transition: border-color 0.4s ease;
}
.return__form input::placeholder { color: var(--muted); opacity: 0.7; }
.return__form input:focus { outline: none; border-bottom-color: var(--gold); }
.return__form input:focus-visible { outline: none; }
.return__receive {
  background: none;
  border: 1px solid rgba(127, 181, 173, 0.5);
  color: var(--teal);
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  padding: 0.7rem 1.6rem;
  border-radius: 100px;
  transition: border-color 0.35s ease, color 0.35s ease;
}
.return__receive:hover { border-color: var(--gold); color: var(--gold); }
.return__confirm {
  margin-top: 1.4rem;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--gold-soft);
}

.return__nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.6rem; margin-bottom: 2.6rem; }
.return__nav a {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.35s ease;
}
.return__nav a:hover { color: var(--gold); }
.return__signoff {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.4rem;
  color: var(--ink);
  margin-bottom: 1rem;
}
.return__legal { font-size: 0.72rem; letter-spacing: 0.12em; color: var(--muted); }

/* ---------- PLAYER MODAL ---------- */
.player { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1.5rem; }
.player[hidden] { display: none; }
.player__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 14, 26, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.player__panel {
  position: relative;
  width: min(100%, 1080px);
  z-index: 2;
  will-change: transform;
}
.player__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}
.player__frame::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(217, 168, 106, 0.6);
  border-radius: 8px;
  z-index: 2;
  pointer-events: none;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.player.is-drawn .player__frame::before { clip-path: inset(0 0 0 0); }
.player__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.player__close {
  position: absolute;
  top: -3.2rem;
  right: 0;
  width: 44px;
  height: 44px;
  background: none;
  border: 1px solid rgba(236, 231, 220, 0.3);
  border-radius: 50%;
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  transition: border-color 0.35s ease, color 0.35s ease, transform 0.35s ease;
}
.player__close:hover { border-color: var(--gold); color: var(--gold); transform: rotate(90deg); }
.player__title {
  font-family: var(--display);
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  margin-top: 1.4rem;
}
.player__yt {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
  transition: color 0.35s ease;
}
.player__yt:hover { color: var(--gold); }

body.is-modal-open { overflow: hidden; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1080px) {
  .books { flex-wrap: wrap; justify-content: center; gap: 8vh 4vw; }
  .book--tide { margin-top: 0; }
  .book--dawn, .book--bloom { margin-left: 0; margin-right: 0; }
}

@media (max-width: 820px) {
  .nav__links { display: none; }
  .nav__toggle { display: block; }

  /* the foliage plane stays on mobile — same arrival as desktop */
  .gate__layer--foliage img { object-position: 72% 0%; }
  .gate__layer--mist { opacity: 0.6; }

  .scene--chambers .corridor { display: block; width: 100%; }
  .chamber { width: 100%; height: auto; min-height: 100svh; }
  .chamber__inner {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 12vh 6vw 10vh;
    align-content: center;
  }
  .chamber__shelf { margin: 0 -6vw; padding: 1rem 6vw 1.6rem; }
  .video-card { flex: 0 0 78vw; }
  .chamber-dots { display: none; }

  .books { flex-direction: column; align-items: center; gap: 12vh; }
  .book { width: min(78vw, 320px); }

  .feature, .feature--flip { grid-template-columns: 1fr; gap: 1.6rem; }
  .feature--flip .feature__art { order: 0; }
  .grove__island { width: 94vw; }

  /* grove stage flows naturally on mobile — no absolute overlap */
  .grove__stage { height: auto; min-height: 0; padding: 14vh 0 4vh; }
  .grove__ambient { position: relative; top: auto; margin-bottom: 2.2rem; }
  .grove__plate { position: relative; bottom: auto; margin-top: 2.6rem; }

  .return__form-row { flex-direction: column; align-items: stretch; }
  .return__receive { align-self: center; }
  .enso-progress { bottom: 1.2rem; left: 1.2rem; right: auto; width: 48px; height: 48px; }
  .player__close { top: auto; bottom: -3.6rem; right: 50%; transform: translateX(50%); }
  .player__close:hover { transform: translateX(50%) rotate(90deg); }
}

@media (max-width: 480px) {
  .gate__title { font-size: clamp(2.6rem, 14vw, 4rem); }
  .chamber__numeral { font-size: 6rem; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  #motes { display: none; }
  .scene--gate { height: auto; min-height: 100svh; }
  .gate__line-inner { transform: none; }
  .gate__eyebrow, .gate__cue { opacity: 1; }
  .gate__arrived { position: relative; opacity: 1; margin-top: -20vh; padding-bottom: 8vh; }
  .gate__layer--far img { filter: brightness(0.95); }
  .slowing__line { opacity: 1 !important; filter: none !important; }
  .slowing__path { transform: scaleY(1); }
  .breath__line { position: relative; opacity: 1; grid-area: auto; margin-bottom: 1.2rem; }
  .breath__lines { display: block; min-height: 0; }
  .breath__orb { animation: none; }
  .breath__more { display: none; }
  .breath__reduced { display: block; }
  .breath__enso-arc { display: none; }
  .keepsakes__backdrop { position: absolute; inset: 0; height: 100%; }
  .keepsakes__content { margin-top: 0; }
  .grove__ambient { position: relative; top: 0; margin-bottom: 3rem; }
  .grove__plate { position: relative; bottom: 0; margin-top: 3rem; }
  .grove__stage { height: auto; padding: 14vh 0 6vh; }
  .lantern { opacity: 1; }
  .return__mote { display: none; }
  .is-visible { opacity: 1 !important; transform: none !important; }
}
