/* Roblox LLM Leaderboard, Torpedo Software brand.
   Tokens mirror torpedosoftware.llc (src/styles/tokens.css). Dark theme is default.
   This sheet: tokens, element base styles, nav, the sonar hero, the shared
   controls (search + chips), and the about/footer sections. */

:root,
[data-theme="dark"] {
  --color-canvas: #0f1012;
  --color-surface: #17191c;
  --color-surface-raised: #1d1f23;
  --color-surface-sunken: #0a0b0d;
  --color-border-subtle: #24272b;
  --color-border: #313439;
  --color-border-strong: #474b53;
  --color-text-primary: #f2eee6;
  --color-text-secondary: #b6b7ba;
  --color-text-tertiary: #82858a;
  --color-primary: #4837c8;
  --color-primary-hover: #5140d5;
  --color-primary-contrast: #ffffff;
  --color-primary-soft: rgba(72, 55, 200, 0.16);
  --color-primary-bright: #7d6ee8; /* readable purple for text/points on dark */
  --color-accent: #e0a050;
  --color-accent-soft: #382915;
  --color-success: #4fb079;
  --color-warning: #e0a050;
  --color-danger: #e86058;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 2px 4px rgba(0, 0, 0, 0.32), 0 4px 8px rgba(0, 0, 0, 0.3);
  /* Purple-on-black reads fainter than purple-on-white, so dark theme gets a
     stronger sonar grid to keep the field equally legible on both. */
  --sonar-ring-opacity: 0.15;
  --sonar-spoke-opacity: 0.1;
  --sonar-crosshair-opacity: 0.15;
  --sonar-beam-opacity: 0.3;
  --score-tint: 72, 55, 200;
  --score-tint-max: 0.3;
  --scroll-shadow: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
  --color-canvas: #faf8f5;
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-sunken: #f3efe9;
  --color-border-subtle: #eae4da;
  --color-border: #d8d1c4;
  --color-border-strong: #b8ae9c;
  --color-text-primary: #0f1621;
  --color-text-secondary: #4a5568;
  --color-text-tertiary: #5a6577;
  --color-primary: #3224a5;
  --color-primary-hover: #3728ae;
  --color-primary-contrast: #ffffff;
  --color-primary-soft: #ece9fa;
  --color-primary-bright: #3224a5;
  --color-accent: #c68a3a;
  --color-accent-soft: #f7ebd5;
  --color-success: #2f7d4f;
  --color-warning: #b3701a;
  --color-danger: #b3322c;
  --shadow-1: 0 1px 2px rgba(23, 18, 9, 0.04), 0 1px 1px rgba(23, 18, 9, 0.06);
  --shadow-2: 0 2px 4px rgba(23, 18, 9, 0.05), 0 4px 8px rgba(23, 18, 9, 0.04);
  --sonar-ring-opacity: 0.06;
  --sonar-spoke-opacity: 0.05;
  --sonar-crosshair-opacity: 0.08;
  --sonar-beam-opacity: 0.2;
  --score-tint: 50, 36, 165;
  --score-tint-max: 0.26;
  --scroll-shadow: rgba(23, 18, 9, 0.2);
}

:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Big Shoulders Display", "Inter", sans-serif;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  --motion-fast: 160ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

/* The hidden attribute is the site's one hide mechanism, but the UA's
   [hidden] { display: none } loses to any author display (flex chips, grid
   panels). Restate it with !important so hidden always means hidden. */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  font-feature-settings: "tnum", "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 24px;
  background-color: var(--color-canvas);
  transition: background-color var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out);
}

a { color: var(--color-primary-bright); text-decoration: none; transition: color var(--motion-fast) var(--ease-out); }
a:hover { color: var(--color-primary-hover); text-decoration: underline; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

h1, h2, h3 { font-family: var(--font-display); text-transform: uppercase; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-canvas), 0 0 0 4px var(--color-primary);
  border-radius: var(--radius-sm);
}

/* Overline label: brand utility for eyebrows, table headers, captions */
.overline, thead th, .detail-grid h4 {
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Nav ---------- */

.site-nav {
  height: 56px;
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--color-canvas);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.nav-brand { display: inline-flex; align-items: center; height: 100%; padding: 10px 0; }
.nav-brand img { display: block; }
.wordmark { height: 100%; width: auto; }
[data-theme="dark"] .wordmark-light { display: none; }
[data-theme="light"] .wordmark-dark { display: none; }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a { color: var(--color-text-secondary); font-size: 13px; font-weight: 500; }
.nav-links a:hover { color: var(--color-text-primary); text-decoration: none; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 16px;
  color: var(--color-text-tertiary);
  border-radius: var(--radius-sm);
  transition: color var(--motion-fast) var(--ease-out), background-color var(--motion-fast) var(--ease-out),
    transform var(--motion-fast) var(--ease-out);
}
.theme-toggle:hover { color: var(--color-text-primary); background: var(--color-surface-sunken); }
.theme-toggle:active { transform: scale(0.98); }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark { display: none; }

/* ---------- Header / hero with sonar ---------- */

.site-header { position: relative; overflow: hidden; padding: 64px 0 72px; }

/* Sonar field (ported from the brand site's SonarBackground.tsx; see the
   comment in index.html for the performance rationale). The field sets
   `color` once and every layer paints with currentColor, so the whole sonar
   is theme-reactive; faintness comes from per-layer opacity tokens. */
.sonar-root {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.sonar-field {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 520px);
  aspect-ratio: 1;
  color: var(--color-primary);
}
@media (min-width: 768px) {
  .sonar-field { width: min(140vh, 1200px); }
}
.sonar-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* Promote to a cached GPU layer so the rotating beam (a sibling) never
     dirties the grid's picture-cache slice. */
  transform: translateZ(0);
  will-change: transform;
}
.sonar-grid circle, .sonar-grid line { stroke-width: 1; }
.sonar-ring { opacity: var(--sonar-ring-opacity); }
.sonar-spoke { opacity: var(--sonar-spoke-opacity); }
.sonar-crosshair { opacity: var(--sonar-crosshair-opacity); }

@keyframes sonar-sweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.sonar-beam {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  opacity: var(--sonar-beam-opacity);
  background-size: 100% 100%;
  animation: sonar-sweep 8s linear infinite;
  will-change: transform;
}

/* A ping bloom: pops in, peaks, fades, then stays dormant for the rest of the
   cycle. `backwards` fill holds the invisible 0% state through the delay so a
   delayed ping never shows un-animated on first paint. */
@keyframes sonar-ping {
  0% { opacity: 0; transform: scale(0.4); }
  4% { opacity: 1; transform: scale(1); }
  14% { opacity: 0; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(1.1); }
}
.sonar-ping-pos { position: absolute; }
.sonar-ping {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  opacity: 0.4;
  background: radial-gradient(circle, currentColor 0%, currentColor 35%, transparent 70%);
  animation: sonar-ping 8s linear infinite backwards;
  will-change: transform, opacity;
}

.site-header .wrap { position: relative; }

.eyebrow {
  font-size: 11px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary-bright);
  margin: 0 0 12px;
}

.site-header h1 {
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1.06;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
}
.site-header h1 .accent { color: var(--color-primary-bright); }

.lede { max-width: 620px; color: var(--color-text-secondary); font-size: 17px; line-height: 26px; margin: 0; }

.eval-cost-total {
  text-align: right;
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 20px;
  color: var(--color-text-tertiary);
}

.eval-cost-value {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--color-text-secondary);
}

/* Odometer / spinner for the animating cost value. Each digit lives in a
   fixed-height column and slides vertically as the number changes. */
.odo-col {
  position: relative;
  display: inline-block;
  height: 1em;
  line-height: 1em;
  /* Clip the sliding digits with clip-path rather than overflow: an
     inline-block with non-visible overflow takes its baseline from its bottom
     edge, which would drop the digits off the surrounding text's baseline;
     clip-path clips without disturbing the ::before reference baseline. */
  clip-path: inset(0);
  vertical-align: baseline;
  transition: opacity var(--motion-fast) var(--ease-out);
}
.odo-col::before {
  /* Invisible reference glyph: sets the column width and its text baseline
     so the sliding digits align with the surrounding text. */
  content: "0";
  visibility: hidden;
}
.odo-strip {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}
.odo-cell {
  display: block;
  height: 1em;
  line-height: 1em;
  text-align: center;
}

/* ---------- Controls ---------- */

.controls {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 14px 16px;
  margin-bottom: 20px;
  background: color-mix(in srgb, var(--color-canvas) 90%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
}

.search {
  flex: 1 1 220px;
  max-width: 360px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--color-text-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color var(--motion-fast) var(--ease-out);
}
.search:hover { border-color: var(--color-border-strong); }
.search::placeholder { color: var(--color-text-tertiary); }

.chip-group { display: inline-flex; gap: 4px; }

.chip {
  height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--color-text-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  transition: color var(--motion-fast) var(--ease-out), background-color var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out), transform var(--motion-fast) var(--ease-out);
}
.chip:hover { border-color: var(--color-border-strong); }
.chip:active { transform: scale(0.98); }
.chip.is-active {
  color: var(--color-primary-contrast);
  background: var(--color-primary);
  border-color: var(--color-primary);
}

/* ---------- About & footer ---------- */

.about { margin: 64px 0; }
.about-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.about-grid > div {
  padding: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
}
.about-grid h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; letter-spacing: 0.02em; }
.about-grid p { margin: 0; color: var(--color-text-secondary); font-size: 13px; line-height: 20px; }
.about-grid code {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--color-primary-bright);
  background: var(--color-primary-soft);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
}

.site-footer {
  padding: 28px 0 40px;
  border-top: 1px solid var(--color-border-subtle);
  color: var(--color-text-tertiary);
  font-size: 13px;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .site-header { padding: 40px 0 48px; }
  .wrap { padding: 0 16px; }
  .controls { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 50ms !important; animation-duration: 50ms !important; animation-iteration-count: 1 !important; }
  /* The sweep and pings hide under reduced motion, leaving the static grid. */
  .sonar-beam, .sonar-ping { display: none; }
}
