/* Shared styles for the static, crawlable content pages (how-to-connect, about, and the future
   prerendered data pages). Lives in public/ so it ships unhashed - these pages never mount the Svelte
   app, so they must not depend on Vite's hashed bundle. Brand tokens mirror shared/styles/tokens.css. */

:root {
  --accent: #E8933A;
  --accent-bright: #F0A54E;
  --accent-deep: #C97A2E;
  --bg: #0A0A0B;
  --surface-1: #111114;
  --surface-2: #16171C;
  --surface-3: #1E2028;
  --border-subtle: #23252E;
  --border-emphasis: #363944;
  --text-primary: #FAFAFA;
  --text-secondary: #A7ABB6;
  --text-tertiary: #6B6F7A;
  --success: #2ECC71;
  --danger: #E84B4B;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-secondary);
  font-family: 'Sora', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-bright); text-decoration: underline; }

/* Page chrome */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem clamp(1rem, 5vw, 2.5rem);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(10, 10, 11, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-header img { height: 30px; width: auto; display: block; }
.page-nav { display: flex; gap: clamp(0.9rem, 3vw, 1.6rem); align-items: center; }
.page-nav a {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.page-nav a:hover { color: var(--text-primary); text-decoration: none; }
.page-nav a.cta {
  color: var(--bg);
  background: var(--accent);
  padding: 0.45rem 0.9rem;
  border-radius: 7px;
}
.page-nav a.cta:hover { background: var(--accent-bright); }

main {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(2.2rem, 6vw, 4rem) clamp(1.1rem, 5vw, 1.5rem) 4rem;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 0.6rem;
}

h1 {
  color: var(--text-primary);
  font-size: clamp(2rem, 6vw, 2.9rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
h2 {
  color: var(--text-primary);
  font-size: clamp(1.3rem, 4vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 2.6rem 0 0.8rem;
}
h3 { color: var(--text-primary); font-size: 1.12rem; font-weight: 700; margin: 1.6rem 0 0.4rem; }

.lead { font-size: 1.18rem; color: var(--text-primary); margin: 0 0 1.6rem; }

p { margin: 0 0 1.1rem; }
ul, ol { margin: 0 0 1.2rem; padding-left: 1.3rem; }
li { margin: 0 0 0.5rem; }
strong { color: var(--text-primary); font-weight: 700; }

/* Step / callout cards */
.steps { list-style: none; counter-reset: step; padding: 0; margin: 1.4rem 0; }
.steps > li {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.1rem 1.2rem 1.1rem 3.4rem;
  margin: 0 0 0.9rem;
}
.steps > li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 1rem; top: 1.05rem;
  width: 1.7rem; height: 1.7rem;
  display: grid; place-items: center;
  background: var(--accent); color: var(--bg);
  font-weight: 800; font-size: 0.95rem;
  border-radius: 50%;
}
.steps > li strong { display: block; margin-bottom: 0.2rem; }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
  margin: 1.4rem 0;
}
.card p:last-child { margin-bottom: 0; }

.addr {
  font-family: ui-monospace, 'DM Mono', 'SF Mono', Menlo, monospace;
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.12rem 0.45rem;
  font-size: 0.92em;
  color: var(--text-primary);
}

.btn-row { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 1.4rem 0; }
.btn {
  display: inline-block;
  background: var(--accent); color: var(--bg);
  font-weight: 700; font-size: 0.98rem;
  padding: 0.7rem 1.3rem; border-radius: 8px;
}
/* Pin text colors on hover - the global `a:hover` rule would otherwise repaint the label amber on
   an amber background (it has higher specificity than `.btn` alone), blanking the button. */
.btn:hover { background: var(--accent-bright); color: var(--bg); text-decoration: none; }
.btn.secondary { background: transparent; color: var(--text-primary); border: 1px solid var(--border-emphasis); }
.btn.secondary:hover { border-color: var(--accent); background: var(--surface-1); color: var(--text-primary); text-decoration: none; }

/* Data tables (driver stats, recent races, leaderboard) */
.stats { width: 100%; border-collapse: collapse; margin: 1.4rem 0; font-size: 0.96rem; }
.stats th, .stats td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border-subtle); }
.stats tbody th { color: var(--text-tertiary); font-weight: 600; width: 45%; }
.stats td { color: var(--text-primary); }
.stats thead th { color: var(--text-tertiary); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; }
.stats.results td, .stats.leaderboard td, .stats.leaderboard th { white-space: nowrap; }
.stats .rank { color: var(--accent); font-weight: 700; }
.stats .up { color: var(--success); }
.stats .down { color: var(--danger); }
.stats.leaderboard td a { font-weight: 600; }
.stats tr:hover td { background: var(--surface-1); }

/* Results archive: collapsible race-night blocks + month index */
.session { margin: 0 0 0.6rem; border: 1px solid var(--border-subtle); border-radius: 10px; background: var(--surface-1); overflow: hidden; }
.session > summary {
  list-style: none; cursor: pointer; padding: 0.9rem 1.1rem;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.8rem;
  transition: background var(--transition-fast, 0.15s);
}
.session > summary::-webkit-details-marker { display: none; }
.session > summary::before { content: '▸'; color: var(--accent); margin-right: 0.5rem; transition: transform 0.15s; display: inline-block; }
.session[open] > summary::before { transform: rotate(90deg); }
.session > summary:hover { background: var(--surface-2); }
.session-day { color: var(--text-primary); font-weight: 700; }
.session > .stats { margin: 0 1.1rem 1rem; width: auto; }
.session-sub { color: var(--text-tertiary); font-size: 0.88rem; }

/* Sort/expand toolbar (added by results-sort.js; absent without JS) */
.sort-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.4rem 0 1rem; }
.sort-bar .sort-label { color: var(--text-tertiary); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; }
.sort-bar .sort-spacer { flex: 1; }
.sort-bar button {
  background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border-subtle);
  border-radius: 7px; padding: 0.35rem 0.7rem; font: inherit; font-size: 0.85rem; cursor: pointer;
}
.sort-bar button:hover { border-color: var(--border-emphasis); color: var(--text-primary); }
.sort-bar button.on { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }
.muted { color: var(--text-tertiary); font-size: 0.85em; }
.month-index { list-style: none; padding: 0; margin: 0.4rem 0 1.4rem;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.3rem 1.2rem; }
.month-index li { margin: 0; padding: 0.3rem 0; border-bottom: 1px solid var(--border-subtle); }

.page-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 2rem clamp(1rem, 5vw, 2.5rem);
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.88rem;
}
.page-footer a { color: var(--text-secondary); }
.page-footer .brand { color: var(--accent); font-weight: 700; letter-spacing: 0.04em; }

/* ---- Mobile ---- */
@media (max-width: 640px) {
  /* Header: stack the wordmark above a centered, wrapping nav so nothing clips and the Discord CTA
     stays on-screen + reachable (these static pages have no JS hamburger). */
  .page-header { flex-direction: column; gap: 0.7rem; padding-top: 0.9rem; padding-bottom: 0.9rem; }
  .page-nav { gap: 0.8rem 1.1rem; flex-wrap: wrap; justify-content: center; width: 100%; }
  .page-nav a { font-size: 0.9rem; }
  /* Wide data tables (results sessions, driver history, leaderboard) scroll instead of clipping. */
  .stats { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .month-index { grid-template-columns: 1fr; }
  .addr { font-size: 0.85em; }
}
