/* =====================================================
   Editorial x Team Colors — F1 Tracker
   ===================================================== */


/* --- Light theme tokens --- */
:root {
  --bg:      #f4f1ea;
  --ink:     #0e0e0e;
  --mute:    #6b6258;
  --line:    #d9d3c5;
  --paper:   #ffffff;
  --accent:  #E10600;
  --podGrad: rgba(225,6,0,.04);

  --font-display: 'Fraunces', serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-number:  'Archivo Narrow', 'Archivo', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
  --font-heading: 'Archivo', sans-serif;

  --sp-4: 4px;  --sp-8: 8px;  --sp-12: 12px; --sp-14: 14px;
  --sp-16: 16px; --sp-18: 18px; --sp-20: 20px; --sp-24: 24px;
  --sp-28: 28px; --sp-32: 32px; --sp-40: 40px; --sp-48: 48px;
  --sp-56: 56px; --sp-64: 64px;

  --radius-none: 0;
  --radius-bar:  3px;
  --radius-pill: 20px;

  --team-mercedes:     #27F4D2;
  --team-ferrari:      #E80020;
  --team-mclaren:      #FF8000;
  --team-redbull:      #3671C6;
  --team-aston-martin: #229971;
  --team-alpine:       #0093CC;
  --team-williams:     #64C4FF;
  --team-racing-bulls: #6692FF;
  --team-haas:         #B6BABD;
  --team-audi:         #52E252;
  --team-cadillac:     #B6BABD;

  --podium-gold:   #d4a017;
  --podium-silver: #c0c0c0;
  --podium-bronze: #CD7F32;

  --delta-up:   #1a7a3e;
  --delta-down: var(--accent);

  --fl-purple: #7d3cff;

  /* W1/F design tokens */
  --paper2: #ebe6d8;
  --ink2:   #3a342b;
  --faint:  #b8b1a0;
  --line2:  #e8e2d2;
  --line3:  #f0ebde;
  --rain:   #3a6fa8;

  /* Pit stop / VSC / anomaly tokens */
  --accent-bg: #fdebe2;
  --ok:        #3d8a5a;
  --ok-bg:     #e3efe4;
  --warn:      #c89a2f;
  --warn-bg:   #faf1d5;
}

/* --- Dark theme tokens --- */
[data-theme="dark"] {
  --bg:      #14110b;
  --ink:     #f0ece2;
  --mute:    #9d9387;
  --line:    #2a2620;
  --paper:   #1c1811;
  --accent:  #FF3A1F;
  --podGrad: rgba(255,58,31,.10);

  /* W1/F design tokens */
  --paper2: #221e17;
  --ink2:   #c8c0b4;
  --faint:  #5a544a;
  --line2:  #2e2a22;
  --line3:  #2a2620;
  --rain:   #4a8fd8;

  /* Pit stop / VSC / anomaly tokens */
  --accent-bg: rgba(255,58,31,.12);
  --ok:        #5ab87a;
  --ok-bg:     rgba(61,138,90,.12);
  --warn:      #e0b848;
  --warn-bg:   rgba(200,154,47,.12);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

/* --- Typography scale --- */
.ed-h1 {
  font-family: var(--font-display);
  font-size: 104px;
  font-weight: 400;
  line-height: 1.05;
  text-wrap: balance;
  letter-spacing: -0.02em;
}
.ed-h1 em, .ed-h1 i {
  font-weight: 300;
  font-style: italic;
}
.ed-h2 {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 400;
  line-height: 1.15;
  text-wrap: balance;
}
.ed-h3 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 400;
  line-height: 1.2;
  text-wrap: pretty;
}
.ed-h4 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.3;
}
.ed-body {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
}
.ed-body-sm {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}
.ed-number {
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.ed-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.ed-mono-sm {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.20em;
  text-transform: uppercase;
}
.ed-driver-num {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 220px;
  line-height: 0.85;
  letter-spacing: -0.05em;
}

/* --- Layout --- */
.ed-page {
  max-width: 1600px;
  margin: 0 auto;
  padding: var(--sp-48) var(--sp-56);
}
.ed-hairline {
  border: none;
  border-top: 1px solid var(--line);
  margin: 0;
}
.ed-grid-hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--sp-48);
  align-items: start;
}
.ed-grid-content {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--sp-48);
  align-items: start;
}
.ed-grid-detail {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: var(--sp-48);
  align-items: start;
}

/* --- Widescreen side-by-side grids --- */
.ed-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-40);
  align-items: start;
}
.ed-grid-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--sp-32);
  align-items: start;
}
.ed-grid-sidebar {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--sp-40);
  align-items: start;
}
.ed-sessions-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.ed-sessions-strip > div {
  padding: var(--sp-16) var(--sp-12);
  border-right: 1px solid var(--line);
}
.ed-sessions-strip > div:last-child {
  border-right: none;
}
.ed-stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}
.ed-stats-strip > div {
  padding: var(--sp-28) var(--sp-24);
  border-right: 1px solid var(--line);
}
.ed-stats-strip > div:last-child {
  border-right: none;
}

/* --- Paper surface --- */
.ed-paper {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: var(--sp-28);
}

/* --- Eyebrow --- */
.ed-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: var(--sp-8);
}
.ed-eyebrow::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* --- Breadcrumb --- */
.ed-breadcrumb {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
  margin-bottom: var(--sp-24);
}
.ed-breadcrumb a { color: var(--mute); }
.ed-breadcrumb a:hover { color: var(--ink); }

/* --- Section heading --- */
.ed-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-16);
  margin-bottom: var(--sp-24);
}
.ed-section-head h2 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  margin: 0;
}
.ed-section-head small {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .ed-grid-2col,
  .ed-grid-3col,
  .ed-grid-sidebar { grid-template-columns: 1fr; }
  .ed-grid-3col { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .ed-grid-hero,
  .ed-grid-content,
  .ed-grid-detail { grid-template-columns: 1fr; gap: var(--sp-32); }
  .ed-grid-2col,
  .ed-grid-3col,
  .ed-grid-sidebar { grid-template-columns: 1fr; }
  .ed-sessions-strip { grid-template-columns: repeat(3, 1fr); }
  .ed-h1 { font-size: 56px; }
  .ed-driver-num { font-size: 120px; }
  .ed-page { padding: var(--sp-24) var(--sp-16); }
}
@media (max-width: 600px) {
  .ed-sessions-strip { grid-template-columns: 1fr 1fr; }
  .ed-stats-strip { grid-template-columns: 1fr 1fr; }
  .ed-h1 { font-size: 40px; }
  .ed-h2 { font-size: 28px; }
  .ed-driver-num { font-size: 80px; }
  .ed-page { padding: var(--sp-16) var(--sp-12); }
}

/* --- Editorial header --- */
.ed-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.ed-header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--sp-56);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-24);
}
.ed-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-8);
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-decoration: none;
}
.ed-logo::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.ed-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}
.ed-nav-link {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  color: var(--mute);
  padding: var(--sp-8) var(--sp-14);
  transition: color 150ms;
}
.ed-nav-link:hover { color: var(--ink); }
.ed-nav-link.active {
  color: var(--ink);
  border-bottom: 2px solid var(--accent);
}
.ed-nav-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
}

/* --- Main content override --- */
.main-content {
  flex: 1;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: var(--sp-24) var(--sp-56) var(--sp-48);
}

/* --- Editorial widget container --- */
.ed-widget {
  border: 1px solid var(--line);
  background: var(--paper);
}

/* --- Editorial standing rows --- */
.ed-standing-row {
  display: grid;
  grid-template-columns: 30px 1fr auto auto auto;
  align-items: center;
  gap: var(--sp-12);
  padding: var(--sp-12) var(--sp-8);
  border-bottom: 1px solid var(--line);
  transition: background 150ms;
}
.ed-standing-row:last-child { border-bottom: none; }
.ed-standing-row:hover { background: var(--paper); }
.ed-standing-pos {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  text-align: center;
  color: var(--ink);
}
.ed-standing-bar { display: flex; align-items: center; }

/* --- GP pill --- */
.ed-gp-pill {
  display: inline-block;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  margin-top: var(--sp-4);
}

/* --- News items --- */
.ed-news-featured a:hover h3,
.ed-news-featured a:hover .ed-h3 { text-decoration: underline; }
.ed-news-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-16);
  padding: var(--sp-14) 0;
  border-top: 1px solid var(--line);
}
.ed-news-item a:hover { text-decoration: underline; }

/* --- Theme transition --- */
.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
  transition: background-color 0.3s ease,
              color 0.3s ease,
              border-color 0.3s ease !important;
}

/* --- Podium cards --- */
.ed-podium-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
}
.ed-podium-card {
  background: var(--paper);
  padding: var(--sp-24) var(--sp-20);
  text-align: center;
}

/* --- Fastest lap pill --- */
.ed-fl-pill {
  display: inline-block;
  background: var(--fl-purple);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  margin-left: var(--sp-4);
  vertical-align: middle;
}

/* --- Responsive overrides --- */
@media (max-width: 900px) {
  .ed-standing-row { grid-template-columns: 24px 1fr auto auto; }
  .ed-standing-bar { display: none; }
  .main-content { padding: var(--sp-24) var(--sp-24) var(--sp-48); }
  .ed-podium-cards { grid-template-columns: 1fr; background: none; gap: var(--sp-8); }
  .ed-podium-card { border: 1px solid var(--line); }
  .ed-grid-2col,
  .ed-grid-3col,
  .ed-grid-sidebar { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .main-content { padding: var(--sp-16) var(--sp-16) var(--sp-40); }
  .ed-header-inner { padding: 0 var(--sp-16); }
  .ed-nav { display: none; }
  .ed-podium-cards { grid-template-columns: 1fr; }
  .ed-standing-row { grid-template-columns: 24px 1fr auto; }
}

@media (max-width: 480px) {
  .ed-h1 { font-size: 32px; }
  .ed-h2 { font-size: 22px; }
  .ed-driver-num { font-size: 64px; }
  .ed-sessions-strip { grid-template-columns: 1fr; }
  .ed-stats-strip { grid-template-columns: 1fr 1fr; }
  .ed-standing-bar { display: none; }
  .ed-result-row { grid-template-columns: 28px 1fr auto; }
  .ed-result-team { display: none; }
  .ed-result-time { display: none; }
}

/* --- Editorial tabs --- */
.ed-tab {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
  background: none;
  border: none;
  padding: var(--sp-12) var(--sp-16);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 150ms, border-color 150ms;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.ed-tab:hover { color: var(--ink); }
.ed-tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.ed-tab:focus-visible { color: var(--ink); outline: 2px solid var(--accent); outline-offset: -2px; }

/* --- Editorial filter chip --- */
.ed-filter-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: var(--sp-4) var(--sp-12);
  cursor: pointer;
  transition: background 150ms, color 150ms, border-color 150ms;
  white-space: nowrap;
}
.ed-filter-chip:hover { color: var(--ink); border-color: var(--ink); }
.ed-filter-chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ed-filter-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- Form field --- */
.ed-field {
  font-family: var(--font-body);
  font-size: 14px;
  padding: var(--sp-12) var(--sp-16);
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  width: 100%;
}
.ed-field:focus { border-color: var(--accent); outline: none; }

/* --- Buttons --- */
.ed-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: var(--sp-12) var(--sp-24);
  border: 1px solid var(--line);
  background: none;
  color: var(--ink);
  cursor: pointer;
  transition: background 150ms;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-8);
  text-decoration: none;
}
.ed-btn:hover { background: var(--paper); }
.ed-btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ed-btn-primary:hover { opacity: 0.85; background: var(--ink); }

/* --- Banners --- */
.ed-banner {
  padding: var(--sp-12) var(--sp-16);
  border: 1px solid var(--line);
  font-family: var(--font-body);
  font-size: 14px;
  margin-bottom: var(--sp-16);
}
.ed-banner-success { border-color: var(--delta-up); background: rgba(26,122,62,0.06); }
.ed-banner-error   { border-color: var(--accent); background: rgba(225,6,0,0.06); }

/* --- Standing info column --- */
.ed-standing-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

/* --- M3 compatibility layer ---
   Ensures non-editorial pages (schedule, settings, live, etc.)
   pick up editorial color tokens via their existing M3 class names. */
body {
  background: var(--bg);
  color: var(--ink);
}

.card,
.card-elevated,
.card-hero {
  border-radius: var(--radius-none);
  box-shadow: none;
  border: 1px solid var(--line);
  background: var(--paper);
}

.card-hero {
  color: var(--ink);
}

.standing-row {
  border-color: var(--line);
}

.m3-table td {
  border-color: var(--line);
}

.m3-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.20em;
  background: transparent;
  color: var(--mute);
}

.btn {
  border-radius: var(--radius-none);
}

.chip {
  border-radius: var(--radius-pill);
  border-color: var(--line);
}

[data-theme="dark"] .card,
[data-theme="dark"] .card-elevated {
  background: var(--paper);
  border-color: var(--line);
}

/* =====================================================
   Editorial Override Layer — M3 → Editorial migration
   ===================================================== */

/* --- Token aliases: --md-sys-* → editorial tokens --- */
:root {
  --md-sys-color-primary: var(--accent);
  --md-sys-color-on-primary: var(--bg);
  --md-sys-color-primary-container: var(--paper);
  --md-sys-color-on-primary-container: var(--ink);
  --md-sys-color-secondary-container: var(--paper);
  --md-sys-color-on-secondary-container: var(--ink);
  --md-sys-color-surface: var(--paper);
  --md-sys-color-surface-container-low: var(--paper);
  --md-sys-color-on-surface: var(--ink);
  --md-sys-color-on-surface-variant: var(--mute);
  --md-sys-color-outline: var(--line);
  --md-sys-color-outline-variant: var(--line);
  --md-sys-color-background: var(--bg);
  --md-sys-color-on-background: var(--ink);
  --md-sys-color-error: var(--accent);
  --md-sys-color-error-container: rgba(225,6,0,0.08);
  --md-sys-color-on-error-container: var(--accent);
  --md-sys-color-tertiary: var(--mute);
  --md-shape-extra-large: 0px;
  --md-elevation-3: none;
}
[data-theme="dark"] {
  --md-sys-color-primary: var(--accent);
  --md-sys-color-on-primary: var(--bg);
  --md-sys-color-primary-container: var(--paper);
  --md-sys-color-on-primary-container: var(--ink);
  --md-sys-color-secondary-container: var(--paper);
  --md-sys-color-on-secondary-container: var(--ink);
  --md-sys-color-surface: var(--paper);
  --md-sys-color-surface-container-low: var(--paper);
  --md-sys-color-on-surface: var(--ink);
  --md-sys-color-on-surface-variant: var(--mute);
  --md-sys-color-outline: var(--line);
  --md-sys-color-outline-variant: var(--line);
  --md-sys-color-background: var(--bg);
  --md-sys-color-on-background: var(--ink);
  --md-sys-color-error: var(--accent);
  --md-sys-color-error-container: rgba(225,6,0,0.08);
  --md-sys-color-on-error-container: var(--accent);
  --md-sys-color-tertiary: var(--mute);
}

/* --- Auth pages --- */
.ed-auth-wrap {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ed-auth-card {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: var(--sp-40);
  width: 100%;
  max-width: 440px;
}
@media (max-width: 480px) {
  .ed-auth-card { padding: var(--sp-24); }
}

/* --- Button overrides --- */
.btn {
  border-radius: 0;
  padding: var(--sp-12) var(--sp-24);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-8);
  transition: background 150ms, opacity 150ms;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.btn-filled { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-filled:hover { opacity: 0.85; }
.btn-outlined { background: none; border-color: var(--line); color: var(--ink); }
.btn-outlined:hover { border-color: var(--ink); }
.btn-tonal { background: var(--paper); border-color: var(--line); color: var(--ink); }
.btn-tonal:hover { border-color: var(--ink); }
.btn-text { background: none; border-color: transparent; color: var(--mute); }
.btn-text:hover { color: var(--ink); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.w-full { width: 100%; }

/* --- Typography overrides --- */
.headline-large { font-family: var(--font-display); font-size: 40px; font-weight: 400; line-height: 1.15; }
.headline-medium { font-family: var(--font-display); font-size: 32px; font-weight: 400; line-height: 1.2; }
.headline-small { font-family: var(--font-display); font-size: 24px; font-weight: 400; line-height: 1.25; }
.title-large { font-family: var(--font-display); font-size: 22px; font-weight: 400; }
.title-medium { font-family: var(--font-body); font-size: 16px; font-weight: 600; }
.title-small { font-family: var(--font-body); font-size: 14px; font-weight: 600; }
.label-medium { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; }
.label-small { font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: 0.20em; text-transform: uppercase; }
.body-large { font-family: var(--font-body); font-size: 16px; font-weight: 500; line-height: 1.5; }
.body-medium { font-family: var(--font-body); font-size: 14px; font-weight: 500; line-height: 1.45; }
.body-small { font-family: var(--font-body); font-size: 13px; font-weight: 400; line-height: 1.4; }
.section-header { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--mute); }

/* --- Table overrides --- */
.m3-table { width: 100%; border-collapse: collapse; }
.m3-table th {
  border-bottom: 1px solid var(--line);
  padding: var(--sp-12) var(--sp-16);
  text-align: left;
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
  background: transparent;
}
.m3-table td { border-bottom: 1px solid var(--line); padding: var(--sp-12) var(--sp-16); font-size: 14px; }
.m3-table tbody tr:hover { background: rgba(0,0,0,0.02); }
[data-theme="dark"] .m3-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { border-bottom: 1px solid var(--line); padding: var(--sp-12) var(--sp-16); text-align: left; color: var(--mute); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 500; background: transparent; }
.data-table td { border-bottom: 1px solid var(--line); padding: var(--sp-12) var(--sp-16); font-size: 14px; }

/* --- Chip overrides --- */
.chip {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: var(--sp-4) var(--sp-12);
  background: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
}
.chip-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.sprint-chip { background: var(--ink); color: var(--bg); border-color: var(--ink); border-radius: 99px; padding: var(--sp-4) var(--sp-12); font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; }
.compound-chip { font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; border: 1px solid var(--line); border-radius: 99px; padding: var(--sp-4) var(--sp-12); background: none; color: var(--ink); display: inline-flex; align-items: center; }
.chip-danger { border-color: var(--accent); color: var(--accent); }
.chip-warn { border-color: #f59e0b; color: #f59e0b; }

/* --- Form field overrides --- */
.field {
  font-family: var(--font-body);
  font-size: 14px;
  padding: var(--sp-12) var(--sp-16);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  width: 100%;
}
.field:focus { border-color: var(--accent); outline: none; }
.field-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
  display: block;
  margin-bottom: var(--sp-8);
}

/* --- Card overrides --- */
.card { border-radius: 0; box-shadow: none; border: 1px solid var(--line); background: var(--paper); padding: var(--sp-24); }
.card-hero { border: 1px solid var(--line); background: var(--paper); padding: var(--sp-24); border-radius: 0; box-shadow: none; }
.card-elevated { border-radius: 0; box-shadow: none; border: 1px solid var(--line); background: var(--paper); }

/* --- Misc overrides --- */
.page-header h1 { font-family: var(--font-display); font-size: clamp(2rem,5vw,3rem); font-weight: 400; line-height: 1.1; margin: 0; }
.page-header p { color: var(--mute); margin: 4px 0 0; }
.breadcrumb { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--mute); }
.breadcrumb a { color: var(--mute); }
.breadcrumb a:hover { color: var(--ink); }
.banner { padding: var(--sp-12) var(--sp-16); border: 1px solid var(--line); font-size: 14px; margin-bottom: var(--sp-16); }
.banner-success { border-color: #1a7a3e; background: rgba(26,122,62,0.06); }
.banner-error { border-color: var(--accent); background: rgba(225,6,0,0.06); }
.tabs { display: flex; gap: 0; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tab { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; padding: var(--sp-12) var(--sp-16); border: none; background: none; color: var(--mute); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* --- Navbar dropdown editorial styling --- */
.nav-group-dropdown .nav-link { font-family: var(--font-body); font-weight: 500; font-size: 14px; color: var(--mute); padding: var(--sp-8) var(--sp-14); }
.nav-group-dropdown .nav-link:hover { color: var(--ink); }

/* --- Bottom nav editorial overrides --- */
.bottom-nav { background: var(--paper); border-top: 1px solid var(--line); }
.bottom-nav-item { color: var(--mute); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.bottom-nav-item.active { color: var(--ink); }
.bottom-nav-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }

/* --- Bottom sheet editorial overrides --- */
.bottom-sheet { background: var(--paper); border-top: 1px solid var(--line); }
.bottom-sheet-group-title { font-family: var(--font-mono); color: var(--mute); letter-spacing: 0.12em; text-transform: uppercase; font-size: 10px; }
.bottom-sheet-item { color: var(--ink); font-family: var(--font-body); }
.bottom-sheet-item:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }

/* --- Touch target improvements for coarse pointer devices (mobile) --- */
@media (pointer: coarse) {
  .ed-filter-chip {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .ed-tab {
    min-height: 44px;
  }
}

/* =====================================================
   W1 — Weather Hero Pill + Session Forecast Table
   ===================================================== */

/* Hero Pill */
.w1-pill {
  background: var(--ink);
  color: var(--paper);
  display: grid;
  grid-template-columns: auto auto 1fr auto auto auto;
  align-items: center;
  gap: 28px;
  padding: 18px 24px;
  border-radius: 0;
  margin-bottom: 0;
}
[data-theme="dark"] .w1-pill {
  background: var(--paper2);
  border: 1px solid var(--line);
}

.w1-pulse {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  background: var(--accent);
  border-radius: 50%;
  animation: w1pulse 1.4s infinite ease-in-out;
}
@keyframes w1pulse { 0%,100%{opacity:1} 50%{opacity:.25} }

.w1-pill-lbl {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .22em;
  color: var(--faint);
  text-transform: uppercase;
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}
.w1-pill-city {
  font-family: var(--font-display);
  font-size: 18px;
  font-style: italic;
  font-weight: 300;
  letter-spacing: -.01em;
  color: var(--paper);
  display: block;
}

.w1-pill-cond {
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 1px solid #3a342b;
  padding-left: 24px;
  height: 42px;
}
.w1-pill-cond-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--paper);
  text-transform: capitalize;
}

.w1-pill-stat {
  border-left: 1px solid #3a342b;
  padding-left: 24px;
  text-align: right;
}
.w1-pill-stat b {
  font-family: var(--font-number);
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--paper);
  display: block;
}
.w1-pill-stat sup {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--faint);
  margin-left: 2px;
  font-weight: 400;
  vertical-align: top;
}
.w1-pill-stat-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .2em;
  color: var(--faint);
  text-transform: uppercase;
  margin-top: 4px;
  font-weight: 600;
}

/* Session Table */
.w1-tbl {
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0;
}

.w1-tbl-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 24px 28px 14px;
  border-bottom: 2px solid var(--ink);
  flex-wrap: wrap;
  gap: 8px;
}
.w1-tbl-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  letter-spacing: -.02em;
  margin: 0;
  line-height: 1;
  color: var(--ink);
}
.w1-tbl-title em {
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
}
.w1-tbl-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 600;
  white-space: nowrap;
}

.w1-thead {
  display: grid;
  grid-template-columns: 140px 1fr 90px 90px 90px 130px 80px;
  gap: 12px;
  padding: 12px 28px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 600;
}

.w1-row {
  display: grid;
  grid-template-columns: 140px 1fr 90px 90px 90px 130px 80px;
  gap: 12px;
  align-items: center;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line2);
  border-radius: 0;
}
.w1-row:last-child { border-bottom: none; }
.w1-row.cur { background: var(--paper2); }

.w1-row-session {
  display: flex;
  align-items: center;
  gap: 8px;
}
.w1-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line);
  flex-shrink: 0;
}
.w1-dot.cur {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(185,74,45,.15);
  animation: w1pulse 1.4s infinite ease-in-out;
}
.w1-row-name {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}
.w1-row.race .w1-row-name {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 17px;
}

.w1-row-wx {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink2);
  text-transform: capitalize;
  letter-spacing: .04em;
}

.w1-row-dt {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--mute);
  letter-spacing: .04em;
  white-space: nowrap;
}
.w1-row-dt b { color: var(--ink); font-weight: 700; }

.w1-row-temp {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.w1-row-temp b {
  font-family: var(--font-number);
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -.01em;
}
.w1-row-temp i {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--mute);
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-left: 2px;
}

.w1-row-rain {
  display: flex;
  align-items: center;
  gap: 8px;
}
.w1-rain-bar {
  flex: 1;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  display: block;
}
.w1-rain-bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
  font-style: normal;
  min-width: 0;
}
.w1-rain-val {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink2);
  min-width: 34px;
  text-align: right;
}

.w1-row-wind {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
  text-align: right;
  letter-spacing: .04em;
}

/* W1 Responsive — collapse to cards below 720px */
@media (max-width: 720px) {
  .w1-pill {
    grid-template-columns: 1fr 1fr;
    gap: 12px 18px;
    padding: 14px 16px;
  }
  .w1-pill-loc { grid-column: 1 / -1; }
  .w1-pill-cond { border-left: none; padding-left: 0; }
  .w1-pill-stat { border-left: none; padding-left: 0; text-align: left; }
  .w1-thead { display: none; }
  .w1-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 16px;
  }
  .w1-row-rain { width: 100%; }
  .w1-rain-bar { flex: 1; }
  .w1-row-wind { text-align: left; }
}

/* ── Timeline_B_LapGrouped (shared: circuit.html + race_timeline.html) ── */
.tb-r { display: grid; grid-template-columns: 64px 1fr 90px; gap: 16px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line2); position: relative; }
.tb-r:first-child { border-top: 2px solid var(--ink); }
.tb-lap { font-family: var(--font-number); font-weight: 800; font-size: 24px; color: var(--ink); letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.tb-lap small { display: block; font-family: var(--font-mono); font-size: 8px; letter-spacing: .22em; color: var(--mute); text-transform: uppercase; margin-top: 3px; font-weight: 600; }
.tb-events { display: flex; flex-wrap: wrap; gap: 6px; }
.tb-ev { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px 5px 5px; background: var(--line3); font-family: var(--font-mono); font-size: 11px; color: var(--ink); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.tb-ev .n { width: 22px; height: 22px; color: #fff; font-weight: 700; font-size: 10px; display: flex; align-items: center; justify-content: center; letter-spacing: -.02em; flex-shrink: 0; }
.tb-ev .cd { font-weight: 700; font-size: 10.5px; letter-spacing: .08em; color: var(--ink); }
.tb-ev .d { font-weight: 500; color: var(--ink2); }
.tb-ev.anom { background: var(--accent-bg); }
.tb-ev.anom .d { color: var(--accent); font-weight: 700; }
.tb-ev.anom .badge { font-size: 9px; letter-spacing: .16em; color: var(--accent); text-transform: uppercase; font-weight: 700; padding-left: 3px; }
.tb-meta { justify-self: end; font-family: var(--font-mono); font-size: 10px; color: var(--mute); letter-spacing: .06em; text-align: right; font-variant-numeric: tabular-nums; line-height: 1.6; }
.tb-meta b { color: var(--ink); font-weight: 600; }
.tb-r.vsc { background: var(--warn-bg); }
.tb-r.vsc::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--warn); }
.tb-r.vsc .tb-lap small { color: var(--warn); }
.tb-r.vsc .tb-lap { color: var(--warn); }
.tb-vsc-empty { font-family: var(--font-body); font-size: 12px; font-style: italic; color: var(--warn); }

/* ── Race Timeline filter strip ── */
.tl-filter-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tl-vsc-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; background: var(--warn-bg); border: 1px solid var(--warn); font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; color: var(--warn); font-weight: 700; text-transform: uppercase; cursor: default; }
.tl-vsc-chip::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); flex-shrink: 0; }
.tl-stat-chip { display: inline-flex; align-items: center; padding: 5px 10px; background: transparent; border: 1px solid var(--line); font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; color: var(--ink2); font-weight: 600; text-transform: uppercase; }
.tl-copy-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; background: transparent; border: 1px solid var(--line); font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em; color: var(--ink); font-weight: 700; text-transform: uppercase; cursor: pointer; }
.tl-copy-btn:hover { background: var(--line3); }
.tb-r.vsc-only .tb-meta { color: var(--warn); font-weight: 600; }

/* ── Responsive: pit stop grid ── */
@media (max-width: 600px) {
  .tb-r { grid-template-columns: 40px 1fr; gap: 10px; }
  .tb-meta { grid-column: 2; justify-self: start; font-size: 9px; margin-top: 4px; }
  .tb-lap { font-size: 18px; }
  .tb-ev { padding: 4px 7px 4px 4px; gap: 4px; }
  .tb-ev .n { width: 18px; height: 18px; font-size: 9px; }
  .tl-filter-strip { gap: 6px; }
  .tl-copy-btn { margin-left: 0; width: 100%; justify-content: center; }
}
