/* =============================================================
   scorecard.css — shared base
   Variables, reset, body, a11y primitives, focus, motion,
   sr-only/skip-link, spinner, toast, loading overlay.
   ============================================================= */

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:        #0f1419;
  --surface:   #1a1f2e;
  --surface2:  #222836;

  /* Borders — a11y-improved (transparent so they sit nicely on any surface) */
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.16);

  /* Text — a11y-improved (text3 lightened for 4.5:1 contrast on --bg) */
  --text:      #f0f0f0;
  --text2:     #c0c0c0;
  --text3:     #9a9aa0;

  /* Player / side identity */
  --home:      #22d3ee;
  --away:      #fbbf24;
  --home-bg:     #1a2535;
  --home-border: #1e3a5f;
  --away-bg:     #2a1f0a;
  --away-border: #3d2e00;

  /* Status */
  --green:   #22c55e;
  --red:     #ef4444;
  --warn:    #f97316;
  --neutral: #22d3ee;     /* cyan accent for neutral interactive emphasis */

  /* Geometry */
  --radius:    5px;
  --radius-lg: 10px;
}

/* ── RESET ─────────────────────────────────────────────────── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, sans-serif;
}

/* ── A11Y: FOCUS INDICATOR ────────────────────────────────────
   :focus-visible only fires on keyboard navigation, not mouse clicks. */
:focus { outline: none; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
details:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--home);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ── A11Y: REDUCED MOTION ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── A11Y: VISUALLY HIDDEN (screen-reader only) ──────────── */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── A11Y: SKIP LINK ──────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -40px; left: 0;
  z-index: 100;
  background: var(--home);
  color: #000;
  padding: 8px 16px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { top: 0; }

/* ── SPINNER ──────────────────────────────────────────────── */
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border2);
  border-top-color: var(--home);
  border-radius: 50%;
  animation: sc-spin 0.8s linear infinite;
}
.spinner.lg { width: 32px; height: 32px; }
@keyframes sc-spin { to { transform: rotate(360deg); } }

/* ── LOADING OVERLAY ──────────────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 12px;
  z-index: 300;
}
.loading-overlay.scrim {
  background: rgba(0,0,0,0.75);
}
.loading-text {
  font-size: 13px;
  color: var(--text2);
}

/* ── TOAST ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 30px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  z-index: 200;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--red); color: #fca5a5; }
/* Top-anchored variant (used by setup) */
.toast.top {
  bottom: auto;
  top: 12px;
  transform: translateX(-50%) translateY(-80px);
}
.toast.top.show { transform: translateX(-50%) translateY(0); }
