/* /begin/ — the descent. An opt-in scroll prelude: the ten chapters as
   one fall, from the stars to the self, over the cosmic clips, resolving
   into the truck hero. Dark immersive theme; light type. */

@font-face {
  font-family: 'Newsreader';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/Newsreader-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Newsreader';
  font-style: italic; font-weight: 400; font-display: swap;
  src: url('/fonts/Newsreader-Italic.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/JetBrainsMono-Regular.woff2') format('woff2');
}

:root {
  --void: #05060a;
  --paper: #f3efe6;
  --warm: #c9b79c;   /* kicker / accents on dark */
  --quiet: #a89f90;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; }
html, body {
  margin: 0; padding: 0;
  background: var(--void);
  color: var(--paper);
  font-family: 'Newsreader', Georgia, serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- nav header (exposed for navigation; fixed over the dark cinematic bg, so
   it never breaks iOS video playback and doesn't shift the scroll layout) ---- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: 0.75rem 1.4rem;
  background: linear-gradient(180deg, rgba(5, 6, 10, 0.82) 30%, rgba(5, 6, 10, 0));
}
.site-header .wordmark { margin: 0; font-weight: 400; font-size: 1.05rem; line-height: 1; }
.site-header .wordmark a { color: var(--paper); text-decoration: none; }
.site-header .nav-links { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.site-header .nav-links a {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.74rem; letter-spacing: 0.03em;
  color: var(--quiet); text-decoration: none; transition: color 0.15s;
}
.site-header .nav-links a:hover { color: var(--paper); }
.site-header .wordmark { margin-right: auto; }
.site-header .nav-follow {
  margin-left: 1rem; flex: none; text-decoration: none;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.72rem;
  padding: 0.4rem 0.85rem; cursor: pointer;
  background: var(--paper); color: var(--void);
  border: 1px solid var(--paper); border-radius: 4px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.site-header .nav-follow:hover { background: var(--warm); border-color: var(--warm); color: var(--void); }
@media (max-width: 480px) {
  .site-header { padding: 0.6rem 1rem; }
  .site-header .wordmark { font-size: 0.92rem; }
  .site-header .nav-links { gap: 0.85rem; }
  .site-header .nav-links a { font-size: 0.66rem; }
}

/* ---- in-page signup ("Follow the road"; dark theme; the header Follow scrolls
   here). Reuses .foot-form/.foot-row/.foot-* so begin.js can wire it generically. ---- */
.begin-signup {
  position: relative; z-index: 2;
  background: var(--void);
  padding: 4.5rem 1.5rem 5.5rem;
  text-align: center;
  border-top: 1px solid rgba(201, 183, 156, 0.18);
}
.begin-signup-kicker {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.72rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--warm);
  margin: 0 0 0.8rem;
}
.begin-signup-line {
  font-family: 'Newsreader', Georgia, serif; font-size: 1.15rem; font-style: italic;
  color: var(--paper); max-width: 30rem; margin: 0 auto 1.6rem; line-height: 1.5;
}
.begin-signup .foot-form { max-width: 26rem; margin: 0 auto; }
.begin-signup .foot-row { display: flex; gap: 0.5rem; }
.begin-signup .foot-row input {
  flex: 1; min-width: 0; padding: 0.7rem 0.9rem;
  /* 16px keeps iOS Safari from zooming the page when the field is focused. */
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 1rem;
  background: rgba(243, 239, 230, 0.06); color: var(--paper);
  border: 1px solid rgba(201, 183, 156, 0.3); border-radius: 4px;
}
.begin-signup .foot-row input::placeholder { color: var(--quiet); }
.begin-signup .foot-row input:focus { outline: none; border-color: var(--warm); }
.begin-signup .foot-row button {
  flex: none; padding: 0 1.2rem; cursor: pointer;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.78rem;
  background: var(--paper); color: var(--void);
  border: 1px solid var(--paper); border-radius: 4px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.begin-signup .foot-row button:hover { background: var(--warm); border-color: var(--warm); }
.begin-signup .foot-msg {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.74rem;
  color: var(--warm); min-height: 1.2em; margin: 0.7rem 0 0;
}
.begin-signup .foot-links { margin: 1.6rem 0 0; display: flex; gap: 0.6rem; justify-content: center; align-items: center; }
.begin-signup .foot-social {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 999px;
  border: 1px solid rgba(201, 183, 156, 0.3); color: var(--quiet);
  background: transparent; transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.begin-signup .foot-social svg { width: 18px; height: 18px; display: block; }
.begin-signup .foot-social:hover { border-color: var(--warm); color: var(--paper); background: rgba(243, 239, 230, 0.06); }

/* ---- sticky background ---- */
/* A STICKY (not fixed) full-viewport background: iOS Safari refuses to
   play a <video> that has a position:fixed ancestor (shows the poster,
   never plays) — sticky it plays. TWO stacked videos cross-dissolve as
   movements change (begin.js); the content below is pulled up over them
   with a negative margin. */
.bg-sticky {
  position: sticky;
  top: 0;
  height: 100svh;
  z-index: 0;
  overflow: hidden;
  background: var(--void);
}
.bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 1;
  transition: opacity 1s ease;
}

/* darkening + vignette so light type holds over any frame. Above both
   video layers (which begin.js stacks at z-index 1 and 2). */
.scrim {
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background:
    radial-gradient(130% 90% at 50% 50%, rgba(5,6,10,0.18), rgba(5,6,10,0.66)),
    linear-gradient(180deg, rgba(5,6,10,0.5), rgba(5,6,10,0.32) 45%, rgba(5,6,10,0.58));
}

/* ---- beats ---- */
/* Pulled up over the sticky background that precedes it in the flow. */
.prelude { position: relative; z-index: 2; margin-top: -100svh; }
.beat {
  min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  padding: 12vh 1.5rem;
  text-align: center;
}
.beat-inner {
  max-width: 34rem;
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 1s ease, transform 1s ease;
}
.beat.in .beat-inner { opacity: 1; transform: none; }

.beat-kicker {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.74rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--warm);
  margin: 0 0 1.1rem;
}
.beat-line {
  font-size: clamp(1.55rem, 4.4vw, 2.7rem);
  line-height: 1.32;
  font-weight: 400;
  letter-spacing: 0.004em;
  margin: 0;
  text-shadow: 0 2px 34px rgba(0,0,0,0.72);
}

/* ---- cover ---- */
.cover-mark {
  font-size: clamp(2.6rem, 7.5vw, 4.6rem);
  letter-spacing: 0.012em;
  margin: 0 0 0.7rem;
  text-shadow: 0 2px 40px rgba(0,0,0,0.7);
}
.cover-sub {
  font-style: italic;
  color: var(--quiet);
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  margin: 0 0 4.5rem;
}
.scroll-cue {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--warm);
  margin: 0;
  animation: cue 2.6s ease-in-out infinite;
}
@keyframes cue { 0%,100% { opacity: 0.35; } 50% { opacity: 1; } }

/* ---- finale ---- */
.finale-line {
  font-size: clamp(1.5rem, 4.2vw, 2.5rem);
  line-height: 1.34;
  font-style: italic;
  margin: 0 0 2.4rem;
  text-shadow: 0 2px 34px rgba(0,0,0,0.72);
}
.finale-actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }
.finale-btn {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--paper);
  text-decoration: none;
  padding: 0.7rem 1.2rem;
  border: 1px solid rgba(243,239,230,0.4);
  border-radius: 2px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.finale-btn:hover { border-color: var(--paper); background: rgba(243,239,230,0.08); }
.finale-btn.primary {
  background: var(--paper); color: var(--void); border-color: var(--paper);
}
.finale-btn.primary:hover { background: #fff; }

/* ---- the full written passage ---- */
/* The long-form of the descent, set on a readable dark card over the
   held truck background. Not a .beat, so it stays visible and does not
   fade in/out as you scroll the ~900 words. */
.passage-full {
  position: relative;
  z-index: 2;
  max-width: 40rem;
  margin: 0 auto;
  padding: 14vh 1.5rem;
}
.passage-card {
  background: rgba(5, 6, 10, 0.80);
  border: 1px solid rgba(243, 239, 230, 0.12);
  border-radius: 5px;
  padding: 2.6rem 2.2rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.passage-kicker {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--warm);
  margin: 0 0 1.6rem;
}
.passage-card p {
  font-size: 1.04rem;
  line-height: 1.85;
  margin: 0 0 1.3rem;
  color: var(--paper);
}
.passage-card p:last-child { margin-bottom: 0; }
.passage-close { font-style: italic; color: var(--quiet); }

@media (max-width: 600px) {
  .passage-full { padding: 8vh 1rem; }
  .passage-card { padding: 1.8rem 1.3rem; }
  .passage-card p { font-size: 1rem; line-height: 1.78; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bg { transition: none; }
  .beat-inner { opacity: 1; transform: none; transition: none; }
  .scroll-cue { animation: none; opacity: 0.7; }
}
