/* ==========================================================================
   The Long Road — site styles
   Mobile-first. The palette is the game's own (lib/theme/app_theme.dart):
   one ember accent, dimmed semantic hues, rarity as the only firework.
   ========================================================================== */

:root {
  /* ground */
  --bg: #1a1410;            /* AppColors.background */
  --surface: #2a2218;       /* AppColors.surface */
  --card: #352c22;          /* AppColors.card */
  --border: #4a4038;        /* AppColors.cardBorder */
  --plaque: #14100b;        /* AppColors.plaque — the one surface darker than bg */

  /* text */
  --text: #e8dcc8;          /* textPrimary */
  --text-2: #a09080;        /* textSecondary */
  /* textFaded, lightened from the game's #706050: on a phone in daylight the
     site's whispers are functional text (consent line, captions, footer), so
     the web token clears WCAG AA (≈4.7:1 on --bg) where the in-game one
     could stay atmospheric. */
  --text-3: #8f7f6b;

  /* the one accent + dimmed semantics */
  --ember: #c99a5b;
  --slate: #7b93ad;         /* rest, calm info — the storm's word colour */
  --brick: #a96665;         /* danger */
  --sage: #75937a;          /* success */

  /* storm ground — the band's own darkness */
  --storm-bg: #0e0b09;
  --storm-sky: #14161c;

  --wrap: 66rem;
  --radius: 8px;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
}

/* ── reset-ish ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--ember); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; border-radius: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }
.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ── type grammar (the game's own) ─────────────────────────────────────── */
/* faint label — small caps strip over a section */
.overline {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ember);
  margin: 0 0 0.75rem;
}
/* whisper — the quiet lowercase line; never a button, never tappable */
.whisper {
  color: var(--text-3);
  font-size: 0.875rem;
  letter-spacing: 0.02em;
}
h1, h2, h3 { line-height: 1.15; margin: 0; }
h2 {
  font-size: clamp(1.5rem, 5.2vw, 2.25rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.lede { color: var(--text-2); font-size: 1.0625rem; max-width: 42rem; }

/* ── header ────────────────────────────────────────────────────────────── */
.site-head {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  padding: 0.9rem 0;
}
.site-head .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  color: var(--text);
  font-size: 0.8125rem; font-weight: 800;
  letter-spacing: 0.22em; text-transform: uppercase;
}
.brand:hover { text-decoration: none; }
.brand svg { width: 22px; height: 22px; flex: none; }
.site-nav { display: flex; gap: 1.1rem; }
.site-nav a {
  color: var(--text-2);
  font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
}
.site-nav a:hover { color: var(--ember); text-decoration: none; }

/* Small phones: brand + nav cannot share a 320px line, so they stack. Two
   things keep the stack from reading as one cramped block — real air
   between the rows, and a hierarchy: the name leads at full strength, the
   links sit back a step. The links also grow a touch target here; at 11px
   the text alone is nowhere near thumb-sized. */
@media (max-width: 560px) {
  .site-head { padding: 1.1rem 0 0.8rem; }
  .site-head .wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .brand { font-size: 0.8125rem; letter-spacing: 0.18em; }
  .brand svg { width: 20px; height: 20px; }
  .site-nav {
    gap: 1.35rem;
    margin: -0.4rem 0; /* absorb the links' padding so the row stays tight */
  }
  .site-nav a {
    padding: 0.4rem 0;
    font-size: 0.6875rem;
    letter-spacing: 0.16em;
    color: var(--text-3);
  }
  /* Top-align the hero copy here: with `justify-content: center` any spare
     height is split above and below, so padding-top is worth only half its
     value as visible gap under the header — and how much slack there is
     depends on the phone, which makes the gap unpredictable. Aligned to the
     start, this padding IS the gap, on every device. */
  .hero {
    justify-content: flex-start;
    padding-top: 10rem;
  }
}

/* subpages get a solid header instead of the floating one */
.site-head.solid {
  position: static;
  background: var(--bg);
  border-bottom: 1px solid;
  border-image: linear-gradient(90deg, var(--border), transparent 85%) 1;
}

/* ── hero ──────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 96svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 5.5rem 0 9.5rem; /* foot padding keeps copy clear of the road band */
  overflow: hidden;
}
.hero-road {
  position: absolute; inset: auto 0 0 0;
  /* capped at the copy's reserved foot padding so the pines can never rise
     behind the CTA row on a tall, narrow hero */
  height: min(38%, 10rem);
  width: 100%;
  pointer-events: none;
}
.hero-road canvas { width: 100%; height: 100%; display: block; }
.hero-copy { position: relative; z-index: 2; }
.hero h1 {
  font-size: clamp(2.4rem, 11vw, 5rem);
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text);
}
.hero .promise {
  margin: 1.1rem 0 0;
  font-size: clamp(1.05rem, 3.6vw, 1.35rem);
  color: var(--text-2);
  max-width: 34rem;
}
.hero .sub {
  margin: 0.9rem 0 0;
  max-width: 36rem;
}
.cta-row {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  margin-top: 2rem;
}
.platform-line { margin-top: 1.4rem; }

/* ── buttons (theme grammar: ember primary, bordered secondary) ───────── */
.btn {
  display: inline-block;
  padding: 0.9rem 1.6rem;
  border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 800;
  letter-spacing: 0.12em; text-transform: uppercase;
  border: 1px solid transparent;
  cursor: pointer;
  transition: filter 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--ember); color: var(--bg); }
.btn-primary:hover, .btn-primary:focus-visible { filter: brightness(1.08); }
.btn-ghost {
  background: transparent; color: var(--text-2);
  border-color: var(--border);
}
.btn-ghost:hover, .btn-ghost:focus-visible { color: var(--ember); border-color: var(--ember); }

/* ── sections ──────────────────────────────────────────────────────────── */
.section { padding: 4.5rem 0; }
.section-head { margin-bottom: 2rem; }
.section-head .lede { margin: 0.9rem 0 0; }

/* bridge whisper between sections (…the wind turns.) */
.bridge {
  text-align: center;
  padding: 2.5rem 1.25rem;
  font-style: italic;
}

/* ── the three beats ───────────────────────────────────────────────────── */
.beats { display: grid; gap: 1rem; }
.beat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.3rem;
}
.beat h3 {
  font-size: 0.8125rem; font-weight: 800;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ember);
  margin-bottom: 0.6rem;
}
.beat p { margin: 0; color: var(--text-2); font-size: 0.9375rem; }

/* ── places gallery ────────────────────────────────────────────────────── */
.places {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 72%;
  gap: 0.9rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 0.75rem;
  -webkit-overflow-scrolling: touch;
}
.place {
  scroll-snap-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--plaque);
}
.place img { width: 100%; aspect-ratio: 5 / 7; object-fit: cover; }
.place figcaption {
  padding: 0.6rem 0.8rem;
  font-size: 0.8125rem;
  color: var(--text-3);
}
.place.storm-tile figcaption { color: var(--slate); }

/* ── the storm band — the hard break ───────────────────────────────────── */
.storm {
  position: relative;
  min-height: 100svh;
  display: flex; align-items: center;
  background:
    linear-gradient(180deg, var(--storm-sky) 0%, var(--storm-bg) 22%, var(--storm-bg) 100%);
  overflow: hidden;
}
.storm-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.storm-copy {
  position: relative; z-index: 2;
  padding: 6rem 0;
  max-width: 36rem;
}
/* The storm copy fades in when the band is entered — but the hidden state
   only exists under .js (set by an inline head script), so a no-JS visitor
   reads everything. */
.storm-copy h2 {
  font-size: clamp(2rem, 9vw, 3.6rem);
  letter-spacing: 0.14em;
  color: #ccd2da; /* the storm's cold read of textPrimary */
  transition: opacity 1200ms ease, transform 1200ms ease;
}
.js .storm:not(.on) .storm-copy h2 { opacity: 0; transform: translateY(10px); }
.storm-copy p {
  color: #8d94a0;
  font-size: 1rem;
  margin: 1.2rem 0 0;
  transition: opacity 1400ms ease 500ms;
}
.js .storm:not(.on) .storm-copy p { opacity: 0; }
.word-pin {
  display: inline-block;
  margin-top: 1.6rem;
  font-size: 0.6875rem; font-weight: 800;
  letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--slate);
  transition: opacity 1400ms ease 1200ms;
}
.js .storm:not(.on) .word-pin { opacity: 0; }
.storm-exit {
  position: absolute; z-index: 2;
  left: 0; right: 0; bottom: 1.6rem;
  text-align: center;
  font-style: italic;
  color: var(--text-3);
}

/* ── legacy section ────────────────────────────────────────────────────── */
.legacy p { max-width: 42rem; color: var(--text-2); }
.northstar {
  margin-top: 2rem;
  font-size: 1.125rem;
  color: var(--text);
  font-weight: 600;
}
.northstar .whisper { display: block; font-weight: 400; margin-top: 0.35rem; }

/* ── devlog strip + devlog pages ───────────────────────────────────────── */
.devlog-list { display: grid; gap: 0.9rem; margin: 0; padding: 0; list-style: none; }
.devlog-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.devlog-item a {
  display: block;
  padding: 1.1rem 1.2rem;
  color: inherit;
}
.devlog-item a:hover { text-decoration: none; border-radius: var(--radius); background: var(--card); }
.devlog-item time {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-3);
  letter-spacing: 0.08em;
}
.devlog-item .verdict {
  display: block;
  margin-top: 0.3rem;
  color: var(--text);
  font-size: 0.9875rem;
}
.devlog-more { margin-top: 1.4rem; }

/* devlog entry page */
.entry { padding: 3rem 0 4rem; }
.entry-head time {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--text-3);
  letter-spacing: 0.08em;
}
.entry-head h1 {
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 0.4rem;
}
.entry-head .verdict {
  margin: 1rem 0 0;
  font-size: 1.0625rem;
  color: var(--text-2);
  font-style: italic;
}
.entry-body { margin-top: 2rem; max-width: 44rem; }
.entry-body ul { padding-left: 1.1rem; margin: 0; display: grid; gap: 0.9rem; }
.entry-body li { color: var(--text-2); font-size: 0.9375rem; }
.entry-body li::marker { color: var(--ember); }
.entry-body li ul {
  margin-top: 0.5rem;
  padding-left: 1rem;
  display: grid;
  gap: 0.4rem;
  font-size: 0.875rem;
}
.entry-body li ul li::marker { color: var(--text-3); }
.entry-body strong { color: var(--text); }
.entry-body p { color: var(--text-2); }
.entry-nav {
  margin-top: 3rem;
  display: flex; justify-content: space-between; gap: 1rem;
  font-size: 0.8125rem;
}

/* ── the fire (email form) ─────────────────────────────────────────────── */
.fire {
  border-top: 1px solid;
  border-image: linear-gradient(90deg, var(--border), transparent 85%) 1;
}
.fire-form { margin-top: 1.6rem; max-width: 30rem; }
.fire-form label {
  display: block;
  font-size: 0.6875rem; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 0.5rem;
}
.field-row { display: grid; gap: 0.75rem; }
.fire-form input[type="email"] {
  width: 100%;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
.fire-form input[type="email"]::placeholder { color: var(--text-3); }
.fire-form input[type="email"]:focus { border-color: var(--ember); }
.fire-form input[type="email"]:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}
/* honeypot — off-screen for humans, present for bots */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  overflow: hidden;
}
.consent { margin-top: 0.9rem; font-size: 0.8125rem; }
.form-note { margin-top: 0.9rem; font-size: 0.9375rem; }
.form-note.ok { color: var(--sage); }
.form-note.err { color: var(--brick); }
.joined { display: none; }
.joined strong { color: var(--ember); }
/* no-JS server redirects land on these anchors — :target shows the state
   without a line of script */
.joined:target { display: block; }
#fire-oops { display: none; }
#fire-oops:target { display: block; }

/* ── footer ────────────────────────────────────────────────────────────── */
.site-foot {
  margin-top: 3rem;
  padding: 2.2rem 0 2.6rem;
  border-top: 1px solid;
  border-image: linear-gradient(90deg, var(--border), transparent 85%) 1;
}
.foot-links {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem;
  font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.foot-links a { color: var(--text-3); }
.foot-links a:hover { color: var(--ember); text-decoration: none; }
.site-foot .whisper { margin-top: 1rem; display: block; }

/* ── press page bits ───────────────────────────────────────────────────── */
.facts { display: grid; gap: 0.35rem 1.5rem; grid-template-columns: max-content 1fr; font-size: 0.9375rem; }
.facts dt { color: var(--text-3); }
.facts dd { margin: 0; color: var(--text-2); }
.swatches { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.swatch { width: 72px; }
.swatch i {
  display: block; height: 44px;
  border-radius: 6px; border: 1px solid var(--border);
}
.swatch span {
  display: block; margin-top: 0.3rem;
  font-family: var(--mono); font-size: 0.625rem; color: var(--text-3);
}
.dl-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); }
.dl-grid .place img { aspect-ratio: auto; }

/* ── reveal on scroll (calm: small, slow, off under reduced motion) ─────
   The hidden state is gated on .js so a no-JS visitor sees the whole page —
   including the email form. */
.reveal { transition: opacity 900ms ease, transform 900ms ease; }
.js .reveal:not(.on) { opacity: 0; transform: translateY(14px); }

@media (prefers-reduced-motion: reduce) {
  .reveal, .storm-copy h2, .storm-copy p, .word-pin,
  .js .reveal:not(.on),
  .js .storm:not(.on) .storm-copy h2,
  .js .storm:not(.on) .storm-copy p,
  .js .storm:not(.on) .word-pin {
    opacity: 1 !important; transform: none !important; transition: none !important;
  }
}

/* ── desktop enhancement layer ─────────────────────────────────────────── */
@media (min-width: 640px) {
  .field-row { grid-template-columns: 1fr auto; }
  .beats { grid-template-columns: repeat(3, 1fr); }
  .dl-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 960px) {
  body { font-size: 17px; }
  .section { padding: 6.5rem 0; }
  .hero { padding-bottom: 12rem; }
  .hero-road { height: min(34%, 13rem); }
  .places {
    grid-auto-flow: row;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-columns: unset;
    overflow-x: visible;
  }
  .storm-copy { padding: 8rem 0; }
}
