/* Shared look for the report and the dashboard.
   Palette taken from the F1 team-colour poster: black-to-red backdrop, team colour
   cards with checkered tops, condensed white name plates. */

:root {
  --ferrari: #DC0000;
  --williams: #1E44FF;
  --mclaren: #FD8000;
  --redbull: #2A3472;
  --mercedes: #00A09A;
  --aston: #097A68;
  --alpine: #FF67ED;
  --haas: #AB0101;
  --sauber: #53E254;
  --vcarb: #58B6FF;
  --academy: #C54CFF;
  --f1grey: #979797;
  --f1red: #FC1F04;

  --bg: #000;
  --panel: #111114;
  --panel-2: #18181d;
  --line: #26262d;
  --ink: #F2F2F5;
  --ink-2: #B9B9C3;
  --ink-3: #85858F;

  --display: "Bebas Neue", "Oswald", Impact, sans-serif;
  --body: "Titillium Web", "Segoe UI", system-ui, sans-serif;
  --radius: 4px;
  --max: 1160px;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  /* The poster's backdrop, black at the top fading to red at the bottom, with soft red and
     reddish-orange glows at staggered points down the sides. The glows are sized relative to
     the page, so each page gets the same rhythm however long it is; the centre and the gaps
     between glows stay dark. */
  background:
    radial-gradient(ellipse 45% 9% at 100% 6%, rgba(255, 77, 28, 0.20), transparent 70%),
    radial-gradient(ellipse 40% 10% at 0% 22%, rgba(220, 0, 0, 0.24), transparent 70%),
    radial-gradient(ellipse 45% 11% at 100% 40%, rgba(255, 90, 24, 0.24), transparent 70%),
    radial-gradient(ellipse 45% 11% at 0% 57%, rgba(252, 31, 4, 0.30), transparent 70%),
    radial-gradient(ellipse 50% 12% at 100% 74%, rgba(255, 77, 28, 0.34), transparent 70%),
    linear-gradient(180deg, #000 0%, #030000 30%, #120001 50%, #3a0401 70%, #8a0c02 84%,
      #E3180A 94%, #FF4D1C 100%);
}

a { color: var(--vcarb); }
a:hover { color: #fff; }

h1, h2, h3, .display {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.05;
  margin: 0;
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* ---------- navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 3px solid var(--f1red);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 60px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand-mark { width: 54px; height: 22px; display: block; }
.brand-text { font-family: var(--display); font-size: 26px; letter-spacing: 0.04em; white-space: nowrap; }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  font-family: var(--display);
  font-size: 20px;
  letter-spacing: 0.05em;
  color: var(--ink-2);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius);
}
.nav-links a:hover { color: #fff; background: var(--panel-2); }
.nav-links a[aria-current="page"] { color: #fff; background: var(--f1red); }

/* ---------- checkered strip (the poster's card tops) ---------- */
.checker {
  --c: var(--f1red);
  --sq: 10px;
  height: calc(var(--sq) * 2);
  background: repeating-conic-gradient(var(--c) 0 25%, #0a0a0a 0 50%) 0 0 / calc(var(--sq) * 2) calc(var(--sq) * 2);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-body { padding: 18px 20px 20px; }

/* team name plate, like the poster's labels */
.plate {
  display: inline-block;
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--c, var(--f1red));
  padding: 3px 12px 1px;
  border-radius: 2px;
}

/* ---------- hero ---------- */
.hero { padding: 56px 0 28px; }
.hero .eyebrow {
  font-family: var(--display);
  color: var(--f1red);
  font-size: 22px;
  letter-spacing: 0.12em;
}
.hero h1 { font-size: clamp(48px, 9vw, 104px); margin: 6px 0 10px; }
.hero h1 span { color: var(--f1red); }
.byline { color: var(--ink-2); font-size: 16px; margin: 0 0 22px; }
.byline strong { color: #fff; }
.summary { max-width: 860px; font-size: 19px; color: var(--ink); }

/* ---------- stat tiles ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin: 28px 0 8px;
}
.stat .card-body { padding: 14px 16px 16px; }
.stat-value { font-family: var(--display); font-size: 44px; line-height: 1; color: #fff; }
.stat-label { margin-top: 6px; font-size: 14px; line-height: 1.35; color: var(--ink-2); }
.stat .checker { --sq: 7px; }

/* ---------- report sections ---------- */
.section { margin: 36px 0; }
.section .card-body { padding: 26px 28px 28px; }
.section-num { font-family: var(--display); font-size: 18px; letter-spacing: 0.12em; color: var(--ink-3); }
.section h2 { font-size: clamp(30px, 4.2vw, 44px); margin: 4px 0 14px; }
.section p { margin: 0 0 14px; color: var(--ink); max-width: 820px; }
.section p .hl { color: #fff; font-weight: 700; }
.chart-title { font-weight: 700; font-size: 15px; color: var(--ink-2); margin: 20px 0 8px; }
.chart-box { position: relative; height: 360px; }
.chart-box.tall { height: 440px; }
.chart-note { font-size: 13px; color: var(--ink-3); margin-top: 8px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 6px; font-size: 14px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }

.about dl { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 10px 20px; margin: 10px 0 0; }
.about dt { font-weight: 700; color: #fff; }
.about dd { margin: 0; color: var(--ink); }
.about code { font-size: 14px; background: var(--panel-2); padding: 1px 5px; border-radius: 3px; }

.cta { display: flex; justify-content: center; margin: 40px 0 10px; }
.btn {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--f1red);
  border: 0;
  border-radius: var(--radius);
  padding: 10px 26px 7px;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: #fff; color: #000; }
.btn.ghost { background: transparent; border: 1px solid var(--ink-3); color: var(--ink); font-size: 18px; padding: 7px 16px 4px; }
.btn.ghost:hover { border-color: #fff; background: #fff; color: #000; }

footer { padding: 30px 0 90px; color: #fff; font-size: 14px; text-align: center; }
footer p { margin: 4px 0; }
footer a { color: #fff; }

/* ---------- dashboard ---------- */
.dash-head { padding: 34px 0 14px; }
.dash-head h1 { font-size: clamp(40px, 6vw, 64px); }
.dash-head p { color: var(--ink-2); margin: 6px 0 0; max-width: 820px; }

.controls { padding: 16px 18px 18px; }
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.field label {
  display: block;
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  margin-bottom: 4px;
}
.field select {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid #34343d;
  border-radius: var(--radius);
  padding: 7px 8px;
}
.field select:focus-visible, .seg button:focus-visible, .btn:focus-visible, th button:focus-visible {
  outline: 2px solid var(--vcarb);
  outline-offset: 2px;
}
.switches { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: flex-end; margin-top: 16px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button {
  font: inherit;
  font-size: 14px;
  color: var(--ink-2);
  background: var(--panel-2);
  border: 1px solid #34343d;
  border-radius: var(--radius);
  padding: 5px 11px;
  cursor: pointer;
}
.seg button:hover { color: #fff; border-color: var(--ink-3); }
.seg button[aria-pressed="true"] { color: #fff; background: var(--f1red); border-color: var(--f1red); }
.switches .reset { margin-left: auto; }
.status { margin-top: 12px; font-size: 14px; color: var(--ink-3); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 12px; margin: 18px 0; }
.kpis .card-body { padding: 12px 12px 14px; }
.kpis .stat-value { font-size: 32px; }
.kpis .stat-sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }

/* globe */
.globe-card { margin-bottom: 16px; }
.globe-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: center; }
.globe-box { width: 100%; max-width: 460px; aspect-ratio: 1; margin: 0 auto; }
.globe-svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; user-select: none; }
.globe-svg.dragging { cursor: grabbing; }
.globe-svg.zoomed { cursor: zoom-out; }
.globe-svg.zoomed.dragging { cursor: grabbing; }
.globe-svg circle { cursor: pointer; }
.globe-svg circle:hover { stroke-width: 2.5; }
.globe-info h3 { font-size: 34px; margin: 0 0 4px; }
.globe-info .eyebrow { font-family: var(--display); font-size: 16px; letter-spacing: 0.12em; color: var(--ink-3); }
.globe-info p { margin: 8px 0 12px; color: var(--ink); }
.globe-info ul { list-style: none; padding: 0; margin: 0 0 14px; }
.globe-info li { padding: 7px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }
.globe-info li .sub { color: var(--ink-3); font-size: 14px; }
.globe-info li b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.globe-info .linkish {
  font: inherit; color: var(--ink); background: none; border: 0; padding: 0; text-align: left; cursor: pointer;
  text-decoration: underline; text-decoration-color: rgba(255,255,255,0.3); text-underline-offset: 3px;
}
.globe-info .linkish:hover { color: #fff; text-decoration-color: var(--f1red); }
.globe-info .linkish:focus-visible { outline: 2px solid var(--vcarb); outline-offset: 2px; }
.globe-info .hint { font-size: 13px; color: var(--ink-3); margin: 0; }
.track-box { height: 210px; margin: 8px 0 2px; }
.track-box svg { width: 100%; height: 100%; display: block; }
.track-missing { color: var(--ink-3); font-size: 14px; margin: 0; padding-top: 90px; text-align: center; }
.track-cap { font-size: 13px; color: var(--ink-3); margin-bottom: 10px; text-align: center; }
.track-cap:empty { display: none; }
.globe-info li .grow { flex: 1; }
.mini-track { flex: none; width: 54px; height: 38px; align-self: center; }
.mini-track svg { width: 100%; height: 100%; display: block; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2 .card-body { padding: 16px 18px 18px; }
.grid-2 h3 { font-size: 24px; margin-bottom: 8px; }
.grid-2 .chart-box { height: 330px; }

.table-card { margin: 16px 0 10px; }
.table-card h3 { font-size: 24px; margin-bottom: 8px; }
.table-scroll { max-height: 520px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
thead th { position: sticky; top: 0; background: var(--panel-2); z-index: 1; }
th button {
  font: inherit;
  font-weight: 700;
  color: var(--ink-2);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
th button:hover { color: #fff; }
th.sorted button { color: #fff; }
td.active, th.active { background: rgba(252, 31, 4, 0.12); }
tbody tr:hover td { background: var(--panel-2); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: 0; }
.empty { padding: 40px 0; text-align: center; color: var(--ink-2); }

@media (max-width: 820px) {
  .brand-text { font-size: 21px; }
  .globe-layout { grid-template-columns: 1fr; gap: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .section .card-body { padding: 20px 18px 22px; }
  .about dl { grid-template-columns: 1fr; gap: 2px; }
  .about dd { margin-bottom: 10px; }
  .chart-box, .chart-box.tall { height: 300px; }
  .switches .reset { margin-left: 0; }
}
@media (max-width: 620px) {
  .brand-text { display: none; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .nav-links a { font-size: 18px; padding: 6px 9px; }
  .stat-value { font-size: 36px; }
}

/* ---------- music player (both pages) ---------- */
.music {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 8px;
  background: rgba(14, 14, 18, 0.82);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}
.music-play {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--f1red);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 0 0 rgba(252, 31, 4, 0.6);
}
.music-play svg { width: 20px; height: 20px; }
.music-play:hover { background: #ff4a2a; }
.music-play:focus-visible, .music-vol:focus-visible { outline: 2px solid var(--vcarb); outline-offset: 3px; }
.music.is-playing .music-play { box-shadow: 0 0 16px 2px rgba(252, 31, 4, 0.55); }
.music-meta { line-height: 1.2; }
.music-title { font-family: var(--display); font-size: 19px; letter-spacing: 0.06em; color: #fff; }
.music-sub { font-size: 12px; color: var(--ink-3); }
.music-eq { display: flex; align-items: flex-end; gap: 2px; height: 16px; width: 18px; }
.music-eq i { flex: 1; height: 3px; background: var(--f1red); border-radius: 1px; }
.music.is-playing .music-eq i { animation: music-eq 0.9s ease-in-out infinite; }
.music.is-playing .music-eq i:nth-child(2) { animation-delay: -0.3s; }
.music.is-playing .music-eq i:nth-child(3) { animation-delay: -0.6s; }
.music.is-playing .music-eq i:nth-child(4) { animation-delay: -0.15s; }
@keyframes music-eq { 0%, 100% { height: 3px; } 50% { height: 16px; } }
.music-vol { width: 90px; accent-color: var(--f1red); cursor: pointer; }
@media (max-width: 620px) {
  .music { right: 12px; bottom: 12px; padding: 6px; gap: 0; }
  .music-meta, .music-vol, .music-eq { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .music.is-playing .music-eq i { animation: none; height: 10px; }
}
