/* Custom GT3 Championship — dark motorsport theme.
 *
 * Chart colours come from the validated data-viz palette (dark steps against the
 * #1a1a19 chart surface): series 1 blue #3987e5, series 2 orange #d95926,
 * series 3 aqua #199e70; status warning/serious/critical as published.
 * Page plane #0d0d0d, chart surface #1a1a19 — the surfaces those steps validate on.
 */

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

:root {
  color-scheme: dark;

  /* surfaces & ink */
  --plane:        #0d0d0d;
  --surface-1:    #1a1a19;
  --surface-2:    #131313;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --muted:        #898781;
  --grid:         #2c2c2a;
  --axis:         #383835;
  --border:       rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);

  /* series (validated dark steps) */
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;

  /* status (fixed, never themed) */
  --warning:  #fab219;
  --serious:  #ec835a;
  --critical: #d03b3b;

  /* accent = series-2 orange, used consistently for interface emphasis */
  --accent: #d95926;
  --accent-ink: #f08b60;

  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --wrap: 76rem;
  --r: 10px;
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--plane);
  color: var(--text-secondary);
  font: 400 1rem/1.6 var(--sans);
  scroll-padding-top: 5rem;
}

h1, h2, h3 { color: var(--text-primary); line-height: 1.12; margin: 0; letter-spacing: -0.02em; }
p { margin: 0 0 1rem; }
a { color: var(--accent-ink); }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 0.5rem; top: -3rem; z-index: 60;
  background: var(--surface-1); color: var(--text-primary);
  padding: 0.5rem 0.85rem; border-radius: var(--r); border: 1px solid var(--border-strong);
  transition: top 0.15s;
}
.skip:focus { top: 0.5rem; }

/* ───────────────────────── nav ───────────────────────── */

.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(13, 13, 13, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-in {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
  display: flex; align-items: center; gap: 1.5rem;
  min-height: 3.75rem;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  color: var(--text-primary); text-decoration: none;
  font-weight: 700; font-size: 0.95rem; letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand em { font-style: normal; color: var(--muted); font-weight: 600; }
.brand-mark {
  width: 1.1rem; height: 1.1rem; flex: none; border-radius: 3px;
  background:
    repeating-conic-gradient(var(--text-primary) 0 25%, transparent 0 50%) 0 0 / 50% 50%,
    var(--accent);
}
.nav-links {
  list-style: none; display: flex; gap: 0.25rem 1.15rem; flex-wrap: wrap;
  margin: 0; padding: 0;
  font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase;
}
.nav-links a {
  color: var(--text-secondary); text-decoration: none;
  padding: 0.35rem 0; display: inline-block;
  border-bottom: 2px solid transparent;
}
.nav-links a:hover { color: var(--text-primary); }
.nav-links a[aria-current="true"] { color: var(--text-primary); border-bottom-color: var(--accent); }
.nav-progress { height: 2px; background: var(--accent); width: 0; }

/* ───────────────────────── hero ───────────────────────── */

/* The three cars run across the middle of the frame at every width, and the sun
   sits top-centre. So the copy is split vertically rather than laid over the
   photo: title into the dark tree line above the cars, stats and CTA onto the
   grass below. Left-aligned throughout, which also keeps it clear of the sun. */
.hero {
  position: relative;
  min-height: min(88dvh, 46rem);
  display: grid; align-items: stretch;
  overflow: hidden;
  background: #0a0a0a;
}
.hero-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 50%;
}
/* top- and bottom-weighted scrim, open through the middle so the cars and the
   sun keep their light */
.hero-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(to bottom, rgba(6,6,6,0.88) 0%, rgba(6,6,6,0.46) 20%, rgba(6,6,6,0.06) 38%,
                               rgba(6,6,6,0.34) 60%, rgba(6,6,6,0.93) 86%),
    linear-gradient(to right, rgba(6,6,6,0.5) 0%, rgba(6,6,6,0.08) 50%, transparent 72%);
}
.hero-copy {
  position: relative;
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
  padding: 2rem 0 2.25rem;
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 1.5rem;
}
.eyebrow {
  color: var(--accent-ink);
  font-size: 0.75rem; letter-spacing: 0.22em; text-transform: uppercase;
  font-weight: 700; margin: 0 0 0.85rem;
}
.hero h1 {
  font-size: clamp(2.4rem, 8.5vw, 4.75rem);
  font-weight: 800; letter-spacing: -0.035em;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.65);
  margin-bottom: 1rem;
}
.hero-sub {
  color: var(--text-primary);
  font-size: clamp(1rem, 2.4vw, 1.15rem);
  max-width: 34rem; margin: 0;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.8);
}
.hero-stats {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  margin-bottom: 1.6rem;
}
.hstat {
  background: rgba(16, 16, 16, 0.72);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  padding: 0.65rem 1rem;
  min-width: 6.5rem;
  backdrop-filter: blur(4px);
}
.hstat b {
  display: block; color: var(--text-primary);
  font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1;
}
.hstat span {
  display: block; margin-top: 0.3rem;
  font-size: 0.68rem; letter-spacing: 0.13em; text-transform: uppercase; color: var(--muted);
}
.cta {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--accent); color: #fff; text-decoration: none;
  font-weight: 700; font-size: 0.9rem; letter-spacing: 0.04em;
  padding: 0.8rem 1.35rem; border-radius: var(--r);
}
.cta:hover { background: #e8662f; }

@media (min-width: 64rem) {
  .hero-copy { padding: 2.75rem 0 2.5rem; }
  .hero-img { object-position: 50% 46%; }
  .hero h1 { max-width: 20ch; font-size: clamp(3rem, 5.4vw, 4.4rem); }
}

/* ───────────────────────── bands ───────────────────────── */

.band { padding: clamp(3.5rem, 8vw, 6rem) 0; border-top: 1px solid var(--border); }
.band.alt { background: var(--surface-2); }

.sec-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem 2rem; flex-wrap: wrap; margin-bottom: 2.25rem;
}
.kicker {
  color: var(--accent-ink);
  font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase;
  font-weight: 700; margin: 0 0 0.6rem;
}
.sec-head h2 { font-size: clamp(1.7rem, 4.2vw, 2.5rem); font-weight: 800; }
.lede { max-width: 46ch; margin: 0.85rem 0 0; color: var(--text-secondary); }
h3.sub { font-size: 1.15rem; margin: 2.75rem 0 0.5rem; }
.note { color: var(--muted); font-size: 0.9rem; }

/* ───────────────────────── season rail ───────────────────────── */

.rail-wrap { overflow-x: auto; padding-bottom: 0.5rem; margin-bottom: 2rem; }
.rail {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(6.2rem, 1fr);
  gap: 2px; min-width: 46rem;
}
.rail li { display: flex; }
.rail a {
  flex: 1; text-decoration: none; color: var(--text-secondary);
  background: var(--surface-1);
  border-top: 3px solid var(--axis);
  padding: 0.6rem 0.55rem 0.7rem;
  display: block;
}
.rail a:hover { background: #222221; color: var(--text-primary); }
.rail a[data-night="true"] { border-top-color: var(--series-1); }
.rail .r-no {
  display: block; font-size: 0.68rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
}
.rail .r-tk {
  display: block; margin-top: 0.2rem;
  font-size: 0.78rem; font-weight: 600; color: inherit; line-height: 1.3;
}

/* ───────────────────────── controls ───────────────────────── */

.controls {
  display: flex; flex-wrap: wrap; gap: 1rem 1.75rem; align-items: flex-end;
  padding: 1.1rem 1.25rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 1rem;
}
.ctl { display: flex; flex-direction: column; gap: 0.45rem; }
.ctl:first-child { flex: 1 1 13rem; }
.ctl-lbl {
  font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
input[type="search"], select {
  font: inherit; font-size: 0.9rem;
  color: var(--text-primary);
  background: #0f0f0f;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  min-height: 2.4rem;
  width: 100%;
}
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  font: inherit; font-size: 0.8rem;
  background: #0f0f0f; color: var(--text-secondary);
  border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 0.35rem 0.75rem; cursor: pointer; min-height: 2rem;
}
.chip:hover { color: var(--text-primary); border-color: var(--muted); }
.chip[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600;
}
.seg {
  display: inline-flex; background: #0f0f0f;
  border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden;
}
.seg button {
  font: inherit; font-size: 0.85rem;
  background: none; border: 0; color: var(--text-secondary);
  padding: 0.5rem 0.95rem; cursor: pointer; min-height: 2.4rem;
}
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 600; }
.count {
  font-size: 0.82rem; color: var(--muted); margin: 0 0 1.4rem;
  font-variant-numeric: tabular-nums;
}

/* ───────────────────────── round cards ───────────────────────── */

.cards {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
}
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem 1.35rem 1.35rem;
  display: flex; flex-direction: column; gap: 0.7rem;
  position: relative; overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--axis);
}
.card[data-night="true"]::before { background: var(--series-1); }
.card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.rd {
  font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; white-space: nowrap;
}
.flag {
  font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}
.card h3 { font-size: 1.18rem; font-weight: 700; }
.card .sub-name { color: var(--accent-ink); font-size: 0.85rem; font-weight: 600; margin: 0; }
.card .focus { font-size: 0.9rem; margin: 0; color: var(--text-secondary); }
.meta {
  display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem;
  padding-top: 0.55rem; margin-top: auto;
  border-top: 1px solid var(--border);
  font-size: 0.78rem; color: var(--muted);
}
.meta b {
  color: var(--text-primary); font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tagrow { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag {
  font-size: 0.7rem; letter-spacing: 0.04em;
  background: #232322; color: var(--text-secondary);
  border-radius: 4px; padding: 0.2rem 0.5rem;
}
.tag.night { background: rgba(57, 135, 229, 0.18); color: #8fc0f5; }
.empty {
  padding: 2.5rem 1rem; text-align: center; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: var(--r);
}

/* ───────────────────────── tables ───────────────────────── */

.tbl-scroll {
  overflow-x: auto;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface-1);
}
.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 38rem; }
.tbl.compact { min-width: 0; }
.tbl th, .tbl td {
  text-align: left; padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--grid); vertical-align: top;
}
.tbl thead th {
  color: var(--muted); font-size: 0.7rem; letter-spacing: 0.12em;
  text-transform: uppercase; font-weight: 700;
  border-bottom: 1px solid var(--axis); white-space: nowrap;
  background: var(--surface-1); position: sticky; top: 0;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #202020; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td.tk { color: var(--text-primary); font-weight: 600; }
.tbl td.fo { color: var(--text-secondary); min-width: 16rem; font-size: 0.85rem; }
.tbl .pen { color: var(--text-primary); font-weight: 600; }

/* ───────────────────────── figures & charts ───────────────────────── */

.fig { margin: 0; }
.fig-cap { margin-bottom: 0.9rem; }
.fig-cap h3 { font-size: 1.05rem; }
.fig-cap p { margin: 0.3rem 0 0; font-size: 0.85rem; color: var(--muted); }
.chart-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem 1.15rem 1rem;
}
.chart-card svg { display: block; width: 100%; height: auto; overflow: visible; }
.tick { fill: var(--muted); font-size: 10.5px; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.tick.mid { fill: var(--text-secondary); }
.vlabel { fill: var(--text-primary); font-size: 11px; font-weight: 600; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.gridline { stroke: var(--grid); stroke-width: 1; }
.baseline { stroke: var(--axis); stroke-width: 1; }
.bar { fill: var(--series-1); }
.bar-hit { fill: transparent; cursor: default; }
.bar-g:hover .bar, .bar-g:focus-visible .bar { fill: #5598e7; }

.legend {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.15rem;
  margin: 0 0 0.9rem; padding: 0; list-style: none;
  font-size: 0.8rem; color: var(--text-secondary);
}
.legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.swatch { width: 0.7rem; height: 0.7rem; border-radius: 3px; flex: none; }
.swatch.s1 { background: var(--series-1); }
.swatch.s2 { background: var(--series-2); }
.swatch.s3 { background: var(--series-3); }
.swatch.win { background: repeating-linear-gradient(135deg, var(--muted) 0 2px, transparent 2px 5px); border: 1px solid var(--axis); }

.tip {
  position: fixed; z-index: 70; pointer-events: none;
  background: #000; color: var(--text-primary);
  border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 0.45rem 0.65rem; font-size: 0.8rem; line-height: 1.35;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.6);
  opacity: 0; transition: opacity 0.1s; max-width: 15rem;
}
.tip.on { opacity: 1; }
.tip b { color: var(--text-primary); }
.tip span { color: var(--muted); }

/* ───────────────────────── format section ───────────────────────── */

.fmt-grid { display: grid; gap: 2rem; }
@media (min-width: 60rem) { .fmt-grid { grid-template-columns: 1.5fr 1fr; align-items: start; } }

.spec {
  margin: 0; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: var(--r);
  overflow: hidden;
}
.spec > div {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: 0.7rem 1.1rem; border-bottom: 1px solid var(--grid);
}
.spec > div:last-child { border-bottom: 0; }
.spec dt { font-size: 0.85rem; color: var(--text-secondary); }
.spec dd {
  margin: 0; color: var(--text-primary); font-weight: 700;
  font-size: 0.95rem; text-align: right; font-variant-numeric: tabular-nums;
}

/* ───────────────────────── feature band ───────────────────────── */

.feature { position: relative; display: grid; align-items: end; min-height: 26rem; overflow: hidden; }
.feature img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 55%; }
.feature-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(5,5,5,0.93) 0%, rgba(5,5,5,0.55) 40%, rgba(5,5,5,0.05) 85%);
}
.feature-copy {
  position: relative; width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto; padding: 2.5rem 0;
}
.feature-copy h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; margin-bottom: 0.7rem; }
.feature-copy p { max-width: 42ch; color: var(--text-primary); margin: 0; }

/* ───────────────────────── points section ───────────────────────── */

.pts-grid { display: grid; gap: 2rem; }
@media (min-width: 64rem) { .pts-grid { grid-template-columns: 1.35fr 1fr; align-items: start; } }

.pts-side { display: grid; gap: 1rem; }
.panel {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.15rem 1.3rem;
}
.panel h3 { font-size: 0.95rem; margin-bottom: 0.7rem; }
.panel p:last-child { margin-bottom: 0; }
.panel p { font-size: 0.9rem; }
/* .panel p sets 0.9rem and outranks a bare .big — scope it to win */
.panel p.big {
  font-size: 2.1rem; font-weight: 800; color: var(--text-primary);
  line-height: 1; margin: 0 0 0.6rem; letter-spacing: -0.03em;
}
.panel p.big span {
  display: block; margin-top: 0.4rem;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted);
}
.bonus, .tie { margin: 0; padding: 0; font-size: 0.9rem; }
.bonus { list-style: none; }
.bonus li {
  display: flex; align-items: baseline; gap: 0.7rem;
  padding: 0.45rem 0; border-bottom: 1px solid var(--grid);
}
.bonus li:last-child { border-bottom: 0; }
.bonus b {
  color: var(--text-primary); font-variant-numeric: tabular-nums;
  background: #232322; border-radius: 4px; padding: 0.1rem 0.45rem;
  font-size: 0.85rem; flex: none;
}
.bonus i { font-style: normal; display: block; color: var(--muted); font-size: 0.8rem; }
.tie { padding-left: 1.2rem; }
.tie li { padding: 0.3rem 0; }
.warn {
  display: flex; gap: 0.6rem; align-items: flex-start;
  font-size: 0.85rem; background: #131313;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 0.7rem 0.85rem; margin-top: 0.9rem;
}
.dot { width: 0.65rem; height: 0.65rem; border-radius: 50%; flex: none; margin-top: 0.35rem; }
.dot.warning { background: var(--warning); }
.dot.serious { background: var(--serious); }
.dot.critical { background: var(--critical); }

/* ───────────────────────── rules section ───────────────────────── */

.rules-grid { display: grid; gap: 2rem; }
@media (min-width: 60rem) { .rules-grid { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.rulelist { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--grid); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
@media (min-width: 34rem) { .rulelist { grid-template-columns: 1fr 1fr; } }
.rulelist li { background: var(--surface-1); padding: 1.05rem 1.2rem; }
.rulelist h3 { font-size: 0.9rem; margin-bottom: 0.35rem; }
.rulelist p { margin: 0; font-size: 0.88rem; }
.rulelist strong { color: var(--text-primary); }
.rules-img { margin: 0; border-radius: var(--r); overflow: hidden; border: 1px solid var(--border); }
.rules-img img { display: block; width: 100%; height: 100%; min-height: 14rem; object-fit: cover; }

/* ───────────────────────── penalties ───────────────────────── */

.auto-tiles { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.tile {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.15rem 1.3rem;
  display: flex; gap: 0.85rem; align-items: flex-start;
}
.tile-ico { width: 1.5rem; height: 1.5rem; flex: none; margin-top: 0.15rem; }
.tile b {
  display: block; color: var(--text-primary); font-size: 1.85rem;
  font-weight: 800; line-height: 1; letter-spacing: -0.03em;
}
.tile .u {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); margin-top: 0.4rem;
}
.tile span { display: block; margin-top: 0.35rem; font-size: 0.88rem; }
.tile .tile-note { color: var(--muted); font-size: 0.8rem; }
.tile em { font-style: normal; color: var(--text-primary); font-weight: 600; }
.sev { display: inline-flex; align-items: center; gap: 0.5rem; white-space: nowrap; font-weight: 700; color: var(--text-primary); }

/* ───────────────────────── footer ───────────────────────── */

.foot { border-top: 1px solid var(--border); padding: 3rem 0 4rem; background: var(--surface-2); }
.foot-lede { color: var(--text-primary); font-weight: 600; }
.foot-note { font-size: 0.8rem; color: var(--muted); max-width: 62ch; }

@media print {
  .nav, .controls, .rail-wrap, .cta, .hero-stats, .seg { display: none !important; }
  body { background: #fff; color: #111; }
}
