/* Styles every site shares (engine/build.mjs puts them ahead of each site's own site.css, in one
   file). Colors and fonts come from the custom properties each site's site.css sets on :root. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.65 var(--font);
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--accent-ink); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
code, kbd { font-family: var(--mono); font-size: 0.88em; }
code { background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 5px; }
kbd { background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px; padding: 0.05em 0.4em; border-radius: 6px; white-space: nowrap; }
pre { background: var(--surface-2); padding: 14px 16px; border-radius: 10px; overflow-x: auto; font-size: 0.9em; }
pre code { background: none; padding: 0; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 10; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.header-inner { display: flex; align-items: center; gap: 20px; min-height: 64px; flex-wrap: wrap; }
.site-nav { margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.site-nav a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 0.95rem; white-space: nowrap; }
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--surface-2); color: var(--ink); }
@media (max-width: 760px) {
  .header-inner { gap: 4px; padding-top: 10px; }
  .site-nav { margin: 0 -16px; padding: 0 12px 8px; width: calc(100% + 32px); }
}

/* Breadcrumbs */
.crumbs { margin: 22px 0 0; font-size: 0.88rem; color: var(--ink-3); }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line); }
.crumbs a { color: var(--ink-3); }

/* Page head */
.page-head { padding: 18px 0 8px; }
.page-head h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 12px; }
.lead { font-size: 1.15rem; color: var(--ink-2); margin: 0 0 18px; }

/* Article body */
.prose h2 { font-size: 1.45rem; line-height: 1.25; margin: 2.2em 0 0.6em; letter-spacing: -0.01em; }
.prose h3 { font-size: 1.12rem; margin: 1.8em 0 0.4em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: 0.3em 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: 0.95rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-weight: 650; color: var(--ink-2); background: var(--surface-2); }
.prose blockquote { margin: 1.2em 0; padding: 4px 18px; border-left: 4px solid var(--accent); color: var(--ink-2); }
.note { background: var(--surface-2); border-radius: var(--radius); padding: 14px 18px; margin: 1.4em 0; }
.note p { margin: 0.3em 0; }

/* Cards and lists */
.card-list { list-style: none; padding: 0 !important; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.card-list li { margin: 0 !important; }
.card-list a { display: block; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); }
.card-list a:hover { border-color: var(--accent); }
.card-list strong { display: block; margin-bottom: 2px; }
.card-list span { color: var(--ink-2); font-size: 0.92rem; line-height: 1.45; display: block; }

/* Offers */
.offer { margin: 2em 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.offer-heading { font-weight: 700; margin: 0 0 12px; }
.offer-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.offer-card { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 10px; background: var(--surface-2); text-decoration: none; color: var(--ink); }
.offer-card:hover { outline: 2px solid var(--accent); }
.offer-card span { font-size: 0.9rem; color: var(--ink-2); line-height: 1.45; }
.offer-card .offer-cta { margin-top: auto; padding-top: 6px; font-weight: 700; color: var(--accent-ink); }
.offer-disclosure { margin: 12px 0 0; font-size: 0.8rem; color: var(--ink-3); }
.offer.shop .shop-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.offer.shop .shop-list li { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); }
.offer.shop .shop-list a { font-weight: 700; color: var(--accent-ink); }
.offer.shop .shop-list span { display: block; margin-top: 2px; font-size: 0.9rem; color: var(--ink-2); line-height: 1.45; }
/* The marker on an affiliate link, and the one small line below the links that decodes it. */
.aff { color: var(--ink-3); }
.aff-note { margin: 0.4em 0 1.6em; font-size: 0.78rem; color: var(--ink-3); }

/* Promo slots. Type and the eye mark are vector, so they stay sharp as the slot changes size.
   The side rail only exists once the article has a gutter wide enough to hold it. */
.rail-scope { position: relative; }
.promo-card:not(.promo-card-rail) {
  display: flex;
  box-sizing: border-box;
  min-width: 0;
  container-type: inline-size;
  overflow: hidden;
}
.promo-card {
  background: #000;
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(104, 52, 248, 0.5);
}
.promo-card[hidden] { display: none; }
.promo a.promo-card,
.promo a.promo-card:hover { color: #fff; text-decoration: none; }
.promo-card:hover { border-color: #6834f8; }
.promo-brand { display: flex; align-items: center; gap: 0.35em; color: #6834f8; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.promo-mark { width: 1em; height: 1em; flex: none; }
/* The eye mark keeps Moob purple (3.4:1 on black, fine for a graphic); the name is text, so it needs 4.5:1. */
.promo-name { color: #8b66ff; }
.promo-line { font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.promo-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #6834f8;
  font-weight: 700;
  letter-spacing: -0.01em;
  border-radius: 999px;
  flex: none;
}
.promo-card:hover .promo-cta { background: #6834f8; color: #fff; }

.promo-rect { display: flex; justify-content: center; margin: 2em auto; }
.promo-card-rect {
  width: min(300px, 100%);
  min-height: 250px;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
}
.promo-card-rect .promo-brand { font-size: clamp(22px, 9cqi, 28px); }
.promo-card-rect .promo-line { font-size: clamp(18px, 7.4cqi, 22px); flex: 1; display: flex; align-items: center; }
.promo-card-rect .promo-cta { height: 38px; font-size: 15px; }

.promo-banner { display: flex; justify-content: center; margin: 0 auto 28px; padding: 0 16px; }
.promo-card-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 16px;
  width: min(728px, 100%);
  min-height: 90px;
  padding: 12px 16px;
  border-radius: 14px;
}
.promo-card-banner .promo-brand { font-size: clamp(18px, 4.2cqi, 26px); }
.promo-card-banner .promo-line { display: flex; flex-direction: column; gap: 2px; font-size: clamp(15px, 2.5cqi, 18px); font-weight: 650; }
.promo-card-banner .promo-line span { color: #ddd6f5; font-weight: 600; }
.promo-card-banner .promo-line strong { color: #fff; font-weight: 800; font-size: 1.08em; }
.promo-card-banner .promo-cta { height: 36px; padding: 0 14px; font-size: 14px; }
@media (max-width: 640px) {
  .promo-card-banner {
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand cta" "line line";
    row-gap: 8px;
    column-gap: 12px;
    padding: 12px 14px;
  }
  .promo-card-banner .promo-brand { grid-area: brand; }
  .promo-card-banner .promo-cta { grid-area: cta; justify-self: end; }
  .promo-card-banner .promo-line { grid-area: line; }
}

.promo-rail { display: none; }
@media (min-width: 1180px) {
  .rail-scope:not(.rail-scope-home) .promo-rail {
    display: block;
    position: absolute;
    top: 0;
    left: calc(50% + 412px);
    width: 160px;
    height: auto;
    pointer-events: none;
  }
}
@media (min-width: 1500px) {
  .rail-scope-home .promo-rail {
    display: block;
    position: absolute;
    top: 0;
    left: calc(50% + 564px);
    width: 160px;
    height: auto;
    pointer-events: none;
  }
}
.promo-rail > .promo-card-rail { pointer-events: auto; }
/* Row 1: screenshot at its natural aspect. Row 2: copy; outer card grows with row 2. */
a.promo-card.promo-card-rail {
  position: sticky;
  top: 24px;
  display: grid;
  grid-template-rows: auto auto;
  grid-template-columns: 1fr;
  align-content: start;
  box-sizing: border-box;
  width: 160px;
  max-height: min(600px, calc(100vh - 40px));
  padding: 0;
  border-radius: 16px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}
.promo-rail-frame { display: contents; }
.promo-rail-shot {
  grid-row: 1;
  width: 100%;
  margin: 0;
  line-height: 0;
  background: #000;
}
.promo-rail-shot img {
  display: block;
  width: 100%;
  height: auto;
}
.promo-rail-body {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 10px 14px;
  background: #000;
  border-top: 1px solid rgba(104, 52, 248, 0.35);
}
.promo-card-rail .promo-brand { font-size: 17px; }
.promo-card-rail .promo-line { font-size: 14px; line-height: 1.25; }
.promo-card-rail .promo-cta { min-height: 34px; font-size: 12px; padding: 8px; text-align: center; line-height: 1.15; }

/* Buttons */
.btn svg { width: 18px; height: 18px; }

/* Article footer */
.article-foot { margin: 3em 0 0; padding-top: 1.4em; border-top: 1px solid var(--line); }
.article-foot h2 { font-size: 1.1rem; margin: 0 0 12px; }
.share-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 26px; color: var(--ink-3); font-size: 0.88rem; }

/* Footer */
.site-footer { margin-top: 72px; border-top: 1px solid var(--line); background: var(--surface-2); padding: 34px 0 26px; font-size: 0.92rem; }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 24px; }
.footer-cols h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin: 0 0 8px; }
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols li { margin: 4px 0; }
.footer-cols a { color: var(--ink-2); text-decoration: none; }
.footer-cols a:hover { color: var(--accent-ink); text-decoration: underline; }
.footer-bottom { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--ink-3); }
.footer-bottom p { margin: 0; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 650;
  transition: opacity 0.18s, transform 0.18s; z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* 404 */
.not-found { text-align: center; padding: 60px 0 20px; }

/* Ping Speed Test's theme: fuchsia on near-white with graphite text. Text stays at 4.5:1 contrast or
   better in light and dark mode (npm run audit:browser -- pingspeedtest --local measures it). The brand
   color, #a21caf, is also in lib/brand.mjs and site.config.json. Grade colors (green, amber, red) are
   separate from the brand and never carry meaning alone: every grade shows its letter. */
:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #eeece7;
  --ink: #1c2128;
  --ink-2: #434b56;
  --ink-3: #636a76;
  --line: #dcd9d2;
  --accent: #a21caf;
  --accent-ink: #86198f;
  --accent-soft: #fae8ff;
  --alert: #b45309;
  --alert-soft: #fbefdf;
  --live: #b45309;
  --high: #b42318;
  --high-soft: #fdecea;
  --mid: #b45309;
  --low: #2f6b3a;
  --focus: #2563eb;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(28 33 40 / 6%), 0 6px 20px rgb(28 33 40 / 6%);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1c1f23;
    --surface-2: #24282d;
    --ink: #eceae6;
    --ink-2: #c3c0ba;
    --ink-3: #959189;
    --line: #34383e;
    --accent: #f0abfc;
    --accent-ink: #f5d0fe;
    --accent-soft: #3b1a40;
    --alert: #f0a957;
    --alert-soft: #33261a;
    --live: #f0a957;
    --high: #f28b82;
    --high-soft: #3a1f1d;
    --mid: #f0a957;
    --low: #8fd19e;
    --focus: #8cc4ff;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 20px rgb(0 0 0 / 25%);
  }
}
.narrow { max-width: 780px; }

/* Header */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.2rem; letter-spacing: -0.01em; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: #a21caf; color: #fff; }
.brand-mark svg { width: 22px; height: 22px; }

/* Page head */
.home-head { text-align: center; padding: 34px 0 6px; }
.home-head h1 { font-size: clamp(2rem, 6vw, 3rem); line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 10px; }
.home-head .lead { max-width: 600px; margin: 0 auto 18px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font: inherit; font-weight: 650; font-size: 0.95rem;
  background: var(--ink); color: var(--bg); border: 1px solid var(--ink); border-radius: 999px; padding: 8px 16px; text-decoration: none;
}
.btn:hover { background: #a21caf; border-color: #a21caf; color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }

/* 404 */
.not-found .big { width: 72px; height: 72px; color: var(--accent); }

/* Tools (shared) */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 18px; margin: 8px 0 26px; }
.tool-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 18px; }
@media (max-width: 760px) { .tool-grid { grid-template-columns: 1fr; } }
.tool-panel { min-width: 0; }
.tool-step { font-weight: 700; margin: 4px 0 10px; color: var(--ink); }
.tool-field { display: flex; flex-direction: column; gap: 4px; margin: 14px 0 0; font-size: 0.92rem; color: var(--ink-2); }
.tool-field.inline { margin: 0; max-width: 360px; }
.tool-field input, .tool-field select { font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.tool-note { font-size: 0.85rem; color: var(--ink-3); margin: 14px 0 0; }
.tool-results { background: var(--surface-2); border-radius: 14px; padding: 14px 16px; margin-top: 16px; }
.tool-grid .tool-results { margin-top: 0; align-self: start; }
.tool-results h3 { font-size: 1rem; margin: 16px 0 4px; }
.tool-results p { margin: 0.4em 0; }
[hidden] { display: none !important; }

/* The test card ({{speedtest MODE}}, lib/test.mjs + assets/test.js) */
.st { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 20px; margin: 8px 0 26px; }
.st-top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.st-start { font-size: 1.05rem; padding: 12px 26px; background: #a21caf; border-color: #a21caf; color: #fff; }
.st-start:hover { background: #86198f; border-color: #86198f; }
.st-start:disabled { opacity: 0.7; cursor: progress; }
.st-status { margin: 0; color: var(--ink-2); font-size: 0.95rem; flex: 1 1 240px; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 18px 0 0; }
.st-cell { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; margin: 0; }
.st-cell dt { font-size: 0.82rem; color: var(--ink-3); font-weight: 600; }
.st-cell dd { margin: 4px 0 0; font-size: 1.45rem; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; color: var(--ink); }
.st.is-running .st-cell:not(.has-value) dd { color: var(--ink-3); }
.st-verdict { margin: 18px 0 0; padding: 14px 16px; border-radius: 14px; background: var(--accent-soft); }
.st-verdict p { margin: 0.35em 0; }
.st-good { font-weight: 700; font-size: 1.08rem; }
.st-uses { list-style: none; padding: 0; margin: 8px 0; }
.st-uses li { margin: 4px 0; }
.st-uses .ok .st-mark { color: var(--low); font-weight: 800; }
.st-uses .no .st-mark { color: var(--high); font-weight: 800; }
.st-letter { display: inline-grid; place-items: center; min-width: 2em; height: 2em; border-radius: 8px; font-weight: 800; color: #fff; background: var(--ink-3); margin-right: 6px; }
.st-letter[data-grade="A"], .st-letter[data-grade="B"] { background: #2f6b3a; }
.st-letter[data-grade="C"] { background: #9a4a08; }
.st-letter[data-grade="D"], .st-letter[data-grade="F"] { background: #b42318; }
.st-fix a { font-weight: 700; }
.st-note { font-size: 0.9rem; color: var(--ink-2); }
.st-meta { font-size: 0.85rem; color: var(--ink-3); margin: 12px 0 0; }
.st-actions { display: flex; gap: 10px; margin: 14px 0 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
