/*
 * signalescape.com — the landing page.
 *
 * **The page is a route.** One line runs its whole length, each section is a
 * station on it, and the only place it branches is the footer, where there is
 * finally somewhere else to go. That is the game's own notation used as page
 * structure rather than as decoration: a junction means a choice of branch, and
 * until the footer there is no choice to offer.
 *
 * The palette and the two faces are the game's, taken from `app/src/styles/
 * tokens.css` and `app/public/fonts`. This page and the thing it links to have
 * to look like one object — a shopfront in a different palette is a different
 * shop.
 */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0 clamp(18px, 5vw, 56px);
  background: var(--bg);
  color: var(--ink);
  font: 400 clamp(1rem, 0.98rem + 0.15vw, 1.0625rem) / 1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main,
footer {
  max-width: var(--page);
  margin: 0 auto;
}

/* ---- the route ---------------------------------------------------------- */

/*
 * Two strokes, amber and teal, three pixels each with three between them —
 * which is how the board draws a segment both colours can reach. Adjacent
 * sections butt together, so the line is continuous down the page without
 * anything having to measure it.
 */
.stop {
  position: relative;
  padding: clamp(56px, 9vw, 104px) 0 0 var(--gutter);
}

.stop::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--line-w);
  background:
    linear-gradient(var(--amber), var(--amber)) 0 0 / 3px 100% no-repeat,
    linear-gradient(var(--teal), var(--teal)) 6px 0 / 3px 100% no-repeat;
  /* Bright enough to read as the board's two-colour track rather than as an
     accidental border. It was 0.34, which at three pixels a stroke on this
     background is a hairline nobody sees — the signature failing quietly. */
  opacity: 0.8;
  transition: opacity var(--t) var(--ease);
}

.stop-hero::before {
  /* The route starts at the source, not above it. */
  top: clamp(56px, 9vw, 104px);
}

.stop-end::before {
  /* And stops at the junction, which is where it branches instead. */
  bottom: auto;
  height: clamp(56px, 9vw, 104px);
}

.station,
.junction {
  position: absolute;
  left: calc(var(--line-w) / 2 - var(--station) / 2);
  top: clamp(56px, 9vw, 104px);
  width: var(--station);
  height: var(--station);
  background: var(--bg);
  border: 3px solid var(--ink-soft);
  transform: translateY(-50%);
  transition:
    border-color var(--t) var(--ease),
    box-shadow var(--t) var(--ease);
}

.station {
  border-radius: 50%;
}

/* A source is an open ring — the board draws the start of a line that way. */
.station-source {
  border-color: var(--amber);
}

/* The junction: a diamond, as on the board, and the only branch on the page. */
.junction {
  border-radius: 2px;
  border-color: var(--ink);
  transform: translateY(-50%) rotate(45deg);
}

/*
 * Scroll lights the station you have reached, which is what the board does when
 * a signal occupies one (§8.2). Applied only when the script is running, so
 * with no JavaScript every station is simply lit and nothing is missing.
 */
.js .stop:not(.is-lit)::before {
  opacity: 0.26;
}

.js .stop:not(.is-lit) .station,
.js .stop:not(.is-lit) .junction {
  border-color: var(--track);
}

.is-lit .station {
  border-color: var(--teal);
  box-shadow: var(--glow-station);
}

.is-lit .station-source {
  border-color: var(--amber);
  box-shadow: var(--glow-source);
}

.is-lit .junction {
  border-color: var(--ink);
  box-shadow: var(--glow-junction);
}

/* ---- type --------------------------------------------------------------- */

.wordmark {
  margin: 0;
  font-size: clamp(2.75rem, 9vw, 5.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
}

.subtitle {
  margin: clamp(10px, 1.4vw, 16px) 0 0;
  font: 700 clamp(0.72rem, 1.5vw, 0.8rem) / 1.4 var(--mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.pitch {
  max-width: var(--measure);
  margin: clamp(28px, 4vw, 44px) 0 0;
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
  line-height: 1.35;
  letter-spacing: -0.015em;
}

/* The half of the sentence that is the whole game. */
.pitch em {
  font-style: normal;
  color: var(--amber-text);
}

.eyebrow {
  margin: 0 0 clamp(16px, 2vw, 22px);
  font: 700 clamp(0.72rem, 1.5vw, 0.8rem) / 1.4 var(--mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.lead {
  max-width: var(--measure);
  margin: 0 0 1.1em;
  font-size: clamp(1.05rem, 1.5vw, 1.2rem);
  line-height: 1.6;
}

.note,
.colophon,
figcaption {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* ---- the call to action ------------------------------------------------- */

.actions {
  margin: clamp(28px, 3.5vw, 40px) 0 0;
}

.note {
  margin: 14px 0 0;
}

.play {
  display: inline-block;
  padding: 15px 30px;
  border: 0;
  border-radius: 999px;
  background: var(--amber);
  color: #14161c;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition:
    transform var(--t) var(--ease),
    box-shadow var(--t) var(--ease);
}

.play:hover,
.play:focus-visible {
  /* A signal glows when it is the thing about to move. */
  box-shadow: var(--glow-cta);
  transform: translateY(-1px);
}

/* ---- screens ------------------------------------------------------------ */

.screen {
  margin: clamp(36px, 5vw, 60px) 0 0;
}

.screen img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--bg);
}

.screen figcaption {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.screen-quiet img {
  /* Below the fold these are evidence, not the argument — so they sit back. */
  opacity: 0.92;
}

/* ---- lists -------------------------------------------------------------- */

.consequences,
.features {
  max-width: var(--measure);
  margin: clamp(24px, 3vw, 34px) 0 0;
  padding: 0;
  list-style: none;
}

.consequences li,
.features li {
  position: relative;
  padding: 14px 0 14px 26px;
  border-top: 1px solid var(--rule);
}

.consequences li:last-child,
.features li:last-child {
  border-bottom: 1px solid var(--rule);
}

/* A station mark, small: each of these is a stop on the same idea. */
.consequences li::before,
.features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 1.45em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
}

.features li::before {
  background: var(--amber);
}

.features strong {
  font-weight: 700;
}

/* ---- the junction ------------------------------------------------------- */

.stop-end {
  padding-bottom: clamp(64px, 8vw, 110px);
}

.closing {
  max-width: var(--measure);
  margin: 0 0 clamp(24px, 3vw, 32px);
  font-size: clamp(1.05rem, 1.5vw, 1.2rem);
}

.branches {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.branch {
  padding: 11px 20px;
  border: 1px solid var(--track);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.95rem;
  text-decoration: none;
  transition:
    border-color var(--t) var(--ease),
    color var(--t) var(--ease);
}

.branch:hover,
.branch:focus-visible {
  border-color: var(--teal);
  color: var(--teal-text);
}

.branch-primary {
  border-color: var(--amber);
  color: var(--amber-text);
}

.branch-primary:hover,
.branch-primary:focus-visible {
  border-color: var(--amber);
  color: var(--amber-text);
  box-shadow: var(--glow-pill);
}

.colophon {
  margin: clamp(36px, 5vw, 52px) 0 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.colophon a {
  color: var(--ink-soft);
  text-decoration-color: var(--track);
  text-underline-offset: 3px;
  transition: color var(--t) var(--ease);
}

.colophon a:hover,
.colophon a:focus-visible {
  color: var(--ink);
}

/* ---- the cookie question ------------------------------------------------ */

/*
 * A bar across the foot of the window, not a modal over the middle of it.
 *
 * The page is readable without answering and the answer changes nothing about
 * it, so the banner is sized and placed like what it is — a question that can
 * wait. Darkening the page behind a consent dialog would claim otherwise.
 */
.consent {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;

  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  align-items: center;
  justify-content: space-between;

  /* `env()` so the bar clears a phone's home indicator rather than sitting under it. */
  padding: 18px clamp(18px, 5vw, 56px) calc(18px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--rule);
  background: var(--chrome);
}

.consent[hidden] {
  display: none;
}

.consent-body {
  flex: 1 1 22rem;
}

.consent-title {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.consent-text {
  max-width: var(--measure);
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.consent-button {
  padding: 10px 22px;
  border: 1px solid var(--track);
  border-radius: 999px;
  background: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition:
    border-color var(--t) var(--ease),
    color var(--t) var(--ease);
}

.consent-button:hover,
.consent-button:focus-visible {
  border-color: var(--teal);
  color: var(--teal-text);
}

/*
 * Amber, like every other button on the page that is the thing about to move.
 * Accept is the affirmative answer, not the recommended one — Decline sits
 * beside it at the same size, and both are one press.
 */
.consent-accept {
  border-color: var(--amber);
  color: var(--amber-text);
}

.consent-accept:hover,
.consent-accept:focus-visible {
  border-color: var(--amber);
  color: var(--amber-text);
  box-shadow: var(--glow-pill);
}

.consent-more {
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-decoration-color: var(--track);
  text-underline-offset: 3px;
  transition: color var(--t) var(--ease);
}

.consent-more:hover,
.consent-more:focus-visible {
  color: var(--ink);
}

/* The footer's two controls are `button`s, and `.branch` was written for `a`. */
.consent-reopen,
.theme-toggle {
  background: none;
  font-family: inherit;
  cursor: pointer;
}

/*
 * The label swaps between two words of different widths, so the button is
 * given the room for the wider one — otherwise switching themes visibly
 * resizes the control you just pressed and nudges the row beside it.
 */
.theme-toggle-label {
  display: inline-block;
  min-width: 4.6em;
}

/* ---- the floor ---------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (max-width: 40rem) {
  :root {
    --gutter: 28px;
    --station: 16px;
  }

  /*
   * The level select is a 2560px-wide banner of small type. At a phone's width
   * that is not a screenshot, it is a smear — and its one claim, that there are
   * fifty named levels, is already made in the sentence above it. So the
   * picture goes and the argument stays.
   */
  .screen-wide {
    display: none;
  }

  /*
   * The banner is a bar on a desktop and a slab on a phone: the same three
   * sentences wrap to eight lines at 375px and took 43% of the viewport, which
   * is not a question sitting politely at the foot of the page, it is a wall in
   * front of the hero. Smaller type and tighter padding, not less text — the
   * text is what makes the choice an informed one.
   */
  .consent {
    gap: 12px;
    padding: 14px clamp(18px, 5vw, 56px) calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .consent-text {
    font-size: 0.82rem;
    line-height: 1.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }

  /*
   * Every station lit, and none of them changing. The lighting is a pleasant
   * echo of a mechanic, not information — so when motion is unwelcome it is the
   * whole effect that goes, not just its duration.
   */
  .js .stop:not(.is-lit)::before {
    opacity: 0.8;
  }

  .js .stop:not(.is-lit) .station {
    border-color: var(--teal);
  }

  .js .stop:not(.is-lit) .station-source {
    border-color: var(--amber);
  }

  .js .stop:not(.is-lit) .junction {
    border-color: var(--ink);
  }
}
