/* PIT WALL 2025 — black + red, speed and impact */
:root {
  --bg: #0a0a0c;
  --surface: #131317;
  --surface-2: #1b1b21;
  --line: #2a2a33;
  --text: #f3f3f5;
  --muted: #9b9ba8;
  --red: #ff2b2b;
  --red-deep: #c10015;
  --gold: #ffcf3f;
  --silver: #d5d8de;
  --bronze: #d9905a;
  --radius: 4px;
  --display: 'Barlow Condensed', 'Noto Sans JP', system-ui, sans-serif;
  --body: 'Noto Sans JP', system-ui, -apple-system, 'Hiragino Sans', sans-serif;
  --max: 1200px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: clip;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: inherit; }
img, svg { max-width: 100%; }
button, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.num, .display { font-family: var(--display); font-style: italic; font-weight: 800; letter-spacing: .01em; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(10, 10, 12, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header::after { /* red speed stripe */
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--red) 0 30%, transparent 30% 32%, var(--red) 32% 36%, transparent 36%);
}
.header-row { display: flex; align-items: center; gap: 16px; height: 60px; }
.logo { display: flex; align-items: baseline; gap: 6px; text-decoration: none; white-space: nowrap; }
.logo b { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 26px; letter-spacing: .02em; }
.logo b span { color: var(--red); }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  position: relative; text-decoration: none; padding: 8px 12px; font-weight: 700; font-size: 14px; color: var(--muted);
  transform: skewX(-12deg);
}
.nav a > span { display: inline-block; transform: skewX(12deg); }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current='page'] { color: #fff; background: var(--red); }
.lang { display: flex; border: 1px solid var(--line); transform: skewX(-12deg); margin-right: 4px; }
.lang button {
  background: none; border: 0; padding: 6px 10px; cursor: pointer; font-family: var(--display); font-weight: 700;
  font-size: 14px; color: var(--muted);
}
.lang button[aria-pressed='true'] { background: var(--text); color: var(--bg); }

@media (max-width: 720px) {
  .header-row { flex-wrap: wrap; height: auto; padding-top: 10px; gap: 8px; }
  .lang { margin-left: auto; }
  .nav { order: 3; width: 100%; margin: 0; padding: 0 0 8px; overflow-x: auto; }
  .nav a { flex: 1 0 auto; text-align: center; font-size: 13px; padding: 7px 10px; }
}

/* ---------- page heading ---------- */
.page-head { position: relative; padding: 48px 0 28px; overflow: hidden; border-bottom: 1px solid var(--line); }
.page-head::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(-60deg, transparent 0 22px, rgba(255, 43, 43, .05) 22px 24px);
  mask-image: linear-gradient(90deg, transparent, #000 60%);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 60%);
}
.page-head h1 { position: relative; margin: 0; font-family: var(--display); font-style: italic; font-weight: 800; font-size: clamp(36px, 7vw, 64px); line-height: 1; }
.page-head h1::before { content: ''; display: inline-block; width: .5em; height: .7em; margin-right: .25em; background: var(--red); transform: skewX(-18deg); }
.page-head p { position: relative; margin: 12px 0 0; color: var(--muted); max-width: 60ch; }

/* ---------- section heading ---------- */
.section { padding: 40px 0; }
.sec-title {
  display: flex; align-items: center; gap: 12px; margin: 0 0 20px;
  font-family: var(--display); font-style: italic; font-weight: 800; font-size: 26px; text-transform: uppercase;
}
.sec-title::before { content: ''; width: 28px; height: 6px; background: var(--red); transform: skewX(-30deg); flex: none; }
.sec-title .more { margin-left: auto; font-family: var(--body); font-style: normal; font-size: 13px; font-weight: 700; color: var(--red); text-decoration: none; text-transform: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; text-decoration: none; font-weight: 900;
  background: var(--red); color: #fff; border: 0; cursor: pointer; transform: skewX(-12deg);
  transition: background .15s;
}
.btn > span { transform: skewX(12deg); display: inline-block; }
.btn:hover { background: var(--red-deep); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--text); }
.btn.ghost:hover { background: var(--text); color: var(--bg); }

/* ---------- hero (home) ---------- */
.hero { position: relative; overflow: hidden; padding: 64px 0 40px; border-bottom: 1px solid var(--line); }
.hero::before {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(115deg, transparent 0 55%, rgba(255, 43, 43, .16) 55% 56%, transparent 56% 60%, rgba(255, 43, 43, .1) 60% 61%, transparent 61%),
    repeating-linear-gradient(0deg, transparent 0 38px, rgba(255, 255, 255, .025) 38px 39px);
}
.hero-inner { position: relative; display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: center; }
.kicker { font-family: var(--display); font-style: italic; font-weight: 700; color: var(--red); letter-spacing: .2em; font-size: 15px; }
.hero h1 { margin: 6px 0 0; font-family: var(--display); font-style: italic; font-weight: 800; font-size: clamp(64px, 14vw, 150px); line-height: .85; letter-spacing: -.01em; }
.hero h1 .yr { display: block; color: transparent; -webkit-text-stroke: 2px var(--red); }
.hero .lead { color: #c9c9d2; max-width: 44ch; margin: 18px 0 24px; }
.hero .ctas { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-art { position: relative; }
.hero-art .car { width: 120%; max-width: none; margin-left: -4%; filter: drop-shadow(0 18px 30px rgba(255, 43, 43, .25)); animation: drive 1s ease-out both; }
@keyframes drive { from { transform: translateX(40%); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hero-art .car { animation: none; } }
@media (max-width: 720px) {
  .hero { padding: 40px 0 32px; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { order: -1; }
  .hero-art .car { width: 100%; margin: 0; }
}

/* ---------- champion cards ---------- */
.champs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.champ {
  position: relative; overflow: hidden; padding: 24px; background: var(--surface); border-left: 6px solid var(--tc, var(--red));
  display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center;
}
.champ::after { content: ''; position: absolute; right: -40px; top: 0; bottom: 0; width: 160px; background: var(--tc); opacity: .08; transform: skewX(-20deg); }
.champ .label { grid-column: 1 / -1; font-size: 12px; font-weight: 700; color: var(--gold); letter-spacing: .08em; }
.champ .name { font-family: var(--display); font-style: italic; font-weight: 800; font-size: clamp(28px, 4vw, 42px); line-height: 1.05; }
.champ .sub { color: var(--muted); font-size: 13px; }
.champ .big { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 52px; line-height: 1; text-align: right; }
.champ .big small { display: block; font-size: 14px; color: var(--muted); font-weight: 700; }
.champ .helmet, .champ .car { width: 120px; }
.champ .art { grid-row: 2 / span 2; grid-column: 2; position: relative; z-index: 1; }
@media (max-width: 720px) { .champs { grid-template-columns: 1fr; } }

/* ---------- stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--surface); padding: 18px 20px; position: relative; overflow: hidden; }
.stat::before { content: ''; position: absolute; left: 0; top: 0; width: 4px; height: 100%; background: var(--red); }
.stat .v { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 48px; line-height: 1; }
.stat .v small { font-size: 20px; margin-left: 2px; }
.stat .k { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* ---------- top 5 bars ---------- */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 40px minmax(120px, 220px) 1fr 64px; gap: 12px; align-items: center; }
.bar-row .p { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 28px; color: var(--muted); }
.bar-row:first-child .p { color: var(--gold); }
.bar-row .who b { display: block; line-height: 1.2; }
.bar-row .who span { color: var(--muted); font-size: 12px; }
.bar-track { height: 14px; background: var(--surface-2); transform: skewX(-20deg); }
.bar-fill { height: 100%; background: var(--tc); }
.bar-row .pts { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 24px; text-align: right; }
@media (max-width: 560px) {
  .bar-row { grid-template-columns: 32px 1fr 56px; }
  .bar-track { grid-column: 2 / 4; grid-row: 2; }
}

.highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.hl { background: var(--surface); padding: 18px 20px; border-top: 3px solid var(--tc, var(--red)); }
.hl .k { font-size: 12px; color: var(--muted); font-weight: 700; }
.hl .v { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 28px; line-height: 1.15; margin-top: 4px; }
.hl .d { font-size: 13px; color: #c9c9d2; margin-top: 4px; }

/* ---------- teams page ---------- */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
@media (max-width: 400px) { .team-grid { grid-template-columns: 1fr; } }
.team-card { position: relative; background: var(--surface); overflow: hidden; display: flex; flex-direction: column; }
.team-card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--tc); }
.team-top { position: relative; padding: 22px 20px 0; display: flex; align-items: flex-start; gap: 12px; }
.team-pos {
  font-family: var(--display); font-style: italic; font-weight: 800; font-size: 20px; line-height: 1; padding: 6px 10px;
  background: var(--tc); color: #0a0a0c; transform: skewX(-12deg); flex: none;
}
.team-name { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 32px; line-height: 1; }
.team-base { color: var(--muted); font-size: 12px; margin-top: 4px; }
.team-pts { margin-left: auto; text-align: right; }
.team-pts b { display: block; font-family: var(--display); font-style: italic; font-weight: 800; font-size: 34px; line-height: 1; }
.team-pts span { font-size: 11px; color: var(--muted); }
.team-art { position: relative; padding: 8px 20px 0; }
.team-art::before { content: ''; position: absolute; left: 0; right: 0; bottom: 14px; height: 2px; background: repeating-linear-gradient(90deg, var(--line) 0 18px, transparent 18px 28px); }
.team-art .car { display: block; width: 100%; height: auto; position: relative; }
.team-meta { display: flex; gap: 16px; padding: 4px 20px 12px; font-size: 13px; color: var(--muted); }
.team-meta b { color: var(--text); font-family: var(--display); font-style: italic; font-size: 18px; margin-right: 4px; }
.drivers { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); margin-top: auto; }
.driver { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.driver:last-child { border-bottom: 0; }
.driver .helmet { width: 64px; height: auto; display: block; }
.driver .dn { font-weight: 900; line-height: 1.3; }
.driver .dn small { font-family: var(--display); font-style: italic; font-weight: 800; color: var(--tc); margin-left: 6px; font-size: 16px; }
.driver .dm { font-size: 12px; color: var(--muted); }
.driver .tenure { display: inline-block; margin-top: 2px; font-size: 11px; font-weight: 700; padding: 1px 8px; background: var(--surface-2); border-left: 3px solid var(--tc); }
.driver .dp { text-align: right; }
.driver .dp b { display: block; font-family: var(--display); font-style: italic; font-weight: 800; font-size: 24px; line-height: 1; }
.driver .dp span { font-size: 11px; color: var(--muted); }
.helmet-no { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 20px; fill: #0a0a0c; }

/* ---------- tabs / controls ---------- */
.tabs { display: flex; gap: 4px; margin: 24px 0 0; overflow-x: auto; border-bottom: 2px solid var(--line); }
.tab {
  background: none; border: 0; padding: 12px 18px; cursor: pointer; font-weight: 900; color: var(--muted); white-space: nowrap;
  position: relative; transform: skewX(-12deg);
}
.tab > span { display: inline-block; transform: skewX(12deg); }
.tab:hover { color: var(--text); background: var(--surface); }
.tab[aria-selected='true'] { color: #fff; background: var(--red); }
.panel { padding: 24px 0 48px; }
.panel[hidden] { display: none; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.seg { display: inline-flex; border: 1px solid var(--line); }
.seg button { background: none; border: 0; padding: 8px 16px; cursor: pointer; font-weight: 700; color: var(--muted); }
.seg button[aria-pressed='true'] { background: var(--text); color: var(--bg); }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
.select { position: relative; }
.select select {
  appearance: none; -webkit-appearance: none; background: var(--surface); border: 1px solid var(--line); padding: 8px 36px 8px 12px; cursor: pointer; min-width: 180px;
}
.select::after { content: ''; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

/* ---------- calendar ---------- */
.race-layout { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; }
.race-layout > div { min-width: 0; }
.calendar { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: calc(100vh - 140px); overflow-y: auto; position: sticky; top: 76px; }
.cal-btn {
  width: 100%; display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; text-align: left;
  background: var(--surface); border: 0; border-left: 4px solid transparent; padding: 8px 12px; cursor: pointer;
}
.cal-btn:hover { background: var(--surface-2); }
.cal-btn[aria-current='true'] { border-left-color: var(--red); background: var(--surface-2); }
.cal-btn .r { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 22px; color: var(--muted); }
.cal-btn[aria-current='true'] .r { color: var(--red); }
.cal-btn .n { font-weight: 700; font-size: 14px; line-height: 1.3; }
.cal-btn .dt { font-size: 11px; color: var(--muted); }
.cal-btn .w { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 15px; padding: 0 6px; border-right: 3px solid var(--tc); }
.spr-tag { display: inline-block; font-size: 10px; font-weight: 900; padding: 0 5px; margin-left: 4px; background: var(--red); color: #fff; vertical-align: 2px; }
@media (max-width: 900px) {
  .race-layout { grid-template-columns: 1fr; }
  .calendar { position: static; max-height: none; grid-auto-flow: column; grid-auto-columns: 170px; overflow-x: auto; overflow-y: hidden; padding-bottom: 6px; }
  .cal-btn { grid-template-columns: 30px 1fr; border-left: 0; border-top: 4px solid transparent; height: 100%; }
  .cal-btn[aria-current='true'] { border-top-color: var(--red); }
  .cal-btn .w { grid-column: 1 / -1; justify-self: start; }
}

.race-head { position: relative; padding: 20px 22px; background: var(--surface); margin-bottom: 16px; overflow: hidden; }
.race-head::after { content: attr(data-round); position: absolute; right: 10px; bottom: -18px; font-family: var(--display); font-style: italic; font-weight: 800; font-size: 120px; line-height: 1; color: rgba(255, 255, 255, .04); }
.race-head .rnd { font-family: var(--display); font-style: italic; font-weight: 700; color: var(--red); letter-spacing: .1em; }
.race-head h2 { margin: 2px 0 4px; font-family: var(--display); font-style: italic; font-weight: 800; font-size: clamp(30px, 5vw, 44px); line-height: 1.05; }
.race-head .meta { color: var(--muted); font-size: 13px; }
.podium { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; position: relative; z-index: 1; }
.podium div { background: var(--bg); padding: 6px 12px 6px 10px; border-left: 4px solid var(--tc); font-size: 13px; }
.podium .pp { font-family: var(--display); font-style: italic; font-weight: 800; margin-right: 6px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
thead th { background: var(--surface-2); font-size: 12px; color: var(--muted); font-weight: 700; position: sticky; top: 0; }
tbody tr:nth-child(even) { background: rgba(255, 255, 255, .015); }
tbody tr:hover { background: var(--surface); }
td.r, th.r { text-align: right; }
td.c, th.c { text-align: center; }
.pos { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 18px; width: 44px; }
tr.p1 .pos { color: var(--gold); } tr.p2 .pos { color: var(--silver); } tr.p3 .pos { color: var(--bronze); }
.dname { font-weight: 700; }
.dname .code { font-family: var(--display); font-style: italic; font-weight: 800; color: var(--muted); margin-left: 6px; }
.tchip { display: inline-flex; align-items: center; gap: 8px; }
.tchip::before { content: ''; width: 4px; height: 16px; background: var(--tc); transform: skewX(-15deg); flex: none; }
.ptsc { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 17px; }
.zero { color: var(--muted); opacity: .6; }
.status-bad { color: var(--red); font-weight: 700; }
.fl-badge { display: inline-block; font-size: 10px; font-weight: 900; padding: 1px 5px; background: #a020f0; color: #fff; }
.gain { font-size: 11px; margin-left: 4px; }
.gain.up { color: #39d98a; } .gain.down { color: var(--red); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th[aria-sort='descending']::after { content: ' ▼'; color: var(--red); }
th[aria-sort='ascending']::after { content: ' ▲'; color: var(--red); }
th.sortable button { all: unset; cursor: pointer; }
.empty { padding: 24px; text-align: center; color: var(--muted); }
@media (max-width: 560px) {
  th, td { padding: 8px 7px; font-size: 13px; }
  .hide-sm { display: none; }
}

/* ---------- chart ---------- */
.chart-box { position: relative; background: var(--surface); padding: 12px 8px 4px; }
.chart-box svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart-box .grid line { stroke: var(--line); }
.chart-box .axis text { fill: var(--muted); font-size: 11px; font-family: var(--display); font-style: italic; font-weight: 700; }
.chart-box .series path { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-box .series text { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 12px; }
.chart-box .guide { stroke: var(--text); stroke-opacity: .4; stroke-dasharray: 3 3; }
.tooltip {
  position: absolute; pointer-events: none; background: rgba(10, 10, 12, .95); border: 1px solid var(--line); padding: 8px 10px;
  font-size: 12px; min-width: 150px; z-index: 5; display: none;
}
.tooltip h4 { margin: 0 0 4px; font-size: 12px; color: var(--red); }
.tooltip div { display: flex; justify-content: space-between; gap: 12px; }
.tooltip i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: var(--tc); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); padding: 4px 10px;
  cursor: pointer; font-size: 13px; font-weight: 700; color: var(--muted);
}
.chip::before { content: ''; width: 10px; height: 10px; background: var(--tc); opacity: .35; }
.chip[aria-pressed='true'] { color: var(--text); border-color: var(--tc); }
.chip[aria-pressed='true']::before { opacity: 1; }
.chip.dashed::before { background: repeating-linear-gradient(90deg, var(--tc) 0 3px, transparent 3px 5px); }

/* ---------- driver view ---------- */
.dv-head { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: center; background: var(--surface); padding: 16px 20px; border-left: 6px solid var(--tc); margin-bottom: 12px; }
.dv-head .helmet { width: 96px; }
.dv-head h3 { margin: 0; font-family: var(--display); font-style: italic; font-weight: 800; font-size: 34px; line-height: 1.05; }
.dv-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.dv-stats { margin-bottom: 16px; }
.dv-stats .stat .v { font-size: 34px; }
.posbar { display: inline-block; height: 8px; background: var(--tc); vertical-align: middle; margin-left: 8px; transform: skewX(-20deg); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: 12px; margin-top: 24px; }
.site-footer p { margin: 0 0 6px; max-width: 90ch; }
.site-footer a { color: var(--text); }
.site-footer .logo b { font-size: 20px; }
