/* Leadership Springfield x PTG scavenger hunt.
 *
 * Concept: WAYFINDING. The activity is finding things around a building, so
 * the interface borrows from building and exhibition signage rather than from
 * quiz apps -- high contrast, directional, left-aligned, confident. Progress
 * is a route with stops on it, not a progress bar.
 *
 * The hard constraint behind most of these numbers: this is read one-handed,
 * on the move, by adults who are looking at an exhibit and not at the phone.
 * Museum lighting is dim and inconsistent. Type is large, contrast is high,
 * tap targets are 56px, and nothing important is grey-on-grey.
 */

/* ---------------------------------------------------------------- tokens */

:root {
  /* Leadership Springfield's own values, sampled from their logo and site. */
  --teal-deep: #006666;
  --teal-mid: #00807f;
  --teal-light: #72c0c4;
  --teal-wash: #e4f0f0;

  /* Their brand near-black and grey. */
  --ink: #222222;
  --ink-soft: #4a4f4f;
  /* Darkened from Leadership Springfield's #7d8080. Their grey is a logo
     colour, and at small sizes on this off-white it only reaches 3.7:1 --
     under AA, and genuinely hard to read on a phone in sunlight, which is the
     condition this app is used in. #6a6e6e clears 4.5:1 both as text on paper
     and as the ground under white bullet numerals, and still reads as
     secondary next to --ink-soft. The brand grey stays in the logo itself. */
  --grey: #6a6e6e;
  --rule: #d4dcdc;

  /* Cool off-white, pulled from the teal family -- deliberately not cream. */
  --paper: #f5f7f7;
  --paper-raised: #ffffff;

  /* Street tones. WalkNYC builds its palette out of what is actually on the
     pavement rather than out of a brand guide alone. The same idea here: a
     dark neutral, a near-white, and a signal amber give the palette a range
     the pure-teal version lacked, and read cleanly under gallery lighting. */
  --asphalt: #1d2626;
  --asphalt-raised: #263131;
  --asphalt-line: #3c4a4a;
  --signal: #f5a32a;
  --crosswalk: #f7fafa;

  /* PTG hexagon facets. Amber is the working accent; the rest appear once,
     on the finish page, as the reward moment. */
  --ptg-amber: #f5a32a;
  --ptg-red: #e8412f;
  --ptg-indigo: #4a4490;
  --ptg-blue: #4285f4;
  --ptg-green: #00a887;

  --ok: #0a7d55;
  --bad: #c4341f;

  --shell: 34rem;
  --step: 0.75rem;
  --radius: 4px;

  --font-ui: 'Barlow', system-ui, -apple-system, sans-serif;
  --font-sign: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
  --font-note: 'Newsreader', Georgia, serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* A faint floor plan behind every player-facing page. It is the reason the
   light screens no longer read as a generic form on a blank background: the
   page knows it is about finding your way around a building. Kept very low
   contrast so it never competes with the question. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  color: var(--teal-deep);
  background-image: url('../brand/floorplan.svg');
  background-size: 300px 300px;
  opacity: 0.055;
  pointer-events: none;
}

body.board::before { display: none; }

/* Signage is set in caps and tracked out. Used ONLY for stop markers and
   section rules -- not as a decorative eyebrow above every heading. */
.sign {
  font-family: var(--font-sign);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 1rem;
}

a { color: var(--teal-deep); }

:focus-visible {
  outline: 3px solid var(--ptg-amber);
  outline-offset: 2px;
}



/* The connecting road. */
.route__stop::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--rule);
}

.route__stop:first-child::before { left: 50%; }
.route__stop:last-child::before { right: 50%; }

.route__stop::after {
  content: '';
  position: relative;
  margin: 0 auto;
  width: var(--dot);
  height: var(--dot);
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--rule);
  z-index: 1;
}

.route__stop--done::before { background: var(--teal-light); }
.route__stop--done::after {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
}

.route__stop--missed::after {
  background: var(--paper);
  border-color: var(--grey);
}

.route__stop--here::after {
  --dot: 15px;
  background: var(--ptg-amber);
  border-color: var(--ptg-amber);
  box-shadow: 0 0 0 4px rgba(245, 163, 42, 0.25);
}

/* --------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  max-width: var(--shell);
  margin: 0 auto;
}

.topbar__meta {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-shrink: 0;
  font-family: var(--font-sign);
  font-variant-numeric: tabular-nums;
}

.topbar__count {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.topbar__of { font-size: 0.95rem; color: var(--grey); }

.clock {
  font-family: var(--font-sign);
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

.clock--low { color: var(--bad); }

/* ------------------------------------------------------------- stop card */
/* Not a card in the SaaS sense -- it is the sign at the stop. Flat, edged on
   one side only, no drop shadow. */

.stop {
  padding: 1.75rem 0 1rem;
}

.stop__marker {
  font-family: var(--font-sign);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--teal-deep);
  display: block;
}

.stop__place {
  font-size: 0.98rem;
  color: var(--ink-soft);
  margin: 0.15rem 0 0;
  padding-left: 0.9rem;
  border-left: 3px solid var(--teal-light);
}

.stop__question {
  font-size: clamp(1.6rem, 6.5vw, 2.1rem);
  line-height: 1.18;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 1.3rem 0 0;
  text-wrap: balance;
}

.stop__points {
  margin-top: 0.9rem;
  font-size: 0.92rem;
  color: var(--grey);
}

/* ----------------------------------------------------------------- form */

.answer { margin-top: 1.6rem; }

.answer__field {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 1.15rem;
  padding: 0.95rem 1rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
}

.answer__field::placeholder { color: var(--grey); }

.answer__field:focus {
  border-color: var(--teal-deep);
  outline: 3px solid var(--teal-light);
  outline-offset: 0;
}

.btn {
  display: block;
  width: 100%;
  min-height: 56px;
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.9rem 1.2rem;
  border: 2px solid var(--teal-deep);
  border-radius: var(--radius);
  background: var(--teal-deep);
  color: #fff;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.btn:hover:not(:disabled) { background: #005050; border-color: #005050; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn--quiet {
  background: transparent;
  color: var(--teal-deep);
  border-color: var(--rule);
}

.btn--quiet:hover:not(:disabled) {
  background: var(--teal-wash);
  border-color: var(--teal-light);
}

.btn--ghost {
  background: none;
  border: none;
  color: var(--teal-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 44px;
  font-size: 0.98rem;
  width: auto;
  padding: 0.5rem 0;
}

.answer__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.9rem;
  min-height: 44px;
}

/* --------------------------------------------------------------- verdict */
/* Replaces the old app's floating cartoon toasts. Verdict appears inline,
   where the person is already looking, and stays until they move on. */

.verdict {
  margin-top: 0.9rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border-left: 4px solid;
  font-size: 1rem;
  background: var(--paper-raised);
}

.verdict--yes { border-color: var(--ok); color: #0a5c40; background: #eaf6f0; }
.verdict--no { border-color: var(--bad); color: #8f2415; background: #fdeeec; }
.verdict--near { border-color: var(--ptg-amber); color: #8a5504; background: #fdf3e2; }

.verdict strong { font-weight: 700; }

.hint {
  margin-top: 1rem;
  padding: 0.85rem 1rem 0.85rem 1.1rem;
  background: var(--teal-wash);
  border-left: 4px solid var(--teal-light);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------- footer */

.brandbar {
  margin-top: 3rem;
  padding: 1.4rem 1rem 2rem;
  border-top: 1px solid var(--rule);
}

.brandbar__inner {
  max-width: var(--shell);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brandbar__by {
  font-size: 0.8rem;
  color: var(--grey);
  line-height: 1.35;
}

.brandbar img { display: block; }
.brandbar__ptg { height: 22px; width: auto; }
.brandbar__lsgf { height: 34px; width: auto; }
.brandbar__keep { height: 32px; width: auto; }

/* --------------------------------------------------------------- landing */

.hero { padding: 2.5rem 0 0; }

.hero__lockup { width: min(19rem, 78%); height: auto; display: block; }

.hero__title {
  font-family: var(--font-sign);
  font-size: clamp(2.6rem, 12vw, 4rem);
  line-height: 0.92;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin: 1.8rem 0 0;
  color: var(--ink);
}

.hero__title em {
  display: block;
  font-style: normal;
  color: var(--teal-deep);
}

.hero__lede {
  margin: 1.1rem 0 0;
  font-size: 1.1rem;
  color: var(--ink-soft);
  max-width: 30ch;
}

/* The course preview: the route device at rest, showing what they're in for. */



/* At rest on the sign-up card there is no progress to show, so the stops need
   their own presence -- on white, the default hollow dot all but vanished. */

.form { margin-top: 2rem; }

.field { margin-bottom: 1.1rem; }

.field label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--ink);
}

.field input[type="text"],
.field input[type="email"] {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 1.05rem;
  padding: 0.85rem 1rem;
  border: 2px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
}

.field input:focus {
  border-color: var(--teal-deep);
  outline: 3px solid var(--teal-light);
}

.consent {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: 1.2rem 0 1.6rem;
  line-height: 1.45;
}

.consent input {
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  flex-shrink: 0;
  accent-color: var(--teal-deep);
}

.errors {
  margin: 0 0 1.2rem;
  padding: 0.85rem 1rem;
  background: #fdeeec;
  border-left: 4px solid var(--bad);
  border-radius: var(--radius);
  color: #8f2415;
  font-size: 0.97rem;
}

.errors ul { margin: 0; padding-left: 1.1rem; }

/* ---------------------------------------------------------------- finish */

.finish { padding: 2.5rem 0 0; text-align: center; }


.finish__title {
  font-family: var(--font-sign);
  text-transform: uppercase;
  font-size: clamp(2.2rem, 10vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
  margin: 1.2rem 0 0;
}


/* The recap. Set in a serif because a person -- or something writing like
   one -- wrote it. Everything else on the screen is signage; this is a note. */
.recap {
  margin: 2rem 0 0;
  padding: 1.6rem 1.4rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-top: 5px solid var(--teal-deep);
  border-radius: var(--radius);
  text-align: left;
}

.recap__headline {
  font-family: var(--font-note);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.7rem;
  color: var(--teal-deep);
}

.recap__body {
  font-family: var(--font-note);
  font-size: 1.14rem;
  line-height: 1.62;
  margin: 0;
  color: var(--ink);
}

.recap__by {
  margin: 1.1rem 0 0;
  font-size: 0.78rem;
  color: var(--grey);
  font-family: var(--font-ui);
}

.recap--loading .recap__body { color: var(--grey); }

/* Stat row. Built as real structure rather than a middle-dot string. */




/* Per-stop review on the finish page. */
.review { margin: 2.2rem 0 0; text-align: left; }

.review__heading {
  font-family: var(--font-sign);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--grey);
  margin: 0 0 0.8rem;
}

.review__item {
  display: flex;
  gap: 0.85rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--rule);
}

.review__mark {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
}

.review__mark--yes { background: var(--teal-deep); }
.review__mark--no { background: var(--grey); }

.review__q { margin: 0; font-size: 0.98rem; line-height: 1.4; }

.review__meta {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--grey);
}

/* ----------------------------------------------------- projector board */
/* Read from across a room: dark, enormous, tabular. */

body.board {
  background: var(--ink);
  color: #fff;
}

.board__head {
  padding: 2rem 2.5rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  border-bottom: 2px solid #3a4040;
}

.board__title {
  font-family: var(--font-sign);
  text-transform: uppercase;
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0;
  line-height: 1;
}

.board__sub { color: var(--teal-light); font-size: 1.1rem; margin: 0.4rem 0 0; }

.board__list {
  list-style: none;
  margin: 0;
  padding: 1rem 2.5rem 2.5rem;
}

.board__row {
  display: grid;
  grid-template-columns: 4rem 1fr auto;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid #3a4040;
  font-size: clamp(1.4rem, 2.6vw, 2.2rem);
}

.board__rank {
  font-family: var(--font-sign);
  font-weight: 700;
  color: var(--teal-light);
  font-variant-numeric: tabular-nums;
}

/* 1fr alone will not shrink: a grid item's default min-width is auto, so a
   name with no spaces in it -- a pasted string, a long address -- widens the
   row until the score is pushed off the side of the projection. min-width:0
   lets the column give, and the wrap breaks the run instead of clipping it.
   This board is read from across a hall, so an unreachable score is the
   whole point of the screen gone. */
.board__name { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

.board__score {
  font-family: var(--font-sign);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.board__empty {
  padding: 4rem 2.5rem;
  color: var(--grey);
  font-size: 1.4rem;
}

.board__foot {
  padding: 0 2.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* ------------------------------------------------------------ utilities */

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Laptop: the layout stays a single column. It is what gets demoed on a
   laptop and must look deliberate there, not stretched. */
@media (min-width: 48rem) {
  body { font-size: 18px; }
  .hero { padding-top: 4rem; }
}

/* ======================================================================
   SECOND PASS -- the conference build.
   ----------------------------------------------------------------------
   The first version was correct and forgettable: logo, headline, paragraph,
   form. Everything below exists to give the app a point of view that reads
   from across a room, borrowing from pedestrian wayfinding systems (WalkNYC,
   Bristol Legible City) rather than from web-app convention.

   Two devices carry it, and they repeat on every screen:
     1. the TRANSIT BULLET -- a numbered circle, the way a subway line marks
        a stop. One recognisable shape, used for every stop everywhere.
     2. the DRAWN ROUTE -- the walk shown as a line on a map, not a progress
        bar.
   ====================================================================== */

/* ------------------------------------------------------------- bullets */

.bullet {
  --size: 2.1rem;
  flex: 0 0 auto;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-sign);
  font-weight: 700;
  font-size: calc(var(--size) * 0.52);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  background: var(--teal-deep);
  color: #fff;
  /* Optical: Barlow Condensed numerals sit high in the em box. */
  padding-top: 0.06em;
}

.bullet--ahead {
  background: transparent;
  color: var(--grey);
  box-shadow: inset 0 0 0 2px var(--rule);
}

.bullet--here {
  background: var(--signal);
  color: var(--asphalt);
  box-shadow: 0 0 0 5px rgba(245, 163, 42, 0.22);
}

.bullet--missed { background: var(--grey); color: #fff; }
.bullet--lg { --size: 2.75rem; }

/* --------------------------------------------------------- hero (dark) */
/* The one loud moment. An asphalt panel with the course drawn across it,
   then everything below returns to quiet paper. */

.hero {
  padding: 0;
  margin: 0 -1rem;
}

.hero__panel {
  background: var(--asphalt);
  color: var(--crosswalk);
  padding: 1.35rem 1.25rem 1.2rem;
  position: relative;
  overflow: hidden;
}

.hero__lockup {
  width: min(13.5rem, 60%);
  height: auto;
  display: block;
  margin-bottom: 1.1rem;
}

.hero__title {
  font-family: var(--font-sign);
  text-transform: uppercase;
  font-size: clamp(2.5rem, 13vw, 3.6rem);
  line-height: 0.86;
  font-weight: 700;
  letter-spacing: -0.005em;
  margin: 0;
  color: var(--crosswalk);
}

.hero__title em {
  display: block;
  font-style: normal;
  color: var(--teal-light);
}

.hero__lede {
  margin: 0.8rem 0 0;
  font-size: 1.05rem;
  line-height: 1.45;
  color: #b9c7c7;
  max-width: 32ch;
}

.heromap {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 1.1rem;
  border-radius: 6px;
}

.heromap__stops circle { fill: var(--crosswalk); }
.heromap__stops .heromap__end { fill: var(--signal); }

/* The single orchestrated motion in the whole app: the route draws itself
   once on load. Not a fade-and-slide on every section. */
/* The path carries pathLength="100", so these are percentages of the route
   rather than user units. A hard-coded length here has to be re-measured every
   time the route is redrawn, and when it is too small the tail of the line
   renders inside the dash gap and simply disappears. */
.heromap__route {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: draw-route 1.6s cubic-bezier(.65, 0, .35, 1) 0.25s forwards;
}

.heromap__stops circle,
.heromap__pin circle {
  opacity: 0;
  animation: pop-stop 0.4s ease-out forwards;
}

.heromap__stops circle:nth-child(1) { animation-delay: 0.45s; }
.heromap__stops circle:nth-child(2) { animation-delay: 0.7s; }
.heromap__stops circle:nth-child(3) { animation-delay: 0.9s; }
.heromap__stops circle:nth-child(4) { animation-delay: 1.1s; }
.heromap__stops circle:nth-child(5) { animation-delay: 1.3s; }
.heromap__stops circle:nth-child(6) { animation-delay: 1.5s; }
.heromap__stops circle:nth-child(7) { animation-delay: 1.7s; }
.heromap__stops circle:nth-child(8) { animation-delay: 1.9s; }
.heromap__pin circle { animation-delay: 2.05s; }

@keyframes draw-route { to { stroke-dashoffset: 0; } }
@keyframes pop-stop { to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .heromap__route { stroke-dashoffset: 0; animation: none; }
  .heromap__stops circle, .heromap__pin circle { opacity: 1; animation: none; }
}

/* A strip of facts under the hero, set as signage rather than prose. */
.facts {
  display: flex;
  background: var(--asphalt-raised);
  color: var(--crosswalk);
  border-top: 1px solid var(--asphalt-line);
}

.facts__item {
  flex: 1;
  padding: 0.85rem 1.25rem;
  border-right: 1px solid var(--asphalt-line);
}

.facts__item:last-child { border-right: 0; }

.facts__value {
  font-family: var(--font-sign);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.facts__label {
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #8fa3a3;
  margin-top: 0.25rem;
}

/* ----------------------------------------------------------- sign-up */

.form { margin-top: 2.2rem; }

.form__heading {
  font-family: var(--font-sign);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.form__note {
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

/* Inputs read as filled-in fields on a form you'd find at a desk: a heavy
   bottom rule rather than a floating rounded box. */
.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
  border: 0;
  border-bottom: 2.5px solid var(--rule);
  border-radius: 0;
  background: transparent;
  padding: 0.7rem 0.1rem;
  font-size: 1.15rem;
  transition: border-color 140ms ease;
}

/* Pointer focus gets the quiet treatment -- the rule thickens and turns teal.
   Keyboard focus keeps a real ring: replacing the outline outright, as the
   first version did, left keyboard users with a 2px colour change to navigate
   by. :focus-visible is what distinguishes the two. */
.field input:focus {
  border-bottom-color: var(--teal-deep);
  outline: 0;
  box-shadow: 0 2px 0 0 var(--teal-deep);
}

.field input:focus-visible {
  outline: 3px solid var(--signal);
  outline-offset: 3px;
  border-bottom-color: var(--teal-deep);
}

.field label {
  font-family: var(--font-sign);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-weight: 700;
}

/* ------------------------------------------------------- play: the rail */
/* The route strip becomes a real rail: a drawn line with a bullet riding it. */

.topbar {
  background: var(--asphalt);
  border-bottom: 0;
  color: var(--crosswalk);
}

.topbar__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 1rem;
}

.rail {
  position: relative;
  height: 2.1rem;
  display: flex;
  align-items: center;
}

.rail__line {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--asphalt-line);
  border-radius: 2px;
}

/* The bullet travels between insets of half its own width, not between the
   raw 0% and 100%. Centred on 0% it hung half off the track and sat on top of
   the "pts" label; at 100% it did the same to the clock. --p is the progress
   fraction, set from JS. */
.rail {
  --bullet-size: 2.1rem;
  --bullet-half: 1.05rem;
  --p: 0;
}

/* --p is the travelled fraction, set from drawRail() in play.js.
 *
 * The bullet's CENTRE travels from half a bullet in to half a bullet from the
 * end, which is what keeps it clear of the score on the left and the clock on
 * the right. Measured: 0.041 to 0.959 of the rail width, no overlap at either
 * extreme.
 *
 * A note for anyone measuring this with an automated browser: Chrome freezes
 * CSS transitions at currentTime 0 in a hidden tab, so `left` reads as the
 * start value forever and the bullet looks stuck. Check
 * document.visibilityState before concluding anything is wrong here. */
.rail__done {
  position: absolute;
  left: 0;
  height: 3px;
  background: var(--teal-light);
  border-radius: 2px;
  width: calc(var(--bullet-half) + (100% - var(--bullet-size)) * var(--p));
  transition: width 420ms cubic-bezier(.65, 0, .35, 1);
}

.rail__bullet {
  position: absolute;
  left: calc(var(--bullet-half) + (100% - var(--bullet-size)) * var(--p));
  transform: translateX(-50%);
  transition: left 420ms cubic-bezier(.65, 0, .35, 1);
}

.topbar .clock,
.topbar__count { color: var(--crosswalk); }
.topbar__of { color: #8fa3a3; }
.topbar .clock { color: #b9c7c7; }
.topbar .clock--low { color: #ffb4a6; }

/* ------------------------------------------------------ play: the stop */

.stop { padding: 1.6rem 0 1rem; }

.stop__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stop__marker {
  font-family: var(--font-sign);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--grey);
  display: block;
  line-height: 1.1;
}

.stop__place {
  margin: 0.1rem 0 0;
  padding: 0;
  border: 0;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--teal-deep);
  line-height: 1.2;
}

.stop__question {
  font-size: clamp(1.65rem, 6.8vw, 2.15rem);
  line-height: 1.16;
  font-weight: 600;
  letter-spacing: -0.018em;
  margin: 0;
  text-wrap: balance;
}

.stop__points {
  margin-top: 0.85rem;
  font-family: var(--font-sign);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--grey);
}

/* --------------------------------------------------------- the ticket */
/* The finish page is the screenshot moment, so it is built as a pass: a
   stub with the score, a perforation, and the note underneath. */

.ticket {
  margin-top: 2rem;
  background: var(--paper-raised);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 0 var(--rule), 0 14px 34px -22px rgba(29, 38, 38, 0.55);
  text-align: left;
}

.ticket__stub {
  background: var(--asphalt);
  color: var(--crosswalk);
  padding: 1.5rem 1.4rem 1.3rem;
  position: relative;
}

.ticket__eyebrow {
  font-family: var(--font-sign);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--teal-light);
  margin: 0 0 0.3rem;
}

.ticket__name {
  font-family: var(--font-sign);
  text-transform: uppercase;
  font-size: clamp(2rem, 9vw, 2.7rem);
  line-height: 0.95;
  font-weight: 700;
  margin: 0;
}

.ticket__figures {
  display: flex;
  gap: 1.6rem;
  margin-top: 1.2rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--asphalt-line);
}

.ticket__figure { line-height: 1; }

.ticket__num {
  font-family: var(--font-sign);
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ticket__num small { font-size: 0.55em; color: #8fa3a3; font-weight: 600; }

.ticket__cap {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8fa3a3;
  margin-top: 0.35rem;
}

/* The perforation between stub and note. */
.ticket__perf {
  height: 0;
  border-top: 2px dashed var(--rule);
  position: relative;
}

.ticket__perf::before,
.ticket__perf::after {
  content: '';
  position: absolute;
  top: -11px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--paper);
}

.ticket__perf::before { left: -10px; }
.ticket__perf::after { right: -10px; }

.ticket__note { padding: 1.5rem 1.4rem 1.6rem; }

.recap {
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
}

.recap__headline {
  font-family: var(--font-note);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.6rem;
  color: var(--ink);
}

.recap__body {
  font-family: var(--font-note);
  font-size: 1.12rem;
  line-height: 1.6;
  margin: 0;
  color: var(--ink-soft);
}

.recap__by {
  margin: 1.2rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--grey);
  font-family: var(--font-ui);
}

.recap--loading .recap__headline,
.recap--loading .recap__body { color: var(--grey); }

/* ------------------------------------------------- finish: the review */

.finish { padding: 2.2rem 0 0; text-align: left; }

.finish__title {
  font-family: var(--font-sign);
  text-transform: uppercase;
  font-size: clamp(2rem, 9vw, 2.6rem);
  font-weight: 700;
  line-height: 0.95;
  margin: 0.9rem 0 0;
}

.review__item {
  display: flex;
  gap: 0.9rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--rule);
  align-items: flex-start;
}

.review__q { margin: 0; font-size: 1rem; line-height: 1.35; font-weight: 500; }

.review__meta {
  margin: 0.25rem 0 0;
  font-size: 0.86rem;
  color: var(--grey);
}

/* ---------------------------------------------------- projector board */

.board__row {
  grid-template-columns: auto 1fr auto;
  gap: 1.5rem;
  align-items: center;
}

.board__row .bullet { --size: 2.9rem; }

.board__row--lead .bullet { background: var(--signal); color: var(--asphalt); }

/* ------------------------------------------------------------ desktop */

@media (min-width: 48rem) {
  .hero { margin: 0; }
  .hero__panel { padding: 2.2rem 2rem 1.8rem; border-radius: 8px 8px 0 0; }
  .facts { border-radius: 0 0 8px 8px; }
  .shell { padding: 0 1.5rem; }
}

/* --------------------------------------------------- ticket refinements */

/* The ticket sits near the top -- there is no headline above it any more,
   so the old finish padding left a hole. */
.finish { padding: 1.2rem 0 0; }
.ticket { margin-top: 0; }

.ticket__stub { padding-top: 1.3rem; }

.ticket__mark {
  width: 8.5rem;
  height: auto;
  display: block;
  margin-bottom: 1.1rem;
  opacity: 0.92;
}

/* Who ran it, on the ticket itself so a screenshot carries it. */
.ticket__issuer {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.ticket__issuer img {
  height: 17px;
  width: auto;
  display: block;
  opacity: 0.6;
}

.review { margin-top: 2.4rem; }

/* ------------------------------------------------------ brandbar fixes */
/* Two horizontal wordmarks side by side overflow a 320px phone (iPhone SE,
   and any phone with display zoom on), which produced a horizontally
   scrolling page. They stack instead of shrinking to illegibility. */

/* max-width only. An earlier `height: auto` here silently overrode the fixed
   heights on .brandbar__ptg and .brandbar__lsgf above -- same specificity,
   later in the file -- and both logos rendered at natural size, several
   hundred pixels wide. object-fit keeps the aspect ratio if max-width ever
   does clamp one. */
.brandbar img { max-width: 100%; object-fit: contain; }

.brandbar__inner {
  flex-wrap: wrap;
  row-gap: 1.1rem;
}

@media (max-width: 24.5rem) {
  .brandbar__inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .brandbar__by { order: 2; }
}

/* --------------------------------------------- leaderboard on a phone */
/* The board is built for a projector, but the finish page links to it, so
   people open it on their phones. Without this the fixed-height logo in the
   header forced a 439px-wide page inside a 320px screen. */

.board__head img { max-width: 100%; height: auto; }

@media (max-width: 40rem) {
  .board__head {
    padding: 1.3rem 1.1rem 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .board__head img { height: 40px; }
  .board__list { padding: 0.75rem 1.1rem 2rem; }
  .board__row {
    gap: 0.9rem;
    font-size: 1.25rem;
    padding: 0.7rem 0;
  }
  .board__row .bullet { --size: 2.1rem; }
  .board__foot { padding: 0 1.1rem 1.5rem; }
}
