/* ==========================================================================
   game-sens — Overwatch scoped sensitivity explainer
   Light/dark via prefers-color-scheme, WCAG AA contrast in both.
   ========================================================================== */

:root {
  --bg: #f5f8f9;
  --bg-card: #ffffff;
  --text: #1a1d21;
  --text-muted: #4c5560;   /* 7.4:1 on --bg */
  --accent: #0e918c;       /* turquoise, 4.6:1 on white */
  --accent-text: #0a7a76;
  --accent2: #c4367a;      /* pink, used for highlights */
  --border: #c8dade;
  --formula-bg: #e8f4f4;
  --focus: #0e918c;
  --table-stripe: #eef5f5;
  /* chart colors read by JS */
  --chart-grid: #d0e0e0;
  --chart-tick: #4c5560;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111a1c;
    --bg-card: #182224;
    --text: #e8eaed;
    --text-muted: #b0b8c1;  /* 8.6:1 on --bg */
    --accent: #3dd6cf;      /* turquoise light, 8.5:1 on #111a1c */
    --accent-text: #3dd6cf;
    --accent2: #f06aa5;     /* pink light */
    --border: #2a3e40;
    --formula-bg: #1a2e30;
    --focus: #3dd6cf;
    --table-stripe: #162628;
    --chart-grid: #2a3e40;
    --chart-tick: #b0b8c1;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}

header, main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
}
main { padding-bottom: 3rem; }

header { padding-top: 2rem; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.2; margin-bottom: 0.25rem; }
.tagline { color: var(--text-muted); font-size: 1.1rem; margin-top: 0; }

h2 {
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  border-bottom: 2px solid var(--accent2);
  padding-bottom: 0.25rem;
  margin-top: 2.5rem;
}
h3 { font-size: 1.15rem; margin-top: 1.75rem; }

a { color: var(--accent-text); }
a:hover { text-decoration-thickness: 2px; }

/* Visible focus states everywhere */
a:focus-visible,
input:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- nav ------------------------------------------------------------- */
nav ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}
nav a { font-weight: 600; text-decoration: none; }
nav a:hover { text-decoration: underline; }

/* --- calculator ------------------------------------------------------ */
.calc-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin: 1rem 0;
}
.control label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
.control output { color: var(--accent2); font-variant-numeric: tabular-nums; }
.control input[type="range"] { width: 100%; accent-color: var(--accent2); }
.help { color: var(--text-muted); font-size: 0.9rem; margin: 0.4rem 0 0; }

.status {
  min-height: 1.5em;
  font-weight: 600;
  color: var(--accent-text);
}

/* --- tables ----------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table {
  border-collapse: collapse;
  width: 100%;
  background: var(--bg-card);
  font-variant-numeric: tabular-nums;
}
caption {
  text-align: left;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.4rem 0;
}
th, td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}
thead th { background: var(--formula-bg); }
tbody tr:nth-child(even) { background: var(--table-stripe); }
td.your-value { font-weight: 700; color: var(--accent2); }

.fineprint { color: var(--text-muted); font-size: 0.9rem; }

/* --- charts ------------------------------------------------------------ */
.chart-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}
.chart-block h3 { margin-top: 0.25rem; }
.chart-frame { position: relative; height: 340px; }
@media (max-width: 600px) { .chart-frame { height: 260px; } }

/* --- formulas ----------------------------------------------------------- */
.formula {
  background: var(--formula-bg);
  border-left: 4px solid var(--accent2);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 1.05rem;
  overflow-x: auto;
}
/* --- diagram ------------------------------------------------------------ */
.diagram-figure { margin: 1.5rem 0; }
.diagram {
  width: 100%;
  height: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.d-eye { fill: var(--accent); }
.d-screen { stroke: var(--text); stroke-width: 5; }
.d-rays line { stroke: var(--text-muted); stroke-width: 1.5; stroke-dasharray: 6 4; }
.d-hits circle { fill: var(--accent); }
.d-arcs path { fill: none; stroke: var(--accent2); stroke-width: 2; }
.d-angle text { fill: var(--accent2); font-size: 13px; font-family: inherit; }
.d-label { fill: var(--text); font-size: 14px; font-family: inherit; }
.d-brace { stroke: var(--accent); stroke-width: 3; }
.d-brace2 { opacity: 0.6; }
figcaption { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.5rem; }

/* --- a11y helper ------------------------------------------------------------ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
