/* === @font-face — local copies in cloud/public/fonts/ === */
@font-face {
  font-family: 'Gunplay';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url('../fonts/GunplayRg-subset.woff2') format('woff2');
}
@font-face {
  font-family: 'HelveticaNow';
  font-style: normal;
  font-weight: 100 900;
  font-display: block;
  src: url('../fonts/HelveticaNow-subset.woff2') format('woff2');
}

/* === DESIGN TOKENS (per 11-WEBSITE-SPEC.md) === */
:root {
  --bg-primary: #0a0a12;
  --bg-secondary: #12121f;
  --bg-waveform: #060612;
  --brand-blue: #017bfc;
  --brand-yellow: #f3b652;
  --brand-red: #f15f59;
  --brand-green: #7ed7ac;
  --text-primary: #e8e8f0;
  --text-muted: rgba(232, 232, 240, 0.45);
  --border-subtle: rgba(232, 232, 240, 0.08);
}

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

/* === BASE === */
html { font-size: 16px; }
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'HelveticaNow', 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

/* === TYPOGRAPHY === */
.wordmark {
  font-family: 'Gunplay', 'Impact', 'Arial Black', sans-serif;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: clamp(2rem, 6vw, 4rem);
  color: #e6e6e6;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.5),
    0 4px 0 rgba(0, 0, 0, 0.35),
    0 6px 10px rgba(0, 0, 0, 0.6),
    0 0 20px var(--brand-blue),
    0 0 40px var(--brand-blue);
}
.section-heading {
  font-family: 'Gunplay', 'Impact', 'Arial Black', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: #e6e6e6;
  font-weight: 400;
  margin-bottom: 1.5rem;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.5),
    0 4px 0 rgba(0, 0, 0, 0.35),
    0 6px 10px rgba(0, 0, 0, 0.6);
}

/* === LAYOUT === */
.container { max-width: 960px; margin: 0 auto; padding: 0 1rem; }

/* === HEADER / NAV === */
.site-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 0;
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.site-nav { display: flex; gap: 0.5rem; }
.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.site-nav a:hover, .site-nav a.active { color: var(--text-primary); background: rgba(1, 123, 252, 0.15); }

/* === HERO === */
.hero {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border-subtle);
}
.hero .container { display: flex; flex-direction: column; gap: 1.5rem; }
.stats-bar { display: flex; gap: 2rem; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; gap: 0.25rem; }
.stat-value {
  font-family: 'HelveticaNow', 'Helvetica Neue', Arial, sans-serif;
  font-variation-settings: "wdth" 90, "opsz" 20, "wght" 800;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stats-bar .stat:nth-child(1) .stat-value { color: var(--brand-blue); }
.stats-bar .stat:nth-child(2) .stat-value { color: var(--brand-yellow); }
.stats-bar .stat:nth-child(3) .stat-value { color: var(--brand-green); }
.stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); }
.hero-subtitle {
  font-family: 'HelveticaNow', 'Helvetica Neue', Arial, sans-serif;
  max-width: 640px;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-top: 0.5rem;
}

/* === LEADERBOARD TABLE (desktop) === */
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table thead th {
  font-family: 'HelveticaNow', 'Helvetica Neue', Arial, sans-serif;
  font-variation-settings: "wdth" 90, "opsz" 14, "wght" 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}
.lb-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.1s;
}
.lb-table tbody tr:hover { background: rgba(1, 123, 252, 0.05); }
.lb-table td {
  padding: 0.65rem 0.75rem;
  font-family: 'HelveticaNow', 'Helvetica Neue', Arial, sans-serif;
  font-variation-settings: "wdth" 90, "opsz" 24, "wght" 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  font-size: 1rem;
}

/* === RANK TREATMENT — white/amber/green per booth palette === */
/* Desktop table rows */
.lb-table tbody tr.rank-1 {
  background: rgba(1, 123, 252, 0.08);
  border-left: 3px solid var(--brand-blue);
}
.lb-table tbody tr.rank-1 td { color: #ffffff; }
.lb-table tbody tr.rank-1 .lb-rank {
  font-weight: 800;
  font-size: 1.1em;
  color: var(--brand-blue);
  text-shadow: 0 0 12px var(--brand-blue), 0 0 24px rgba(1, 123, 252, 0.5);
}
.lb-table tbody tr.rank-2-3 {
  background: rgba(243, 182, 82, 0.07);
}
.lb-table tbody tr.rank-2-3 td { color: var(--brand-yellow); }
.lb-table tbody tr.rank-4plus td { color: var(--brand-green); }

/* Mobile cards */
.lb-card.rank-1 {
  border-left: 3px solid var(--brand-blue);
  background: rgba(1, 123, 252, 0.10);
}
.lb-card.rank-1 .lb-card-rank,
.lb-card.rank-1 .lb-card-name,
.lb-card.rank-1 .lb-card-meta,
.lb-card.rank-1 .lb-card-score { color: #ffffff; }
.lb-card.rank-1 .lb-card-rank {
  color: var(--brand-blue);
  font-weight: 800;
  text-shadow: 0 0 12px var(--brand-blue), 0 0 24px rgba(1, 123, 252, 0.5);
}
.lb-card.rank-2-3 {
  background: rgba(243, 182, 82, 0.08);
}
.lb-card.rank-2-3 .lb-card-rank,
.lb-card.rank-2-3 .lb-card-name,
.lb-card.rank-2-3 .lb-card-meta,
.lb-card.rank-2-3 .lb-card-score { color: var(--brand-yellow); }
.lb-card.rank-4plus .lb-card-rank,
.lb-card.rank-4plus .lb-card-name,
.lb-card.rank-4plus .lb-card-meta,
.lb-card.rank-4plus .lb-card-score { color: var(--brand-green); }

/* === LEADERBOARD CARD (mobile) === */
.lb-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.lb-card-rank {
  font-size: 1.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 2.5rem;
  font-family: 'HelveticaNow', 'Helvetica Neue', Arial, sans-serif;
  font-variation-settings: "wdth" 90, "opsz" 20, "wght" 800;
  letter-spacing: -0.01em;
}
.lb-card-info { flex: 1; min-width: 0; }
.lb-card-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'HelveticaNow', 'Helvetica Neue', Arial, sans-serif;
  font-variation-settings: "wdth" 90, "opsz" 16, "wght" 700;
  letter-spacing: -0.01em;
}
.lb-card-meta { font-size: 0.75rem; color: var(--text-muted); }
.lb-card-score {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-family: 'HelveticaNow', 'Helvetica Neue', Arial, sans-serif;
  font-variation-settings: "wdth" 90, "opsz" 18, "wght" 700;
  letter-spacing: -0.01em;
}

/* === EVENT CARDS === */
.event-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text-primary);
  display: block;
  transition: border-color 0.15s, transform 0.1s;
}
.event-card:hover { border-color: var(--brand-blue); transform: translateY(-1px); }
.event-card-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.25rem; }
.event-card-meta { font-size: 0.8rem; color: var(--text-muted); display: flex; gap: 1rem; flex-wrap: wrap; }

/* === FOOTER === */
.site-footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.site-footer a { color: var(--brand-blue); text-decoration: none; }

/* === STALE INDICATOR === */
.stale-indicator { font-size: 0.75rem; color: var(--text-muted); text-align: right; margin-top: 0.5rem; }

/* === LOADING / EMPTY STATES === */
.loading { color: var(--text-muted); text-align: center; padding: 3rem; }
.empty { color: var(--text-muted); text-align: center; padding: 2rem; }

/* === SECTION === */
.section { padding: 2rem 0; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.lb-stack { display: flex; flex-direction: column; gap: 0.5rem; }

/* === EVENT META === */
.event-meta-header {
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}
.event-title {
  font-family: 'Gunplay', 'Impact', 'Arial Black', sans-serif;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.5),
    0 4px 0 rgba(0, 0, 0, 0.35),
    0 6px 10px rgba(0, 0, 0, 0.6);
}
.event-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
}
.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: inline-block;
  margin-bottom: 1rem;
  transition: color 0.15s;
}
.back-link:hover { color: var(--text-primary); }

/* === RESPONSIVE: desktop shows table, mobile shows cards === */
@media (min-width: 640px) {
  .lb-stack { display: none; }
  .lb-table { display: table; }
}
@media (max-width: 639px) {
  .lb-stack { display: flex; }
  .lb-table { display: none; }
}

/* === PHASE 12: US MAP === */
.map-section {
  padding: 1.5rem 0 0;
}
.map-section .container {
  position: relative;
}
.map-svg {
  width: 100%;
  max-width: 720px;            /* ~60% of 1200px desktop content width per D-10 */
  max-height: 480px;
  height: auto;
  display: block;
  margin: 0 auto;
}
.us-states path {
  fill: #1a1a2e;
  stroke: rgba(1, 123, 252, 0.35);
  stroke-width: 0.75;
}

/* Pins: anchor + visible circle + hit overlay (24px tap target per WCAG 2.5.8) */
.pin { cursor: pointer; }
.pin .pin-visible {
  stroke: var(--bg-primary);
  stroke-width: 2;
  r: 8;
}
.pin .pin-hit {
  fill: transparent;
  pointer-events: all;
  r: 12;
}
.pin-past .pin-visible { fill: var(--brand-yellow); }
.pin-live .pin-visible {
  fill: var(--brand-green);
  animation: pin-pulse 2s ease-in-out infinite;
}

@keyframes pin-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* Page Visibility integration (Pitfall #6): JS toggles .paused on .map-svg */
.map-svg.paused .pin-live .pin-visible {
  animation-play-state: paused;
}

/* Honor user preference (RESEARCH Open Question 6: stop pulse, keep green color) */
@media (prefers-reduced-motion: reduce) {
  .pin-live .pin-visible {
    animation: none;
    opacity: 1;
  }
}

/* Empty state inside SVG */
.map-empty {
  fill: var(--text-muted);
  font-size: 14px;
  font-family: 'HelveticaNow', 'Helvetica Neue', Arial, sans-serif;
}

/* Mobile: larger pins for tap target */
@media (max-width: 639px) {
  .pin .pin-visible { r: 12; }
  .pin .pin-hit { r: 16; }
}
