/* MachRun lead-car page.
   Built on MachRun's own "APEX" design system (their machrun-apex.css), whose
   laws this page keeps: square corners everywhere, 1px hairlines instead of
   gaps and shadows, Anton / Space Grotesk / JetBrains Mono only, and one
   accent, #f5311f, never tinted. Eyebrows are mono, red, and start "/ ". */

:root {
  --mr-bg: #0c0c0d;
  --mr-panel: #131315;
  --mr-panel-2: #161618;
  --mr-ink: #f2f0ee;
  --mr-ink-2: #bdb8b2;
  --mr-muted: #8a857f;
  --mr-muted-2: #7a756f;
  --mr-muted-3: #6f6a64;
  --mr-accent: #f5311f;
  --mr-on-accent: #0c0c0d;
  --mr-line: rgba(255, 255, 255, .10);
  --mr-line-strong: rgba(255, 255, 255, .12);
  --mr-line-btn: rgba(255, 255, 255, .28);
  --mr-font-display: 'Anton', 'Arial Narrow', sans-serif;
  --mr-font-body: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --mr-font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;
  --mr-gutter: 48px;
  --mr-header-h: 62px;
  --mr-maxw: 1480px;
  --mr-ease: cubic-bezier(.2, .6, .2, 1);
  --lc-cell-w: 240px;
  --lc-cell-h: 100px;
  --lc-sponsor-dur: 42s;
  color-scheme: dark;
}

@media (max-width: 900px) {
  :root { --mr-gutter: 22px; }
}

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

html, body { margin: 0; background: var(--mr-bg); color: var(--mr-ink); }

body {
  font-family: var(--mr-font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection { background: var(--mr-accent); color: var(--mr-on-accent); }

img { display: block; }
button { font: inherit; }

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

/* ---- shell ------------------------------------------------------------ */

.lc-app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Live, the map takes whatever the screen has left over. The page is never
   squeezed below its content: on a short phone or in landscape it scrolls
   instead, so nothing overlaps. */

.lc-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: var(--mr-header-h);
  flex: 0 0 auto;
  padding: 0 var(--mr-gutter);
  background: var(--mr-bg);
  border-bottom: 1px solid var(--mr-line);
}

.lc-logo { display: flex; align-items: center; height: 100%; text-decoration: none; }
.lc-logo__mark { background: var(--mr-accent); height: 100%; display: flex; align-items: center; padding: 0 18px; }
.lc-logo__mark span { font-family: var(--mr-font-display); font-size: 26px; letter-spacing: .03em; line-height: 1; color: var(--mr-on-accent); }
.lc-logo__tag {
  font-family: var(--mr-font-mono); font-size: 10px; letter-spacing: .16em; line-height: 1.15;
  text-transform: uppercase; color: var(--mr-muted-2); padding-left: 14px;
}

.lc-chip {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mr-font-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--mr-muted); white-space: nowrap;
}
.lc-chip__dot { width: 8px; height: 8px; background: var(--mr-muted-3); flex: 0 0 auto; }
.lc-chip[data-tone="live"] { color: var(--mr-ink); }
.lc-chip[data-tone="live"] .lc-chip__dot { background: var(--mr-accent); animation: lc-blink 1.4s steps(1, end) infinite; }
.lc-chip[data-tone="warn"] { color: var(--mr-ink-2); }
.lc-chip[data-tone="warn"] .lc-chip__dot { background: var(--mr-ink-2); }

@keyframes lc-blink { 50% { opacity: .2; } }

/* ---- ticker (MachRun's red marquee strip) ------------------------------ */

.lc-ticker {
  flex: 0 0 auto;
  overflow: hidden; white-space: nowrap;
  background: var(--mr-accent);
  border-bottom: 1px solid var(--mr-bg);
}
.lc-ticker__track { display: inline-flex; animation: lc-marquee 26s linear infinite; will-change: transform; }
.lc-ticker__item {
  display: inline-flex; align-items: center;
  font-family: var(--mr-font-mono); font-size: 12px; font-weight: 500; letter-spacing: .14em;
  text-transform: uppercase; color: var(--mr-on-accent);
  padding: 9px 0 9px 22px;
}
.lc-ticker__item::after { content: ''; width: 6px; height: 6px; margin-left: 22px; background: var(--mr-on-accent); }

@keyframes lc-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---- the three screens -------------------------------------------------- */

.lc-main { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }

html:not([data-phase="before"]) .lc-before,
html:not([data-phase="live"]) .lc-live,
html:not([data-phase="finished"]) .lc-finished { display: none; }

.lc-eyebrow {
  font-family: var(--mr-font-mono); font-size: 12px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--mr-accent);
}

.lc-hero { width: 100%; max-width: var(--mr-maxw); margin: 0 auto; padding: 72px var(--mr-gutter) 64px; }

.lc-h1 {
  font-family: var(--mr-font-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(52px, 9vw, 128px); line-height: .84; letter-spacing: .005em;
  margin: 20px 0 0;
}
.lc-accent { color: var(--mr-accent); }

.lc-body { font-size: 18px; line-height: 1.6; color: var(--mr-ink-2); max-width: 34em; margin: 32px 0 0; }
.lc-actions { margin: 36px 0 0; }

/* Countdown: MachRun's stat bar, four cells between hairlines. */
.lc-countdown {
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin-top: 44px;
  border-top: 1px solid var(--mr-line); border-bottom: 1px solid var(--mr-line);
}
.lc-count { padding: 32px 32px 28px; border-right: 1px solid var(--mr-line); min-width: 0; }
.lc-count:last-child { border-right: 0; }
.lc-count__num {
  font-family: var(--mr-font-display); font-size: clamp(64px, 11vw, 176px); line-height: .9;
  color: var(--mr-accent); font-variant-numeric: tabular-nums;
}
.lc-count__label {
  font-family: var(--mr-font-mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--mr-muted); margin-top: 14px;
}

@media (max-width: 900px) {
  .lc-hero { padding: 44px var(--mr-gutter) 44px; }
  .lc-count { padding: 24px 20px 20px; }
}

@media (max-width: 600px) {
  .lc-logo__tag { display: none; }
  .lc-countdown { grid-template-columns: 1fr 1fr; }
  .lc-count:nth-child(2) { border-right: 0; }
  .lc-count:nth-child(-n + 2) { border-bottom: 1px solid var(--mr-line); }
  .lc-count__num { font-size: 27vw; }
  .lc-body { font-size: 17px; }
}

/* ---- live --------------------------------------------------------------- */

.lc-live { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 1fr; grid-template-rows: minmax(260px, 1fr) auto; }

.lc-map { position: relative; min-height: 260px; background: var(--mr-panel-2); overflow: hidden; }
/* Two classes: mapbox-gl.css loads later and sets .mapboxgl-map to position: relative. */
.lc-map .lc-map__canvas { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
.lc-map__fallback {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: 0; display: grid; place-items: center; padding: 32px; text-align: center;
  font-family: var(--mr-font-mono); font-size: 12px; letter-spacing: .1em; line-height: 1.7;
  text-transform: uppercase; color: var(--mr-muted);
}
.lc-map__fallback[hidden] { display: none; }

.lc-panel { padding: 20px var(--mr-gutter) 22px; border-top: 1px solid var(--mr-line); background: var(--mr-bg); }

.lc-status {
  font-family: var(--mr-font-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(36px, 5vw, 60px); line-height: .9; margin-top: 12px;
}
.lc-status[data-tone="stale"], .lc-status[data-tone="waiting"] { color: var(--mr-ink-2); }
.lc-status[data-tone="lost"] { color: var(--mr-muted); }

.lc-place { font-size: 18px; line-height: 1.4; color: var(--mr-ink-2); margin-top: 10px; min-height: 1.4em; }

.lc-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  font-family: var(--mr-font-mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--mr-muted); margin-top: 12px; min-height: 1.6em;
}
.lc-meta--you { color: var(--mr-ink); min-height: 0; }
.lc-meta--you[hidden] { display: none; }

.lc-sep { display: inline-block; width: 5px; height: 5px; background: currentColor; opacity: .7; margin: 0 12px; vertical-align: middle; }
.lc-meta .lc-sep { margin: 0; }
.lc-sep[hidden] { display: none; }

@media (min-width: 901px) {
  .lc-live { grid-template-columns: 1fr 420px; grid-template-rows: 1fr; }
  .lc-panel { border-top: 0; border-left: 1px solid var(--mr-line); padding: 40px 32px; }
  .lc-status { margin-top: 16px; }
}

/* Map controls, square and mono like MachRun's buttons. */
.lc-controls { position: absolute; top: 12px; right: 12px; z-index: 5; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.lc-controls[hidden] { display: none; }
.lc-zoom { display: flex; flex-direction: column; }
.lc-zoom .lc-btn + .lc-btn { border-top: 0; }

.lc-btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mr-font-mono); font-size: 13px; letter-spacing: .06em; line-height: 1;
  text-transform: uppercase; text-decoration: none;
  padding: 16px 24px; border: none; cursor: pointer;
  transition: filter .15s var(--mr-ease), background .15s var(--mr-ease), color .15s var(--mr-ease);
}
.lc-btn--primary { background: var(--mr-accent); color: var(--mr-on-accent); font-weight: 700; }
.lc-btn--primary:hover { filter: brightness(1.08); }
.lc-btn--ghost { background: transparent; color: var(--mr-ink); border: 1px solid var(--mr-line-btn); }
.lc-btn--ghost:hover, .lc-btn--ghost[aria-pressed="true"] { background: var(--mr-ink); color: var(--mr-on-accent); border-color: var(--mr-ink); }
.lc-btn:focus-visible { outline: 2px solid var(--mr-accent); outline-offset: 2px; }
.lc-btn[hidden] { display: none; }
.lc-btn--map { padding: 12px 16px; font-size: 12px; }
.lc-btn--map.lc-btn--ghost, .lc-btn--icon { background: rgba(12, 12, 13, .88); }
.lc-btn--icon { width: 42px; height: 42px; padding: 0; justify-content: center; }
.lc-btn--icon svg { width: 14px; height: 14px; fill: currentColor; }
.lc-arrow { width: 14px; height: 14px; fill: currentColor; }

/* The way back to the car: bottom centre, in reach of a thumb. The bar along
   its foot drains while the map is left alone, then the map goes home itself. */
.lc-home {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 6;
  overflow: hidden; white-space: nowrap; box-shadow: 0 0 0 2px var(--mr-bg);
}
.lc-home__icon { width: 14px; height: 14px; fill: currentColor; flex: 0 0 auto; }
.lc-home__timer {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: rgba(12, 12, 13, .5); transform-origin: left center;
}
.lc-home__timer.is-running { animation-name: lc-drain; animation-timing-function: linear; animation-fill-mode: forwards; }
@keyframes lc-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Phones pinch to zoom; the buttons are for mice and keyboards. */
@media (hover: none) and (pointer: coarse) {
  .lc-zoom { display: none; }
}
.lc-car { cursor: pointer; }

/* The car: a red square with a heading chevron, MachRun's red flag beside it. */
.lc-car { position: relative; width: 28px; height: 28px; }
.lc-car__pulse { position: absolute; top: -9px; right: -9px; bottom: -9px; left: -9px; border: 2px solid var(--mr-accent); opacity: 0; }
.lc-car[data-tone="fresh"] .lc-car__pulse { animation: lc-ring 1.8s var(--mr-ease) infinite; }
.lc-car__body {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: grid; place-items: center;
  background: var(--mr-accent); box-shadow: 0 0 0 2px var(--mr-bg);
}
.lc-car__chevron { width: 18px; height: 18px; fill: var(--mr-on-accent); }
.lc-car__dot { display: none; width: 8px; height: 8px; background: var(--mr-on-accent); }
.lc-car[data-moving="false"] .lc-car__chevron { display: none; }
.lc-car[data-moving="false"] .lc-car__dot { display: block; }
.lc-car__tag {
  position: absolute; left: 100%; top: 50%; transform: translateY(-50%); margin-left: 8px;
  background: var(--mr-accent); color: var(--mr-on-accent);
  font-family: var(--mr-font-mono); font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; white-space: nowrap; padding: 5px 8px;
  box-shadow: 0 0 0 2px var(--mr-bg);
}
.lc-car[data-tone="stale"] .lc-car__body, .lc-car[data-tone="stale"] .lc-car__tag { background: var(--mr-muted); }

@keyframes lc-ring { 0% { transform: scale(.7); opacity: .9; } 100% { transform: scale(1.55); opacity: 0; } }

.lc-pin {
  font-family: var(--mr-font-mono); font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; white-space: nowrap; padding: 5px 8px;
  background: var(--mr-ink); color: var(--mr-on-accent); box-shadow: 0 0 0 2px var(--mr-bg);
}
.lc-you { width: 16px; height: 16px; background: var(--mr-ink); box-shadow: 0 0 0 3px var(--mr-bg); }

/* Mapbox's own chrome, squared off and quietened. The wordmark is hidden the
   way every portal map hides it (components/map/container.vue). */
.lc-map .mapboxgl-ctrl-logo { display: none !important; }
.lc-map .mapboxgl-ctrl-attrib, .lc-map .mapboxgl-ctrl-attrib.mapboxgl-compact { background: rgba(12, 12, 13, .8); border-radius: 0; }
.lc-map .mapboxgl-ctrl-attrib a, .lc-map .mapboxgl-ctrl-attrib-inner { color: var(--mr-muted); font-family: var(--mr-font-mono); font-size: 10px; }
.lc-map .mapboxgl-ctrl-attrib-button { border-radius: 0; background-color: var(--mr-ink-2); }

/* ---- sponsors ----------------------------------------------------------- */

.lc-sponsors { flex: 0 0 auto; border-top: 1px solid var(--mr-line); padding-top: 28px; }
.lc-sponsors__title { padding: 0 var(--mr-gutter) 16px; }
.lc-sponsors__band { background: var(--mr-ink); overflow: hidden; cursor: pointer; }
.lc-sponsors__track {
  list-style: none; margin: 0; padding: 0;
  display: flex; width: max-content;
  animation: lc-marquee var(--lc-sponsor-dur) linear infinite;
}
.lc-sponsors__band:hover .lc-sponsors__track,
.lc-sponsors__band.is-paused .lc-sponsors__track { animation-play-state: paused; }
.lc-sponsor {
  flex: 0 0 auto; width: var(--lc-cell-w); height: var(--lc-cell-h);
  border-right: 1px solid rgba(12, 12, 13, .12);
}
.lc-sponsor img { width: 100%; height: 100%; object-fit: contain; }

html[data-phase="live"] {
  --lc-cell-w: 156px;
  --lc-cell-h: 65px;
  --lc-sponsor-dur: 28s;
}
html[data-phase="live"] .lc-sponsors { padding-top: 12px; }
html[data-phase="live"] .lc-sponsors__title { font-size: 11px; padding-bottom: 10px; }

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

.lc-footer {
  flex: 0 0 auto;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding: 20px var(--mr-gutter) 24px;
  border-top: 1px solid var(--mr-line);
  font-family: var(--mr-font-mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--mr-muted-3);
}
.lc-footer .lc-sep { margin: 0 12px; }
.lc-footer strong { color: var(--mr-ink-2); font-weight: 700; letter-spacing: .08em; }
html[data-phase="live"] .lc-footer { padding: 10px var(--mr-gutter) 12px; }

@media (max-width: 600px) {
  html[data-phase="live"] .lc-footer__place { display: none; }
}

/* ---- motion ------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .lc-ticker__track, .lc-sponsors__track, .lc-chip__dot, .lc-car__pulse { animation: none !important; }
  .lc-home__timer { display: none; }
  .lc-sponsors__track { width: auto; flex-wrap: wrap; justify-content: center; }
  .lc-sponsor[aria-hidden="true"] { display: none; }
}
