/* ==========================================================================
   Why Exodus 4:10–11 — the intersection at night.
   The scene stays pinned; the verses scroll over it. why.js sets the light
   (data-light on .why), --u (untangling), --drive and --dawn as you scroll.
   ========================================================================== */

.why {
  --night: #0A0D14;
  --road: #1A1A1A;
  --red: #C8102E;
  --amber: #F5B971;
  --green: #1DB954;
  --red-text: #FF5A6E;      /* brighter red for small text on the dark scene */
  --ink: #F4F1EC;
  --lc: var(--red);         /* the color the light throws around */
  --drive: 0;
  --dawn: 0;
  --serif: "Cormorant Garamond", "EB Garamond", Georgia, serif;

  /* traffic light size; the verses pin just below it */
  --sig-w: clamp(2.9rem, 5vw, 4.75rem);
  --wire: clamp(1rem, 4.5vh, 3rem);
  --pin-top: calc(var(--wire) + var(--sig-w) * 2.68 + clamp(1.25rem, 3.5vh, 2.25rem));
}
.why[data-light="yellow"] { --lc: var(--amber); }
.why[data-light="green"]  { --lc: var(--green); }

/* The header floats over the scene: hidden at night, back on the white section. */
.why-page .site-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  transition: opacity 0.6s ease, transform 0.6s var(--ease);
}
.is-night .why-page .site-header {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
}
.no-js .why-page .site-header { position: sticky; }

/* ---------- The intersection ---------- */

.crossing {
  position: relative;
  background: var(--night);
  color: var(--ink);
}

.scene {
  position: sticky;
  top: 0;
  z-index: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  pointer-events: none;
}

.scene__sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #06080D 0%, var(--night) 40%, #151925 52%, #0B0C10 53%);
}
.scene__stars {
  position: absolute;
  inset: 0 0 50%;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(255,255,255,.7), transparent 60%),
    radial-gradient(1px 1px at 27% 32%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1.4px 1.4px at 41% 12%, rgba(255,255,255,.8), transparent 60%),
    radial-gradient(1px 1px at 63% 26%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(1.2px 1.2px at 78% 9%, rgba(255,255,255,.7), transparent 60%),
    radial-gradient(1px 1px at 88% 36%, rgba(255,255,255,.45), transparent 60%),
    radial-gradient(1px 1px at 6% 44%, rgba(255,255,255,.4), transparent 60%),
    radial-gradient(1.3px 1.3px at 93% 21%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1px 1px at 53% 40%, rgba(255,255,255,.35), transparent 60%),
    radial-gradient(1px 1px at 34% 6%, rgba(255,255,255,.6), transparent 60%);
}

.scene__road {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-origin: 50% 52%;
  transform: scale(calc(1 + var(--drive) * 0.55));
}
.scene__dashes { transform: translateY(calc(var(--drive) * 260px)); }

/* the light's color on the wet road: a wide wash plus a long streak */
.scene__spill {
  position: absolute;
  inset: 50% 0 0;
  background: radial-gradient(ellipse 60% 70% at 50% 8%, var(--lc), transparent 70%);
  opacity: 0.26;
  transition: background 0.9s ease;
}
.scene__spill::after {
  content: "";
  position: absolute;
  top: 2%;
  left: 50%;
  width: clamp(2.5rem, 7vw, 6rem);
  height: 70%;
  background: radial-gradient(ellipse 50% 100% at 50% 0, var(--lc), transparent 70%);
  opacity: 0.7;
  transform: translateX(-50%);
  transition: background 0.9s ease;
}

.scene__flood {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 85% 75% at 50% 20%, rgba(29, 185, 84, 0.5), rgba(29, 185, 84, 0.12) 55%, transparent 80%);
  opacity: 0;
  transition: opacity 1.4s ease;
}
.why[data-light="green"] .scene__flood { opacity: 1; }

/* ---------- The traffic light ---------- */

.signal {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: 50% 0;
  transform: translateX(-50%) translateY(calc(var(--drive) * -150%)) scale(calc(1 + var(--drive) * 0.9));
}
/* the cable strung across the intersection */
.signal::before {
  content: "";
  position: absolute;
  top: 0.35rem;
  left: 50%;
  width: 200vw;
  height: 2px;
  background: #2A2D35;
  transform: translateX(-50%);
}
.signal__wire {
  display: block;
  width: 3px;
  height: var(--wire);
  background: #2A2D35;
}
.signal__body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: calc(var(--sig-w) * 0.12);
  padding: calc(var(--sig-w) * 0.14);
  border-radius: calc(var(--sig-w) * 0.2);
  background: linear-gradient(90deg, #121212, #1E1E1E 45%, #101010);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 10px 30px rgba(0, 0, 0, 0.6);
}

.lamp {
  position: relative;
  display: block;
  width: calc(var(--sig-w) * 0.72);
  height: calc(var(--sig-w) * 0.72);
  border-radius: 50%;
  background: var(--off);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.6);
  transition: background-color 0.5s ease, box-shadow 0.5s ease;
}
/* the hood over each lamp */
.lamp::before {
  content: "";
  position: absolute;
  top: -8%;
  left: -12%;
  right: -12%;
  height: 42%;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  background: #0C0C0C;
  opacity: 0.85;
}
.lamp--red    { --off: #2A0A0F; --on: #FF2A44; --glow: rgba(200, 16, 46, 0.85); }
.lamp--yellow { --off: #2A2010; --on: #F5B971; --glow: rgba(245, 185, 113, 0.75); }
.lamp--green  { --off: #0A2214; --on: #3BE07A; --glow: rgba(29, 185, 84, 0.8); }

.why[data-light="red"]    .lamp--red,
.why[data-light="yellow"] .lamp--yellow,
.why[data-light="green"]  .lamp--green {
  background: radial-gradient(circle at 45% 40%, #fff 0 8%, var(--on) 40%, var(--on));
  box-shadow: 0 0 calc(var(--sig-w) * 0.5) var(--glow), 0 0 calc(var(--sig-w) * 1.6) var(--glow);
}

/* STOP / WAIT / GO, so the light never depends on color alone */
.lamp__tag {
  position: absolute;
  top: 50%;
  left: calc(100% + var(--sig-w) * 0.55);
  color: rgba(244, 241, 236, 0.5);
  font-family: var(--font-display);
  font-size: clamp(0.8rem, 1.1vw, 1rem);
  letter-spacing: 0.24em;
  line-height: 1;
  white-space: nowrap;
  transform: translateY(-40%);
  transition: color 0.4s ease;
}
.why[data-light="red"]    .lamp--red .lamp__tag    { color: var(--red-text); }
.why[data-light="yellow"] .lamp--yellow .lamp__tag { color: var(--amber); }
.why[data-light="green"]  .lamp--green .lamp__tag  { color: #4FE38A; }
.why[data-light="red"]    .lamp--red .lamp__tag::before,
.why[data-light="yellow"] .lamp--yellow .lamp__tag::before,
.why[data-light="green"]  .lamp--green .lamp__tag::before { content: "◂ "; }

/* ---------- The car ---------- */

.scene__hood {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: clamp(6.5rem, 22vh, 13rem);
  transform-origin: 50% 100%;
  transform: translateY(calc(var(--drive) * 18%)) scale(calc(1 + var(--drive) * 0.12));
}
.scene__hood-glow { opacity: 0.3; }
#hood-shine stop { stop-color: var(--lc); transition: stop-color 0.9s ease; }

.scene__dawn {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #FFFFFF;
  opacity: var(--dawn);
}

/* ---------- The verses ---------- */

.crossing__beats {
  position: relative;
  z-index: 1;
  margin-top: -100vh;
  margin-top: -100svh;
}

.beat { position: relative; }
.beat--intro { height: 100vh; height: 100svh; }
.beat--red    { height: 240vh; }
.beat--yellow { height: 210vh; }
.beat--green  { height: 180vh; }
.beat--drive  { height: 150vh; }

.beat__pin {
  position: sticky;
  top: var(--pin-top);
  width: min(100% - 2 * var(--gutter), 48rem);
  margin-inline: auto;
  text-align: center;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.75);
}

.kicker {
  margin: 0;
  color: var(--red-text);
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 1.3vw, 1.15rem);
  letter-spacing: 0.5em;
  line-height: 1;
  text-transform: uppercase;
  padding-left: 0.5em; /* balance the trailing letter-space */
}
.why-title {
  margin-top: clamp(0.9rem, 2vw, 1.5rem);
  color: var(--ink);
  font-size: clamp(3.25rem, 11vw, 9.5rem);
  line-height: 0.86;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.scroll-cue {
  position: absolute;
  bottom: clamp(7.5rem, 25vh, 14.5rem);
  left: 50%;
  margin: 0;
  color: rgba(244, 241, 236, 0.75);
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  transform: translateX(-50%);
}
.scroll-cue span { display: inline-block; margin-left: 0.2em; animation: cue 1.8s ease-in-out infinite; }
@keyframes cue { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(0.35em); } }

.stage-tag {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.verse {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2.5vw, 2.3rem);
  font-weight: 500;
  line-height: 1.38;
  text-wrap: pretty;
}
.verse p { margin: 0; }
.verse__num {
  margin-right: 0.25em;
  color: var(--red-text);
  font-family: var(--font-display);
  font-size: 0.6em;
  letter-spacing: 0.08em;
  vertical-align: 0.55em;
  line-height: 0;
}

/* verse 10: each word starts thrown somewhere else and settles as --u goes 0 → 1 */
.verse--tangled { --u: 1; }
.verse--tangled .w {
  display: inline-block;
  transform:
    translate(calc(var(--dx, 0) * (1 - var(--u)) * 1em), calc(var(--dy, 0) * (1 - var(--u)) * 1em))
    rotate(calc(var(--dr, 0) * (1 - var(--u)) * 1deg));
  opacity: calc(0.55 + var(--u) * 0.45);
}

.question {
  margin-bottom: clamp(1rem, 2.5vw, 1.75rem);
  color: #FFFFFF;
  font-size: clamp(3rem, 7vw, 7rem);
  line-height: 0.88;
  text-wrap: balance;
  text-shadow: 0 0 30px rgba(245, 185, 113, 0.35), 0 2px 18px rgba(0, 0, 0, 0.8);
}
.question--go {
  font-size: clamp(4rem, 14vw, 12rem);
  text-shadow: 0 0 40px rgba(29, 185, 84, 0.55), 0 2px 18px rgba(0, 0, 0, 0.8);
}

/* ---------- Why it matters to me (back on white) ---------- */

.why-story {
  position: relative;
  z-index: 1;
  padding: calc(var(--header-h) + clamp(3rem, 9vw, 7rem)) var(--gutter) clamp(4rem, 9vw, 7rem);
  background: #FFFFFF;
  color: #111111;
}
.why-story__inner { max-width: 40rem; margin-inline: auto; }
.kicker--day { color: var(--accent); padding-left: 0; }
.why-story__text {
  margin-top: clamp(1.25rem, 3vw, 2rem);
  font-size: clamp(1.15rem, 1.7vw, 1.4rem);
  font-weight: 300;
  line-height: 1.75;
}
.why-story__text .accent { font-weight: 400; }
.why-story__btn { margin-top: clamp(2rem, 4vw, 2.75rem); padding-inline: 1.8rem; }
.why-story__legal {
  margin-top: clamp(3.5rem, 8vw, 5rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.6;
}

/* ---------- Phones ---------- */

@media (max-width: 40em) {
  .beat--red    { height: 260vh; }
  .verse { font-size: clamp(1.3rem, 5.6vw, 1.6rem); line-height: 1.32; }
  .beat__pin { width: calc(100% - 2rem); }
}

/* ---------- Reduced motion: every light and verse in order, nothing moves ---------- */

@media (prefers-reduced-motion: reduce) {
  .why, .why .scene { --drive: 0 !important; --dawn: 0 !important; }
  .verse--tangled { --u: 1 !important; }
  .scroll-cue span { animation: none; }
  .lamp, .lamp__tag, .scene__spill, .scene__spill::after, .scene__flood, #hood-shine stop,
  .why-page .site-header { transition: none; }
  .beat--red, .beat--yellow, .beat--green { height: auto; min-height: 120vh; }
  .beat--drive { display: none; }
  .beat__pin { position: relative; top: auto; padding-top: var(--pin-top); }
  .scene__dawn { display: none; }
}
