/* Livebib server-page stylesheet — the ONE look for every Go-rendered page
   (/, /login, /new, /settings, /@handle, auth errors, 404). These pages used
   to be dark GitHub-flavored system-ui one-offs, three visual identities away
   from the app (launch design review). They now share the app shell's tokens,
   fonts and components: light stage, white cards, brand green, Space Grotesk
   display over Spline Sans body, Space Mono for times and data.
   The home page (/) is the discovery surface — a live-tracking board, not a
   bare list — and carries the richest components (masthead, hero, card grid,
   contour thumbnails). Everything green ALWAYS means live; amber means an
   estimate or an upcoming/scheduled thing. Light-only, matching the app.
   Fonts are self-hosted at /static/fonts (OFL, no third-party requests). */

@font-face {
  font-family: "Space Grotesk";
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/space-grotesk-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/space-grotesk-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Spline Sans";
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/spline-sans-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Spline Sans";
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/spline-sans-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Spline Sans";
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/spline-sans-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Space Mono";
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/space-mono-latin-400-normal.woff2") format("woff2");
}

:root {
  /* Mirrors web/viewer/src/styles.css :root — keep in sync by hand. */
  --bg: #eef1ee;
  --surface: #ffffff;
  --surface-2: #f6f8f6;
  --line: rgba(27, 31, 36, 0.12);
  --line-2: rgba(27, 31, 36, 0.07);
  --ink: #1b1f24;
  --ink-2: #3b4a42;
  --mut: #5b6770;
  --faint: #8b978f;
  --accent: #2ea043;
  --accent-ink: #1a7f37;
  --accent-bright: #39d353;
  /* Amber = estimate / upcoming. The one non-green semantic these pages carry. */
  --amber: #b9761a;
  --amber-ink: #9c6210;
  --amber-bg: #f7edd7;
  --amber-line: rgba(185, 118, 26, 0.32);
  --danger: #c93c37;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(20, 40, 28, 0.05), 0 8px 24px -14px rgba(20, 45, 30, 0.16);
  --shadow-lg: 0 2px 6px rgba(20, 40, 28, 0.07), 0 26px 60px -24px rgba(18, 50, 32, 0.32);
  --disp: "Space Grotesk", system-ui, sans-serif;
  --sans: "Spline Sans", system-ui, -apple-system, sans-serif;
  --mono: "Space Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font: 15px/1.5 var(--sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- skip link: a11y — first tab stop bypasses the header nav straight to
   <main>. Off-screen until focused, then a brand-green pill top-left. ---- */
.skip {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip:focus {
  top: 8px;
}

/* ---- header: the app's TopBar, in static form. The green top edge is the
   bib stripe — the brand's signature. Sub-pages use the plain header; the home
   page adds an .actions cluster (CTA + avatar or sign-in). ---- */
.lb-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px clamp(16px, 4vw, 40px);
  background: var(--surface);
  border-top: 3px solid var(--accent);
  border-bottom: 1px solid var(--line);
}
.lb-top .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--disp);
  font-weight: 700;
  font-size: 19px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.lb-top .brand svg {
  width: 23px;
  height: 23px;
}
.lb-top .topnav {
  margin-left: auto;
  display: flex;
  gap: 18px;
}
.lb-top .topnav a {
  color: var(--mut);
  text-decoration: none;
  font-weight: 500;
}
.lb-top .topnav a:hover {
  color: var(--ink);
}
.lb-top .actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}
.signin-link {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-2);
  text-decoration: none;
}
.signin-link:hover {
  color: var(--accent-ink);
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--disp);
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(145deg, #2ea043, #166b2c);
  box-shadow: var(--shadow);
}
/* CTA in the header — the pill button, compact form. White label on the deep
   brand green (accent-ink) — passes AA; the bright green is reserved for LIVE. */
.cta-top {
  font-family: var(--disp);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
  color: #fff;
  background: var(--accent-ink);
  border: 0;
  padding: 10px 16px;
  border-radius: 11px;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 6px 16px -8px rgba(46, 160, 67, 0.6);
  transition: transform 0.12s ease, filter 0.12s ease;
}
.cta-top:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
.cta-top:active {
  transform: translateY(0);
}
.cta-top .cta-short {
  display: none;
}

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 36px 20px 64px;
}
.wrap.narrow {
  max-width: 520px;
}
/* The home discovery surface is wider than the reading pages. */
.wrap.home {
  max-width: 1120px;
  padding: clamp(20px, 3.5vw, 40px) clamp(16px, 4vw, 40px) 80px;
}

h1 {
  font-family: var(--disp);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
h2,
.eyebrow {
  font-family: var(--disp);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mut);
  margin: 32px 0 8px;
}
a {
  color: var(--accent-ink);
}
.muted {
  color: var(--mut);
}
.sub {
  color: var(--mut);
  font-size: 13px;
  margin: 4px 0 0;
}
.hide {
  display: none;
}
.lb-mono {
  font-family: var(--mono);
}

/* ---- cards & lists (shared: profile, settings, new, 404) ---- */
.card,
.broadcast,
.note {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
}
.broadcast {
  padding: 14px 16px;
  margin: 8px 0;
}
.broadcast:hover {
  border-color: rgba(27, 31, 36, 0.28);
}
.note {
  padding: 12px 16px;
  margin: 16px 0;
  color: var(--mut);
  background: var(--surface-2);
}
/* The live preview card — the profile page's hero. Green edge + soft glow:
   green always means LIVE, never decoration. */
.card {
  margin: 20px 0;
  padding: 20px;
  border: 1px solid var(--accent);
  box-shadow: 0 1px 0 rgba(27, 31, 36, 0.04), 0 0 0 4px rgba(46, 160, 67, 0.08);
}
.card .title {
  font-family: var(--disp);
  font-size: 21px;
  font-weight: 700;
  margin: 6px 0;
}
.card .go {
  color: var(--accent-ink);
  font-weight: 700;
}
.live-badge {
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
}
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-bright);
  margin-right: 8px;
  animation: lbpulse 1.6s ease-out infinite;
}
@keyframes lbpulse {
  0% {
    box-shadow: 0 0 0 0 rgba(57, 211, 83, 0.55);
  }
  100% {
    box-shadow: 0 0 0 12px rgba(57, 211, 83, 0);
  }
}

/* ============================================================
   HOME — the discovery surface
   ============================================================ */
.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin: 8px 0 8px;
}
.masthead .kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-ink);
  margin-bottom: 14px;
}
.masthead .kicker .ping {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: lbping 2.2s ease-out infinite;
}
.masthead h1 {
  font-size: clamp(2rem, 4.4vw, 3rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin: 0;
  text-wrap: balance;
}
.masthead .lede {
  margin: 12px 0 0;
  color: var(--mut);
  font-size: 17px;
  max-width: 46ch;
}
.masthead .headstat {
  text-align: right;
  font-family: var(--mono);
  color: var(--mut);
  font-size: 12px;
  line-height: 1.7;
}
.masthead .headstat b {
  display: block;
  font-family: var(--disp);
  color: var(--ink);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* section header — a labelled hairline rule */
.section {
  margin-top: 38px;
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 15px;
}
.section-head h2 {
  font-family: var(--mono);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  color: var(--ink-2);
  margin: 0;
}
.section-head .count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}
.section-head .rule {
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---- hero: the top live broadcast, rendered large ---- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 0 4px rgba(46, 160, 67, 0.07);
}
.hero .viz {
  position: relative;
  min-height: 300px;
  background: var(--surface-2);
}
.hero .viz canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}
.hero .viz .grad {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 45%,
    rgba(255, 255, 255, 0.72) 100%
  );
  pointer-events: none;
}
.pill-live {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #06210f;
  background: var(--accent);
  padding: 6px 11px 6px 9px;
  border-radius: 8px;
  box-shadow: 0 6px 18px -6px rgba(46, 160, 67, 0.65);
}
.pill-live .bd {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: lbbeat 1.6s ease-in-out infinite;
}
.hero .body {
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
}
.chiprow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.chip {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px solid var(--line);
  color: var(--ink-2);
  background: var(--surface-2);
}
.chip.lock {
  color: var(--mut);
}
.hero h2.title {
  font-family: var(--disp);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 26px;
  line-height: 1.1;
  margin: 2px 0 6px;
  color: var(--ink);
  text-transform: none;
}
.hero .who {
  color: var(--mut);
  font-size: 15px;
  margin-bottom: 20px;
}
.hero .who b {
  color: var(--ink-2);
  font-weight: 600;
}
/* Live facts on the hero — the run's own numbers, straight from the DTO. Grid
   with 1px gaps over a line-coloured ground gives clean dividers that also work
   when the cells wrap to two rows on a narrow column (auto-fit). */
.hero .hstats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 1px;
  margin: 2px 0 20px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  overflow: hidden;
  background: var(--line-2);
}
.hero .hstats > div {
  padding: 11px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--surface);
}
.hero .hstats .k {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.hero .hstats .v {
  font-family: var(--disp);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.hero .follow {
  margin-top: auto;
  align-self: flex-start;
  font-family: var(--disp);
  font-weight: 600;
  font-size: 15px;
  color: #fff;
  background: var(--accent-ink);
  border-radius: 11px;
  padding: 11px 18px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: gap 0.14s ease, transform 0.12s ease;
}
.hero .follow:hover {
  gap: 12px;
  transform: translateY(-1px);
}

/* ---- card grid ---- */
.grid {
  display: grid;
  /* min(290px,100%) keeps a single track from overflowing a ~320px phone (a
     bare 290px min would push a 2px horizontal scroll). */
  grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
  gap: 16px;
}
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(46, 160, 67, 0.4);
}
.tile .thumb {
  position: relative;
  height: 112px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-2);
}
.tile .thumb canvas {
  display: block;
  width: 100%;
  height: 100%;
}
/* Real elevation silhouette (the run's course profile). Stretched to fill the
   thumb (preserveAspectRatio=none); non-scaling-stroke keeps the line crisp
   despite the non-uniform stretch. Green = the climb, amber-neutral leg
   dividers mark a multi-leg course's swim→bike→run transitions. */
.thumb-elev {
  display: block;
  width: 100%;
  height: 100%;
}
.thumb-elev .ar {
  fill: rgba(46, 160, 67, 0.13);
}
.thumb-elev .ln {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.thumb-elev .leg {
  stroke: rgba(27, 31, 36, 0.2);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  vector-effect: non-scaling-stroke;
}
.hero .viz .hero-elev .ln {
  stroke-width: 2.8;
}
.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.badge.live {
  color: #06210f;
  background: var(--accent);
}
.badge.live .bd {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: lbbeat 1.6s ease-in-out infinite;
}
.badge.upcoming {
  color: var(--amber-ink);
  background: var(--amber-bg);
  border: 1px solid var(--amber-line);
}
.badge.ended {
  color: var(--mut);
  background: rgba(27, 31, 36, 0.05);
  border: 1px solid var(--line);
}
.tile .tlock {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--mut);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(4px);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 7px;
}
.tile .t-body {
  padding: 13px 15px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.tile h3 {
  font-family: var(--disp);
  font-weight: 600;
  letter-spacing: -0.015em;
  font-size: 17px;
  line-height: 1.2;
  margin: 0;
}
.tile .when {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mut);
  margin-top: auto;
}
.tile .when .amber {
  color: var(--amber-ink);
}
.tile .when .g {
  color: var(--accent-ink);
}
.tile .t-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line-2);
  padding: 10px 15px;
  background: var(--surface-2);
}
.tile .t-foot .act {
  font-family: var(--disp);
  font-weight: 600;
  font-size: 13px;
  color: var(--accent-ink);
}
.tile .t-foot .meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 26px;
  text-align: center;
  color: var(--mut);
  background: var(--surface-2);
}
.empty .cta-top {
  margin-top: 14px;
  display: inline-block;
}

/* ---- forms (new, settings, login) ---- */
label {
  display: block;
  margin: 18px 0 6px;
  font-weight: 600;
}
input,
select {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2.5px solid rgba(46, 160, 67, 0.6);
  outline-offset: 2px;
}
button {
  margin-top: 16px;
  padding: 11px 20px;
  border: none;
  border-radius: 999px;
  background: var(--accent-ink);
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
button.danger {
  background: var(--danger);
  color: #fff;
}
/* Auth/form pages get a centered card frame — the "login etc." pages should
   look as considered as the home page. */
.authcard {
  max-width: 460px;
  margin: 40px auto 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.authcard .stripe {
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
}
.authcard .in {
  padding: 26px 26px 28px;
}
.authcard h1 {
  font-size: 24px;
}
.authcard .oauth-note {
  margin-top: 14px;
  font-size: 13px;
  color: var(--faint);
}
.cta {
  display: inline-block;
  margin: 10px 0 20px;
  padding: 11px 18px;
  background: var(--accent-ink);
  color: #fff;
  font-weight: 700;
  border-radius: 999px;
  text-decoration: none;
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 18px;
  font-weight: 400;
}
.check input {
  width: auto;
  margin-top: 3px;
  accent-color: var(--accent);
}
.err {
  color: var(--danger);
  margin-top: 10px;
}
.ok {
  color: var(--accent-ink);
  margin-top: 14px;
}

.backlink {
  margin-top: 28px;
}

/* Discreet Terms/Privacy footer links (login/settings/new) — quiet mono small
   print, never competing with the page's own actions. */
.legal-links {
  margin-top: 36px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
}
.legal-links a {
  color: var(--mut);
  text-decoration: none;
}
.legal-links a:hover {
  text-decoration: underline;
}

/* Language switcher — a plain ?lang= link per locale (marketing-site model,
   PR #31): no auto-detection, switching is one click. A <details> disclosure
   keeps 11 languages a single compact pill (esp. on mobile); it expands the
   full list on tap and needs no JS. */
.langbar {
  margin-top: 48px;
  display: flex;
  justify-content: center;
  font-family: var(--mono);
  font-size: 12px;
}
.langbar details {
  text-align: center;
}
.langbar summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--mut);
}
.langbar summary::-webkit-details-marker {
  display: none;
}
.langbar summary::after {
  content: "▾";
  font-size: 9px;
  color: var(--faint);
}
.langbar summary:hover,
.langbar details[open] summary {
  color: var(--ink);
  border-color: rgba(27, 31, 36, 0.28);
}
.langbar .langmenu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: center;
  max-width: 320px;
  margin: 14px auto 0;
}
.langbar .langmenu a {
  color: var(--mut);
  text-decoration: none;
}
.langbar .langmenu a:hover {
  color: var(--accent-ink);
}
.langbar .langmenu .on {
  color: var(--ink);
  font-weight: 600;
}

@keyframes lbbeat {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.8);
    opacity: 0.7;
  }
}
@keyframes lbping {
  0% {
    box-shadow: 0 0 0 0 rgba(46, 160, 67, 0.5);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(46, 160, 67, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(46, 160, 67, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dot,
  .pill-live .bd,
  .badge.live .bd,
  .masthead .kicker .ping {
    animation: none;
  }
  .tile,
  .hero .follow,
  .cta-top {
    transition: none;
  }
}

@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .hero .viz {
    min-height: 200px;
  }
}
@media (max-width: 560px) {
  .masthead .headstat {
    display: none;
  }
  /* Keep the header on one line on phones: shorten the CTA, drop its shadow
     spread, and tighten spacing so brand + action + identity always fit. */
  .lb-top {
    gap: 8px;
  }
  .lb-top .actions {
    gap: 10px;
  }
  .cta-top {
    padding: 9px 13px;
    font-size: 13px;
  }
  .cta-top .cta-long {
    display: none;
  }
  .cta-top .cta-short {
    display: inline;
  }
  /* Hero live stats: let the three cells breathe on a narrow column. */
  .hero .hstats > div {
    padding: 10px 11px;
  }
  .hero .hstats .v {
    font-size: 17px;
  }
}

/* ——— Profile page: the bib masthead — the "live bib" pun made literal ———
   The person's public face opens with their name printed on a race bib: green
   sponsor strip, punched zip-tie holes, mono race-style handle, Space Grotesk
   display name, and dashed roadbook chips for the stats (runs + total ❤).
   The lanes below reuse the home board's tiles, so the profile speaks the same
   visual language as discovery. */
.profile .pmast {
  display: flex;
  justify-content: center;
  margin: 30px 0 38px;
}
.profile .bibcard {
  position: relative;
  text-align: center;
  background: #fff;
  border: 2px solid #1b1f24;
  border-radius: 16px;
  padding: 40px 46px 26px;
  min-width: min(440px, 92vw);
  box-shadow: 0 20px 48px rgba(27, 31, 36, 0.16);
}
.profile .bibcard::before {
  /* the sponsor strip */
  content: "";
  position: absolute;
  inset: 12px 30px auto;
  height: 7px;
  border-radius: 99px;
  background: linear-gradient(90deg, #2ea043, #39d353 55%, #5cf06f);
}
.profile .bib-hole {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #eef0eb;
  border: 2px solid #1b1f24;
}
.profile .bib-hole.tl { top: 9px; left: 11px; }
.profile .bib-hole.tr { top: 9px; right: 11px; }
.profile .bib-hole.bl { bottom: 9px; left: 11px; }
.profile .bib-hole.br { bottom: 9px; right: 11px; }
.profile .bib-handle {
  font-family: "Space Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #57606a;
  margin-top: 6px;
}
.profile .bibcard h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(34px, 7vw, 54px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin: 6px 0 14px;
}
.profile .bib-stats {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.profile .bs {
  font-family: "Space Mono", monospace;
  font-size: 13px;
  border: 1.5px dashed #c7cfd6;
  border-radius: 999px;
  padding: 5px 13px;
  color: #57606a;
}
.profile .bs.hearts {
  color: #e5484d;
  border-color: #f0b3b5;
}

/* ---- peak pages (/peak/{slug}) — the places family ---- */
/* The facts line under the peak name: elevation as data (Space Mono, the
   roadbook voice), country + links quiet beside it. */
.peak-facts {
  margin: 4px 0 10px;
  color: var(--mut);
}
.peak-elev {
  font-family: "Space Mono", monospace;
  font-size: 19px;
  color: var(--ink);
  letter-spacing: 0.02em;
}
/* The hero photo — always rights-cleared (display gate) and always credited:
   the attribution caption is part of the component, never optional styling. */
.peak-hero {
  margin: 18px 0;
}
.peak-hero img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.peak-hero figcaption {
  font-size: 12px;
  margin-top: 6px;
}
/* The 3D-stage card: carries the per-peak tile URLs as data attributes (the
   viewer-stage embed config). Costs nothing when the peak has no tiles — the
   section isn't rendered at all (component cost discipline). */
.peak-stage {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 16px 0;
}
.peak-stage h2 {
  margin: 0 0 6px;
}
.peak-stage p {
  margin: 0;
}

/* ==== race page (/race/{slug}) — the indexed event landing, redesigned.
   Hero (eyebrow · name · bib-row facts · roadbook silhouette), races as
   bib-cards, an invitation when no broadcasts. Additive: shares the tokens
   above, adds only .race-* / .rx-* / .rb-* / .rc-* / .rr-* classes, so home,
   profile and peak are untouched. Light premium — precision over flash. ==== */
.race {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 clamp(18px, 5vw, 56px) 96px;
}
.race-hero {
  padding: clamp(34px, 6vw, 68px) 0 clamp(18px, 3vw, 34px);
}
.race-eyebrow {
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
  margin: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--mut);
}
.rx-sep {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--faint);
}
.rx-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.rx-chip .rx-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.rx-live {
  color: var(--accent-ink);
  border-color: rgba(46, 160, 67, 0.4);
  background: rgba(46, 160, 67, 0.08);
}
.rx-live .rx-dot {
  animation: rxpulse 2.4s ease-out infinite;
}
.rx-pending {
  color: var(--amber-ink);
  border-color: var(--amber-line);
  background: var(--amber-bg);
}
.rx-ended {
  color: var(--mut);
}
@keyframes rxpulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 160, 67, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(46, 160, 67, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 160, 67, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .rx-live .rx-dot { animation: none; }
}
.race-name {
  font-family: var(--disp);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.025em;
  font-size: clamp(2.4rem, 7vw, 5rem);
  margin: 18px 0 0;
  text-wrap: balance;
  color: var(--ink);
}
.race-name .rx-yr {
  color: var(--accent-ink);
}
.race-site {
  margin: 14px 0 0;
}
.race-site a {
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(26, 127, 55, 0.28);
}
.race-site a:hover {
  border-color: var(--accent-ink);
}
.race-bib {
  display: flex;
  flex-wrap: wrap;
  margin-top: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.rb-cell {
  flex: 1 1 130px;
  padding: 18px 22px;
  border-right: 1px solid var(--line);
}
.rb-cell:last-child {
  border-right: 0;
}
.rb-k {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mut);
}
.rb-v {
  font-family: var(--disp);
  font-weight: 700;
  font-size: clamp(1.4rem, 3.2vw, 2rem);
  letter-spacing: -0.02em;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.rb-hero {
  color: var(--accent-ink);
}
.race-roadbook {
  margin-top: 28px;
  height: 118px;
}
.rr-elev {
  display: block;
  width: 100%;
  height: 100%;
}
.rr-elev .ar {
  fill: rgba(46, 160, 67, 0.11);
}
.rr-elev .ln {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.rr-elev .leg {
  stroke: var(--line-2);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.race-h2 {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mut);
  margin: 58px 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.race-h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}
.race-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.race-card {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  row-gap: 14px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: box-shadow 0.18s, transform 0.18s;
}
.rc-nm {
  font-family: var(--disp);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.015em;
  flex: 1;
  min-width: 160px;
  color: var(--ink);
}
.rc-facts {
  display: flex;
  gap: 24px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.rc-facts span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rc-facts em {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--mut);
}
.rc-facts b {
  font-weight: 400;
  font-size: 15px;
  color: var(--ink);
}
/* Multi-sport discipline breakdown — a roadbook sub-row under the facts. Drops
   to its own line (flex-basis:100%) so it reads as a leg strip, not a stat. */
.rc-disc {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px dashed var(--line-2);
}
.rc-d {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 9px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.rc-d b {
  font-weight: 500;
  color: var(--ink);
}
.rc-d i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}
/* Discipline accents — muted, distinct hues; deliberately NOT the live-bright
   green (that semantic is reserved for "live"). */
.rc-swim i { background: #3a8fc2; }
.rc-bike i { background: #c79a3e; }
.rc-run i { background: #4e9a5f; }
.rc-ski i { background: #4bb0c4; }
.rc-paddle i { background: #7b74c9; }
.rc-obstacle i { background: #c06a3a; }
/* Leg-count chip: no dot, quieter — it counts the strip, isn't a leg itself. */
.rc-legs {
  color: var(--mut);
  border-style: dashed;
  background: transparent;
}
.rb-live {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  margin-bottom: 12px;
  border: 1px solid rgba(46, 160, 67, 0.35);
  border-radius: 14px;
  background: rgba(46, 160, 67, 0.05);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.18s, transform 0.18s;
}
.rb-livedot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-bright);
  box-shadow: 0 0 10px rgba(57, 211, 83, 0.7);
}
.rb-t {
  flex: 1;
  font-family: var(--disp);
  font-weight: 700;
  color: var(--ink);
}
.rb-go {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent-ink);
}
.rb-row {
  display: block;
  padding: 16px 22px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--ink);
  transition: box-shadow 0.18s, transform 0.18s;
}
.rb-row strong {
  font-family: var(--disp);
  font-weight: 700;
}
.race-card:hover,
.rb-row:hover,
.rb-live:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.race-invite {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  justify-content: space-between;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: radial-gradient(120% 120% at 0% 0%, rgba(46, 160, 67, 0.06), var(--surface) 60%);
  box-shadow: var(--shadow);
}
.race-invite p {
  margin: 0;
  max-width: 48ch;
  color: var(--ink-2);
}
.race-invite strong {
  color: var(--ink);
}
.race-cta {
  font-family: var(--disp);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  padding: 12px 22px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 6px 16px -8px rgba(46, 160, 67, 0.6);
  transition: background 0.16s, transform 0.16s;
}
.race-cta:hover {
  background: var(--accent-ink);
  transform: translateY(-1px);
}
.race-foot {
  margin-top: 70px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
@media (max-width: 560px) {
  .race-card { flex-wrap: wrap; }
  .rb-cell { flex-basis: 50%; }
}
