/* f1gures - design tokens & global styles */

:root {
  /* Surfaces */
  --bg-0: #050505;
  --bg-1: #0a0a0a;
  --bg-2: #1c1d22;
  --bg-3: #252629;
  --bg-hover: #2d2f36;
  --bg-elevated: #22232a;

  /* Borders */
  --line-1: #2c2e36;
  --line-2: #383a44;
  --line-3: #484c56;

  /* Text */
  --fg-1: #f5f5f5;
  --fg-2: #b8b9bd;
  --fg-3: #9a9ba1;
  --fg-4: #636469;

  /* Accent - F1 red */
  --accent: #E8002D;
  --accent-dim: #b8002a;
  --accent-glow: rgba(232, 0, 45, 0.18);

  /* Semantic */
  --pos: #2ecc71;
  --neg: #ff4444;
  --neutral: #75767b;
  --warn: #ffb020;
  --live: #ff1e1e;

  /* Type */
  --f-display: 'Barlow Condensed', 'Barlow', 'Helvetica Neue Condensed', 'Arial Narrow', sans-serif;
  --f-body: 'Barlow', 'Inter', system-ui, -apple-system, sans-serif;
  --f-mono: 'JetBrains Mono', 'IBM Plex Mono', 'Roboto Mono', ui-monospace, 'SF Mono', monospace;

  /* Layout */
  --nav-h: 56px;
}

/* ── Light mode ───────────────────────────────────────────── */
html.light {
  --bg-0: #eeeef2;
  --bg-1: #f5f5f8;
  --bg-2: #ffffff;
  --bg-3: #ededf1;
  --bg-hover: #e6e6ea;
  --bg-elevated: #ffffff;
  --line-1: #e0e1e6;
  --line-2: #cccdd4;
  --line-3: #b2b3bc;
  --fg-1: #0d0e12;
  --fg-2: #3d3e48;
  --fg-3: #6a6b75;
  --fg-4: #9a9ba6;
  --accent-glow: rgba(232, 0, 45, 0.10);
  --pos: #15803d;
  --neg: #dc2626;
  --warn: #b45309;
}
html.light .f1-app {
  background: var(--bg-1);
}
html.light .nav {
  background: rgba(245, 245, 248, 0.92);
  border-bottom-color: var(--line-1);
}
html.light .botnav {
  background: rgba(245, 245, 248, 0.96);
  border-top-color: var(--line-1);
}
html.light .topbar-mobile {
  background: rgba(245, 245, 248, 0.96);
  border-bottom-color: var(--line-1);
}

/* Theme switcher - segmented control */
.theme-switcher {
  display: flex; flex-shrink: 0;
  border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden;
}
.theme-opt {
  background: transparent; border: none; padding: 4px 10px;
  font-family: var(--f-display); font-size: 12px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  line-height: 1; cursor: pointer;
  color: var(--fg-3);
  transition: background .15s, color .15s;
}
.theme-opt:first-child { border-right: 1px solid var(--line-2); }
.theme-opt.active { background: var(--bg-3); color: var(--fg-1); }
.theme-opt:hover:not(.active) { background: var(--bg-hover); color: var(--fg-2); }

/* Drivers/Constructors switcher (mobile standings pages) */
.standings-toggle {
  display: flex;
  margin: 0 0 16px;
  border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden;
}
.standings-toggle-opt {
  flex: 1; text-align: center;
  padding: 10px 12px;
  font-family: var(--f-display); font-size: 13px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  line-height: 1; color: var(--fg-3); text-decoration: none;
  transition: background .15s, color .15s;
}
.standings-toggle-opt + .standings-toggle-opt { border-left: 1px solid var(--line-2); }
.standings-toggle-opt.active { background: var(--bg-3); color: var(--fg-1); }
.standings-toggle-opt:hover:not(.active) { background: var(--bg-hover); color: var(--fg-2); }

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg-1);
  color: var(--fg-1);
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01';
}

button { font-family: inherit; }

/* Carbon fibre undertone via subtle SVG noise */
.f1-app {
  background:
    linear-gradient(180deg, #0a0a0a 0%, #08080a 100%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.008) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.008) 0 1px, transparent 1px 3px);
  min-height: 100%;
  color: var(--fg-1);
}

/* Type primitives */
.t-display {
  font-family: var(--f-display);
  font-weight: 700;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  line-height: 0.95;
}
.t-eyebrow {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.t-mono {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}
.t-num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: rgba(8, 8, 10, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-1);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 24px;
}
.nav-logo {
  font-family: var(--f-display); font-weight: 800; font-size: 22px;
  letter-spacing: 0.04em; line-height: 1; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
}
.nav-logo .dot { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 8px var(--accent-glow); }
.nav-items { display: flex; gap: 2px; height: 100%; align-items: center; }
.nav-item {
  font-family: var(--f-display); font-weight: 600;
  font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-2); padding: 8px 14px; cursor: pointer;
  border: none; background: transparent;
  position: relative; height: 100%; display: flex; align-items: center;
}
.nav-item:hover { color: var(--fg-1); }
.nav-item.active { color: var(--fg-1); }
.nav-item.active::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 0;
  height: 2px; background: var(--accent);
}
.nav-item .caret { font-size: 10px; opacity: 0.5; margin-left: 6px; }

/* BMC widget - restyle the floating button from a 64x64 circle into a
   flatter rectangle so it reads as a 'Support' CTA rather than a circular
   badge. The widget script sets these via inline styles, so we need
   !important to win. A ::after label adds a 'Support' wordmark next to the
   coffee-cup icon. */
#bmc-wbtn {
  width: auto !important;
  height: 40px !important;
  border-radius: 6px !important;
  padding: 0 14px !important;
  gap: 8px !important;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
#bmc-wbtn img { height: 20px !important; width: 20px !important; }
#bmc-wbtn::after { content: 'Support'; }
@media (max-width: 720px) {
  /* On mobile keep it a touch smaller and out of the way of the bottom nav. */
  #bmc-wbtn { height: 36px !important; padding: 0 12px !important; bottom: 80px !important; }
  #bmc-wbtn img { height: 18px !important; width: 18px !important; }
  #bmc-wbtn::after { font-size: 11px; }
}
.nav-spacer { flex: 1; }
.nav-controls { display: flex; align-items: center; gap: 8px; }
.nav-season {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--f-display); font-weight: 600; font-size: 13px;
  letter-spacing: 0.08em; color: var(--fg-2);
  padding: 6px 12px; border: 1px solid var(--line-2); cursor: pointer;
  background: var(--bg-2);
}
.nav-season:hover { border-color: var(--line-3); color: var(--fg-1); }
.nav-dropdown {
  position: absolute; top: 100%; left: 0;
  background: var(--bg-2); border: 1px solid var(--line-2);
  min-width: 160px; padding: 4px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}
.nav-dropdown a, .nav-dropdown button {
  display: block; width: 100%; text-align: left;
  background: transparent; border: 0; color: var(--fg-2);
  padding: 8px 12px; font-family: var(--f-display); font-weight: 600;
  font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer;
  text-decoration: none;
}
.nav-dropdown a:hover, .nav-dropdown button:hover { background: var(--bg-hover); color: var(--fg-1); }
.nav-dropdown button.active { color: var(--fg-1); background: var(--bg-hover); font-weight: 700; }
.nav-dropdown-years { max-height: 320px; overflow-y: auto; min-width: 140px; }
.nav-dropdown-years .dropdown-divider {
  height: 1px; background: var(--line-1); margin: 4px 0;
}

/* Mobile bottom nav */
.botnav {
  position: sticky; bottom: 0; z-index: 50;
  background: rgba(8,8,10,0.95); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line-1);
  display: flex; padding: 6px 4px 8px;
}
.botnav-item {
  flex: 1; background: transparent; border: 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px; cursor: pointer;
  font-family: var(--f-display); font-weight: 600;
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--fg-3);
}
.botnav-item.active { color: var(--accent); }
.botnav-item .botnav-icon { font-size: 18px; line-height: 1; }

/* ============================================================
   PAGE / LAYOUT
   ============================================================ */
.page { padding: 24px 20px 40px; max-width: 1280px; margin: 0 auto; }
.page-mob { padding: 16px 14px 24px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-title { font-family: var(--f-display); font-weight: 800; font-size: 36px; letter-spacing: 0; line-height: 1.02; text-transform: uppercase; }
.page-mob .page-title { font-size: 28px; }
.page-sub { color: var(--fg-3); font-size: 13px; margin-top: 4px; }

.section-head {
  display: flex; align-items: center; gap: 10px; margin: 24px 0 12px;
}
.section-head h2 {
  font-family: var(--f-display); font-weight: 700; font-size: 16px;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.section-head .section-rule { flex: 1; height: 1px; background: var(--line-1); }

/* ============================================================
   PANEL / CARD
   ============================================================ */
.panel {
  background: var(--bg-2);
  border: 1px solid var(--line-1);
}
.panel-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-1);
  display: flex; align-items: center; gap: 8px;
  font-family: var(--f-display); font-weight: 600;
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fg-2);
}
.panel-body { padding: 14px; }
.panel-tight .panel-body { padding: 0; }

.kbd-corner {
  position: absolute; width: 10px; height: 10px; border: 1px solid var(--line-3);
}
.kbd-tl { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.kbd-tr { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.kbd-bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.kbd-br { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-display); font-weight: 700;
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 9px 16px; border: 1px solid transparent; cursor: pointer;
  background: transparent; color: var(--fg-1);
  transition: background .12s, border-color .12s, color .12s;
  line-height: 1; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #ff0a36; }
.btn-secondary { background: var(--bg-3); border-color: var(--line-2); color: var(--fg-1); }
.btn-secondary:hover { border-color: var(--line-3); background: var(--bg-hover); }
.btn-ghost { color: var(--fg-2); }
.btn-ghost:hover { color: var(--fg-1); background: var(--bg-2); }
.btn-sm { padding: 6px 10px; font-size: 11px; }
.btn .arrow { font-size: 14px; line-height: 0.5; }

/* ============================================================
   TABLE
   ============================================================ */
.tbl-wrap { width: 100%; overflow-x: auto; }
.tbl {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
  min-width: 720px;
}
.tbl thead th {
  position: sticky; top: 0;
  background: var(--bg-3);
  font-family: var(--f-display); font-weight: 600;
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fg-3);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
  user-select: none;
}
.tbl thead th.sortable { cursor: pointer; }
.tbl thead th.sortable:hover { color: var(--fg-1); }
.tbl thead th .sort-ind { color: var(--accent); margin-left: 4px; font-size: 9px; }
.tbl thead th.right { text-align: right; }
.tbl thead th.center { text-align: center; }

.tbl tbody tr {
  border-bottom: 1px solid var(--line-1);
  transition: background .08s;
}
.tbl tbody tr:nth-child(even) { background: rgba(255,255,255,0.012); }
.tbl tbody tr:hover { background: var(--bg-hover); }
.tbl tbody tr.clickable { cursor: pointer; }

.tbl td {
  padding: 12px;
  vertical-align: middle;
  white-space: nowrap;
}
.tbl td.right { text-align: right; }
.tbl td.center { text-align: center; }
.tbl td.num { font-variant-numeric: tabular-nums; }

/* Driver name cell with team color strip */
.driver-cell {
  display: flex; align-items: center; gap: 10px;
  padding-left: 0;
  position: relative;
  border-left: 3px solid var(--team-color, var(--line-2));
  padding-left: 10px;
  min-width: 180px;
}
.driver-flag { font-size: 14px; line-height: 1; flex-shrink: 0; display: inline-flex; align-items: center; }

/* Flag images (lipis flag-icons, 4:3). Height is driven by the surrounding
   font-size so each call site keeps its previous visual weight; width
   auto-tracks the 4:3 ratio. Subtle border + radius keeps light flags
   (Japan, white-heavy ones) visually grounded against either theme. */
.flag-img {
  display: inline-block;
  height: 1em;
  width: auto;
  vertical-align: -0.15em;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--line-1);
  background: var(--bg-2);
  flex-shrink: 0;
}
.driver-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.driver-firstlast .first { color: var(--fg-3); font-weight: 400; margin-right: 4px; }
.driver-firstlast .last { color: var(--fg-1); font-weight: 600; }
.driver-code { font-family: var(--f-mono); font-size: 11px; color: var(--fg-3); margin-left: 6px; }
.driver-num { font-family: var(--f-display); font-weight: 700; font-size: 16px; color: var(--fg-3); width: 28px; text-align: right; }

/* Position cell */
.pos {
  font-family: var(--f-display); font-weight: 800; font-size: 16px;
  width: 28px; text-align: center; color: var(--fg-1);
  letter-spacing: 0;
}
.pos-1 { color: #FFD700; }
.pos-2 { color: #C0C0C0; }
.pos-3 { color: #CD7F32; }

/* Change indicator */
.chg {
  font-family: var(--f-mono); font-size: 11px;
  display: inline-flex; align-items: center; gap: 3px;
  width: 36px;
}
.chg.up { color: var(--pos); }
.chg.down { color: var(--neg); }
.chg.flat { color: var(--fg-4); }

/* Status pills */
.pill {
  display: inline-flex; align-items: center;
  font-family: var(--f-display); font-weight: 700;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--line-2); color: var(--fg-2);
  background: var(--bg-3); white-space: nowrap;
}
.pill-finished { color: var(--fg-2); border-color: var(--line-2); }
.pill-dnf { color: var(--neg); border-color: rgba(255,68,68,0.3); background: rgba(255,68,68,0.08); }
.pill-dsq { color: var(--warn); border-color: rgba(255,176,32,0.3); background: rgba(255,176,32,0.08); }
.pill-completed { color: var(--fg-3); }
.pill-next { color: var(--accent); border-color: var(--accent); background: rgba(232,0,45,0.08); }
.pill-upcoming { color: var(--fg-3); }
.pill-sprint {
  color: #fff; background: linear-gradient(90deg, var(--accent) 0%, #FF4500 100%);
  border-color: transparent;
}
.pill-live {
  color: #fff; background: var(--live); border-color: transparent;
  display: inline-flex; align-items: center; gap: 6px;
}
.pill-live .dot {
  width: 6px; height: 6px; background: #fff; border-radius: 50%;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--line-1); gap: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  font-family: var(--f-display); font-weight: 600;
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 12px 18px; cursor: pointer; background: transparent; border: 0;
  color: var(--fg-3); position: relative; white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--fg-2); }
.tab.active { color: var(--fg-1); }
.tab.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--accent);
}
.tab.locked { color: var(--fg-4); cursor: not-allowed; }
.tab.live { color: var(--live); }
.tab .tab-status { font-size: 9px; opacity: 0.7; }

/* ============================================================
   COUNTDOWN
   ============================================================ */
.countdown {
  display: flex; gap: 0; align-items: stretch;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
}
.countdown-cell {
  flex: 1; padding: 14px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border-right: 1px solid var(--line-1);
}
.countdown-cell:last-child { border-right: 0; }
.countdown-num {
  font-family: var(--f-display); font-weight: 800;
  font-size: 44px; line-height: 0.9; color: var(--fg-1);
  font-variant-numeric: tabular-nums;
}
.countdown-lbl {
  font-family: var(--f-display); font-weight: 600;
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--fg-3);
}

/* ============================================================
   STAT BLOCK / KPI
   ============================================================ */
.stat {
  padding: 14px;
  border: 1px solid var(--line-1);
  background: var(--bg-2);
  display: flex; flex-direction: column; gap: 6px;
}
.stat-lbl {
  font-family: var(--f-display); font-weight: 600;
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--fg-3);
}
.stat-val {
  font-family: var(--f-display); font-weight: 700;
  font-size: 28px; line-height: 1;
  color: var(--fg-1);
}
.stat-val.mono { font-family: var(--f-mono); font-weight: 600; font-size: 22px; }
.stat-sub { font-size: 12px; color: var(--fg-3); }

/* Highlight callout (fastest lap, pole) */
.callout {
  border: 1px solid var(--line-2);
  background:
    radial-gradient(80% 120% at 100% 0%, rgba(232,0,45,0.06) 0%, transparent 60%),
    var(--bg-2);
  padding: 16px;
  display: flex; gap: 14px; align-items: center;
  position: relative; overflow: hidden;
}
.callout::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent);
}
.callout-icon { font-size: 28px; opacity: 0.85; }
.callout-body { flex: 1; min-width: 0; }
.callout-lbl {
  font-family: var(--f-display); font-weight: 600;
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 4px;
}
.callout-driver { font-family: var(--f-display); font-weight: 700; font-size: 18px; }
.callout-time { font-family: var(--f-mono); font-size: 14px; color: var(--fg-2); margin-top: 2px; }

/* ============================================================
   BARS / RATINGS
   ============================================================ */
.barset { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-lbl {
  font-family: var(--f-display); font-weight: 600; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-3);
  width: 130px; flex-shrink: 0;
}
.bar-track { flex: 1; height: 6px; background: var(--bg-3); border: 1px solid var(--line-1); position: relative; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); }
.bar-val {
  font-family: var(--f-mono); font-size: 12px; color: var(--fg-2);
  width: 80px; text-align: right; font-variant-numeric: tabular-nums;
}
.bar-rating {
  font-family: var(--f-display); font-weight: 700; font-size: 12px;
  letter-spacing: 0.1em; text-transform: uppercase; width: 80px; text-align: right;
}
.bar-rating.low { color: var(--pos); }
.bar-rating.medium { color: var(--warn); }
.bar-rating.high { color: var(--neg); }

/* Grid utilities */
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-7 { grid-template-columns: repeat(7, 1fr); }

@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ============================================================
   RACE CARD
   ============================================================ */
.race-card {
  position: relative; padding: 16px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line-1);
  display: flex; flex-direction: column; gap: 12px;
  transition: border-color .12s, background .12s;
  min-height: 200px;
}
.race-card:hover { border-color: var(--line-3); background: var(--bg-elevated); }

/* Completed - recede into history */
.race-card.is-completed {
  opacity: 0.45;
  border-color: var(--line-1);
}
.race-card.is-completed:hover { opacity: 0.75; border-color: var(--line-2); }

/* Next - dominant focal point */
.race-card.is-next {
  border: 2px solid var(--accent);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 1px rgba(232,0,45,0.2), 0 8px 32px rgba(232,0,45,0.14);
}
.race-card.is-next::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(80% 70% at 50% 0%, rgba(232,0,45,0.1) 0%, transparent 65%);
}
.race-card.is-next:hover {
  border-color: var(--accent);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 1px rgba(232,0,45,0.35), 0 8px 40px rgba(232,0,45,0.2);
}

/* Upcoming - clean, forward-looking */
.race-card.is-upcoming {
  border-color: var(--line-1);
}
.race-card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
}
.race-round {
  font-family: var(--f-display); font-weight: 800; font-size: 13px;
  letter-spacing: 0.1em; color: var(--fg-3);
}
.race-name {
  font-family: var(--f-display); font-weight: 700; font-size: 22px;
  line-height: 1; text-transform: uppercase;
}
.race-circuit { color: var(--fg-3); font-size: 12px; margin-top: 4px; }
.race-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.race-flag { font-size: 18px; }
.race-card-foot { margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--line-1); display: flex; flex-direction: column; gap: 6px; }
.race-mini-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; }
.race-mini-row .lbl { color: var(--fg-3); font-family: var(--f-display); font-weight: 600; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.race-mini-row .val { color: var(--fg-1); font-family: var(--f-mono); font-size: 11px; }

/* ============================================================
   DRIVER CARD (small)
   ============================================================ */
.driver-card {
  background: var(--bg-2);
  border: 1px solid var(--line-1);
  padding: 14px;
  display: flex; gap: 12px; align-items: center;
  border-left: 3px solid var(--team-color);
  cursor: pointer;
  transition: background .12s;
}
.driver-card:hover { background: var(--bg-elevated); }
.driver-card .pos {
  font-family: var(--f-display); font-weight: 800; font-size: 28px;
  width: 36px; text-align: center;
}
.driver-card .meta { flex: 1; min-width: 0; }
.driver-card .name { font-family: var(--f-display); font-weight: 700; font-size: 16px; line-height: 1.1; text-transform: uppercase; }
.driver-card .team { font-size: 11px; color: var(--fg-3); margin-top: 2px; font-family: var(--f-display); letter-spacing: 0.1em; text-transform: uppercase; }
.driver-card .pts { text-align: right; }
.driver-card .pts-num { font-family: var(--f-display); font-weight: 800; font-size: 22px; line-height: 1; }
.driver-card .pts-lbl { font-size: 10px; color: var(--fg-3); font-family: var(--f-display); letter-spacing: 0.14em; text-transform: uppercase; }

/* ============================================================
   IMAGE PLACEHOLDER (silhouettes etc)
   ============================================================ */
.silhouette {
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.02) 0 6px, rgba(255,255,255,.04) 6px 12px),
    var(--bg-3);
  border: 1px solid var(--line-1);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-mono); font-size: 10px; color: var(--fg-4);
  letter-spacing: 0.1em; text-transform: uppercase; text-align: center;
  position: relative;
  overflow: hidden;
}
.silhouette svg { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); height: 90%; opacity: 0.18; }
.silhouette-photo {
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, color-mix(in srgb, var(--team-color) 18%, transparent) 100%), var(--bg-3);
}
.silhouette-photo img {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  height: 100%; width: auto; max-width: 100%;
  object-fit: contain; object-position: bottom center;
}

/* Race header - circuit name links to the circuit detail page. Subtle dotted
   underline and ↗ arrow hint at clickability without breaking the eyebrow's
   monospaced look. */
.inline-link { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--line-2); }
.inline-link:hover { color: var(--fg-1); border-bottom-color: var(--accent); }
.inline-link:hover .inline-link-arrow { color: var(--accent); }
.inline-link-arrow { margin-left: 4px; opacity: 0.6; font-size: 0.9em; }

/* Circuit track map - render both variants and let CSS pick by theme. */
.circuit-track {
  width: 100%; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-1);
}
.circuit-track img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.circuit-track .circuit-track-dark { display: block; }
.circuit-track .circuit-track-light { display: none; }
html.light .circuit-track .circuit-track-dark { display: none; }
html.light .circuit-track .circuit-track-light { display: block; }

/* Recharts dark theme tweaks */
.recharts-cartesian-axis-tick text { fill: var(--fg-3) !important; font-family: var(--f-mono) !important; font-size: 11px !important; }
.recharts-cartesian-grid line { stroke: var(--line-1) !important; }
.recharts-tooltip-wrapper { outline: none !important; }
.recharts-default-tooltip {
  background: var(--bg-3) !important;
  border: 1px solid var(--line-2) !important;
  border-radius: 0 !important;
  font-family: var(--f-mono) !important;
  font-size: 12px !important;
}
.recharts-tooltip-label { color: var(--fg-2) !important; font-family: var(--f-display) !important; letter-spacing: 0.1em !important; text-transform: uppercase !important; font-size: 11px !important; }
.recharts-legend-item-text { color: var(--fg-2) !important; font-family: var(--f-display) !important; font-size: 11px !important; letter-spacing: 0.08em !important; text-transform: uppercase !important; }

/* Selects */
.sel {
  background: var(--bg-3); color: var(--fg-1);
  border: 1px solid var(--line-2);
  font-family: var(--f-display); font-weight: 600; font-size: 12px;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 8px 28px 8px 12px; cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--fg-3) 50%), linear-gradient(135deg, var(--fg-3) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 10px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.sel:hover { border-color: var(--line-3); }
.sel:focus { outline: none; border-color: var(--accent); }

/* Search/text input */
.input {
  background: var(--bg-3); color: var(--fg-1);
  border: 1px solid var(--line-2);
  font-family: var(--f-body); font-size: 13px;
  padding: 8px 12px;
}
.input:focus { outline: none; border-color: var(--accent); }

/* Mini progression sparkline-ish */
.team-color-bar {
  width: 4px; align-self: stretch; min-height: 30px;
  background: var(--team-color);
  flex-shrink: 0;
}
.team-strip {
  display: inline-block; width: 24px; height: 4px;
  background: var(--team-color); vertical-align: middle; margin-right: 8px;
}
.team-dot {
  display: inline-block; width: 8px; height: 8px;
  background: var(--team-color); border-radius: 50%; margin-right: 6px;
}

/* Driver chip (small pill) */
.driver-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; padding: 3px 7px;
  background: var(--bg-3); border: 1px solid var(--line-2);
  border-left: 2px solid var(--team-color);
  font-family: var(--f-display); font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
}

/* Hide visually but keep in DOM */
.sr { position: absolute; left: -9999px; }

/* Boot skeleton - visible until React's createRoot().render() replaces #root.
   Gives crawlers (and JS-disabled users) a real H1 + intro on first paint. */
.boot-skeleton {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: 48px 24px;
  text-align: center;
  font-family: 'Barlow', system-ui, sans-serif;
  color: var(--fg-2);
}
.boot-skeleton h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(28px, 6vw, 48px);
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin: 0 0 12px;
  color: var(--fg-1);
}
.boot-skeleton p {
  margin: 0 0 10px;
  max-width: 620px;
  line-height: 1.5;
  font-size: 15px;
}

/* SEO content paragraphs - visible natural-language summaries above
   detail page tables. Reused for race-summary and driver-summary. */
.race-summary,
.driver-summary {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--fg-2, #b8b9bd);
  margin: 12px 0 18px;
  max-width: 65ch;
}

.race-keylinks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 16px 0 20px;
  font-size: 0.9rem;
}
.race-keylinks ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.race-keylinks li { display: inline-flex; gap: 6px; }
.race-keylinks .t-mono { opacity: 0.6; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.04em; }

.inline-link { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: rgba(255,255,255,0.25); text-underline-offset: 3px; }
.inline-link:hover { text-decoration-color: currentColor; text-decoration-thickness: 2px; }
html.light .inline-link { text-decoration-color: rgba(0,0,0,0.25); }

.team-drivers-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px 16px;
}
.team-drivers-list li { font-size: 0.95rem; }
.team-drivers-list .t-mono { opacity: 0.65; font-size: 0.85rem; }
@media (max-width: 720px) {
  .team-drivers-list { grid-template-columns: 1fr; }
}

.race-card-link {
  position: relative;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
}
.race-card-link:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.race-card-stretch {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: transparent;
  border: 0;
  font-size: 0;
  color: transparent;
  text-decoration: none;
}
/* keep the winner inline-link clickable on top of the stretch overlay */
.race-card-overlay-link {
  position: relative;
  z-index: 2;
}
