/* Reflekt client preview: dark cinematic scrollytelling.
   Tokens from the Reflekt design system (src/styles/global.css). */

@font-face {
  font-family: "Google Sans Variable";
  src: url("fonts/google-sans-latin-full-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Jost Variable";
  src: url("fonts/jost-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --paper: #fcf8f1;
  --cream: rgba(252, 248, 241, 0.92);
  --muted: rgba(252, 248, 241, 0.6);
  --copper: #9a6a45;
  --copper-soft: #b98a63;
  --mango: #e6a14b;
  --acai: #6b2d5c;
  --acai-deep: #4a2240;
  --void: #120a14; /* near-black with a whisper of acai, never pure black */
  --display: "Google Sans Variable", sans-serif;
  --heading: "Jost Variable", "Century Gothic", sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  background: var(--void);
  color: var(--cream);
  font-family: var(--display);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- loader ---------- */

.loader {
  position: fixed; inset: 0; z-index: 50;
  background: var(--void);
  display: flex; flex-direction: column; gap: 28px;
  align-items: center; justify-content: center;
  transition: opacity 0.7s var(--ease-out), visibility 0.7s;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader img { opacity: 0.9; }
.loader-bar {
  width: 120px; height: 2px; border-radius: 2px;
  background: rgba(252, 248, 241, 0.14);
  overflow: hidden;
}
.loader-bar span {
  display: block; height: 100%; width: 0;
  background: var(--copper-soft);
  transition: width 0.3s ease;
}

/* ---------- hero ---------- */

.hero {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 24px;
  position: relative;
  background:
    radial-gradient(ellipse 120% 70% at 50% 115%, rgba(107, 45, 92, 0.35) 0%, rgba(18, 10, 20, 0) 60%),
    var(--void);
}
.hero-eyebrow {
  font-family: var(--heading);
  font-size: 13px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--copper-soft);
  animation: rise 0.9s var(--ease-out) 0.15s both;
}
.hero-title {
  font-family: var(--heading);
  font-weight: 600;
  font-size: clamp(64px, 17vw, 150px);
  letter-spacing: 0.14em; text-indent: 0.14em;
  line-height: 1.05;
  margin-top: 18px;
  color: var(--paper);
  animation: rise 0.9s var(--ease-out) 0.3s both;
}
.hero-sub {
  margin-top: 22px;
  font-size: clamp(17px, 4.4vw, 22px);
  font-weight: 400;
  line-height: 1.55;
  color: var(--muted);
  max-width: 30ch;
  animation: rise 0.9s var(--ease-out) 0.45s both;
}
.hero-cue {
  position: absolute; bottom: 28px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  animation: rise-cue 0.9s var(--ease-out) 0.9s both;
}
.hero-cue-line {
  width: 1px; height: 44px;
  background: linear-gradient(to bottom, rgba(252,248,241,0) 0%, var(--copper-soft) 100%);
  animation: cue 2.2s ease-in-out infinite;
  transform-origin: top;
}
.hero-cue-label {
  font-family: var(--heading);
  font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--muted);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes rise-cue {
  from { opacity: 0; transform: translateX(-50%) translateY(26px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes cue {
  0%, 100% { transform: scaleY(0.4); opacity: 0.4; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* ---------- scrub chapters ---------- */

.scrub { position: relative; }
/* scroll runway per chapter; JS sets the exact height from frame count */
.scrub-stage {
  position: sticky; top: 0;
  height: 100dvh;
  overflow: hidden;
}
.scrub canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}
/* soft edges so captions stay legible and cuts between chapters feel graded */
.scrub-stage::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(18,10,20,0.55) 0%, rgba(18,10,20,0) 22%, rgba(18,10,20,0) 72%, rgba(18,10,20,0.6) 100%);
}

.scrub-caption {
  position: absolute; left: 0; right: 0; bottom: 14dvh;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center;
  padding: 0 28px;
  opacity: var(--cap, 0);
  transform: translateY(calc((1 - var(--cap, 0)) * 26px));
  will-change: transform, opacity;
  pointer-events: none;
  z-index: 2;
}
.cap-eyebrow {
  font-family: var(--heading);
  font-size: 12px; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--mango);
}
.cap-line {
  font-size: clamp(26px, 6.6vw, 44px);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.22;
  color: var(--paper);
  text-shadow: 0 2px 24px rgba(18, 10, 20, 0.55);
}

/* ---------- interludes ---------- */

.interlude {
  min-height: 92dvh;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  padding: 20dvh 28px;
  background: var(--void);
  position: relative;
  z-index: 3;
}
.interlude-text {
  font-size: clamp(28px, 7vw, 52px);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--paper);
}
.interlude-turn .interlude-text { color: var(--mango); }
.reveal-line {
  display: inline-block;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}
.reveal-line.on { opacity: 1; transform: translateY(0); }
.reveal-line:nth-child(2) { transition-delay: 0.15s; }

/* ---------- film ---------- */

.film {
  padding: 16dvh 24px 10dvh;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center;
  background:
    radial-gradient(ellipse 120% 60% at 50% 0%, rgba(74, 34, 64, 0.5) 0%, rgba(18, 10, 20, 0) 60%),
    var(--void);
  position: relative; z-index: 3;
}
.film-title {
  font-family: var(--heading);
  font-weight: 500;
  font-size: clamp(24px, 6vw, 36px);
  letter-spacing: 0.06em;
  color: var(--paper);
}
.film-sub {
  font-family: var(--heading);
  font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--copper-soft);
  margin-bottom: 14px;
}
.film video {
  width: min(400px, 86vw);
  aspect-ratio: 9 / 16;
  border-radius: 18px;
  background: #000;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(252, 248, 241, 0.08);
}

/* ---------- outro ---------- */

.outro {
  min-height: 88dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 24px;
  position: relative; z-index: 3;
}
.outro-mark { opacity: 0.95; margin-bottom: 22px; }
.outro-ritual {
  font-size: clamp(22px, 5.4vw, 30px);
  font-weight: 500;
  color: var(--cream);
}
.outro-brand {
  font-family: var(--heading);
  font-weight: 600;
  font-size: clamp(40px, 10vw, 64px);
  letter-spacing: 0.18em; text-indent: 0.18em;
  color: var(--paper);
  margin-top: 6px;
}
.outro-meta {
  font-family: var(--heading);
  font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--mango);
  margin-top: 10px;
}
.outro-note {
  margin-top: 9dvh;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: rgba(252, 248, 241, 0.42);
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .hero-eyebrow, .hero-title, .hero-sub, .hero-cue { animation: none; }
  .hero-cue-line { animation: none; }
  .reveal-line { opacity: 1; transform: none; transition: none; }
  .scrub-caption { opacity: 1; transform: none; }
  /* JS also collapses scrub runways to a single static frame */
}
