/* =========================================================
   Website Tester — Design tokens & base styles
   ========================================================= */

:root {
  /* Color — Pixel Lattice brand palette */
  --color-bg: #FAFAFA;
  --color-surface: #FFFFFF;
  --color-border: #E8E0EB;
  --color-border-light: #F2ECF4;
  --color-text: #0A0A0A;
  --color-text-secondary: #555555;
  --color-success: #16A34A;
  --color-success-bg: #F0FDF4;
  --color-warning: #F59E0B;
  --color-warning-bg: #FFFBEB;
  --color-error: #DC2626;
  --color-error-bg: #FEF2F2;

  /* Brand */
  --color-purple: #60046C;
  --color-purple-hover: #4D0358;
  --color-purple-light: #F5E6F7;
  --color-purple-mid: #D9A8E0;
  --color-orange: #F41149;
  --color-orange-hover: #D40040;
  --color-orange-light: #FDE6EC;

  --color-btn-primary: var(--color-orange);
  --color-btn-primary-text: #FFFFFF;
  --color-btn-hover: var(--color-orange-hover);

  /* Radius */
  --radius-button: 8px;
  --radius-card: 14px;
  --radius-input: 9px;
  --radius-badge: 999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(10, 10, 10, 0.05);
  --shadow-md: 0 4px 16px rgba(96, 4, 108, 0.08);
  --shadow-lg: 0 8px 28px rgba(96, 4, 108, 0.14);

  /* Type */
  --font-sans: 'Plus Jakarta Sans', system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* Layout */
  --container-max: 1120px;
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

::selection { background: var(--color-purple); color: #fff; }

html, body {
  padding: 0;
  margin: 0;
  overflow-x: hidden; /* belt-and-suspenders: if any element is ever wider than the
    viewport (long unbroken strings, a miscalculated width, etc.), clip and let
    that element scroll internally rather than letting mobile browsers expand
    the whole layout viewport to fit it — which is what causes the "have to
    zoom out to see anything" symptom. */
  width: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

button, input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }

/* ---------- Focus states (accessibility) ---------- */
:focus-visible {
  outline: 2px solid var(--color-purple);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- 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;
  }
}

/* ---------- Typography scale ---------- */
h1, .h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

h2, .h2 {
  font-size: 1.625rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

h3, .h3 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

h4, .h4 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
}

.text-lg { font-size: 1.0625rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

.text-secondary { color: var(--color-text-secondary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }
.text-purple { color: var(--color-purple); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ---------- Layout primitives ---------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* ---------- Grid overflow safety net ----------
   CSS Grid items default to min-width: auto, meaning "never shrink
   below your content's natural size" — not min-width: 0 like flex
   items effectively behave once wrapping. That default is what let a
   long unbroken URL, a wide badge, or a big icon silently force a grid
   track (and the whole page along with it) wider than the viewport —
   the actual root cause behind several overflow bugs that were
   otherwise fixed one at a time (image grid, stat tiles, kv-grid).
   Applying min-width: 0 to every grid container's direct children in
   the app, in one place, closes off this entire class of bug instead
   of relying on finding each instance individually. */
.kv-grid > *,
.category-grid > *,
.feature-strip > *,
.overview-grid > *,
.results-layout > *,
.metric-grid > *,
.stat-summary-row > *,
.image-audit-grid > *,
.footer-grid > * {
  min-width: 0;
}

.stack { display: flex; flex-direction: column; }
.row { display: flex; flex-direction: row; align-items: center; min-width: 0; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }

section { padding: var(--space-8) 0; }

.section-heading {
  margin-bottom: var(--space-5);
}

.section-heading p {
  margin-top: var(--space-2);
}

/* ---------- Utility ---------- */
.hidden { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
