/* F1 Fonts */
@font-face {
  font-family: 'Formula1';
  src: url('../assets/fonts/Formula1-Regular_web_0.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Formula1';
  src: url('../assets/fonts/Formula1-Bold_web_0.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Formula1Wide';
  src: url('../assets/fonts/Formula1-Wide_web_0.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --navy-deepest: #060e1c;
  --navy-deep: #0a1628;
  --navy-mid: #0d1f3c;
  --navy-light: #122040;
  --navy-border: #1a3a6e;
  --blue-accent: #3b8de0;
  --blue-bright: #5aaaf0;
  --blue-dim: rgba(59,141,224,0.15);
  --blue-border: rgba(59,141,224,0.25);
  --text-primary: #e8f0fa;
  --text-secondary: #8ba4c8;
  --text-muted: #4a6a94;
  --gold: #c8a840;
  --silver: #9daab8;
  --bronze: #b06030;
  --font-display: 'Formula1', sans-serif;
  --font-wide: 'Formula1Wide', sans-serif;
  --font-body: 'Formula1', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 8px;
  --radius-lg: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--navy-deepest);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  min-height: 100vh;
}

/* ── NAV ── */

.nav-logo {
  display: flex;
  align-items: center; 
  text-decoration: none;
}

.logo-img {
  height: 40px; 
  width: auto;  
  display: block;
}

.nav-logo-pip {
  margin-right: 10px;
}

#nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--navy-deep);
  border-bottom: 1px solid var(--blue-border);
  display: flex; align-items: center;
  padding: 0 1.5rem; height: 56px;
  gap: 2rem;
}

.nav-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text-primary);
  font-family: var(--font-wide);
  font-size: 13px; font-weight: 400; letter-spacing: 1px;
}

.nav-logo-pip {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--blue-accent);
  box-shadow: 0 0 8px var(--blue-accent);
}

.nav-links {
  display: flex; gap: 2px; margin-left: auto;
  list-style: none;
}

.nav-links a {
  display: block;
  font-family: var(--font-display);
  font-size: 13px; font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  transition: all 0.15s;
  text-transform: uppercase;
}

.nav-links a:hover { color: var(--text-primary); background: var(--blue-dim); }
.nav-links a.active { color: var(--blue-bright); background: var(--blue-dim); }

/* ── HERO STRIP ── */
.hero-strip {
  background: var(--navy-mid);
  border-bottom: 1px solid var(--blue-border);
  padding: 2rem 1.5rem 1.5rem;
  position: relative; overflow: hidden;
}

.hero-strip::after {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 300px; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(59,141,224,0.04));
  pointer-events: none;
}

.hero-eyebrow {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--blue-accent); margin-bottom: 0.5rem;
}

.hero-title {
  font-family: var(--font-wide);
  font-size: 24px; font-weight: 400;
  color: #fff; line-height: 1.1;
  margin-bottom: 0.5rem;
}

.hero-sub {
  color: var(--text-secondary); font-size: 14px;
  max-width: 500px;
}

.hero-stats {
  display: flex; gap: 2rem; margin-top: 1.25rem;
}

.hero-stat .val {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700;
  color: var(--blue-accent); line-height: 1;
}

.hero-stat .lbl {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-top: 3px;
}

/* ── PAGE LAYOUT ── */
.page-container {
  max-width: 1100px; margin: 0 auto;
  padding: 2rem 1.5rem;
}

.section-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-secondary);
}

/* ── CARDS ── */
.card {
  background: var(--navy-mid);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.stat-card {
  background: var(--navy-light);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.stat-card .s-label {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stat-card .s-val {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 700;
  color: var(--text-primary);
}

.stat-card .s-sub {
  font-size: 12px; color: var(--text-secondary);
  margin-top: 2px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px; margin-bottom: 1.5rem;
}

/* ── TABS ── */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--blue-border);
  margin-bottom: 1.5rem;
}

.tab-btn {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 500;
  letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--text-muted);
  background: none; border: none;
  padding: 10px 18px;
  border-bottom: 2px solid transparent;
  cursor: pointer; transition: all 0.15s;
  margin-bottom: -1px;
}

.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active { color: var(--blue-accent); border-bottom-color: var(--blue-accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── STANDINGS TABLE ── */
.standings-table {
  width: 100%; border-collapse: collapse;
  font-size: 14px;
}

.standings-table th {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-muted);
  text-align: left; padding: 8px 12px;
  border-bottom: 1px solid var(--blue-border);
}

.standings-table th:not(:nth-child(1)):not(:nth-child(2)):not(:nth-child(3)) { text-align: center; }

.standings-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(59,141,224,0.07);
  color: var(--text-secondary);
  vertical-align: middle;
}

.standings-table td:not(:nth-child(1)):not(:nth-child(2)):not(:nth-child(3)) { text-align: center; }

.standings-table tbody tr { transition: background 0.1s; }
.standings-table tbody tr:hover td { background: rgba(59,141,224,0.05); }
.standings-table tbody tr.leader td { background: rgba(59,141,224,0.08); }

.pos-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 5px;
  font-family: var(--font-display); font-size: 13px; font-weight: 700;
  background: var(--navy-light); color: var(--text-secondary);
}

.pos-badge.p1 { background: var(--gold); color: #1a1000; }
.pos-badge.p2 { background: var(--silver); color: #1a1a20; }
.pos-badge.p3 { background: var(--bronze); color: #fff; }

.driver-name-cell {
  display: flex; align-items: center; gap: 8px;
}

.driver-flag { font-size: 16px; }

.driver-name-link {
  color: var(--text-primary); font-weight: 500;
  text-decoration: none; transition: color 0.15s;
}

.driver-name-link:hover { color: var(--blue-bright); }

.team-pill {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.3px;
  padding: 2px 9px;
  border-radius: 10px;
  border: 1px solid;
  white-space: nowrap;
}

.pts-cell {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 700;
  color: var(--text-primary);
}

.gap-cell {
  font-family: var(--font-mono);
  font-size: 12px; color: var(--text-muted);
}

/* ── RACE CALENDAR ── */
.race-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.race-card {
  background: var(--navy-light);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer; transition: all 0.15s;
  text-decoration: none;
  display: block;
}

.race-card:hover {
  border-color: var(--blue-accent);
  background: rgba(59,141,224,0.08);
  transform: translateY(-1px);
}

.race-round {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 4px;
}

.race-name {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 2px;
  line-height: 1.2;
}

.race-circuit {
  font-size: 12px; color: var(--text-secondary);
}

.race-date {
  font-size: 11px; color: var(--text-muted);
  margin-top: 8px;
}

.race-status-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.5px; text-transform: uppercase;
  padding: 2px 7px; border-radius: 4px;
  margin-top: 6px;
}

.status-complete { background: rgba(30,180,100,0.15); color: #40c878; border: 1px solid rgba(30,180,100,0.3); }
.status-upcoming { background: var(--blue-dim); color: var(--blue-bright); border: 1px solid var(--blue-border); }
.status-live { background: rgba(200,40,40,0.2); color: #f06060; border: 1px solid rgba(200,40,40,0.4);
  animation: pulse-live 1.5s ease-in-out infinite; }

@keyframes pulse-live {
  0%, 100% { opacity: 1; } 50% { opacity: 0.6; }
}

/* ── DRIVER CARD (grid) ── */
.driver-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.driver-card {
  background: var(--navy-light);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  text-decoration: none;
  display: block;
  transition: all 0.15s;
}

.driver-card:hover {
  border-color: var(--blue-accent);
  background: rgba(59,141,224,0.06);
  transform: translateY(-2px);
}

.driver-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 16px; font-weight: 700;
  color: #fff; margin-bottom: 10px;
  background: var(--navy-mid);
  border: 2px solid var(--blue-border);
}

.driver-card-name {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2; margin-bottom: 4px;
}

.driver-card-meta {
  font-size: 12px; color: var(--text-secondary);
}

/* ── SEASON SELECTOR ── */
.season-selector {
  display: flex; gap: 6px;
}

.season-btn {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 600;
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid var(--blue-border);
  background: none; color: var(--text-muted);
  cursor: pointer; transition: all 0.15s;
}

.season-btn:hover { color: var(--text-secondary); background: var(--blue-dim); }
.season-btn.active { background: var(--blue-accent); color: #fff; border-color: var(--blue-accent); }

/* ── MODAL ── */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 200;
  background: rgba(6,14,28,0.85);
  align-items: center; justify-content: center;
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--navy-mid);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius-lg);
  width: 90%; max-width: 700px;
  max-height: 85vh; overflow-y: auto;
  padding: 1.5rem;
  position: relative;
}

.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: var(--blue-dim); border: none;
  color: var(--text-secondary); width: 30px; height: 30px;
  border-radius: 50%; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}

.modal-close:hover { background: rgba(59,141,224,0.3); color: var(--text-primary); }

/* ── PODIUM CARDS ── */
.podium-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 1.5rem;
}

.podium-card {
  background: var(--navy-light);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.podium-card.p1 { border-color: rgba(200,168,64,0.4); background: rgba(200,168,64,0.06); }
.podium-card.p2 { border-color: rgba(157,170,184,0.4); background: rgba(157,170,184,0.04); }
.podium-card.p3 { border-color: rgba(176,96,48,0.3); background: rgba(176,96,48,0.04); }

.podium-pos {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  margin-bottom: 4px;
}

.podium-card.p1 .podium-pos { color: var(--gold); }
.podium-card.p2 .podium-pos { color: var(--silver); }
.podium-card.p3 .podium-pos { color: var(--bronze); }

.podium-driver {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
  color: var(--text-primary);
}

.podium-team { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--blue-border);
  background: var(--navy-deep);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted); font-size: 13px;
}

footer a { color: var(--blue-accent); text-decoration: none; }

/* ── BUTTONS ── */
.btn {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.5px; text-transform: uppercase;
  padding: 8px 18px; border-radius: var(--radius);
  border: 1px solid; cursor: pointer; transition: all 0.15s;
  text-decoration: none; display: inline-block;
}

.btn-primary {
  background: var(--blue-accent); color: #fff;
  border-color: var(--blue-accent);
}
.btn-primary:hover { background: var(--blue-bright); border-color: var(--blue-bright); }

.btn-ghost {
  background: none; color: var(--text-secondary);
  border-color: var(--blue-border);
}
.btn-ghost:hover { color: var(--text-primary); background: var(--blue-dim); border-color: var(--blue-accent); }

/* ── UTILS ── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--blue-accent); }
.font-display { font-family: var(--font-display); }

.divider {
  border: none; border-top: 1px solid var(--blue-border);
  margin: 1.5rem 0;
}

.pill {
  display: inline-block;
  font-family: var(--font-display); font-size: 11px;
  font-weight: 600; letter-spacing: 0.3px;
  padding: 2px 9px; border-radius: 10px;
  background: var(--blue-dim); color: var(--blue-bright);
  border: 1px solid var(--blue-border);
}

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-display); font-size: 12px;
  font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--text-muted); text-decoration: none;
  transition: color 0.15s; margin-bottom: 1.5rem;
}
.back-link:hover { color: var(--blue-accent); }

/* ── RESPONSIVE ── */
@media (max-width: 700px) {
  .hero-stats { gap: 1rem; }
  .hero-title { font-size: 18px; }
  .podium-row { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .race-grid { grid-template-columns: 1fr 1fr; }
}

/* Twemoji flag sizing */
img.emoji {
  height: 1.2em;
  width: 1.2em;
  vertical-align: -0.2em;
  display: inline-block;
}
.driver-tile-flag img.emoji {
  height: 2em;
  width: 2em;
  vertical-align: middle;
}
.driver-avatar-lg img.emoji {
  height: 3em;
  width: 3em;
}
.nav-tile-icon img.emoji {
  height: 1.4em;
  width: 1.4em;
}
