/* Base Tokens */
:root {
  --color-background: #0f172a;
  --color-surface: #111827;
  --color-surface-alt: #0b1220;
  --color-panel: rgba(15, 23, 42, 0.6);
  --color-border: rgba(148, 163, 184, 0.2);
  --color-border-strong: rgba(148, 163, 184, 0.35);
  --color-muted: #94a3b8;
  --color-text: #f8fafc;
  --color-accent: #38bdf8;
  --color-accent-strong: #0ea5e9;
  --color-highlight: #f97316;
  --color-positive: #34d399;
  --color-negative: #f87171;
  --shadow-lg: 0 20px 45px rgba(15, 23, 42, 0.45);
  --shadow-md: 0 12px 25px rgba(15, 23, 42, 0.35);
  --shadow-md-mobile: 0 10px 18px rgba(15, 23, 42, 0.28);
  --shadow-lg-mobile: 0 14px 22px rgba(15, 23, 42, 0.3);
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --container-max: 1200px;
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--color-background);
  color: var(--color-text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Global flowing background layer (continuous across all sections) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(900px 600px at 12% 8%, rgba(56, 189, 248, 0.14), transparent 60%),
    radial-gradient(850px 520px at 88% 18%, rgba(249, 115, 22, 0.12), transparent 62%),
    radial-gradient(900px 650px at 75% 82%, rgba(168, 85, 247, 0.12), transparent 62%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.0) 0%, rgba(2, 6, 23, 0.35) 45%, rgba(15, 23, 42, 0.0) 100%);
  opacity: 1;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  /* subtle vignette so sections feel connected */
  background: radial-gradient(circle at center, rgba(2, 6, 23, 0) 0%, rgba(2, 6, 23, 0.55) 100%);
}

body.is-modal-open {
  overflow: hidden;
}

/* ----------------------------- */
/* Mobile app shell (clean rebuild) */
/* ----------------------------- */
.m-app {
  display: none;
}

@media (max-width: 640px) {
  html,
  body {
    overflow-x: hidden;
    /* Prevent iOS-style horizontal rubber-banding */
    overscroll-behavior-x: none;
    /* Keep vertical scrolling normal */
    overscroll-behavior-y: auto;
    /* Hint to browsers to avoid horizontal panning gestures */
    touch-action: pan-y;
  }

  .m-app {
    width: 100%;
    overflow-x: hidden;
  }

  /* Hide the long-scroll desktop site on mobile */
  .site-header,
  main#top,
  .site-footer {
    display: none;
  }

  .m-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  .m-topbar {
    position: sticky;
    top: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    background: rgba(11, 18, 32, 0.9);
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    backdrop-filter: none;
  }

  .m-topbar__brand {
    appearance: none;
    border: none;
    background: none;
    color: var(--color-text);
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 600;
    letter-spacing: 0.22em;
    font-size: 1rem;
    padding: 0.4rem 0.25rem;
  }

  .m-topbar__season select {
    appearance: none;
    width: 100%;
    max-width: 200px;
    padding: 0.6rem 2.2rem 0.6rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.75) url('data:image/svg+xml,%3csvg width="12" height="8" viewBox="0 0 12 8" fill="none" xmlns="http://www.w3.org/2000/svg"%3e%3cpath d="M1 1.5L6 6.5L11 1.5" stroke="%2394a3b8" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/%3e%3c/svg%3e') no-repeat right 0.9rem center;
    color: var(--color-text);
    font-size: 0.9rem;
    min-height: 44px;
  }

  .m-views {
    flex: 1;
    padding: 0.9rem 0.9rem calc(0.9rem + 70px);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.9rem;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .m-view {
    display: none;
    gap: 0.9rem;
    max-width: 100%;
    overflow-x: hidden;
    width: 100%;
  }

  .m-view.is-active {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .m-subheader,
  .m-card,
  .m-list,
  .m-row {
    max-width: 100%;
  }

  .m-hero {
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(11, 18, 32, 0.75);
    padding: 1rem;
    box-shadow: var(--shadow-md-mobile);
  }

  .m-hero h1 {
    margin: 0;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
    font-family: 'Space Grotesk', system-ui, sans-serif;
  }

  .m-hero__top {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
  }

  .m-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.55);
    font-weight: 800;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .m-hero__meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .m-meta {
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.45);
    padding: 0.65rem 0.75rem;
    display: grid;
    gap: 0.25rem;
  }

  .m-meta__k {
    color: rgba(148, 163, 184, 0.9);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
  }

  .m-meta__v {
    font-weight: 800;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-soft {
    color: rgba(148, 163, 184, 0.9);
    font-weight: 700;
  }

  .m-muted {
    margin: 0.35rem 0 0;
    color: var(--color-muted);
    font-size: 0.9rem;
  }

  .m-quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .m-action {
    min-height: 48px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.6);
    color: var(--color-text);
    font-weight: 600;
  }

  .m-subheader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.25rem;
  }

  .m-subheader h2 {
    margin: 0;
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
  }

  .m-seg {
    display: inline-flex;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 999px;
    padding: 0.25rem;
    gap: 0.25rem;
  }

  .m-seg__btn {
    min-height: 40px;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    border: none;
    background: none;
    color: var(--color-muted);
    font-weight: 600;
  }

  .m-seg__btn.is-active {
    background: rgba(56, 189, 248, 0.18);
    color: var(--color-text);
  }

  .m-inline-select select {
    min-height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.75);
    color: var(--color-text);
    padding: 0.6rem 0.85rem;
  }

  .m-card {
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(11, 18, 32, 0.75);
    padding: 1rem;
    box-shadow: var(--shadow-md-mobile);
  }

  .m-list {
    display: grid;
    gap: 0.6rem;
  }

  .m-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.62), rgba(15, 23, 42, 0.42));
    padding: 0.85rem 0.9rem;
    width: 100%;
    text-align: left;
    appearance: none;
  }

  .m-row--clickable {
    cursor: pointer;
  }

  .m-row--clickable:focus-visible {
    outline: 2px solid rgba(56, 189, 248, 0.85);
    outline-offset: 3px;
  }

  .m-row--tight {
    padding: 0.65rem 0.75rem;
  }

  .m-row__left {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
  }

  .m-row__title {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.55rem;
  }

  .m-row__sub {
    color: var(--color-muted);
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }

  .m-row__right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
  }

  .m-chip {
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(2, 6, 23, 0.35);
    color: var(--color-muted);
    font-weight: 700;
    font-size: 0.8rem;
  }

  .m-chip--pts {
    color: var(--color-text);
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.25);
  }

  .m-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid rgba(2, 6, 23, 0.35);
    flex-shrink: 0;
  }

  .m-dot--sm {
    width: 8px;
    height: 8px;
    border-width: 2px;
  }

  .m-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 22px;
    padding-inline: 0.35rem;
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.14);
    color: rgba(241, 245, 249, 0.92);
    font-weight: 900;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
  }

  .m-stats {
    display: grid;
    gap: 0.75rem;
  }

  .m-stat {
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(11, 18, 32, 0.75);
    padding: 1rem;
  }

  .m-stat__title {
    margin: 0 0 0.65rem;
    font-weight: 700;
    font-size: 0.95rem;
  }

  .m-stat__section {
    display: grid;
    gap: 0.45rem;
    margin-top: 0.85rem;
  }

  .m-stat__label {
    color: rgba(148, 163, 184, 0.9);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 800;
  }

  /* Mobile Analytics */
  .m-analytics {
    margin-top: 1.25rem;
    display: grid;
    gap: 0.75rem;
    contain: layout style;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .m-analytics .m-subheader {
    margin-bottom: 0.35rem;
  }

  .m-analytics__card {
    background: rgba(11, 18, 32, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 14px;
    padding: 0.85rem;
    contain: layout style;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .m-analytics__card[data-loading="true"] {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .m-analytics__card[data-loading="true"]::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid rgba(148, 163, 184, 0.3);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: m-spin 0.6s linear infinite;
  }

  @keyframes m-spin {
    to { transform: rotate(360deg); }
  }

  .m-analytics__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
  }

  .m-analytics__header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
  }

  .m-analytics__value {
    color: var(--color-accent);
    font-weight: 700;
    font-size: 0.8rem;
  }

  .m-timeline-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(148, 163, 184, 0.2);
    outline: none;
  }

  .m-timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
  }

  .m-timeline-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
    border: none;
  }

  .m-analytics__chart {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 180px;
    max-height: 180px;
    overflow: hidden;
    box-sizing: border-box;
  }

  .m-analytics__chart canvas {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 180px !important;
  }

  .m-analytics__heatmap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -0.85rem;
    padding: 0 0.85rem 0.5rem;
  }

  .m-analytics__heatmap .heatmap-grid {
    display: table;
    border-collapse: collapse;
    font-size: 0.6rem;
    width: max-content;
    min-width: 100%;
  }

  .m-analytics__heatmap .heatmap-row {
    display: table-row;
  }

  .m-analytics__heatmap .heatmap-cell {
    display: table-cell;
    padding: 0.25rem 0.35rem;
    min-width: 26px;
    text-align: center;
    vertical-align: middle;
    border: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(15, 23, 42, 0.6);
  }

  .m-analytics__heatmap .heatmap-cell--driver {
    font-size: 0.6rem;
    padding: 0.25rem 0.4rem;
    white-space: nowrap;
    text-align: left;
    min-width: 70px;
    max-width: 85px;
    overflow: hidden;
    text-overflow: ellipsis;
    position: sticky;
    left: 0;
    background: rgba(11, 18, 32, 0.95);
    z-index: 1;
  }

  .m-analytics__heatmap .heatmap-cell--header {
    font-size: 0.55rem;
    font-weight: 700;
    color: rgba(148, 163, 184, 0.8);
    background: rgba(11, 18, 32, 0.9);
    padding: 0.3rem 0.35rem;
  }

  .m-analytics__heatmap .heatmap-cell--position[data-position="1"] {
    background: rgba(250, 204, 21, 0.5);
    color: #fbbf24;
    font-weight: 700;
  }

  .m-analytics__heatmap .heatmap-cell--position[data-position="2"] {
    background: rgba(203, 213, 225, 0.35);
    color: #cbd5e1;
    font-weight: 600;
  }

  .m-analytics__heatmap .heatmap-cell--position[data-position="3"] {
    background: rgba(249, 115, 22, 0.4);
    color: #fb923c;
    font-weight: 600;
  }

  .m-analytics__heatmap .heatmap-cell--dnf {
    color: rgba(148, 163, 184, 0.4);
  }

  .m-analytics__controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
  }

  .m-analytics__vs {
    font-weight: 700;
    color: var(--color-accent);
    font-size: 0.75rem;
    flex-shrink: 0;
  }

  .m-select {
    flex: 1;
    min-width: 0;
    appearance: none;
    padding: 0.45rem 1.4rem 0.45rem 0.55rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.8) url('data:image/svg+xml,%3csvg width="10" height="6" viewBox="0 0 10 6" fill="none" xmlns="http://www.w3.org/2000/svg"%3e%3cpath d="M1 1L5 5L9 1" stroke="%2394a3b8" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/%3e%3c/svg%3e') no-repeat right 0.4rem center;
    color: var(--color-text);
    font-size: 0.75rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .m-analytics__stats {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    font-size: 0.75rem;
  }

  .m-analytics__stats .h2h-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem 0.75rem;
  }

  .m-analytics__stats .h2h-stat {
    min-width: 0;
  }

  .m-analytics__stats .h2h-stat:last-child {
    grid-column: 1 / -1;
  }

  .m-analytics__stats .h2h-stat__label {
    font-size: 0.6rem;
    margin-bottom: 0.15rem;
  }

  .m-analytics__stats .h2h-stat__value {
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .m-analytics__stats .h2h-stat__value--winner {
    color: var(--color-accent);
  }

  /* Fastest lap stats compact */
  .m-analytics__stats .h2h-stat__value {
    font-size: 1rem;
  }

  /* ───────────────────────────────────────
     MOBILE SEASONS VIEW
     ─────────────────────────────────────── */
  #m-view-seasons {
    min-height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
  }

  #m-view-seasons.is-active {
    display: flex;
  }

  #m-view-seasons .m-subheader {
    margin-bottom: 0.5rem;
  }

  .m-season-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
  }

  .m-season-list .m-season-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem 1rem;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.75), rgba(30, 41, 59, 0.6));
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  }

  .m-season-list .m-season-card:active {
    transform: scale(0.98);
  }

  .m-season-list .m-season-card:hover,
  .m-season-list .m-season-card:focus-visible {
    border-color: rgba(148, 163, 184, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  }

  .m-season-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
  }

  .m-season-card__title {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
  }

  .m-season-card__badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.2);
    color: rgba(148, 163, 184, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  .m-season-card__badge--current {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(14, 165, 233, 0.4));
    color: var(--color-text);
  }

  .m-season-card__meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--color-muted);
  }

  .m-season-card__stat {
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }

  .m-season-card__stat-value {
    font-weight: 600;
    color: var(--color-text);
  }

  .m-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 250;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.25rem;
    padding: 0.45rem 0.5rem calc(0.45rem + env(safe-area-inset-bottom));
    background: rgba(11, 18, 32, 0.92);
    border-top: 1px solid rgba(148, 163, 184, 0.18);
  }

  .m-nav-btn {
    min-height: 48px;
    border: none;
    background: none;
    color: var(--color-muted);
    font-weight: 700;
    font-size: 0.78rem;
    border-radius: 12px;
  }

  .m-nav-btn.is-active {
    color: var(--color-text);
    background: rgba(56, 189, 248, 0.12);
  }
}

img {
  max-width: 100%;
  display: block;
}

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

a[data-scroll]:focus-visible,
button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.container {
  width: min(100% - 2.5rem, var(--container-max));
  margin-inline: auto;
}

.section {
  padding-block: 3.75rem;
  /* Ensure section background effects blend smoothly */
  position: relative;
  isolation: isolate;
}

.section::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  /* Gentle mid-section tint that fades at edges (prevents “band breaks”) */
  background: linear-gradient(
    to bottom,
    rgba(15, 23, 42, 0) 0%,
    rgba(15, 23, 42, 0.22) 18%,
    rgba(15, 23, 42, 0.22) 82%,
    rgba(15, 23, 42, 0) 100%
  );
}

.section--pad {
  padding-block: 4.25rem;
}

.section--alt {
  /* Softer “flowing” background: avoid hard band edges */
  position: relative;
  isolation: isolate;
  background: transparent;
  backdrop-filter: blur(18px);
  border-block: none;
}

.section--alt::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  /* Fade in/out so sections blend into the page background */
  background: linear-gradient(
    to bottom,
    rgba(15, 23, 42, 0) 0%,
    rgba(15, 23, 42, 0.55) 14%,
    rgba(15, 23, 42, 0.55) 86%,
    rgba(15, 23, 42, 0) 100%
  );
}

.section__header {
  margin-bottom: 1.75rem;
}

.section__header--row {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section__header h2 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: clamp(1.75rem, 2vw + 1rem, 2.75rem);
  letter-spacing: -0.01em;
  margin: 0 0 0.3rem;
}

.section__subtitle {
  color: var(--color-muted);
  margin: 0;
  max-width: 600px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-accent);
  margin: 0;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(18px);
  border-bottom: none;
}

.site-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 18px;
  pointer-events: none;
  /* Soft edge instead of a hard border line */
  background: linear-gradient(
    to bottom,
    rgba(15, 23, 42, 0.65),
    rgba(15, 23, 42, 0)
  );
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1rem;
}

.brand {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.28em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-nav a {
  font-size: 0.95rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease, color 0.2s ease;
  color: var(--color-muted);
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: rgba(56, 189, 248, 0.12);
  color: var(--color-text);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
}

.nav-toggle__line {
  display: block;
  width: 24px;
  height: 2px;
  margin-block: 5px;
  background: var(--color-text);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Hero */
.hero {
  padding-block: 4.5rem 3.5rem;
  position: relative;
  isolation: isolate;
}

.hero::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 90px;
  z-index: -1;
  /* Smooth transition from hero into the next section */
  background: linear-gradient(
    to bottom,
    rgba(15, 23, 42, 0),
    rgba(15, 23, 42, 0.45),
    rgba(15, 23, 42, 0)
  );
  pointer-events: none;
}

.hero__content {
  display: grid;
  gap: 2rem;
}

.hero__copy {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.hero__title {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  line-height: 1.1;
  margin: 0;
}

.hero__subtitle {
  color: rgba(241, 245, 249, 0.78);
  margin: 0;
  max-width: 520px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.hero__panel {
  display: grid;
  gap: 1rem;
}

.hero-card {
  background: var(--color-panel);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 1rem;
  min-width: 220px;
}

.hero-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.hero-card__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin: 0;
}

.hero-metrics div {
  display: grid;
  gap: 0.2rem;
}

.hero-metrics dt {
  color: var(--color-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.hero-metrics dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.hero-card--race {
  padding-bottom: 1.25rem;
}

.hero-race-meta {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.hero-podium {
  display: grid;
  gap: 0.75rem;
}

.hero-podium__empty {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.podium {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--color-border);
  position: relative;
  overflow: hidden;
}

.podium::after {
  content: '';
  position: absolute;
  inset: auto auto -4px -4px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.25), transparent 70%);
  transform: rotate(25deg);
  pointer-events: none;
}

.podium__rank {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: rgba(248, 250, 252, 0.85);
}

.podium__meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.podium__name {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.podium__dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(15, 23, 42, 0.45);
}

.podium__points {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.podium__entrant {
  display: block;
  font-size: 0.76rem;
  color: rgba(148, 163, 184, 0.75);
}

.podium--first {
  border-color: rgba(250, 204, 21, 0.5);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(251, 191, 36, 0.18));
  transform: translateY(-6px);
}

.podium--second {
  border-color: rgba(148, 163, 184, 0.4);
  transform: translateY(2px);
}

.podium--third {
  border-color: rgba(249, 115, 22, 0.35);
  transform: translateY(6px);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.85rem 1.6rem;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn--primary {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  color: #0b1220;
  box-shadow: 0 16px 30px rgba(14, 165, 233, 0.3);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 32px rgba(14, 165, 233, 0.34);
}

.btn--ghost {
  border-color: rgba(148, 163, 184, 0.3);
  color: var(--color-text);
}

.btn--ghost:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.btn--subtle {
  background: rgba(56, 189, 248, 0.12);
  color: var(--color-accent);
}

.btn--subtle:hover {
  background: rgba(56, 189, 248, 0.2);
  color: var(--color-accent-strong);
}

/* Season Picker */
.season-controls {
  display: grid;
  gap: 1.2rem;
  margin-bottom: 1.75rem;
}

.season-select {
  display: grid;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  max-width: 260px;
}

.season-select select,
.race-select select {
  appearance: none;
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: rgba(15, 23, 42, 0.8) url('data:image/svg+xml,%3csvg width="12" height="8" viewBox="0 0 12 8" fill="none" xmlns="http://www.w3.org/2000/svg"%3e%3cpath d="M1 1.5L6 6.5L11 1.5" stroke="%2394a3b8" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/%3e%3c/svg%3e') no-repeat right 1rem center;
  color: var(--color-text);
  font-size: 0.95rem;
}

.season-select select:focus-visible,
.race-select select:focus-visible {
  border-color: var(--color-accent);
}

.season-select__label,
.race-select__label {
  display: block;
  margin-bottom: 0.35rem;
}

.season-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.season-pill {
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: rgba(15, 23, 42, 0.35);
  color: var(--color-muted);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.season-pill.is-active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(14, 165, 233, 0.32));
  border-color: rgba(148, 163, 184, 0.5);
  color: var(--color-text);
  transform: translateY(-2px);
}

.season-card {
  background: rgba(15, 23, 42, 0.55);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  display: grid;
  gap: 1.25rem;
}

.season-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.season-card__header h3 {
  margin: 0.2rem 0 0;
  font-size: 1.45rem;
}

.season-card__badge {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  background: rgba(249, 115, 22, 0.2);
  color: var(--color-highlight);
}

.season-card__description {
  margin: 0;
  color: rgba(241, 245, 249, 0.78);
}

/* Tabs */
.tabs {
  display: inline-flex;
  padding: 0.3rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--color-border);
  margin-bottom: 1.75rem;
}

.tabs__button {
  border: none;
  background: none;
  color: var(--color-muted);
  font-weight: 600;
  padding: 0.65rem 1.45rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.tabs__button.is-active {
  background: rgba(56, 189, 248, 0.18);
  color: var(--color-text);
}

.tab-panels {
  position: relative;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: rgba(11, 18, 32, 0.8);
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.data-table thead {
  color: var(--color-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: rgba(15, 23, 42, 0.7);
}

.data-table th,
.data-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  text-align: left;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.08);
}

.driver-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.driver-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(15, 23, 42, 0.4);
}

.driver-note {
  display: block;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.team-driver-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.team-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(15, 23, 42, 0.4);
  display: inline-block;
  margin-right: 0.65rem;
}

.team-chip {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  color: var(--color-muted);
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.column--points {
  text-align: right;
}

.column--delta {
  width: 80px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.standing-delta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  background: rgba(148, 163, 184, 0.12);
  color: var(--color-muted);
}

.standing-delta--up {
  color: var(--color-positive);
  background: rgba(52, 211, 153, 0.16);
}

.standing-delta--down {
  color: var(--color-negative);
  background: rgba(248, 113, 113, 0.16);
}

.standing-delta--steady {
  color: var(--color-muted);
}

.standing-delta--none {
  color: var(--color-muted);
  background: transparent;
}

.data-table--dense th,
.data-table--dense td {
  padding: 0.8rem 1rem;
}

.column--hide-sm {
  display: none;
}

/* Race Layout */
.race-layout {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.race-details {
  background: rgba(11, 18, 32, 0.85);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 1.5rem;
  display: grid;
  gap: 1.05rem;
}

.race-details__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.race-details__header h3 {
  margin: 0.15rem 0 0;
  font-size: 1.45rem;
}

.race-date {
  color: var(--color-muted);
  font-size: 0.85rem;
}

.race-venue {
  margin: 0;
  font-weight: 600;
}

.race-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 0;
}

.race-settings div {
  display: grid;
  gap: 0.25rem;
}

.race-settings dt {
  color: var(--color-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
}

.race-settings dd {
  margin: 0;
}

.race-track {
  border-radius: var(--radius-lg);
  border: 1px dashed var(--color-border);
  display: grid;
  place-items: center;
  padding: 1rem;
  min-height: 220px;
  background: rgba(11, 18, 32, 0.65);
}

.race-track img {
  border-radius: var(--radius-sm);
  max-height: 260px;
  object-fit: contain;
}

/* Stats */
.stats-grid {
  display: grid;
  gap: 1.5rem;
}

.stat-card {
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: rgba(11, 18, 32, 0.85);
  display: grid;
  gap: 1.1rem;
}

.stat-card--clickable {
  cursor: pointer;
  transition: all 0.2s ease;
}

.stat-card--clickable:hover {
  border-color: var(--color-highlight);
  background: rgba(11, 18, 32, 0.95);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-card h3 {
  margin: 0;
  font-size: 1.15rem;
}

.stat-list {
  display: grid;
  gap: 0.9rem;
}

.stat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 600;
}

.stat-item__label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.stat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(15, 23, 42, 0.5);
}

.stat-item__value {
  color: var(--color-muted);
  font-size: 0.9rem;
}

/* Inline stats charts (Chart.js) */
.stat-chart {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  height: 96px;
}

.stat-chart canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.stat-chart--mobile {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  height: 72px;
}

.stat-list--multi {
  gap: 1.2rem;
}

.stat-columns {
  display: grid;
  gap: 1rem;
}

.stat-columns .stat-item {
  justify-content: flex-start;
}

.stat-columns .stat-item__value {
  margin-left: auto;
}

/* Modal */
.modal[aria-hidden="true"] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  /* Prevent scroll chaining / background "rubber band" while a modal is open */
  overscroll-behavior: contain;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(6px);
}

.modal__panel {
  position: relative;
  width: min(92vw, 800px);
  max-height: 80vh;
  /* Only vertical scrolling inside the modal */
  overflow-y: auto;
  overflow-x: hidden;
  /* Prevent left/right panning on touch devices */
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: rgba(11, 18, 32, 0.96);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
}

.modal__title {
  margin: 0;
  font-size: 1.1rem;
}

.modal__close {
  border: 1px solid var(--color-border);
  background: rgba(15, 23, 42, 0.6);
  color: var(--color-text);
  border-radius: 8px;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.25rem 0.55rem;
  cursor: pointer;
}

.modal__content {
  padding: 1rem 1.25rem 1.25rem;
}

.schedule-rules {
  margin-bottom: 1.5rem;
}

.schedule-rules__title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.schedule-rules__list {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.95rem;
  color: var(--color-muted);
}

.schedule-rules__list li {
  list-style: disc;
}

.schedule-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.schedule-event {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  background: rgba(15, 23, 42, 0.6);
  box-shadow: var(--shadow-md);
}

.schedule-event__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--color-muted);
}

.schedule-event__round {
  font-weight: 600;
  color: var(--color-accent);
}

.schedule-event__track {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.schedule-event__meta {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}

.schedule-event__meta li {
  display: flex;
  gap: 0.5rem;
  color: var(--color-muted);
}

.schedule-event__meta span:first-child {
  min-width: 3.2rem;
  font-weight: 600;
  color: var(--color-text);
}

.schedule-event--break {
  text-align: center;
  padding-block: 1.25rem;
  background: rgba(15, 23, 42, 0.45);
}

.schedule-event__break-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.schedule-event__break-note {
  margin: 0.35rem 0 0;
  color: var(--color-muted);
  font-size: 0.95rem;
}

.modal__list {
  display: grid;
  gap: 0.75rem;
}

/* Driver report modal */
.driver-report {
  display: grid;
  /* Ensure the report never overflows horizontally on small screens */
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.driver-report__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.5);
  min-width: 0;
  /* Allow the points pill to drop below on narrow screens */
  flex-wrap: wrap;
}

.driver-report__name {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.driver-report__name > div {
  min-width: 0;
}

.driver-report__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(2, 6, 23, 0.45);
  flex-shrink: 0;
}

.driver-report__title {
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.driver-report__subtitle {
  margin-top: 0.2rem;
  color: var(--color-muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.driver-report__team-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(2, 6, 23, 0.45);
  flex-shrink: 0;
}

.driver-report__points {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: rgba(248, 250, 252, 0.95);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .modal__header {
    padding: 0.85rem 0.95rem;
  }

  .modal__content {
    padding: 0.85rem 0.95rem 1rem;
  }
}

.driver-report__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.driver-report__kpi {
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(11, 18, 32, 0.65);
  padding: 0.75rem 0.85rem;
  display: grid;
  gap: 0.25rem;
}

.driver-report__kpi .k {
  color: rgba(148, 163, 184, 0.9);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
}

.driver-report__kpi .v {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.driver-report__section-title {
  margin: 0.25rem 0 0;
  color: rgba(148, 163, 184, 0.9);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.driver-report__races {
  display: grid;
  /* Prevent race cards from sizing to max-content width */
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}

.report-race {
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(11, 18, 32, 0.65);
  padding: 0.85rem 0.95rem;
  display: grid;
  /* Ensure the race card itself can't overflow horizontally */
  grid-template-columns: minmax(0, 1fr);
  gap: 0.35rem;
}

.report-race__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.report-race__title {
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-race__chips {
  display: inline-flex;
  gap: 0.45rem;
  flex-shrink: 0;
}

.report-chip {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(2, 6, 23, 0.35);
  padding: 0.25rem 0.55rem;
  font-weight: 800;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.report-chip--accent {
  border-color: rgba(56, 189, 248, 0.22);
  background: rgba(56, 189, 248, 0.12);
}

.report-race__meta {
  color: rgba(148, 163, 184, 0.9);
  font-size: 0.9rem;
  /* Avoid long strings forcing horizontal scroll */
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (min-width: 768px) {
  .driver-report__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Modal grid with two tables */
.modal__grid {
  display: grid;
  gap: 1rem;
}

.modal__section h4 {
  margin: 0 0 0.65rem;
  color: var(--color-muted);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.modal-table {
  min-width: 0;
}

.modal-table .col-rank {
  width: 36px;
}

@media (min-width: 768px) {
  .modal__grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Footer */
.site-footer {
  padding: 3rem 0 2.5rem;
  border-top: none;
  background: transparent;
  position: relative;
  isolation: isolate;
}

.site-footer::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  /* Footer should feel like it fades in, not “starts” abruptly */
  background: linear-gradient(
    to bottom,
    rgba(15, 23, 42, 0) 0%,
    rgba(11, 18, 32, 0.55) 22%,
    rgba(11, 18, 32, 0.7) 100%
  );
}

.footer__content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  color: var(--color-muted);
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 640px) {
  /* Mobile performance: reduce GPU-heavy blur + huge shadows */
  .site-header,
  .section--alt,
  .modal__backdrop {
    backdrop-filter: none;
  }

  .hero-card,
  .season-card,
  .schedule-event,
  .modal__panel {
    box-shadow: var(--shadow-md-mobile);
  }

  .hero__actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero__actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* Season pills become a fast horizontal scroller */
  .season-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .season-pill {
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-height: 44px;
  }

  .tabs__button {
    min-height: 44px;
  }

  .data-table {
    min-width: 0;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  }

  .data-table tbody tr:last-child {
    border-bottom: none;
  }

  .data-table td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 0;
    border-bottom: none;
  }

  .data-table td::before {
    content: attr(data-label);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-muted);
    margin-bottom: 0.2rem;
  }

  .column--points {
    align-items: flex-end;
  }

  .driver-cell {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .team-driver-list {
    flex-direction: column;
    align-items: flex-start;
  }

  .column--hide-sm {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    position: absolute;
    inset: calc(100% + 15px) 1.25rem auto;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.95);
    padding: 1.2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  .site-nav.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
}

@media (min-width: 768px) {
  .hero__content {
    grid-template-columns: 1.2fr 1fr;
  }

  .hero__panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-podium {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .section__header--row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .season-controls {
    grid-template-columns: auto 1fr;
    align-items: center;
  }

  .race-layout {
    grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
    align-items: stretch;
  }

  .column--hide-sm {
    display: table-cell;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .hero {
    padding-block-start: 9rem;
  }

  .section {
    padding-block: 5.5rem;
  }

  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
