/* Cinescroll template — Illume motion canon tokens + Oddy liquid-glass/grain.
   Brand variables are swapped per client from source/design.md by the generator. */

:root {
  /* BRAND — deliberately NEUTRAL factory values. build_site.py REQUIRES every
     one of these in content.json css_vars; neutral defaults mean a missed
     brand contract is visibly unbranded instead of silently wearing another
     client's brand. */
  --brand-bg: #16110D;
  --brand-ink: #FAF7F2;
  --brand-ink-dim: rgba(250, 247, 242, 0.72);
  --brand-accent: #B22C37;
  --brand-surface: #1E1712;
  /* Reveal chapters sit over the BRIGHT end of the journey; override for
     dark-reveal concepts in content.json css_vars. */
  --brand-ink-on-light: #241A12;
  --brand-ink-on-light-dim: rgba(36, 26, 18, 0.78);
  --font-display: "Newsreader", "Cormorant Garamond", Georgia, serif;
  --font-body: "Hanken Grotesk", system-ui, sans-serif;

  /* MOTION CANON (house tokens — do not swap per client) */
  --ease-transition: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-standard: cubic-bezier(0.25, 0.1, 0.25, 1);
  --reveal-duration: 0.7s;

  --runway-height: 500vh; /* scroll distance for the video scrub */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: auto; } /* rAF tour handles smoothness; native smooth fights the scrub */
body {
  background: var(--brand-bg);
  color: var(--brand-ink);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ---------- Film grain (fixed overlay, hides video banding) ---------- */
.grain-defs { position: absolute; }
.grain {
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  filter: url(#grain-f);
  opacity: 0.06;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 40;
}

/* ---------- Liquid glass (text contrast over video, no dark overlay) ---------- */
.lg, .lg-strong {
  position: relative;
  background: rgba(255, 255, 255, 0.01);
  background-blend-mode: luminosity;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  border-radius: 14px;
}
.lg-strong {
  -webkit-backdrop-filter: blur(50px);
  backdrop-filter: blur(50px);
}
.lg::before, .lg-strong::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1.4px;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.5), rgba(255,255,255,0.06) 30%,
    rgba(255,255,255,0.06) 70%, rgba(255,255,255,0.4));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
          mask-composite: exclude;
  pointer-events: none;
}

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 16px; left: 50%;
  transform: translateX(-50%);
  width: min(1200px, calc(100% - 32px));
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
  z-index: 50;
}
.nav-logo { height: 34px; width: auto; }
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  padding: 12px 26px;
  border-radius: 999px;
  color: var(--brand-ink);
  transition: transform 0.3s var(--ease-transition), background 0.3s var(--ease-transition);
}
.btn:hover { transform: translateY(-2px); }
.btn-solid { background: var(--brand-accent); color: #fff; }
.nav-cta { font-size: 0.85rem; padding: 9px 20px; }

/* ---------- The journey (runway + sticky stage + scrubbed video) ---------- */
.journey { height: var(--runway-height); position: relative; }
.stage {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
}
.scrub {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.stage-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0,0,0,0.38) 100%);
  pointer-events: none;
}

/* Chapters: JS drives opacity/translate from scroll progress (ease: none — scroll IS the easing).
   Without JS every chapter is visible (static stack) so content is never lost. */
.chapters { position: absolute; inset: 0; pointer-events: none; }
.chapter {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(720px, calc(100% - 48px));
  text-align: center;
  padding: 34px 38px;
  pointer-events: auto;
}
body.js .chapter { opacity: 0; } /* JS-gated hidden state */
.kicker {
  font-size: 0.78rem; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--brand-ink-dim); margin-bottom: 18px;
}
.headline {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin-bottom: 20px;
}
.sub { font-size: clamp(1rem, 1.6vw, 1.2rem); color: var(--brand-ink-dim); }
.chapter-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(1.9rem, 4.4vw, 3.2rem);
  line-height: 1.12;
  margin-bottom: 16px;
}
.chapter-copy { font-size: clamp(0.98rem, 1.5vw, 1.15rem); color: var(--brand-ink-dim); padding: 18px 22px; display: inline-block; }
.chapter-reveal .chapter-title { color: var(--brand-ink-on-light); }
.chapter-reveal .chapter-copy { color: var(--brand-ink-on-light-dim); }
.chapter-reveal .btn {
  margin-top: 26px;
  background: var(--brand-accent);
  color: #fff;
}
.scroll-hint {
  margin-top: 40px; font-size: 0.75rem; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--brand-ink-dim);
  animation: hint-drift 2.2s var(--ease-transition) infinite;
}
@keyframes hint-drift { 0%,100% { transform: translateY(0); opacity: .7; } 50% { transform: translateY(8px); opacity: 1; } }

/* Chapter rail */
.rail {
  position: absolute; right: 26px; top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 14px;
  z-index: 10;
}
.rail-dot {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.55);
  background: transparent;
  cursor: pointer;
  transition: background 0.3s var(--ease-transition), transform 0.3s var(--ease-transition);
}
.rail-dot.active { background: var(--brand-ink); transform: scale(1.35); }

/* Tour button */
.tour {
  position: absolute; left: 26px; bottom: 26px;
  z-index: 10;
  border: none; cursor: pointer;
  color: var(--brand-ink);
  font-family: var(--font-body);
  font-size: 0.85rem; letter-spacing: 0.06em;
  padding: 12px 22px;
}

/* ---------- Below-the-fold sections ---------- */
.proof, .process, .cta-final {
  position: relative;
  background: var(--brand-bg);
  padding: 120px 24px;
  max-width: 1200px;
  margin: 0 auto;
}
.section-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  line-height: 1.1;
  margin: 14px 0 48px;
}
.proof-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.proof-card img { border-radius: 18px; aspect-ratio: 4 / 5; object-fit: cover; }
.proof-card figcaption { margin-top: 12px; font-size: 0.85rem; color: var(--brand-ink-dim); }
.steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.step-n { font-family: var(--font-display); font-size: 1.4rem; color: var(--brand-accent); display: block; margin-bottom: 10px; }
.step h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.3rem; margin-bottom: 8px; }
.step p { color: var(--brand-ink-dim); font-size: 0.95rem; }
.cta-final { text-align: center; }
.cta-headline { font-family: var(--font-display); font-weight: 300; font-size: clamp(2rem, 5vw, 3.6rem); margin-bottom: 16px; }
.cta-sub { color: var(--brand-ink-dim); margin-bottom: 34px; }

/* FadeIn reveal (canon R1): JS adds .in when 20% visible */
body.js .reveal { opacity: 0; transform: translateY(30px); }
body.js .reveal.in {
  opacity: 1; transform: translateY(0);
  transition: opacity var(--reveal-duration) var(--ease-standard),
              transform var(--reveal-duration) var(--ease-standard);
}

.foot { text-align: center; padding: 48px 24px 64px; color: var(--brand-ink-dim); font-size: 0.85rem; }
.foot-fine { margin-top: 8px; font-size: 0.72rem; opacity: 0.6; }

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
  .proof-grid, .steps { grid-template-columns: 1fr; }
  .rail { right: 12px; }
  .chapter { padding: 24px 18px; }
  .tour { left: 12px; bottom: 12px; }
  /* Perf: feTurbulence + heavy backdrop blur over a per-frame-changing video
     janks low-end devices — drop the grain, lighten the glass. */
  .grain { display: none; }
  .lg-strong { -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); }
}

/* ---------- Static journey layout (no JS / reduced motion) ----------
   Chapters become normal flow content; the stage grows to fit and never
   clips — every chapter and the CTA must be reachable by plain scrolling. */
@media (prefers-reduced-motion: reduce) {
  .journey { height: auto; }
  .stage { position: relative; height: auto; min-height: 100svh; overflow: visible; }
  .scrub { position: absolute; height: 100%; }
  .chapters { position: relative; inset: auto; padding: 12vh 0; z-index: 1; }
  body.js .chapter, .chapter { opacity: 1; position: relative; left: auto; top: auto; transform: none; margin: 26px auto; visibility: visible; }
  .rail, .tour, .scroll-hint { display: none; }
  body.js .reveal { opacity: 1; transform: none; }
  .grain { display: none; }
}
body:not(.js) .journey { height: auto; }
body:not(.js) .stage { position: relative; height: auto; min-height: 100svh; overflow: visible; }
body:not(.js) .scrub { position: absolute; height: 100%; }
body:not(.js) .chapters { position: relative; inset: auto; padding: 12vh 0; z-index: 1; }
body:not(.js) .chapter { position: relative; left: auto; top: auto; transform: none; margin: 26px auto; }
body:not(.js) .rail, body:not(.js) .tour, body:not(.js) .scroll-hint { display: none; }
