/* ==========================================================================
   VOLUBIA — story.css
   Only for story.html. Loads no other stylesheet and is loaded by no other
   page, so nothing here can reach the rest of the site.
   ========================================================================== */

:root {
  --ink: #14120E;
  --cream: #FAF6EE;
  --sand: #E6DAC5;
  --gold: #AE8B45;
  --gold-2: #FFC788;
  --forest: #41503A;
  --muted: #8A8172;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

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

html { -webkit-text-size-adjust: 100%; }
/* No scroll-behavior here on purpose: native scroll stays native. */

body {
  font-family: var(--sans);
  font-size: clamp(1rem, .95rem + .25vw, 1.1rem);
  line-height: 1.7;
  color: var(--cream);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

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

.skip {
  position: absolute; inset-inline-start: 1rem; top: -100px;
  background: var(--cream); color: var(--ink);
  padding: .7rem 1.2rem; z-index: 99; transition: top .2s;
}
.skip:focus { top: 1rem; }

.shell { width: min(92vw, 1180px); margin-inline: auto; }

/* ---------------------------------------------------------------- masthead */
.bar {
  position: absolute; inset-inline: 0; top: 0; z-index: 5;
  padding: 1.4rem 0;
}
.bar__in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--serif); font-size: 1.3rem;
  letter-spacing: .22em; text-transform: uppercase; text-decoration: none;
}
.brand__v {
  width: 24px; height: 24px; border-radius: 3px; flex: none;
  background: var(--forest);
  display: grid; place-items: center;
  font-size: .85rem; letter-spacing: 0; color: var(--gold-2);
}
.bar a.back {
  font-size: .78rem; letter-spacing: .18em; text-transform: uppercase;
  text-decoration: none; opacity: .75;
}
.bar a.back:hover { opacity: 1; }

/* -------------------------------------------------------------------- hero
   The h1 is the LCP element: plain text, no webfont dependency to paint,
   nothing above it that can push it down.                                  */
.hero {
  min-height: 92svh;
  display: grid; place-items: center;
  text-align: center;
  padding: 7rem 0 4rem;
  background:
    radial-gradient(60% 50% at 50% 40%, rgba(174,139,69,.22), transparent 70%),
    linear-gradient(170deg, #17150F, #232C20 60%, #14120E);
}
.hero__eyebrow {
  font-size: .74rem; letter-spacing: .34em; text-transform: uppercase;
  color: var(--gold-2); margin-bottom: 1.4rem;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.6rem, 1.6rem + 4.4vw, 5.4rem);
  line-height: 1.06;
  letter-spacing: -.02em;
  max-width: 16ch;
  margin-inline: auto;
}
.hero h1 em { font-style: italic; color: var(--gold-2); }
.hero__sub {
  margin: 1.6rem auto 0; max-width: 46ch;
  color: rgba(250,246,238,.72); font-weight: 300;
  font-size: clamp(1rem, .95rem + .4vw, 1.25rem);
}
.hero__hint {
  margin-top: 3rem;
  font-size: .72rem; letter-spacing: .24em; text-transform: uppercase;
  color: rgba(250,246,238,.5);
}

/* ------------------------------------------------------------- the sequence
   Stage and chapters share one grid cell, so the chapters scroll over a
   sticky canvas without any negative margins or magic numbers.             */
.scroll { display: grid; grid-template-columns: 1fr; position: relative; }
.stage,
.chapters { grid-area: 1 / 1; }

.stage {
  position: sticky; top: 0;
  height: 100svh;
  overflow: hidden;
  background: #14120E;
  z-index: 0;
}
/* Fixed box before any frame exists — the canvas can never shift layout. */
.stage canvas { display: block; width: 100%; height: 100%; }
/* Photographs carry far more tonal range than flat frames, so the scrim has
   to be strong enough to guarantee contrast wherever the camera lands. */
.stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(20,18,14,.9) 0%, rgba(20,18,14,.72) 38%, rgba(20,18,14,.28) 70%, rgba(20,18,14,.15) 100%);
}

.chapters { position: relative; z-index: 1; }

.ch { min-height: 100svh; display: grid; align-items: center; }
/* The column sits at the left of the shell, which is where the scrim is
   darkest. Constraining .ch__inner itself to 46ch would centre it instead,
   dropping the copy onto the brightest part of the photograph. */
.ch__inner {
  width: min(92vw, 1180px);
  margin-inline: auto;
  padding-block: 4rem;
}
.ch__inner > * { max-width: 46ch; }
.ch__n {
  font-size: .72rem; letter-spacing: .3em; text-transform: uppercase;
  color: var(--gold-2); display: block; margin-bottom: 1rem;
}
.ch h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.9rem, 1.3rem + 2.6vw, 3.2rem);
  line-height: 1.12; letter-spacing: -.01em;
  margin-bottom: 1.1rem;
}
.ch p { color: rgba(250,246,238,.8); }
.ch p + p { margin-top: .9rem; }

/* Static stills: hidden while the canvas is running, shown when it is not */
.ch__still {
  display: none;
  width: 100%; border-radius: 2px; margin-bottom: 1.6rem;
  aspect-ratio: 4 / 5; object-fit: cover;
}

/* --------------------------------------------------------------- reveals
   Scroll-driven where supported. The observer path is only wired up by JS
   when it is not — see story.js.                                          */
@keyframes chIn {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: none; }
}

@supports (animation-timeline: view()) {
  .ch__inner {
    animation: chIn linear both;
    animation-timeline: view();
    animation-range: entry 15% cover 35%;
  }
}
@supports not (animation-timeline: view()) {
  .ch__inner {
    opacity: 0; transform: translateY(30px);
    transition: opacity .8s var(--ease), transform .8s var(--ease);
  }
  .ch__inner.in { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------- outro */
.outro {
  position: relative; z-index: 2;
  background: var(--cream); color: var(--ink);
  padding-block: clamp(4rem, 3rem + 6vw, 8rem);
  text-align: center;
}
.outro h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.9rem, 1.4rem + 2.4vw, 3rem);
  margin-bottom: 1rem;
}
.outro p { color: var(--muted); max-width: 50ch; margin: 0 auto 2rem; }
.cta {
  display: inline-flex; align-items: center; gap: .7em;
  padding: 1.05em 2.2em;
  background: var(--ink); color: var(--cream);
  font-size: .76rem; letter-spacing: .2em; text-transform: uppercase;
  text-decoration: none; border-radius: 2px;
  transition: background .35s var(--ease);
}
.cta:hover { background: var(--forest); }

.foot {
  background: var(--ink); color: rgba(250,246,238,.45);
  padding-block: 2.4rem; text-align: center;
  font-size: .76rem; letter-spacing: .08em;
}

/* ==========================================================================
   NO CANVAS — two cases, one presentation
   1. JS disabled  (.no-js is on <html> until story.js removes it)
   2. prefers-reduced-motion

   Both drop the sticky stage entirely and stack the five stills in normal
   flow. Nothing overlaps, nothing animates, nothing needs scripting.
   ========================================================================== */
.no-js .stage { display: none; }
.no-js .ch__still { display: block; }
.no-js .ch { min-height: 0; }
.no-js .ch__inner { opacity: 1; transform: none; animation: none; }
.no-js .scroll { display: block; }

@media (prefers-reduced-motion: reduce) {
  .stage { display: none; }
  .ch__still { display: block; }
  .ch { min-height: 0; }
  .ch__inner { opacity: 1; transform: none; animation: none; transition: none; }
  .scroll { display: block; }
  .hero { min-height: 70svh; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (max-width: 820px) {
  .stage::after {
    background: linear-gradient(180deg, rgba(20,18,14,.45) 0%, rgba(20,18,14,.8) 65%, rgba(20,18,14,.9) 100%);
  }
  .ch__inner { max-width: none; padding-block: 3rem; }
}
