:root {
  --bg: #0A0A0B;
  --surface-1: #111113;
  --surface-2: #161618;
  --surface-3: #1B1B1E;
  --line-soft: #1F1F23;
  --line: #2A2A2F;
  --control: #6B6B75;
  --text: #F5F5F2;
  --text-2: #CFCFD4;
  --text-3: #A3A3AB;
  --text-4: #8E8E96;
  --gold: #FFD21F;
  --gold-hover: #FFE066;
  --blue: #3AA0FF;
  --link: #5CB0FF;
  --link-hover: #A8D5FF;
  --good: #7EE08A;
  --display: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --body: Barlow, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 16px; line-height: 1.55; }
img { max-width: 100%; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
h1, h2, h3, p, figure { margin: 0; }
[hidden] { display: none !important; }

.wrap { max-width: 1200px; margin: 0 auto; padding-inline: clamp(16px, 4vw, 40px); }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 10; background: var(--gold); color: var(--bg); padding: 8px 12px; border-radius: 6px; font-weight: 700; }
.skip:focus { left: 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* type */
.h1 { font-family: var(--display); font-weight: 800; font-size: clamp(40px, 5vw, 56px); line-height: 1; text-transform: uppercase; }
.h2 { font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1.05; text-transform: uppercase; }
.h3 { font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1.1; text-transform: uppercase; }
.h3.big { font-size: 32px; }
.eyebrow { font-weight: 600; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.mono { font-family: var(--mono); }
.lead { font-size: 18px; color: var(--text-2); }
.small { font-size: 14px; }
.gold { color: var(--gold) !important; }
.good { color: var(--good); }
.dim { color: var(--text-4); }
.dim2 { color: var(--text-3); }
.strong { font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.measure { max-width: 65ch; color: var(--text-2); }
.measure-wide { max-width: 75ch; }

/* layout */
.stack-4, .stack-8, .stack-12, .stack-16, .stack-24, .stack-32 { display: flex; flex-direction: column; }
.stack-4 { gap: 4px; } .stack-8 { gap: 8px; } .stack-12 { gap: 12px; } .stack-16 { gap: 16px; } .stack-24 { gap: 24px; } .stack-32 { gap: 32px; }
.section { padding: 64px 0; }
.section-tight { padding: 0 0 64px; }
.section.alt { background: var(--surface-1); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
#schedule { padding-top: 0; }
.page-head { padding: 40px 0 32px; }
.head-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; }
.head-row .aside { flex: 0 1 320px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* header / footer */
.site-header { border-bottom: 2px solid var(--blue); }
.header-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 12px; padding-bottom: 12px; }
.logo { height: clamp(72px, 9vw, 112px); width: auto; display: block; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-weight: 600; }
.navlink { color: var(--text); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; padding: 0 12px; }
.navlink:hover { color: var(--gold); }
.navlink[aria-current="page"] { color: var(--gold); box-shadow: inset 0 -2px 0 var(--gold); }
.hdr-social { display: inline-flex; margin-left: 8px; border-left: 1px solid var(--line); padding-left: 8px; }
.iconbtn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--text-2); }
.iconbtn:hover { color: var(--gold); }
.site-footer { border-top: 1px solid var(--line-soft); padding: 24px 0; background: var(--surface-1); }
.footer-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; font-size: 14px; color: var(--text-3); }
.footer-logo { height: 72px; width: auto; display: block; }

/* controls */
.btn { min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--control); border-radius: 6px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 16px; background: transparent; }
.btn:hover { border-color: var(--link); color: var(--link-hover); }
.btn-primary { background: var(--gold); border-color: var(--gold); color: var(--bg); }
.btn-primary:hover { background: var(--gold-hover); border-color: var(--gold-hover); color: var(--bg); }
.tlink { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; font-weight: 600; font-size: 14px; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 6px; font: 600 16px var(--body); cursor: pointer; background: transparent; color: var(--text); border: 1px solid var(--control); }
.chip:hover { border-color: var(--link); }
.chip[aria-pressed="true"] { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 4px; background: var(--gold); color: var(--bg); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.ok { font-size: 14px; font-weight: 700; color: var(--gold); }
.tbc { font-size: 14px; font-weight: 700; color: var(--text-3); }

/* cards / section heads */
.card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
a.card { text-decoration: none; color: var(--text); }
a.card:hover { border-color: var(--link); }
.sechead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; border-bottom: 1px solid var(--line); padding-bottom: 12px; position: relative; }
.sechead::after { content: ""; position: absolute; left: 0; bottom: -2px; width: 72px; height: 3px; background: var(--gold); box-shadow: 80px 0 0 var(--blue); }
.stat dt { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.stat dd { margin: 4px 0 0; font-weight: 600; font-size: 18px; }
.stat-grid { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 16px; }

/* tables */
.scroll { overflow-x: auto; }
.tbox { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
table.data { width: 100%; border-collapse: collapse; font-size: 16px; }
table.data th { font: 600 12px var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th.right { text-align: right; }
table.data td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; color: var(--text-2); }
table.data td.strong { color: var(--text); }
table.sticky1 th:first-child, table.sticky1 td:first-child { position: sticky; left: 0; background: var(--bg); z-index: 1; }

/* home */
.hero { padding: 32px 0 48px; }
.hero-row { display: flex; flex-wrap: wrap; gap: 32px; align-items: stretch; }
.next { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 24px; border-top: 3px solid var(--gold); padding: 24px; }
.next-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.next .stat-grid { border-top: 1px solid var(--line); padding-top: 16px; }
.next .btn-row { margin-top: auto; }
.hero-fig { flex: 1 1 440px; display: flex; flex-direction: column; gap: 8px; }
.hero-photo { width: 100%; height: 360px; object-fit: cover; display: block; border-radius: 6px; }
.follow { margin-top: 24px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; padding: 16px 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-1); }
.follow p { flex: 1 1 360px; max-width: 65ch; color: var(--text-2); }
.follow strong { color: var(--text); }
.latest { display: flex; flex-wrap: wrap; gap: 32px; padding: 24px; }
.latest-text { flex: 1 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.latest-text > p { color: var(--text-2); }
.latest-photos, .car-photos { flex: 1 1 360px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-content: start; }
.latest-photos img, .car-photos img { width: 100%; height: auto; object-fit: cover; display: block; border-radius: 6px; aspect-ratio: 4 / 3; }
.latest-photos img.wide, .car-photos img.wide { grid-column: span 2; aspect-ratio: 16 / 9; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.best-card { display: flex; flex-direction: column; gap: 8px; padding: 16px 24px 24px; }
.best-card img { width: 100%; height: 96px; object-fit: contain; display: block; margin-bottom: 8px; }
.best-name { font-weight: 700; font-size: 18px; line-height: 1.25; min-height: 2.5em; display: flex; align-items: flex-end; }
.best-time { font-size: 32px; line-height: 1; color: var(--gold); }
.car-row { display: flex; flex-wrap: wrap; gap: 32px; }
.car-photos { flex-basis: 420px; }
.spec { flex: 1 1 420px; min-width: 0; margin: 0; display: flex; flex-direction: column; }
.spec div { display: flex; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.spec dt { flex: 0 0 112px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); padding-top: 4px; }
.spec dd { margin: 0; font-weight: 500; }
.section.last { border-bottom: 0; }

/* results */
.statband { margin: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.statband > div { background: var(--surface-2); padding: 16px 24px; }
.statband .num { font-size: clamp(24px, 3vw, 32px); font-weight: 500; white-space: nowrap; }
.statband .unit { font: 600 18px var(--body); color: var(--text-3); margin-left: 8px; letter-spacing: .04em; }
.statband .sub { font-size: 14px; font-weight: 500; color: var(--text-3); margin-top: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 16px 32px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.filter-status { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; font-size: 14px; color: var(--text-3); }
.weekend { background: var(--surface-1); overflow: hidden; scroll-margin-top: 16px; }
.wk-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; padding: 16px 16px 8px; }
.wk-head h3 { font-weight: 700; font-size: 18px; }
.wk-meta { color: var(--text-2); }
.wk-date { margin-left: auto; font-size: 14px; color: var(--text-3); }
.wk-photos { display: flex; gap: 8px; padding: 0 16px 12px; overflow-x: auto; }
.wk-photos img { height: 120px; width: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; flex: 0 0 auto; }
.wk-note { padding: 0 16px 8px; font-size: 14px; color: var(--text-3); }
.sgrid { min-width: 880px; }
.srow { display: grid; grid-template-columns: minmax(160px, 1.6fr) 104px 120px 112px 104px 104px 96px; gap: 12px; align-items: center; padding: 8px 16px; border-top: 1px solid var(--line-soft); }
.srow .sname { font-weight: 600; }
.srow [data-l="Laps"], .srow [data-l="Median"] { color: var(--text-2); }
.shead { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); border-top: 0; }
.srow.dnf span { color: var(--text-4); }
.srow .pod { color: var(--gold); font-weight: 700; }

/* track data */
.btn-sm { min-height: 44px; padding: 0 12px; font-size: 14px; }
.btn-sm .dim2 { font-weight: 500; }
.aim-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.aim-card { scroll-margin-top: 16px; display: flex; flex-direction: column; gap: 16px; padding: 16px 16px 24px; }
.aim-card h4 { margin: 0; font-size: 18px; }
.aim-trace { display: flex; flex-direction: column; gap: 8px; background: var(--bg); border-radius: 6px; padding: 12px; }
.aim-trace img { width: 100%; height: auto; aspect-ratio: 4 / 3; display: block; }
.speed-key { display: flex; align-items: center; gap: 8px; font: 500 12px var(--mono); color: var(--text-3); }
.speed-ramp { flex: 1; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #3AA0FF, #F5F5F2, #FFD21F); }
.aim-stats { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.aim-stats dd { font-size: 16px; }
@media (max-width: 420px) { .aim-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.tcard { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; padding: 16px; border-radius: 8px; cursor: pointer; color: var(--text); font-family: var(--body); background: var(--surface-2); border: 1px solid var(--control); }
.tcard:hover { border-color: var(--link); }
.tcard[aria-pressed="true"] { border-color: var(--gold); box-shadow: inset 0 3px 0 var(--gold); background: var(--surface-3); }
.tcard img { width: 100%; height: 88px; object-fit: contain; display: block; margin-bottom: 4px; }
.tcard .best-name { font-size: 16px; }
.tcard-time { font-size: 24px; line-height: 1; color: var(--gold); }
.tmeta { font-size: 14px; color: var(--text-3); }
.track-detail { padding: 40px 0 64px; background: var(--surface-1); border-top: 1px solid var(--line-soft); scroll-margin-top: 16px; }
.detail-row { display: flex; flex-wrap: wrap; gap: 24px; align-items: stretch; }
.map-fig { flex: 1 1 440px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); padding: 24px; }
.map-fig img { width: 100%; height: 300px; object-fit: contain; display: block; }
.map-fig figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; }
.best-panel { flex: 1 1 340px; display: flex; flex-direction: column; gap: 16px; border-top: 3px solid var(--gold); padding: 24px; }
.best-panel .btn { align-self: flex-start; margin-top: auto; }
.hero-time { font-size: 48px; line-height: 1; color: var(--gold); }
.best-grid { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; border-top: 1px solid var(--line); padding-top: 16px; }
.best-grid .span2 { grid-column: span 2; }

@media (max-width: 1100px) {
  .statband { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .statband { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .hero-photo { height: auto; aspect-ratio: 4 / 3; }
}
@media (max-width: 720px) {
  .sgrid { min-width: 0; }
  .shead { display: none; }
  .srow { grid-template-columns: 1fr 1fr; row-gap: 4px; padding: 12px 16px; }
  .srow .sname { grid-column: 1 / -1; }
  .srow [data-l]::before { content: attr(data-l) " "; font-family: var(--body); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-4); }
  .wk-date { margin-left: 0; flex-basis: 100%; }
}
@media (max-width: 640px) {
  .hdr-social { display: none; }
  table.stack { min-width: 0 !important; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; }
  table.stack tr { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
  table.stack td { border: 0; padding: 2px 0; text-align: left; }
  table.stack td.hide-sm { display: none; }
}
@media (max-width: 520px) {
  .tcards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tcard img { height: 56px; }
  .tcard .tmeta { display: none; }
}
@media (max-width: 480px) {
  .nav { width: 100%; justify-content: space-between; gap: 0; }
  .navlink { padding: 0 6px; font-size: 15px; }
}
