/* =========================================================================
   ScreenTest Pro — Shared Design System
   FROZEN after Phase 1. Do not edit from page-specific subagents.
   ========================================================================= */

/* ---------- Design tokens ---------- */
:root {
  /* Surfaces */
  --bg: #f5f6f8;
  --bg-alt: #ffffff;
  --panel-dark: #1b1d22;
  --panel-dark-alt: #24262c;
  --border: #dfe2e7;
  --border-dark: #33353c;

  /* Text */
  --text: #1a1c20;
  --text-muted: #565b64;
  --text-on-dark: #f4f5f7;
  --text-on-dark-muted: #a7acb6;

  /* Accent colors — one per test category. Subagents must not invent new ones. */
  --accent-home: #2d5bff;
  --accent-resolution: #2d5bff;
  --accent-refresh: #ff6b35;
  --accent-color: #9b5de5;
  --accent-oled: #00b894;
  --accent-hdr: #ffb400;
  --accent-touch: #ff2d78;
  --accent-calc: #00a8cc;

  /* Type scale (major third-ish) */
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.375rem;
  --fs-xl: 1.75rem;
  --fs-2xl: 2.25rem;
  --fs-3xl: 3rem;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  /* Spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;

  /* Radius / shadow */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(20, 22, 26, 0.08);
  --shadow-md: 0 4px 16px rgba(20, 22, 26, 0.10);
  --shadow-lg: 0 12px 32px rgba(20, 22, 26, 0.14);

  /* Layout */
  --max-width: 1200px;
  --nav-height: 64px;
  --touch-target: 44px;

  color-scheme: light;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 var(--sp-3); font-weight: 700; }
p { margin: 0 0 var(--sp-4); }
ul, ol { margin: 0 0 var(--sp-4); padding-left: 1.25em; }
button { font-family: inherit; }

/* Visible focus for keyboard users — WCAG 2.4.7 */
:focus-visible {
  outline: 3px solid var(--accent-home);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--panel-dark);
  color: var(--text-on-dark);
  padding: var(--sp-3) var(--sp-4);
  z-index: 1000;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--sp-5);
}
.section { padding: var(--sp-7) 0; }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.row { display: flex; flex-wrap: wrap; gap: var(--sp-4); align-items: center; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--sp-5);
}
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* ---------- Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 800;
  font-size: var(--fs-md);
  text-decoration: none;
  color: var(--text);
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-home), var(--accent-oled));
  flex: none;
}
.main-nav { display: flex; gap: var(--sp-1); flex-wrap: wrap; }
.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-target);
  padding: 0 var(--sp-3);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
}
.main-nav a:hover { background: var(--bg); color: var(--text); }
.main-nav a[aria-current="page"] { color: var(--accent-home); background: #eef1ff; }
.nav-toggle {
  display: none;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  border: 1px solid var(--border);
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--touch-target);
  min-width: var(--touch-target);
  padding: 0 var(--sp-5);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-weight: 700;
  font-size: var(--fs-sm);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent-home); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { box-shadow: var(--shadow-md); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn--ghost:hover { background: var(--bg); }
.btn--on-dark { background: rgba(255,255,255,0.12); color: var(--text-on-dark); border-color: rgba(255,255,255,0.24); }
.btn--on-dark:hover { background: rgba(255,255,255,0.2); }
.btn--sm { min-height: 36px; padding: 0 var(--sp-4); font-size: var(--fs-xs); }
.btn-group { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
/* Shared pressed/active toggle-button state — promoted in Phase 3 from
   duplicated per-page rules (resolution, refresh-rate, oled-motion, homepage
   device chips all reinvented this independently). */
.btn[aria-pressed="true"] {
  background: var(--accent-home);
  border-color: var(--accent-home);
  color: #fff;
}
.btn--on-dark[aria-pressed="true"] {
  background: #fff;
  border-color: #fff;
  color: var(--panel-dark);
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card--link { display: block; text-decoration: none; color: inherit; }
.card__icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--sp-3);
  font-size: 1.25rem;
  color: #fff;
}
.card__title { font-size: var(--fs-md); margin-bottom: var(--sp-2); }
.card__desc { color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: 0; }

/* Accent-colored card icon utility classes */
.accent-home     { background: var(--accent-home); }
.accent-resolution { background: var(--accent-resolution); }
.accent-refresh  { background: var(--accent-refresh); }
.accent-color    { background: var(--accent-color); }
.accent-oled     { background: var(--accent-oled); }
.accent-hdr      { background: var(--accent-hdr); }
.accent-touch    { background: var(--accent-touch); }
.accent-calc     { background: var(--accent-calc); }

.text-accent-home     { color: var(--accent-home); }
.text-accent-resolution { color: var(--accent-resolution); }
.text-accent-refresh  { color: var(--accent-refresh); }
.text-accent-color    { color: var(--accent-color); }
.text-accent-oled     { color: var(--accent-oled); }
.text-accent-hdr      { color: var(--accent-hdr); }
.text-accent-touch    { color: var(--accent-touch); }
.text-accent-calc     { color: var(--accent-calc); }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 700;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.badge--soon { background: #fff4e0; border-color: #ffe0a3; color: #8a5a00; }

/* ---------- Test panel (dark charcoal test surface) ---------- */
.test-panel {
  background: var(--panel-dark);
  color: var(--text-on-dark);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.test-panel__label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-on-dark-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-2);
}
.test-panel__value {
  font-family: var(--font-mono);
  font-size: var(--fs-xl);
  font-weight: 700;
}
.test-panel--fullscreen-target {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-4);
}
.stat {
  background: var(--panel-dark-alt);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
}
.stat__label {
  font-size: var(--fs-xs);
  color: var(--text-on-dark-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--sp-1);
}
.stat__value {
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  font-weight: 700;
}

/* ---------- Disclaimer banner ---------- */
.disclaimer {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  background: #fff8e6;
  border: 1px solid #f0dca0;
  color: #6b5100;
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-5);
}
.disclaimer__icon { flex: none; font-size: 1.1rem; line-height: 1.4; }

/* ---------- Hero ---------- */
.hero {
  padding: var(--sp-8) 0 var(--sp-7);
  text-align: center;
}
.hero h1 {
  font-size: var(--fs-3xl);
  margin-bottom: var(--sp-4);
  letter-spacing: -0.02em;
}
.hero p.lead {
  font-size: var(--fs-md);
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto var(--sp-6);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--sp-6) 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.site-footer .row { justify-content: space-between; }
.footer-links { display: flex; gap: var(--sp-4); flex-wrap: wrap; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* ---------- Form controls (range/select shared look) ---------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field label { font-size: var(--fs-sm); font-weight: 600; }
.field input[type="range"] { width: 100%; accent-color: var(--accent-home); min-height: var(--touch-target); }
.field input[type="number"],
.field select {
  min-height: var(--touch-target);
  padding: 0 var(--sp-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-alt);
  font-size: var(--fs-base);
}

/* ---------- Responsive breakpoints ----------
   phone: <600px (default)
   tablet: 600–899px
   laptop: 900–1279px
   monitor: 1280–1919px
   tv / large: >=1920px
------------------------------------------------ */
@media (max-width: 899px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .main-nav {
    position: absolute;
    top: var(--nav-height);
    left: 0; right: 0;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: var(--sp-3);
    display: none;
  }
  .main-nav.is-open { display: flex; }
  .main-nav a { width: 100%; }
  .hero h1 { font-size: var(--fs-2xl); }
}

@media (min-width: 1920px) {
  .container { max-width: 1600px; }
  .hero h1 { font-size: 4rem; }
  html { font-size: 18px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* High-contrast focus fallback for dark test panels */
.test-panel :focus-visible { outline-color: #ffffff; }
