/* ==========================================================================
   SPTRANS | AFRICAZW
   Built on the Modernist design system: flat planes, hard 2px rules, Archivo
   at weight 800 for anything structural, and a single hot accent. Archivo is
   self-hosted as a variable font, so there is no render-blocking call out to
   a font CDN.
   ========================================================================== */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/archivo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/archivo-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- tokens ------------------------------------------------------------- */

:root {
  color-scheme: light;

  --color-bg: #f3f2f2;
  --color-surface: #eae9e9;
  --color-text: #201e1d;
  --color-accent: #ec3013;
  --color-accent-hover: #dd2b0f;
  --color-accent-deep: #ae1800;
  --color-on-accent: #fff6f4;
  --color-divider: color-mix(in srgb, var(--color-text) 40%, transparent);
  --color-muted: color-mix(in srgb, var(--color-text) 68%, transparent);
  --color-faint: color-mix(in srgb, var(--color-text) 7%, transparent);

  /* Sampled from the logo artwork — the tiger runs red into orange. */
  --brand-gradient: linear-gradient(100deg, #ef4136 0%, #f26322 55%, #f7941e 100%);

  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --weight-heavy: 800;

  --rule: 2px solid var(--color-divider);
  --gutter: clamp(20px, 5vw, 72px);
  --measure: 1200px;
}

/* Light is the house style — it matches the certificates and the logo, both of
   which sit on cream. The dark theme is opt-in through the header toggle only,
   so a visitor whose device is in dark mode still gets the brand look first. */
:root[data-theme='dark'] {
  color-scheme: dark;
  --color-bg: #151413;
  --color-surface: #201e1d;
  --color-text: #f1efee;
  --color-accent: #ff5a3c;
  --color-accent-hover: #ff735a;
  --color-accent-deep: #ffb3a3;
  --color-on-accent: #1a0d09;
  --color-divider: color-mix(in srgb, var(--color-text) 30%, transparent);
  --color-faint: color-mix(in srgb, var(--color-text) 9%, transparent);
}

/* --- base --------------------------------------------------------------- */

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  text-wrap: pretty;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-weight: var(--weight-heavy);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0; }
img { display: block; max-width: 100%; }
figure { margin: 0; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--color-accent); }

::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 12px 20px;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: var(--weight-heavy);
}
.skip:focus { left: 0; color: var(--color-on-accent); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- layout ------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

main { flex: 1; }

.rule { height: 2px; border: 0; margin: 0; background: var(--color-divider); }

.kicker {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent-deep);
  margin-bottom: 18px;
}

.lede {
  font-size: clamp(16px, 1.3vw, 18px);
  line-height: 1.65;
  max-width: 56ch;
  color: var(--color-muted);
}

/* --- buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 20px;
  border: 2px solid transparent;
  font: inherit;
  font-size: 15px;
  font-weight: var(--weight-heavy);
  line-height: 1.2;
  letter-spacing: -0.01em;
  cursor: pointer;
  background: none;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn svg { flex: none; }

.btn-primary { background: var(--color-accent); color: var(--color-on-accent); }
.btn-primary:hover { background: var(--color-accent-hover); color: var(--color-on-accent); }

.btn-outline { border-color: var(--color-divider); color: var(--color-text); }
.btn-outline:hover {
  border-color: var(--color-accent);
  background: var(--color-faint);
  color: var(--color-accent);
}

/* On an accent-filled panel the buttons invert. */
.on-accent .btn-primary { background: var(--color-on-accent); color: var(--color-accent); }
.on-accent .btn-primary:hover { background: #fff; color: var(--color-accent); }
.on-accent .btn-outline { border-color: var(--color-on-accent); color: var(--color-on-accent); }
.on-accent .btn-outline:hover {
  background: var(--color-on-accent);
  color: var(--color-accent);
  border-color: var(--color-on-accent);
}
.on-accent :focus-visible { outline-color: var(--color-on-accent); }

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* --- header ------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: var(--rule);
}

.site-header > .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-right: auto;
  font-weight: var(--weight-heavy);
  font-size: 18px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand:hover { color: inherit; }
.brand picture { display: block; flex: none; }
.brand img { width: 38px; height: auto; }
.brand .zw { color: var(--color-accent); }

.nav-links { display: flex; align-items: center; gap: 28px; }

.nav-links a {
  font-size: 15px;
  font-weight: 600;
  padding-block: 4px;
  border-bottom: 2px solid transparent;
}
.nav-links a:hover { border-color: var(--color-accent); }
.nav-links a[aria-current='page'] {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* Both toggles do nothing without JavaScript, so they stay hidden until the
   head script marks the document as scripted. Gating on a class set before
   first paint — rather than revealing them from site.js — keeps the header
   from shifting after load. */
.nav-toggle, .theme-toggle {
  display: none;
  width: 44px; height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 2px solid var(--color-divider);
  background: none;
  color: inherit;
  cursor: pointer;
}
.nav-toggle:hover, .theme-toggle:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.js .theme-toggle { display: inline-flex; order: 3; }
.nav-panel { order: 5; }

/* The icon shows the theme you would switch *to*. Each rule mirrors the
   matching token block above, so the two can never disagree. */
.icon-sun { display: none; }
.icon-moon { display: block; }
:root[data-theme='dark'] .icon-sun { display: block; }
:root[data-theme='dark'] .icon-moon { display: none; }
.nav-toggle span {
  display: block;
  width: 18px; height: 2px;
  background: currentColor;
  box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}
.nav-toggle[aria-expanded='true'] span { box-shadow: none; transform: rotate(45deg); }
.nav-toggle[aria-expanded='true'] span::after {
  content: '';
  display: block;
  width: 18px; height: 2px;
  background: currentColor;
  transform: rotate(-90deg);
}

@media (max-width: 860px) {
  .site-header > .wrap { flex-wrap: wrap; min-height: 64px; }
  .js .nav-toggle { display: inline-flex; order: 4; }
  .nav-panel {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-bottom: 14px;
  }
  .nav-panel.open { display: flex; }
  .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    border-top: var(--rule);
  }
  .nav-links a {
    padding: 14px 2px;
    border-bottom: 1px solid var(--color-divider);
  }
  .nav-links a[aria-current='page'] { border-bottom-color: var(--color-accent); }
  .nav-panel .btn { margin-top: 14px; justify-content: center; }
}

@media (min-width: 861px) {
  .nav-panel { display: flex; align-items: center; gap: 28px; order: 2; }
  .js .theme-toggle { order: 1; }
}

/* On a phone the brand lockup plus both 44px controls overflow 375px and the
   hamburger drops to a second row, so the wordmark gives up a little size. */
@media (max-width: 520px) {
  .site-header > .wrap { gap: 10px; }
  .brand { font-size: 15px; gap: 8px; }
  .brand img { width: 32px; }
}

/* --- hero --------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr));
  gap: clamp(32px, 5vw, 56px);
  align-items: center;
  padding: clamp(56px, 8vw, 96px) 0 clamp(48px, 6vw, 72px);
}

.hero h1 {
  font-size: clamp(40px, 6.2vw, 82px);
  line-height: 1.03;
  margin-left: -0.05em;
}
.hero h1 span { display: block; }
.hero h1 .accent {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .lede { margin-top: 28px; }
.hero .btn-row { margin-top: 30px; }

.page-head { padding: clamp(56px, 7vw, 88px) 0 clamp(32px, 4vw, 48px); }
.page-head h1 {
  font-size: clamp(36px, 5vw, 66px);
  line-height: 1.04;
  margin-left: -0.05em;
  max-width: 17ch;
}
.page-head .lede { margin-top: 26px; }

/* --- media -------------------------------------------------------------- */

.frame {
  position: relative;
  overflow: hidden;
  background: var(--color-surface);
}
.frame img { width: 100%; height: 100%; object-fit: cover; }

.frame-hero { aspect-ratio: 16 / 10; }
.frame-wide { aspect-ratio: 21 / 9; }

/* Monochrome by default; colour blooms back in on hover. */
.duotone img {
  filter: grayscale(1) contrast(1.07);
  transition: filter 0.45s ease, transform 0.45s ease;
}
.duotone:hover img,
.duotone:focus-visible img { filter: none; }

/* --- stats -------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 32px;
  padding: clamp(36px, 5vw, 52px) 0;
}
.stat dt {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-top: 12px;
}
.stat dd {
  margin: 0;
  font-size: clamp(28px, 3.2vw, 42px);
  font-weight: var(--weight-heavy);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--color-accent);
  font-variant-numeric: tabular-nums;
}

/* --- section heads ------------------------------------------------------ */

.section { padding: clamp(48px, 6vw, 72px) 0; }

/* Spacing utilities. These exist as classes rather than style attributes so
   the Content-Security-Policy can forbid inline styles outright. */
.flush-top { padding-top: 0; }
.pad-bottom { padding-bottom: clamp(48px, 6vw, 80px); }
.gap-top { margin-top: 28px; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px 32px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.section-head h2 { font-size: clamp(28px, 3.4vw, 42px); }

/* --- grid of cells ------------------------------------------------------ */

.cells {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  border-top: var(--rule);
  border-left: var(--rule);
}

/* Four-item rows step 4 → 2 → 1. Left to auto-fit they land on three columns
   around 1000px and strand the fourth item alone on its own row. */
.quad { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .quad { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .quad { grid-template-columns: minmax(0, 1fr); } }
.cell {
  padding: 28px 24px;
  border-right: var(--rule);
  border-bottom: var(--rule);
}
.cell .num {
  font-size: 14px;
  font-weight: var(--weight-heavy);
  color: var(--color-accent-deep);
  font-variant-numeric: tabular-nums;
}
.cell h3 { font-size: 21px; margin-top: 8px; }
.cell p { margin-top: 10px; font-size: 15px; line-height: 1.6; color: var(--color-muted); }

.cell-driver .name { font-size: 21px; font-weight: var(--weight-heavy); margin-top: 18px; }
.cell-driver .km {
  font-size: 32px;
  font-weight: var(--weight-heavy);
  line-height: 1;
  margin-top: 14px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.cell-driver .km small { font-size: 15px; margin-left: 5px; letter-spacing: 0; }

.cell .tick {
  display: block;
  width: 10px; height: 10px;
  background: var(--color-accent);
  margin-bottom: 22px;
}

/* --- values list -------------------------------------------------------- */

.values { border-top: var(--rule); }
.value {
  display: grid;
  grid-template-columns: 70px minmax(0, 320px) minmax(0, 1fr);
  gap: 10px 40px;
  align-items: baseline;
  padding: 28px 0;
  border-bottom: var(--rule);
}
.value .num { font-size: 14px; font-weight: var(--weight-heavy); color: var(--color-accent-deep); }
.value h3 { font-size: 23px; }
.value p { font-size: 15px; line-height: 1.65; color: var(--color-muted); max-width: 54ch; }

@media (max-width: 720px) {
  .value { grid-template-columns: 54px minmax(0, 1fr); gap: 6px 16px; }
  .value p { grid-column: 2; }
}

/* Requirements carry no body copy, so the heading takes the full measure
   instead of being squeezed into the middle column. */
.reqs { list-style: none; padding: 0; margin: 0; }
.reqs .value h3 { grid-column: 2 / -1; font-size: 19px; max-width: 52ch; }

/* --- leaderboard -------------------------------------------------------- */

.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: clamp(28px, 4vw, 44px);
  align-items: start;
}

.podium {
  background: var(--color-accent);
  color: var(--color-on-accent);
  padding: 36px 32px 40px;
}
.podium .label { font-size: 14px; font-weight: var(--weight-heavy); letter-spacing: 0.06em; }
.podium .name {
  font-size: clamp(34px, 4.2vw, 54px);
  font-weight: var(--weight-heavy);
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin-top: 36px;
}
.podium .km {
  font-size: clamp(28px, 3.4vw, 44px);
  font-weight: var(--weight-heavy);
  line-height: 1;
  margin-top: 18px;
  font-variant-numeric: tabular-nums;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  padding: 10px 12px 10px 0;
  border-bottom: var(--rule);
  white-space: nowrap;
}

/* Driver names are row headers, but they should read as plain table text. */
tbody th {
  text-align: left;
  font-weight: var(--weight-heavy);
  font-size: 15px;
  letter-spacing: -0.01em;
  padding: 14px 12px 14px 0;
  border-bottom: 1px solid var(--color-divider);
}
td {
  padding: 14px 12px 14px 0;
  border-bottom: 1px solid var(--color-divider);
  font-variant-numeric: tabular-nums;
}
td:last-child, th:last-child { padding-right: 0; }
.num-col { text-align: right; }
tbody tr:hover { background: var(--color-faint); }

/* A hairline bar behind each row, sized to that driver's share. */
.share { position: relative; min-width: 110px; }
.share .bar {
  display: block;
  height: 7px;
  background: var(--color-accent);
  opacity: 0.85;
}
.share .pct { font-size: 13px; color: var(--color-muted); margin-top: 5px; display: block; }

/* --- gallery ------------------------------------------------------------ */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 12px;
}

.shot {
  position: relative;
  padding: 0;
  border: 0;
  background: var(--color-surface);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  cursor: zoom-in;
  display: block;
}
.shot img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, filter 0.45s ease;
}
.shot:hover img, .shot:focus-visible img { transform: scale(1.045); }

/* --- accent panel ------------------------------------------------------- */

.panel-accent {
  background: var(--color-accent);
  color: var(--color-on-accent);
}
/* padding-block only — the shorthand would wipe out .wrap's gutter. */
.panel-accent .inner { padding-block: clamp(60px, 8vw, 96px) clamp(56px, 7vw, 88px); }
.panel-accent h1, .panel-accent h2 {
  font-size: clamp(38px, 5.8vw, 78px);
  line-height: 1.03;
  margin-left: -0.05em;
}
.panel-accent h1 span, .panel-accent h2 span { display: block; }
.panel-accent .lede { color: inherit; opacity: 0.92; margin-top: 26px; }
.panel-accent .btn-row { margin-top: 38px; }

/* --- footer ------------------------------------------------------------- */

.site-footer { border-top: var(--rule); margin-top: auto; }
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 32px;
  padding-block: 28px;
  font-size: 14px;
}
.site-footer .tag { color: var(--color-muted); }
.site-footer strong { font-weight: var(--weight-heavy); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.site-footer nav a { font-weight: 600; }

/* --- lightbox ----------------------------------------------------------- */

/* The UA hides a closed <dialog> with display:none, so the open state has to
   re-declare the grid rather than setting it on .lightbox outright. */
.lightbox[open] {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  gap: 14px;
  padding: 18px clamp(14px, 4vw, 44px) 22px;
  background: color-mix(in srgb, #0c0b0b 94%, transparent);
  color: #f3f2f2;
  border: 0;
  width: 100%; height: 100%;
  max-width: none; max-height: none;
}
.lightbox::backdrop { background: color-mix(in srgb, #0c0b0b 94%, transparent); }

.lightbox .lb-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.lightbox .lb-stage {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox .lb-stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
}
.lightbox .lb-nav { display: flex; justify-content: space-between; gap: 12px; }
.lightbox .btn { border-color: #f3f2f2; color: #f3f2f2; }
.lightbox .btn:hover { background: #f3f2f2; color: #16100e; }
.lightbox :focus-visible { outline-color: #f3f2f2; }

body.lb-open { overflow: hidden; }

/* --- motion ------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- print -------------------------------------------------------------- */

@media print {
  .site-header, .site-footer nav, .lightbox, .btn-row { display: none; }
  body { background: #fff; color: #000; }
  .frame, .shot { break-inside: avoid; }
}

/* --- generated from src/data.json by build.mjs --- */
.bar-r1 { width: 100%; }
.bar-r2 { width: 96%; }
.bar-r3 { width: 65%; }
.bar-r4 { width: 60%; }
