/* ============================================================
   RACE DECODE — Telemetry Terminal
   Shared system: tokens, type, primitives
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Geist+Mono:wght@300;400;500;600;700;800&family=Inter+Tight:wght@400;500;600;700;800;900&display=swap');

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

:root {
  /* Palette — F1 race flag */
  --bg:        #0a0a0a;
  --bg-1:      #0f0f0f;
  --bg-2:      #141414;
  --line:      #1f1f1f;
  --line-2:    #2a2a2a;
  --line-3:    #3a3a3a;
  --txt:       #f5f5f5;
  --txt-2:     #a8a8a8;
  --txt-3:     #6e6e6e;
  --txt-4:     #4a4a4a;
  --red:       #e10600;   /* F1 red — accent */
  --red-dim:   #8a0400;
  --red-glow:  #e1060040;
  --amber:     #ffb800;
  --green:     #00d166;
  --cyan:      #00d4ff;

  /* Team colors (kept for results) */
  --merc:      #00d2be;
  --fer:       #e8002d;
  --rb:        #3671c6;
  --mcl:       #ff8000;

  /* Type */
  --mono:      'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;
  --mono-alt:  'JetBrains Mono', ui-monospace, monospace;
  --sans:      'Inter Tight', -apple-system, system-ui, sans-serif;
}

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  font-feature-settings: 'tnum' 1, 'ss01' 1;
  overflow-x: hidden;
  min-height: 100vh;
}

/* CRT-ish vertical scanline backdrop */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(255,255,255,.012) 2px 3px),
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(225,6,0,.06), transparent 60%);
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: screen;
}

/* ============================================================
   TERMINAL CHROME
   ============================================================ */
.term-frame {
  position: relative;
  z-index: 2;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Top status bar — like Bloomberg/terminal command bar */
.term-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: stretch;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  height: 32px;
}
.term-bar-cell {
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px;
  border-right: 1px solid var(--line);
  color: var(--txt-3);
  white-space: nowrap;
}
.term-bar-cell.brand { color: var(--txt); font-weight: 700; letter-spacing: .14em; }
.term-bar-cell.brand .dot {
  width: 6px; height: 6px; background: var(--red); border-radius: 50%;
  box-shadow: 0 0 8px var(--red);
  animation: pulse 1.6s ease-in-out infinite;
}
.term-bar-cell.live { color: var(--red); }
.term-bar-cell.spacer { flex: 1; border-right: 1px solid var(--line); }
.term-bar-cell.right { border-right: none; border-left: 1px solid var(--line); }
.term-bar-cell.clickable { cursor: pointer; transition: color .15s, background .15s; }
.term-bar-cell.clickable:hover { color: var(--txt); background: var(--bg-2); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

/* ============================================================
   STANDINGS TICKER — scrolling driver standings
   ============================================================ */
.ticker {
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
  overflow: hidden;
  position: relative;
  height: 36px;
  display: flex;
  align-items: center;
  z-index: 2;
}
.ticker-label {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--bg);
  background: var(--red);
  padding: 4px 14px;
  height: 100%;
  display: flex; align-items: center;
  position: relative;
  z-index: 2;
}
.ticker-track {
  display: flex;
  gap: 0;
  white-space: nowrap;
  animation: ticker-scroll 80s linear infinite;
  flex-shrink: 0;
  padding-left: 0;
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  font-family: var(--mono);
  font-size: 11px;
  border-right: 1px solid var(--line);
  color: var(--txt-2);
}
.ticker-pos {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  color: var(--txt-4);
  min-width: 16px;
}
.ticker-code { color: var(--txt); font-weight: 600; letter-spacing: .04em; }
.ticker-pts { color: var(--txt-2); }
.ticker-delta { color: var(--green); font-size: 10px; }
.ticker-delta.dn { color: var(--red); }
.ticker-team-bar { width: 3px; height: 14px; border-radius: 1px; }

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ============================================================
   COMMON
   ============================================================ */
.section-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .22em;
  color: var(--txt-3);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.section-label::before {
  content: '';
  width: 8px; height: 8px;
  background: var(--red);
  flex-shrink: 0;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line-2), transparent);
}

.hairline { height: 1px; background: var(--line); width: 100%; }

/* ============================================================
   FOOTER
   ============================================================ */
.term-footer {
  position: relative;
  z-index: 2;
  margin-top: 80px;
  border-top: 1px solid var(--line);
  padding: 32px 24px 40px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--txt-3);
  letter-spacing: .08em;
}
.term-footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  flex-wrap: wrap;
}
.term-footer-block { display: flex; flex-direction: column; gap: 6px; }
.term-footer-block strong { color: var(--txt); font-weight: 700; letter-spacing: .14em; }
.term-footer-block a { color: var(--txt-3); text-decoration: none; transition: color .15s; }
.term-footer-block a:hover { color: var(--red); }

/* Chequered — bottom decoration */
.cheq {
  display: flex; gap: 0; height: 8px; margin-top: 12px;
  background: repeating-linear-gradient(90deg, var(--txt) 0 8px, transparent 8px 16px);
  opacity: .12;
  width: 100%;
}

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

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
