/* =========================================================================
   Livestreamers.org — 2026 design system
   Matte-black creator-tech lab. Single accent. Geist + JetBrains Mono.
   ========================================================================= */

:root {
  /* Surfaces */
  --bg-0:        #0a0a0c;
  --bg-1:        #101013;
  --bg-2:        #16161b;
  --bg-3:        #1d1d23;
  --bg-4:        #25252c;
  --bg-elev:    rgba(255,255,255,0.02);

  /* Borders */
  --line:        rgba(255,255,255,0.06);
  --line-2:      rgba(255,255,255,0.10);
  --line-3:      rgba(255,255,255,0.18);

  /* Text */
  --fg:          #f5f5f7;
  --fg-2:        #c9c9cf;
  --fg-3:        #8a8a93;
  /* --fg-4 was #5a5a63 (2.57:1 on --bg-1, fails WCAG AA). Bumped to
     #80808a (3.66:1, passes AA-large @ 18px+; still fails AA-normal @ 4.5:1
     so restrict to mono labels / metadata, not body copy). Phase 2 will do
     a full per-surface contrast audit. */
  --fg-4:        #80808a;
  --fg-5:        #3a3a42;

  /* Accent (toggleable via Tweaks) */
  --accent:        #b6ff3d;
  --accent-2:      #84c426;
  --accent-ink:    #0a0a0c;
  --accent-glow:   rgba(182,255,61,0.22);
  --accent-faint:  rgba(182,255,61,0.08);

  /* Signal */
  --good:        #b6ff3d;
  --warn:        #ffc857;
  --bad:         #ff2d6f;
  --info:        #5ec8ff;

  /* Type */
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-display: "Geist", ui-sans-serif, system-ui, sans-serif;

  /* Geometry */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius:    6px;
  --radius-lg: 10px;
  --radius-pill: 999px;

  /* Spacing scale (8pt-ish, finer at low end) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;

  /* Container */
  --maxw: 1280px;
  --gutter: 32px;
}

/* ===== Reset ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg-0);
  color: var(--fg);
  /* overflow-x: hidden on both so neither the html nor the body element
     can produce a horizontal scrollbar on phones. Some inline-styled grids
     in the page components don't reflow yet (Phase 2 cleans them up). */
  overflow-x: hidden;
  max-width: 100vw;
}
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: "ss01", "ss02", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img, svg { display: block; max-width: 100%; }
input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ===== Type ============================================================= */
.font-mono   { font-family: var(--font-mono); }
.mono        { font-family: var(--font-mono); font-feature-settings: "ss02","zero","cv11"; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 500;
}
.eyebrow .dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-right: 8px; vertical-align: 1px;
  box-shadow: 0 0 0 3px var(--accent-faint);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-wrap: balance;
}
h1 { font-size: clamp(40px, 5.4vw, 76px); line-height: 1.02; letter-spacing: -0.035em; font-weight: 600; }
h2 { font-size: clamp(28px, 3.2vw, 44px); line-height: 1.08; letter-spacing: -0.028em; }
h3 { font-size: 22px; line-height: 1.18; letter-spacing: -0.02em; }
h4 { font-size: 16px; line-height: 1.3; letter-spacing: -0.01em; font-weight: 600; }
p { color: var(--fg-2); text-wrap: pretty; }
.lede { font-size: 18px; color: var(--fg-2); line-height: 1.55; max-width: 60ch; }

/* ===== Page chrome ====================================================== */
.app {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(182,255,61,0.05), transparent 60%),
    radial-gradient(900px 500px at 0% 30%, rgba(94,200,255,0.03), transparent 60%),
    var(--bg-0);
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Top nav */
.topnav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(10,10,12,0.7);
  border-bottom: 1px solid var(--line);
}
.topnav-inner {
  display: flex; align-items: center; gap: 28px;
  height: 60px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-weight: 600; letter-spacing: -0.02em;
  font-size: 15px;
}
.brand-mark {
  width: 26px; height: 26px;
  display: grid; place-items: center;
}
.brand .dot-live {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-left: 6px;
  box-shadow: 0 0 0 3px var(--accent-faint);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.nav-links { display: flex; gap: 2px; flex: 1; }
.nav-link {
  font-size: 13.5px; color: var(--fg-2);
  padding: 8px 12px; border-radius: var(--radius);
  letter-spacing: -0.005em;
  position: relative;
}
.nav-link:hover { color: var(--fg); background: var(--bg-2); }
.nav-link.is-active {
  color: var(--accent);
  background: var(--bg-2);
}
.nav-link.is-active::before {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px;
  height: 1px; background: var(--accent);
}
.nav-tools { display: flex; align-items: center; gap: 8px; }

/* Footer */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: var(--bg-1);
  padding: 64px 0 32px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, 1fr);
  gap: 40px;
}
.footer h5 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 14px;
  font-weight: 500;
}
.footer-col a {
  display: block;
  color: var(--fg-2);
  font-size: 13.5px;
  padding: 4px 0;
  cursor: pointer;
  text-decoration: none;
}
.footer-col a:hover,
.footer-col a:focus-visible { color: var(--accent); outline: none; }
.footer-col a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }

/* "soon" tag on coming-soon footer links — small mono badge so users see
   the destination doesn't exist yet rather than getting silently dead clicks. */
.soon-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 3px;
  vertical-align: 1px;
}
.footer-bottom {
  margin-top: 56px; padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--fg-4); letter-spacing: 0.04em;
}

/* ===== Common atoms ===================================================== */
/* Button */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  transition: transform 80ms ease, background 120ms ease, border-color 120ms ease, color 120ms ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600;
}
.btn-primary:hover { background: #c8ff5b; }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost {
  background: var(--bg-2); color: var(--fg);
  border-color: var(--line-2);
}
.btn-ghost:hover { background: var(--bg-3); border-color: var(--line-3); }
.btn-line {
  background: transparent; color: var(--fg-2);
  border-color: var(--line-2);
}
.btn-line:hover { color: var(--fg); border-color: var(--line-3); background: var(--bg-2); }
.btn-sm { padding: 7px 10px; font-size: 12.5px; }
.btn .arrow { transition: transform 160ms ease; }
.btn:hover .arrow { transform: translateX(2px); }

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  background: var(--bg-3);
  color: var(--fg-2);
  border: 1px solid var(--line-2);
}
.badge.is-tested      { color: var(--accent); border-color: rgba(182,255,61,0.3); background: var(--accent-faint); }
.badge.is-updated     { color: var(--info);   border-color: rgba(94,200,255,0.3); background: rgba(94,200,255,0.08); }
.badge.is-pro         { color: #ffc857;       border-color: rgba(255,200,87,0.3); background: rgba(255,200,87,0.08); }
.badge.is-beginner    { color: var(--fg-2);   border-color: var(--line-3); }
.badge.is-deal        { color: var(--bad);    border-color: rgba(255,45,111,0.3); background: rgba(255,45,111,0.08); }
.badge.is-live        { color: var(--accent); border-color: rgba(182,255,61,0.3); background: var(--accent-faint); }
.badge.is-independent { color: var(--fg);     border-color: var(--line-3);        background: var(--bg-2); }
.badge.is-independent::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 2px; box-shadow: 0 0 0 2px var(--accent-faint); }
.badge.is-stale       { color: var(--warn);   border-color: rgba(255,200,87,0.35); background: rgba(255,200,87,0.05); }
.badge .pulse {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  animation: pulse 1.6s ease-in-out infinite;
}

/* Card */
.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: border-color 140ms ease, transform 140ms ease;
}
.card.hover:hover {
  border-color: var(--line-3);
}
.card-pad { padding: 20px; }
.card-pad-lg { padding: 28px; }

/* Pill (filter chip) */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  font-size: 12.5px;
  color: var(--fg-2);
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 120ms ease;
}
.pill:hover { color: var(--fg); border-color: var(--line-3); }
.pill.is-on { color: var(--accent); border-color: var(--accent); background: var(--accent-faint); }

/* Signal meter */
.meter {
  position: relative;
  height: 6px;
  background: var(--bg-3);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.meter > i {
  display: block; height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  box-shadow: 0 0 12px var(--accent-glow);
}
.meter.warn > i { background: var(--warn); box-shadow: 0 0 12px rgba(255,200,87,0.3); }
.meter.bad  > i { background: var(--bad);  box-shadow: 0 0 12px rgba(255,45,111,0.3); }

/* Stat */
.stat-num {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
}

/* Grid bg */
.grid-bg {
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* Section */
.section { padding: 96px 0; position: relative; }
.section-tight { padding: 64px 0; }
.section-head {
  display: flex; align-items: end; justify-content: space-between;
  gap: 24px; margin-bottom: 40px;
}
.section-head h2 { max-width: 18ch; }

/* Hairline divider */
.hr { height: 1px; background: var(--line); border: 0; }

/* Frame label (corner ticks) */
.frame {
  position: relative;
  border: 1px solid var(--line-2);
}
.frame::before, .frame::after,
.frame > .tl, .frame > .tr {
  content: ""; position: absolute; width: 10px; height: 10px;
  border: 1px solid var(--accent);
}
.frame::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.frame::after  { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.frame > .tl   { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.frame > .tr   { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

/* Live signal strip (data ticker) */
.ticker {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-3);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.ticker .k { color: var(--fg-4); margin-right: 6px; }
.ticker .v { color: var(--fg); margin-right: 18px; font-variant-numeric: tabular-nums; }
.ticker .v.good { color: var(--accent); }
.ticker .v.warn { color: var(--warn); }
.ticker .v.bad  { color: var(--bad); }

/* Marquee */
.marquee {
  display: flex; gap: 48px;
  animation: scroll 60s linear infinite;
  width: max-content;
}
@keyframes scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.marquee-mask {
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}

/* Tabs */
.tabs {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px;
}
.tab {
  padding: 7px 14px;
  font-size: 12.5px;
  color: var(--fg-3);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.tab:hover { color: var(--fg-2); }
.tab.is-on {
  background: var(--bg-4); color: var(--fg);
  box-shadow: 0 1px 0 var(--line-3) inset;
}

/* Range input (custom) */
input[type="range"].slider {
  -webkit-appearance: none; appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  outline: none;
}
input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 0 4px rgba(182,255,61,0.15);
  transition: box-shadow 120ms ease;
}
input[type="range"].slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 6px rgba(182,255,61,0.2);
}
input[type="range"].slider::-moz-range-thumb {
  width: 16px; height: 16px;
  background: var(--accent);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

/* Score pill (0-10) */
.score {
  display: inline-flex; align-items: baseline; gap: 4px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  font-weight: 500;
}
.score .n { color: var(--accent); }
.score .d { color: var(--fg-4); font-size: 12px; }

/* Table */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td {
  text-align: left; padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.tbl th {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 500;
  background: var(--bg-1);
}
.tbl tr:hover td { background: rgba(255,255,255,0.015); }
.tbl .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Viewport modes (Tweaks) */
.viewport-shell {
  display: flex;
  justify-content: center;
  padding: 24px 24px 72px;
  gap: 28px;
}
.viewport-shell.is-desktop { padding: 0; gap: 0; }
.viewport-shell.is-mobile { padding: 24px; }
.viewport-shell.is-mobile .desktop-only,
.viewport-shell.is-mobile .desktop-view { display: none !important; }

/* Mobile frame */
.phone {
  width: 390px;
  flex: 0 0 390px;
  height: 844px;
  background: var(--bg-0);
  border: 1px solid var(--line-3);
  border-radius: 36px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.phone .phone-notch {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 100px; height: 26px; background: #000;
  border-radius: 13px; z-index: 10;
}
.phone .phone-statusbar {
  position: relative;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 28px 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg);
}
.phone .phone-body {
  height: calc(100% - 36px);
  overflow-y: auto;
  overflow-x: hidden;
}
.phone .phone-body::-webkit-scrollbar { width: 0; }

.paired-view {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 28px;
  align-items: start;
}
.paired-view .paired-desktop {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-0);
}

/* Code/tag */
.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--fg-2);
}

/* SVG icon sizing */
.ico { width: 16px; height: 16px; flex-shrink: 0; }
.ico-sm { width: 12px; height: 12px; flex-shrink: 0; }
.ico-lg { width: 20px; height: 20px; flex-shrink: 0; }

/* "Last verified" stamp — sits on every dated/perishable surface.
   Mono caps + tiny accent dot when fresh; switches to warn when stale. */
.last-verified {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-4);
}
.last-verified .dot {
  display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-faint);
}
.last-verified.is-stale { color: var(--warn); }
.last-verified.is-stale .dot { background: var(--warn); box-shadow: 0 0 0 2px rgba(255,200,87,0.15); }

/* Build configurator lane chrome — three vertical lanes for the bifurcation framing.
   Prestige / Sleeper / Phone-vertical. Each lane groups its presets. */
.lane {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  padding: 16px 16px 14px;
}
.lane-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 12px;
}
.lane-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-4);
}
.lane-title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.lane.is-prestige { border-color: rgba(255,200,87,0.25); }
.lane.is-prestige .lane-title { color: #ffc857; }
.lane.is-sleeper  { border-color: rgba(182,255,61,0.25); }
.lane.is-sleeper  .lane-title { color: var(--accent); }
.lane.is-vertical { border-color: rgba(255,45,111,0.25); }
.lane.is-vertical .lane-title { color: var(--bad); }

/* Utility */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 24px; } .gap-6 { gap: 32px; }
.between { justify-content: space-between; }
.center { justify-content: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.text-fg2 { color: var(--fg-2); }
.text-fg3 { color: var(--fg-3); }
.text-fg4 { color: var(--fg-4); }
.text-accent { color: var(--accent); }
.text-bad { color: var(--bad); }
.text-warn { color: var(--warn); }
.text-info { color: var(--info); }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 24px; } .mb-6 { margin-bottom: 32px; } .mb-7 { margin-bottom: 48px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 24px; } .mt-6 { margin-top: 32px; } .mt-7 { margin-top: 48px; }
.fs-12 { font-size: 12px; } .fs-13 { font-size: 13px; } .fs-14 { font-size: 14px; } .fs-16 { font-size: 16px; }
.uppercase { text-transform: uppercase; letter-spacing: 0.1em; }
.tracking-tight { letter-spacing: -0.02em; }
.tracking-tighter { letter-spacing: -0.03em; }
.hidden { display: none; }
.relative { position: relative; }
.block { display: block; }
.inline-block { display: inline-block; }
.w-full { width: 100%; }

/* Page transitions */
.page-fade {
  animation: fade-in 240ms ease;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mobile responsive — desktop hi-fi gracefully collapses.
   Two breakpoints: 900px (tablet/landscape phone) and 480px (phone). */
@media (max-width: 900px) {
  :root { --gutter: 20px; }
  .container { padding: 0 var(--gutter); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .nav-links { display: none; }
  .topnav-inner { gap: 12px; }
  .nav-tools { margin-left: auto; }
  .section { padding: 64px 0; }
  .section-tight { padding: 40px 0; }
  /* Allow horizontal scroll on tables and the configurator grids that
     don't fit narrow viewports — beats squashing them into nonsense. */
  .tbl { font-size: 12.5px; }
  .tbl th, .tbl td { padding: 10px 12px; }
}

/* The page components heavily use inline-styled CSS grids (e.g. style="grid-template-columns: 1.05fr 1fr").
   Inline styles outrank stylesheet rules, so we need !important + attribute selectors to flatten
   them on phones. Phase 2 (Astro) rebuilds these layouts cleanly; Phase 1 just stops the bleeding. */
@media (max-width: 700px) {
  /* Flatten any 2/3/4-column grid declared inline. */
  [style*="grid-template-columns"][style*="1fr"],
  [style*="grid-template-columns"][style*="repeat(2"],
  [style*="grid-template-columns"][style*="repeat(3"],
  [style*="grid-template-columns"][style*="repeat(4"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  /* Tweaks panel paired-view (440px right column) — collapse to single column.
     The desktop preview at scale(0.62) still works inside one column. */
  [style*="grid-template-columns: minmax(0, 1fr) 440px"] {
    grid-template-columns: 1fr !important;
  }
  /* Allow rows of stat blocks / pill rows to wrap rather than overflow. */
  .row { flex-wrap: wrap; }
  /* Common large fixed widths that overflow on phones. */
  [style*="width: 540px"], [style*="width: 480px"] { width: 100% !important; max-width: 100% !important; }
}

@media (max-width: 480px) {
  :root { --gutter: 16px; }
  /* Tap targets — 44px minimum per WCAG / Apple HIG. */
  .btn { min-height: 44px; padding: 12px 16px; }
  .btn-sm { min-height: 38px; padding: 9px 12px; }
  .pill { min-height: 36px; padding: 8px 12px; }
  .nav-link { min-height: 44px; }
  /* Hero & headings clamp lower bound — no 76px h1 on a phone. */
  h1 { font-size: clamp(32px, 9vw, 44px); }
  h2 { font-size: clamp(24px, 6vw, 30px); }
  /* Footer: stack single-column, generous spacing. */
  .footer { padding: 48px 0 24px; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; gap: 8px; align-items: flex-start; }
  /* Section padding compresses further on phones. */
  .section { padding: 48px 0; }
  .section-tight { padding: 32px 0; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 28px; }
  .card-pad { padding: 16px; }
  .card-pad-lg { padding: 20px; }
  /* SignalStrip ticker becomes horizontally scrollable on phone — squashing it loses readability. */
  .ticker { font-size: 11px; }
  /* Stat tiles: scale headline numbers down. */
  .stat-num { font-size: 22px; }
}

/* Honour user preference for reduced motion — disables every animation,
   transition, and scroll-related effect. Cheap accessibility win. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .marquee { animation: none !important; }
}
