/* ============================================================
   Driver pages — extends styles.css tokens, does not redefine them.
   Team color arrives as --team-accent, set inline per driver page.
   Site palette (paper/ink/black-panel) is otherwise untouched —
   team color is scoped to the hero panel, chart, and small accents.
   ============================================================ */

/* ---------- /drivers list page ---------- */
.drivers-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.drivers-toolbar .search-box { flex: 1; min-width: 220px; }

.driver-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (min-width: 620px) { .driver-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .driver-grid { grid-template-columns: repeat(4, 1fr); } }

.driver-grid-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  display: block;
}
.driver-grid-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.driver-grid-card .team-chip {
  width: 22px; height: 22px;
  border-radius: 4px;
  margin-bottom: 12px;
  transform: rotate(45deg);
}
.driver-grid-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  text-transform: uppercase;
  margin: 0 0 2px;
  color: var(--ink);
}
.driver-grid-card .team-name { font-size: 12.5px; color: var(--ink-dim); }
.driver-grid-card .quick-stat {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-dim);
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
}
.driver-grid-card .quick-stat strong { color: var(--ink); }
.driver-grid-card.hidden { display: none; }

/* ---------- /drivers/[n] detail page ---------- */
.driver-hero {
  background: var(--black-panel);
  color: var(--on-black);
  position: relative;
  overflow: hidden;
}
.driver-hero-inner {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  padding: 40px 0 0;
  gap: 12px;
}
@media (min-width: 780px) {
  .driver-hero-inner { grid-template-columns: 1.15fr 0.85fr; padding: 56px 0 0; }
}
.driver-hero-speedlines {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg, transparent 0 60px, var(--team-accent-dim) 60px 62px, transparent 62px 140px);
  opacity: 0.55;
  pointer-events: none;
}
.driver-hero-text { position: relative; z-index: 1; }
.driver-hero-eyebrow {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--on-black-dim); margin-bottom: 10px;
}
.driver-hero-eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--team-accent); }
.driver-hero-text h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(38px, 6.5vw, 60px); line-height: 0.95; margin: 0;
  text-transform: uppercase; color: var(--on-black);
}
.driver-team-badge {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 12px; font-weight: 600; font-size: 14.5px; color: var(--team-accent);
}
.driver-team-badge .chip { width: 9px; height: 9px; background: var(--team-accent); transform: rotate(45deg); display: inline-block; }
.driver-number-tag {
  font-family: var(--font-mono); font-size: 12px; color: var(--on-black-dim);
  margin-top: 4px; letter-spacing: 0.06em;
}

.stat-toggle {
  display: inline-flex;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  padding: 4px;
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.stat-toggle button {
  border: none; background: transparent; color: var(--on-black-dim);
  padding: 8px 18px; border-radius: 999px; cursor: pointer; font-family: inherit;
}
.stat-toggle button.active { background: var(--team-accent); color: #fff; }

.driver-hero-art {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 280px;
}
.driver3d-stage { width: 100%; max-width: 320px; aspect-ratio: 1/1; cursor: grab; touch-action: none; }
.driver3d-stage canvas { width: 100%; height: 100%; display: block; }
.driver3d-controls {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  font-family: var(--font-mono); font-size: 11px; color: var(--on-black-dim);
  padding-bottom: 28px;
}
.driver3d-controls input[type="range"] { width: 140px; accent-color: var(--team-accent); }
.driver-hero.no-3d .driver3d-stage { display: none; }

/* ---------- stat tiles ---------- */
.driver-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line-soft);
  border-top: 1px solid var(--line-soft);
}
@media (min-width: 620px) { .driver-stats { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .driver-stats { grid-template-columns: repeat(6, 1fr); } }
.driver-stat-tile { background: var(--paper-2); padding: 22px 18px; }
.driver-stat-tile .tile-icon { color: var(--team-accent); font-size: 15px; margin-bottom: 8px; }
.driver-stat-tile .tile-value { font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1; color: var(--ink); }
.driver-stat-tile .tile-value.tbd { color: var(--ink-dim); font-size: 22px; }
.driver-stat-tile .tile-label { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 4px; }

/* ---------- round-by-round chart ---------- */
.driver-chart-wrap { padding: 36px 0; }
.driver-chart {
  display: flex; align-items: flex-end; gap: 5px; height: 130px;
  border-bottom: 1px solid var(--line); padding-bottom: 4px;
}
.driver-chart .bar { flex: 1; background: var(--team-accent); border-radius: 2px 2px 0 0; opacity: 0.92; min-height: 2px; }
.driver-chart .bar.future { background: var(--paper-3); }
.driver-chart .bar.unknown {
  background: repeating-linear-gradient(135deg, var(--paper-3) 0 4px, var(--paper-2) 4px 8px);
  border: 1px dashed var(--chrome);
  min-height: 22%;
}
.driver-chart-legend {
  display: flex; gap: 18px; margin-top: 10px;
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-dim);
}
.driver-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.driver-chart-legend .swatch { width: 10px; height: 10px; border-radius: 2px; }
.driver-chart-legend .swatch.scored { background: var(--team-accent); }
.driver-chart-legend .swatch.unknown { background: repeating-linear-gradient(135deg, var(--paper-3) 0 3px, var(--paper-2) 3px 6px); border: 1px dashed var(--chrome); }
.driver-chart-legend .swatch.future { background: var(--paper-3); }
.driver-chart-labels { display: flex; gap: 5px; margin-top: 6px; font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-dim); }
.driver-chart-labels span { flex: 1; text-align: center; }

/* ---------- bio ---------- */
.driver-bio { padding-bottom: 48px; max-width: 700px; }
.driver-bio p { color: var(--ink); }

/* ---------- page transition (in from the drivers list) ---------- */
.page-enter { animation: pageEnter 0.42s ease both; }
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .page-enter { animation: none; }
}
