/* =====================================================================
   F1 2026 Telemetry Dashboard — theme
   Palette: carbon black, F1 red, titanium grey, DRS-purple accent
   ===================================================================== */

:root{
  --bg: #0a0b0d;
  --bg-raised: #101216;
  --bg-card: #15171c;
  --bg-card-hover: #1b1e25;
  --line: #2a2d34;
  --line-soft: #1e2127;

  --red: #e10600;
  --red-glow: #ff2b21;
  --purple: #9d4dff;
  --gold: #ffcf3f;
  --green: #17d67c;

  --text: #eef0f3;
  --text-dim: #9aa0ac;
  --text-faint: #5b616e;

  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Titillium Web', sans-serif;
  --font-mono: 'Chakra Petch', monospace;

  --radius: 10px;
}

*{ box-sizing: border-box; }
html{ color-scheme: dark; }

body{
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 1200px 600px at 15% -10%, rgba(225,6,0,0.10), transparent 60%),
    radial-gradient(ellipse 900px 500px at 100% 0%, rgba(157,77,255,0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  position: relative;
}

/* faint diagonal speed lines across the whole page */
.speed-lines{
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background-image: repeating-linear-gradient(
    115deg, #fff 0px, #fff 1px, transparent 1px, transparent 140px
  );
}

a{ color: var(--red-glow); }

::selection{ background: var(--red); color: #fff; }

/* ---------------------------------------------------------------- header */

.site-header{
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, #0d0e11 0%, #0a0b0d 100%);
  border-bottom: 1px solid var(--line);
}

.checkered-strip{
  height: 7px;
  background-image:
    linear-gradient(45deg, #000 25%, transparent 25%, transparent 75%, #000 75%, #000),
    linear-gradient(45deg, #000 25%, #fff 25%, #fff 75%, #000 75%, #000);
  background-size: 14px 14px;
  background-position: 0 0, 7px 7px;
  opacity: 0.85;
}
.checkered-strip.small{ height: 5px; background-size: 10px 10px; background-position: 0 0, 5px 5px; }

.header-inner{
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 28px 14px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand{ display: flex; align-items: center; gap: 14px; }

.brand-mark{
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 22px;
  background: var(--red);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  letter-spacing: 1px;
  box-shadow: 0 0 22px rgba(225,6,0,0.55), inset 0 -3px 0 rgba(0,0,0,0.25);
  transform: skew(-8deg);
}

.brand-text h1{
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 3px;
  margin: 0;
  line-height: 1;
}
.brand-text h1 .accent{ color: var(--red-glow); }
.brand-sub{
  margin: 4px 0 0;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.tabs{
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.tab-btn{
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 9px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tab-num{
  font-size: 10px;
  color: var(--text-faint);
  font-weight: 700;
}
.tab-btn:hover{
  color: var(--text);
  background: var(--bg-card);
  border-color: var(--line);
}
.tab-btn.active{
  color: #fff;
  background: linear-gradient(135deg, var(--red), #a80400);
  box-shadow: 0 2px 14px rgba(225,6,0,0.4);
}
.tab-btn.active .tab-num{ color: rgba(255,255,255,0.75); }

.lights{ display: flex; gap: 5px; }
.lights span{
  width: 9px; height: 9px; border-radius: 50%;
  background: #2a1010;
  box-shadow: inset 0 0 2px #000;
}
.lights span:nth-child(1){ animation: light-on 3.2s infinite; animation-delay: 0s; }
.lights span:nth-child(2){ animation: light-on 3.2s infinite; animation-delay: 0.3s; }
.lights span:nth-child(3){ animation: light-on 3.2s infinite; animation-delay: 0.6s; }
.lights span:nth-child(4){ animation: light-on 3.2s infinite; animation-delay: 0.9s; }
.lights span:nth-child(5){ animation: light-on 3.2s infinite; animation-delay: 1.2s; }

@keyframes light-on{
  0%, 60%{ background: #2a1010; box-shadow: inset 0 0 2px #000; }
  65%, 90%{ background: var(--red); box-shadow: 0 0 8px var(--red-glow); }
  100%{ background: #2a1010; box-shadow: inset 0 0 2px #000; }
}

/* ---------------------------------------------------------------- layout */

main{
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 28px 80px;
  position: relative;
  z-index: 1;
}

.tab-panel{ display: none; animation: fade-in 0.25s ease; }
.tab-panel.active{ display: block; }

@keyframes fade-in{
  from{ opacity: 0; transform: translateY(6px); }
  to{ opacity: 1; transform: translateY(0); }
}

.panel-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 16px;
}

.panel-head h2{
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: 0.5px;
}

.chip{
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--red-glow);
  border: 1px solid rgba(225,6,0,0.4);
  background: rgba(225,6,0,0.08);
  padding: 4px 9px;
  border-radius: 5px;
}

.status-line{
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-faint);
}
.status-line.error{ color: var(--red-glow); }
.status-line.ok{ color: var(--green); }

/* ---------------------------------------------------------------- schedule */

.event-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.event-card{
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 14px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.event-card::before{
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--line);
  transition: background 0.15s ease;
}
.event-card.is-past::before{ background: var(--text-faint); }
.event-card.is-next::before{ background: var(--red); box-shadow: 0 0 12px var(--red-glow); }
.event-card:hover{ border-color: #3a3d46; transform: translateY(-2px); }

.event-round{
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 1px;
  display: flex;
  justify-content: space-between;
}
.badge-next{
  color: var(--red-glow);
  font-weight: 700;
}
.badge-done{ color: var(--text-faint); }

.event-name{
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin: 6px 0 2px;
  letter-spacing: 0.3px;
}
.event-loc{
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.session-list{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.session-pill{
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 5px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.12s ease;
}
.session-pill:hover{
  border-color: var(--red);
  color: #fff;
  background: rgba(225,6,0,0.15);
}
.session-pill .s-date{
  color: var(--text-faint);
  margin-left: 5px;
}

.results-drawer{
  margin-top: 14px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  display: none;
}
.results-drawer.open{ display: block; }

.results-table{
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.results-table th{
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.5px;
  color: var(--text-faint);
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
}
.results-table td{
  padding: 5px 6px;
  border-bottom: 1px solid var(--line-soft);
}
.results-table tr:last-child td{ border-bottom: none; }
.team-swatch{
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

/* ---------------------------------------------------------------- standings */

.standings-grid{
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
}
@media (max-width: 800px){ .standings-grid{ grid-template-columns: 1fr; } }

.col-title{
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 10px;
}

.standings-table{
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.standings-table th{
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.8px;
  color: var(--text-faint);
  background: var(--bg-raised);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.standings-table td{
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
}
.standings-table tr:last-child td{ border-bottom: none; }
.standings-table tr:hover td{ background: var(--bg-card-hover); }

.pos-cell{
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-dim);
  width: 32px;
}
.pos-cell.p1{ color: var(--gold); }
.pos-cell.p2{ color: #d8dbe0; }
.pos-cell.p3{ color: #cd7f32; }

.driver-name{ font-weight: 600; }
.team-name-cell{ display: flex; align-items: center; color: var(--text-dim); font-size: 12.5px; }
.pts-cell{ font-family: var(--font-mono); font-weight: 700; text-align: right; }

/* ---------------------------------------------------------------- telemetry */

.telemetry-controls{
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 22px;
}

.control{ display: flex; flex-direction: column; gap: 6px; min-width: 170px; }
.control label{
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-faint);
  text-transform: uppercase;
}
.control .hint{ font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-faint); }
.control .hint.dim{ font-family: var(--font-body); font-size: 12.5px; padding: 6px 0; }

select{
  font-family: var(--font-body);
  font-size: 13.5px;
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  min-width: 180px;
}
select:disabled{ opacity: 0.45; cursor: not-allowed; }
select:focus{ outline: none; border-color: var(--red); }

.drivers-control{ flex: 1; min-width: 260px; }
.driver-checks{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
  align-items: center;
}
.driver-chip{
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  cursor: pointer;
  user-select: none;
  transition: all 0.12s ease;
  color: var(--text-dim);
}
.driver-chip input{ display: none; }
.driver-chip .dot{ width: 9px; height: 9px; border-radius: 50%; flex: none; }
.driver-chip.checked{
  color: #fff;
  border-color: currentColor;
  background: rgba(255,255,255,0.06);
}
.driver-chip.disabled{ opacity: 0.35; cursor: not-allowed; }

.btn-primary{
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(135deg, var(--red), #a80400);
  border: none;
  border-radius: 7px;
  padding: 11px 20px;
  cursor: pointer;
  box-shadow: 0 3px 16px rgba(225,6,0,0.35);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-primary:hover:not(:disabled){ transform: translateY(-1px); box-shadow: 0 5px 20px rgba(225,6,0,0.5); }
.btn-primary:disabled{ opacity: 0.35; cursor: not-allowed; box-shadow: none; }
.btn-icon{ font-size: 11px; }

.loading-wrap{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px 20px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 13px;
}
.hidden{ display: none !important; }

.tire-spinner{
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 5px solid var(--line);
  border-top-color: var(--red);
  border-right-color: var(--red-glow);
  animation: spin 0.9s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }

.lap-summary{
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 20px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.lap-summary-item{ display: flex; align-items: center; gap: 8px; }
.lap-summary-item .dot{ width: 10px; height: 10px; border-radius: 50%; }
.lap-summary-item .lt{ color: var(--text); font-weight: 700; }
.lap-summary-item .meta{ color: var(--text-faint); }

.telemetry-charts{
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chart-card{
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.chart-card h4{
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.chart-card h4 .unit{ color: var(--text-faint); font-weight: 400; text-transform: none; letter-spacing: 0; }

.chart-canvas-wrap{ position: relative; height: 220px; }
.chart-canvas-wrap.chart-tall{ height: 320px; }
.chart-canvas-wrap.chart-short{ height: 130px; }
.chart-canvas-wrap canvas{ position: absolute; inset: 0; width: 100% !important; height: 100% !important; }

/* ---------------------------------------------------------------- globe */

.globe-layout{
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.globe-stage{
  position: relative;
  width: 420px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  flex: none;
}

.globe-stage canvas{
  width: 100%;
  height: 100%;
  cursor: grab;
  opacity: 0;
  transition: opacity 1s ease;
  touch-action: none;
}

.globe-legend{
  flex: 1;
  min-width: 260px;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.globe-legend-item{
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 12px;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.globe-legend-item:hover{ border-color: #3a3d46; background: var(--bg-card-hover); }
.globe-legend-item.hovered{ border-color: var(--red); box-shadow: 0 0 0 1px rgba(225,6,0,0.3); }

.gl-round{
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  width: 20px;
  flex: none;
}
.gl-event{ flex: 1; font-size: 13px; }
.gl-event .gl-country{ display: block; font-size: 11px; color: var(--text-faint); }
.gl-winner{
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

/* ---------------------------------------------------------------- footer */

.site-footer{ margin-top: 40px; }
.site-footer p{
  text-align: center;
  font-size: 11.5px;
  color: var(--text-faint);
  padding: 16px 10px 30px;
  font-family: var(--font-mono);
}

/* ---------------------------------------------------------------- misc */

@media (max-width: 760px){
  .header-inner{ flex-wrap: wrap; gap: 14px; padding: 16px 16px 12px; }
  .tabs{ margin-left: 0; order: 3; width: 100%; }
  .lights{ display: none; }
  .tab-btn{ flex: 1; justify-content: center; }
}
