/* ==========================================================================
   F1SITE.NL — design system
   Tokens → base → layout → components → pages → utilities
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Barlow Condensed", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --red: #e10600;
  --red-strong: #b80500;
  --gold: #d4a017;
  --silver: #9aa3ad;
  --bronze: #b0703c;
  --purple: #a855f7;
  --green: #16a34a;
  --amber: #d97706;

  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;
  --container: 1240px;
  --header-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  color-scheme: dark;
  --bg: #0c0d10;
  --bg-soft: #111317;
  --surface: #15171c;
  --surface-2: #1b1e25;
  --surface-3: #232731;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #f1f2f4;
  --text-muted: #a3a8b3;
  --text-subtle: #6f7582;
  --accent: var(--red);
  --accent-soft: rgba(225, 6, 0, .14);
  --link: #ff6159;
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, .14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .45);
  --chart-grid: rgba(255, 255, 255, .06);
  --chart-text: #8b919c;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --bg-soft: #eef0f3;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #eceef2;
  --border: #e3e6eb;
  --border-strong: #cdd2da;
  --text: #121419;
  --text-muted: #555c69;
  --text-subtle: #868d99;
  --accent-soft: rgba(225, 6, 0, .08);
  --link: #c80500;
  --success: #15803d;
  --success-soft: rgba(21, 128, 61, .1);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, .08);
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, .14);
  --chart-grid: rgba(0, 0, 0, .06);
  --chart-text: #6b7280;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 var(--font-sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -48px; z-index: 200; background: var(--red); color: #fff; padding: 8px 14px; border-radius: var(--radius-sm); }
.skip-link:focus { top: 12px; }

.icon { width: 18px; height: 18px; flex: none; }
.icon-sm { width: 14px; height: 14px; flex: none; }
.icon-lg { width: 24px; height: 24px; flex: none; }

.display { font-family: var(--font-display); font-weight: 700; letter-spacing: 0; text-transform: uppercase; line-height: 1; }
.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: .9em; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.accent { color: var(--accent); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .container { padding: 0 32px; } }

.section { padding: 32px 0; }
.section + .section { padding-top: 8px; }
@media (min-width: 768px) { .section { padding: 48px 0; } }

.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { display: flex; flex-direction: column; gap: 32px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; gap: 24px; grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: 16px; grid-template-columns: 1fr; }
.grid-4 { display: grid; gap: 16px; grid-template-columns: repeat(2, 1fr); }
.grid-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.grid-cards-sm { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); }
.layout-sidebar { display: grid; gap: 24px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 720px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1024px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .layout-sidebar { grid-template-columns: minmax(0, 1fr) 340px; }
  .layout-sidebar-left { grid-template-columns: 260px minmax(0, 1fr); }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--red); }
.header-inner { height: var(--header-h); display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: baseline; color: var(--text); font-family: "Oswald", var(--font-display); font-weight: 700; font-style: italic; font-size: 26px; letter-spacing: .01em; text-transform: uppercase; line-height: 1; }
.brand:hover { text-decoration: none; }
.brand span { color: var(--red); }
.main-nav { display: none; align-items: center; gap: 2px; margin-left: 8px; }
.main-nav a {
  color: var(--text-muted); font-weight: 500; font-size: 14px;
  padding: 8px 12px; border-radius: var(--radius-sm); position: relative;
}
.main-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.main-nav a[aria-current="page"] { color: var(--text); }
.main-nav a[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -13px; height: 2px; background: var(--red); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--text-muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }
.menu-toggle { display: inline-grid; }
@media (min-width: 1180px) {
  .main-nav { display: flex; }
  .menu-toggle { display: none; }
}
@media (min-width: 1180px) and (max-width: 1300px) { .main-nav a { padding: 8px 9px; } .header-search input { width: 130px; } }

.header-search { display: none; position: relative; }
.header-search input {
  width: 170px; padding-right: 40px; height: 38px; padding: 0 12px 0 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); font-size: 14px; transition: width .2s var(--ease), border-color .2s;
}
.header-search input:focus { width: 200px; outline: none; border-color: var(--border-strong); }
.header-search .icon { position: absolute; left: 11px; top: 10px; color: var(--text-subtle); }
@media (min-width: 720px) { .header-search { display: block; } .search-btn-mobile { display: none; } }

/* Mobile drawer */
.drawer { position: fixed; inset: 0; z-index: 100; visibility: hidden; }
.drawer.is-open { visibility: visible; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); opacity: 0; transition: opacity .25s var(--ease); }
.drawer.is-open .drawer-backdrop { opacity: 1; }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(340px, 88vw);
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .3s var(--ease);
  display: flex; flex-direction: column; padding: 16px;
}
.drawer.is-open .drawer-panel { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.drawer-nav { display: flex; flex-direction: column; }
.drawer-nav a { padding: 12px; border-radius: var(--radius-sm); color: var(--text); font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.drawer-nav a:hover { background: var(--surface-2); text-decoration: none; }
.drawer-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.drawer form { margin: 8px 0 16px; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 64px; border-top: 1px solid var(--border); background: var(--bg-soft); color: var(--text-muted); font-size: 14px; }
.footer-grid { display: grid; gap: 32px; padding: 48px 0 32px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer-grid h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text); margin-bottom: 12px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer-grid a { color: var(--text-muted); }
.footer-grid a:hover { color: var(--text); }
.footer-bottom { border-top: 1px solid var(--border); padding: 20px 0; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; font-size: 13px; }
.footer-bottom a { color: var(--text-muted); }

/* ---------- Page header ---------- */
.page-head { padding: 32px 0 8px; }
@media (min-width: 768px) { .page-head { padding: 48px 0 16px; } }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin-bottom: 10px; }
.eyebrow::before { content: ""; width: 18px; height: 2px; background: currentColor; }
.page-title { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; font-size: clamp(34px, 6vw, 60px); line-height: .95; letter-spacing: 0; }
.page-lead { margin-top: 12px; color: var(--text-muted); font-size: 16px; max-width: 680px; }
.page-head .spread { align-items: flex-end; }

.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--text-subtle); margin-bottom: 16px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb .sep { opacity: .5; }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-title h2 { font-size: 20px; }
.section-title .link-more { font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-pad { padding: 20px; }
@media (min-width: 768px) { .card-pad { padding: 24px; } }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { font-size: 16px; }
.card-head .meta { font-size: 13px; color: var(--text-subtle); }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); font-size: 14px; }
.card-link { display: block; color: inherit; transition: border-color .2s, transform .2s var(--ease), box-shadow .2s; }
.card-link:hover { text-decoration: none; border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.accent-top { position: relative; overflow: hidden; }
.accent-top::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--c, var(--red)); }

/* ---------- Buttons & controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-strong); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.is-active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: 15px;
}
.textarea { height: auto; min-height: 140px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; cursor: pointer; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--accent-soft); }
.select-sm { height: 36px; font-size: 14px; }

.segmented { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; gap: 2px; flex-wrap: wrap; }
.segmented a, .segmented button {
  border: 0; background: transparent; color: var(--text-muted); padding: 6px 12px; border-radius: 7px;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.segmented a:hover, .segmented button:hover { color: var(--text); text-decoration: none; }
.segmented .is-active, .segmented [aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: 13px; font-weight: 500; cursor: pointer;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 20px; }

/* ---------- Badges, swatches, positions ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: var(--surface-3); color: var(--text-muted); white-space: nowrap;
}
.badge-red { background: var(--accent-soft); color: var(--accent); }
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-purple { background: rgba(168, 85, 247, .15); color: var(--purple); }
.badge-live { background: var(--red); color: #fff; }
.badge-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.swatch { display: inline-block; width: 4px; height: 16px; border-radius: 2px; background: var(--c, var(--text-subtle)); flex: none; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--text-subtle)); flex: none; }
.team-name { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); }
.link-plain { color: inherit; }
.link-plain:hover { color: var(--link); }

.pos {
  display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 4px; border-radius: 6px;
  font-family: var(--font-display); font-weight: 700; font-size: 17px; background: var(--surface-2); color: var(--text);
  font-variant-numeric: tabular-nums;
}
.pos-1 { background: var(--gold); color: #1a1300; }
.pos-2 { background: var(--silver); color: #111; }
.pos-3 { background: var(--bronze); color: #fff; }
.pos-dnf { background: transparent; color: var(--text-subtle); font-size: 13px; font-family: var(--font-sans); font-weight: 600; }
.delta-up { color: var(--success); }
.delta-down { color: var(--danger); }
.flag { width: 20px; height: 15px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px var(--border); display: inline-block; vertical-align: -2px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { font-size: 14px; }
.table th {
  text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-subtle); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface);
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .center { text-align: center; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table .w-pos { width: 56px; }
.table .driver-cell { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.table .driver-cell strong { font-weight: 700; }
.table-compact td { padding-top: 8px; padding-bottom: 8px; }
.table .is-highlight { background: var(--accent-soft); }
.table .points { font-weight: 700; }
@media (max-width: 640px) {
  .table .hide-sm { display: none; }
  .table th:first-child, .table td:first-child { padding-left: 14px; }
  .table th:last-child, .table td:last-child { padding-right: 14px; }
}

/* Points bar inside tables */
.bar { position: relative; height: 6px; border-radius: 3px; background: var(--surface-3); min-width: 60px; overflow: hidden; }
.bar > span { position: absolute; inset: 0 auto 0 0; width: var(--w, 0%); background: var(--c, var(--red)); border-radius: 3px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(var(--cols, 4), 1fr); } }
.stat { background: var(--surface); padding: 16px 20px; }
.stat-label { font-size: 12px; color: var(--text-subtle); font-weight: 500; }
.stat-value { font-family: var(--font-display); font-size: 32px; font-weight: 700; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px 24px; }
.fact dt { font-size: 12px; color: var(--text-subtle); margin-bottom: 2px; }
.fact dd { margin: 0; font-weight: 600; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; margin-bottom: 20px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: none; padding: 12px 14px; color: var(--text-muted); font-weight: 600; font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab[aria-selected="true"], .tab.is-active { color: var(--text); border-bottom-color: var(--red); }
.tab .count { font-size: 11px; color: var(--text-subtle); font-weight: 500; }
[role="tabpanel"][hidden] { display: none; }

/* ---------- Alerts & empty states ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); font-size: 14px; }
.alert-success { background: var(--success-soft); border-color: transparent; color: var(--success); }
.alert-error { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.alert-info { background: var(--surface-2); }
.empty { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty .icon-lg { margin: 0 auto 12px; color: var(--text-subtle); width: 36px; height: 36px; }
.empty h3 { color: var(--text); font-size: 17px; margin-bottom: 6px; }

/* ---------- Hero: next race ---------- */
.hero { position: relative; overflow: hidden; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(1000px 400px at 100% 0%, rgba(225, 6, 0, .16), transparent 60%);
}
.hero-body { position: relative; z-index: 1; padding: 24px; display: grid; gap: 24px; }
@media (min-width: 900px) { .hero-body { padding: 36px; grid-template-columns: 1.2fr 1fr; align-items: center; } }
.hero h1 { font-family: var(--font-display); text-transform: uppercase; font-weight: 800; font-size: clamp(36px, 6vw, 64px); line-height: .95; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; color: var(--text-muted); font-size: 14px; }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.countdown div { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 6px; text-align: center; }
.countdown strong { display: block; font-family: var(--font-display); font-size: clamp(30px, 5vw, 46px); line-height: 1; font-variant-numeric: tabular-nums; }
.countdown span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-subtle); }
.countdown-label { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; display: flex; justify-content: space-between; gap: 8px; }
.sessions { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--border); }
.session { padding: 14px 20px; border-right: 1px solid var(--border); }
.session:last-child { border-right: 0; }
.session .label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-subtle); font-weight: 600; }
.session .when { font-weight: 600; margin-top: 2px; }
.session.is-past { opacity: .5; }
.session.is-next .label { color: var(--accent); }
.weather { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; margin-top: 16px; }
.weather .emoji { font-size: 22px; line-height: 1; }

/* ---------- Driver cards ---------- */
.driver-card { position: relative; overflow: hidden; display: flex; flex-direction: column; }
.driver-card .photo { position: relative; aspect-ratio: 4 / 3.4; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 40%, var(--surface-2)) 0%, var(--surface-2) 70%); overflow: hidden; }
.driver-card .photo img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform .4s var(--ease); }
.driver-card:hover .photo img { transform: scale(1.04); }
.driver-card .number { position: absolute; right: 12px; bottom: 6px; font-family: var(--font-display); font-weight: 800; font-size: 54px; line-height: 1; color: rgba(255, 255, 255, .85); text-shadow: 0 2px 12px rgba(0, 0, 0, .35); }
.driver-card .body { padding: 14px 16px 16px; border-top: 3px solid var(--c); display: flex; flex-direction: column; gap: 2px; }
.driver-card .first { font-size: 13px; color: var(--text-muted); }
.driver-card .last { font-family: var(--font-display); font-weight: 800; font-size: 24px; text-transform: uppercase; line-height: 1; }
.driver-card .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 13px; color: var(--text-muted); }
.fav-btn {
  position: absolute; top: 10px; right: 10px; z-index: 2; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .25); background: rgba(0, 0, 0, .35);
  color: #fff; cursor: pointer; backdrop-filter: blur(6px);
}
.fav-btn svg { width: 16px; height: 16px; }
.fav-btn.is-following { background: var(--gold); border-color: var(--gold); color: #1a1300; }
.fav-btn.is-following svg { fill: currentColor; }
.follow-btn.is-following { background: var(--gold); color: #1a1300; border-color: var(--gold); }
.follow-btn.is-following svg { fill: currentColor; }

/* ---------- Team cards ---------- */
.team-card { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.team-card .logo { height: 48px; display: flex; align-items: center; }
.team-card .logo img { max-height: 48px; max-width: 140px; object-fit: contain; }
.logo-plate { background: #fff; border-radius: var(--radius-sm); padding: 6px 10px; }
.team-card h3 { font-family: var(--font-display); font-size: 26px; text-transform: uppercase; font-weight: 800; }
.team-card .full { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.team-card .drivers { display: flex; gap: 8px; flex-wrap: wrap; }
.team-card .standing { display: flex; gap: 12px; justify-content: space-between; align-items: baseline; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.team-card .standing strong { font-family: var(--font-display); font-size: 22px; color: var(--text); }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; object-position: top; background: var(--surface-3); flex: none; }
.avatar-lg { width: 64px; height: 64px; }
.person { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }

/* ---------- Race cards (calendar) ---------- */
.race-card { display: flex; flex-direction: column; overflow: hidden; }
.race-card .map { aspect-ratio: 16 / 9; background: var(--surface-2); display: grid; place-items: center; padding: 12px; border-bottom: 1px solid var(--border); }
.race-card .map img { max-height: 100%; width: auto; object-fit: contain; }
:root[data-theme="dark"] .race-card .map img, :root:not([data-theme]) .race-card .map img { filter: invert(1) hue-rotate(180deg) brightness(1.1); }
.race-card .body { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.race-card .round { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-subtle); display: flex; justify-content: space-between; align-items: center; }
.race-card h3 { font-size: 18px; }
.race-card .where { color: var(--text-muted); font-size: 14px; display: flex; align-items: center; gap: 6px; }
.race-card .foot { margin-top: auto; padding-top: 12px; display: flex; justify-content: space-between; align-items: center; font-size: 14px; border-top: 1px solid var(--border); }
.race-card.is-done { opacity: .82; }
.race-card.is-next { border-color: var(--red); box-shadow: 0 0 0 1px var(--red), var(--shadow); }

/* ---------- News ---------- */
.news-card { display: flex; flex-direction: column; overflow: hidden; }
.news-card .thumb { aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.news-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.news-card:hover .thumb img { transform: scale(1.04); }
.news-card .body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.news-card .source { font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; display: flex; justify-content: space-between; }
.news-card .source time { color: var(--text-subtle); font-weight: 500; text-transform: none; letter-spacing: 0; }
.news-card h3 { font-size: 16px; line-height: 1.35; color: var(--text); }
.news-card:hover h3 { color: var(--link); }

/* ---------- Profile hero (driver / team / circuit) ---------- */
.profile-hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--border); background: var(--bg-soft); }
.profile-hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, color-mix(in srgb, var(--c, var(--red)) 30%, transparent) 0%, transparent 55%);
  pointer-events: none;
}
.profile-hero .container { position: relative; display: grid; gap: 24px; padding-top: 28px; padding-bottom: 28px; }
@media (min-width: 900px) { .profile-hero .container { grid-template-columns: minmax(0, 1fr) 380px; align-items: end; padding-top: 40px; padding-bottom: 0; } }
.profile-hero .big-number { font-family: var(--font-display); font-weight: 800; font-size: clamp(60px, 10vw, 120px); line-height: .8; color: var(--c); opacity: .9; }
.profile-hero h1 { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; font-size: clamp(42px, 8vw, 88px); line-height: .9; }
.profile-hero h1 .first { display: block; font-size: .42em; font-weight: 600; color: var(--text-muted); letter-spacing: .02em; margin-bottom: 4px; }
.profile-hero .portrait { align-self: end; max-height: 420px; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--c) 30%, transparent)); }
.profile-hero .portrait img { width: 100%; height: 100%; max-height: 420px; object-fit: cover; object-position: top; }
.profile-hero .team-logo { max-height: 160px; max-width: 320px; object-fit: contain; justify-self: center; margin-bottom: 28px; }
.profile-hero .chips-row { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 16px; color: var(--text-muted); font-size: 14px; align-items: center; }
.profile-hero .chips-row span { display: inline-flex; align-items: center; gap: 6px; }
.profile-hero .actions { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; padding-bottom: 8px; }

/* ---------- Head to head ---------- */
.h2h { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px 12px; align-items: center; }
.h2h .label { text-align: center; font-size: 12px; color: var(--text-subtle); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.h2h .a, .h2h .b { font-family: var(--font-display); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.h2h .a { text-align: right; }
.h2h .win { color: var(--accent); }
.h2h-bar { grid-column: 1 / -1; display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--surface-3); margin-bottom: 10px; }
.h2h-bar span { display: block; height: 100%; }

.compare-head { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; }
.compare-driver { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.compare-driver img.avatar { width: 96px; height: 96px; border: 3px solid var(--c); }
.compare-driver h2 { font-family: var(--font-display); text-transform: uppercase; font-size: 28px; }
.vs { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--red); color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 18px; }
.compare-row { display: grid; grid-template-columns: 1fr 150px 1fr; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.compare-row .label { text-align: center; color: var(--text-subtle); font-size: 13px; }
.compare-row .v { font-family: var(--font-display); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.compare-row .v:first-child { text-align: right; padding-right: 8px; }
.compare-row .v:last-child { padding-left: 8px; }
.compare-row .v.win { color: var(--accent); }
@media (max-width: 560px) { .compare-row { grid-template-columns: 1fr 100px 1fr; } .compare-row .v { font-size: 20px; } }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 340px; }
@media (min-width: 900px) { .chart-box { height: 420px; } }
.chart-box-sm { position: relative; height: 220px; }

/* ---------- Prose (legal pages, bios) ---------- */
.prose { max-width: 760px; color: var(--text-muted); font-size: 16px; line-height: 1.75; }
.prose h2 { color: var(--text); font-size: 20px; margin: 32px 0 8px; }
.prose p, .prose ul { margin: 0 0 14px; }
.prose ul { padding-left: 20px; }
.prose strong { color: var(--text); }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 32px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 40px; height: 40px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px;
}
.pagination a:hover { border-color: var(--border-strong); text-decoration: none; }
.pagination .is-active { background: var(--red); color: #fff; border-color: var(--red); }

/* ---------- Season round list (results sidebar) ---------- */
.round-list { list-style: none; margin: 0; padding: 6px; max-height: 70vh; overflow-y: auto; }
.round-list a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-muted); font-size: 14px; }
.round-list a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.round-list a.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.round-list .n { width: 22px; font-variant-numeric: tabular-nums; color: var(--text-subtle); font-size: 12px; }

.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; }
.podium-step { text-align: center; padding: 16px 8px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); border-top: 3px solid var(--c); }
.podium-step .p { font-family: var(--font-display); font-size: 30px; font-weight: 800; line-height: 1; }
.podium-step .n { font-weight: 700; margin-top: 6px; }
.podium-step .t { font-size: 12px; color: var(--text-muted); }
.podium-step.p1 { padding-top: 28px; }
.podium-step.p1 .p { color: var(--gold); }
.podium-step.p2 .p { color: var(--silver); }
.podium-step.p3 .p { color: var(--bronze); }

/* ---------- Cookie banner ---------- */
.cookie-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 90; max-width: 560px; margin-left: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 18px; display: none; gap: 12px; flex-direction: column; font-size: 14px;
}
.cookie-banner.is-visible { display: flex; }
.cookie-banner p { color: var(--text-muted); }
.cookie-banner .row-wrap { justify-content: flex-end; }

/* ---------- Search results ---------- */
.result-item { display: flex; gap: 14px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); color: var(--text); }
.result-item:last-child { border-bottom: 0; }
.result-item:hover { background: var(--surface-2); text-decoration: none; }
.result-item .kind { margin-left: auto; }

/* ---------- Utilities ---------- */
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 14px; } .text-xs { font-size: 12px; } .text-lg { font-size: 18px; }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.text-right { text-align: right; } .text-center { text-align: center; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--border); margin: 16px 0; border: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .site-header, .site-footer, .cookie-banner, .drawer { display: none !important; }
  body { background: #fff; color: #000; }
}
@media (max-width: 640px) { .hide-sm { display: none !important; } }

/* Grid/flex children may shrink below their content width (prevents horizontal overflow on phones). */
.hero-body > *, .grid-2 > *, .grid-3 > *, .layout-sidebar > *, .stack > *, .stack-lg > * { min-width: 0; }
@media (max-width: 480px) {
  .hero-body { padding: 20px; }
  .countdown { gap: 6px; }
  .countdown div { padding: 10px 4px; }
  .podium { gap: 8px; }
  .podium-step { padding: 12px 4px; }
  .podium-step .n { font-size: 13px; }
  .header-inner { gap: 12px; }
}

/* ---------- Title fight ---------- */
.title-fight .champion { display: flex; gap: 18px; align-items: center; background: linear-gradient(110deg, color-mix(in srgb, var(--c) 18%, transparent), transparent 60%); }
.champion-trophy { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: #1a1300; flex: none; box-shadow: 0 0 0 6px color-mix(in srgb, var(--gold) 25%, transparent); }
.champion-trophy .icon-lg { width: 30px; height: 30px; }
.champion-name { font-family: var(--font-display); text-transform: uppercase; font-size: clamp(30px, 5vw, 44px); line-height: 1; font-weight: 600; }
.champion-name strong { font-weight: 800; }
.fight-bar { position: relative; height: 8px; border-radius: 4px; background: var(--surface-3); margin: 6px 0 4px; }
.fight-bar span { position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--c); border-radius: 4px; }
.fight-bar i { position: absolute; top: -4px; bottom: -4px; left: var(--x); width: 2px; background: var(--text); border-radius: 1px; }

/* ---------- Live bar ---------- */
.live-bar { background: var(--red); color: #fff; font-size: 14px; }
.live-bar .container { display: flex; align-items: center; gap: 12px; min-height: 40px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.live-bar a { color: #fff; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; margin-left: auto; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; flex: none; }

/* ---------- Command palette ---------- */
.kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--border-strong); font: 600 11px var(--font-sans); color: var(--text-subtle); background: var(--surface-2); }
.header-search .kbd { position: absolute; right: 8px; top: 9px; pointer-events: none; }
.palette { position: fixed; inset: 0; z-index: 150; display: none; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; background: rgba(0, 0, 0, .55); backdrop-filter: blur(4px); }
.palette.is-open { display: flex; }
.palette-box { width: min(620px, 100%); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.palette-input input { flex: 1; height: 56px; border: 0; background: transparent; font-size: 17px; outline: none; }
.palette-list { max-height: 55vh; overflow-y: auto; padding: 6px; margin: 0; list-style: none; }
.palette-list a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text); }
.palette-list a:hover, .palette-list a.is-active { background: var(--accent-soft); text-decoration: none; }
.palette-list .sub { color: var(--text-subtle); font-size: 13px; margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.palette-list .avatar { width: 28px; height: 28px; }
.palette-foot { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-subtle); }

/* ---------- Quiz ---------- */
.quiz-q { padding: 20px; border-top: 1px solid var(--border); }
.quiz-q:first-of-type { border-top: 0; }
.quiz-options { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 14px; }
@media (min-width: 640px) { .quiz-options { grid-template-columns: 1fr 1fr; } }
.quiz-option { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer; text-align: left; font-weight: 600; transition: border-color .15s, background .15s; }
.quiz-option:hover:not(:disabled) { border-color: var(--text-muted); }
.quiz-option:disabled { cursor: default; }
.quiz-option.is-correct { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.quiz-option.is-wrong { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.quiz-result { text-align: center; }
.quiz-score { font-family: var(--font-display); font-size: 72px; font-weight: 800; line-height: 1; }
.quiz-grid { font-size: 26px; letter-spacing: 4px; margin: 8px 0; }
