/* ==========================================================================
   HeatPump AI — SEO companion site
   Single stylesheet, no build step. Organised as:
     1. Tokens (colour, type, space, radius, shadow) + dark mode
     2. Base elements
     3. Layout primitives (wrap, header, footer, skip link)
     4. Components (cards, pills, buttons, callouts, search, filter)
     5. Page-specific blocks (home, brand, family, code)
     6. Responsive + motion/print
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  /* Surfaces & text — light */
  --bg: #ffffff;
  --bg-subtle: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f4f6f8;
  --surface-hover: #eef1f5;
  --fg: #0d1117;
  --fg-muted: #56606e;          /* 6.38:1 on --bg */
  --border: #e3e7ec;
  --border-strong: #d0d7de;

  /* Brand */
  --accent: #2f54eb;            /* 5.85:1 both ways against white */
  --accent-hover: #2143c4;
  --accent-fg: #ffffff;
  --accent-soft: #eef2ff;
  --accent-ring: rgba(47, 84, 235, 0.35);

  /* Severity */
  --fault-fg: #b42318;
  --fault-bg: #fef3f2;
  --fault-border: #fecdc9;
  --fault-dot: #d92d20;

  --warning-fg: #b54708;
  --warning-bg: #fffaeb;
  --warning-border: #fedf89;
  --warning-dot: #f79009;

  --info-fg: #175cd3;
  --info-bg: #eff8ff;
  --info-border: #b2ddff;
  --info-dot: #2e90fa;

  --neutral-fg: #56606e;
  --neutral-bg: #f4f6f8;
  --neutral-border: #e3e7ec;
  --neutral-dot: #98a2b3;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter var", "Inter", "SF Pro Text",
    system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo,
    Consolas, "Liberation Mono", monospace;

  --step--1: 0.8125rem;   /* 13px  — meta, captions */
  --step-0: 1.0625rem;    /* 17px  — body */
  --step-1: 1.1875rem;    /* 19px  — lead-in */
  --step-2: 1.375rem;     /* 22px  — h3 */
  --step-3: 1.625rem;     /* 26px  — h2 */
  --step-4: clamp(1.875rem, 1.5rem + 1.6vw, 2.5rem);   /* h1 */
  --step-5: clamp(2.25rem, 1.55rem + 3.1vw, 3.5rem);   /* hero */

  /* 8pt spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(13, 17, 23, 0.05);
  --shadow-sm: 0 1px 2px rgba(13, 17, 23, 0.04), 0 2px 6px rgba(13, 17, 23, 0.06);
  --shadow-md: 0 2px 4px rgba(13, 17, 23, 0.04), 0 8px 24px rgba(13, 17, 23, 0.08);
  --shadow-lg: 0 8px 40px rgba(13, 17, 23, 0.12);

  --header-bg: rgba(255, 255, 255, 0.72);
  --hero-glow: radial-gradient(56rem 26rem at 50% -4rem, rgba(47, 84, 235, 0.17), transparent 68%);

  --wrap: 1120px;
  --prose: 72ch;
  --header-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d10;
    --bg-subtle: #0f1216;
    --surface: #14171c;
    --surface-2: #191d23;
    --surface-hover: #1f242c;
    --fg: #e6e8ec;                /* 15.9:1 */
    --fg-muted: #9aa4b2;          /* 7.7:1 */
    --border: #242932;
    --border-strong: #333a45;

    --accent: #8ab0ff;            /* 9.0:1 on --bg */
    --accent-hover: #a9c6ff;
    --accent-fg: #0b0d10;
    --accent-soft: #16203a;
    --accent-ring: rgba(138, 176, 255, 0.4);

    --fault-fg: #ff9d92;
    --fault-bg: #24120f;
    --fault-border: #4a201a;
    --fault-dot: #f97066;

    --warning-fg: #f7bf5e;
    --warning-bg: #241a0b;
    --warning-border: #4a3413;
    --warning-dot: #f79009;

    --info-fg: #84c5ff;
    --info-bg: #0d1c2c;
    --info-border: #1c3550;
    --info-dot: #2e90fa;

    --neutral-fg: #9aa4b2;
    --neutral-bg: #191d23;
    --neutral-border: #242932;
    --neutral-dot: #667085;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);

    --header-bg: rgba(11, 13, 16, 0.72);
    --hero-glow: radial-gradient(56rem 26rem at 50% -4rem, rgba(96, 132, 240, 0.26), transparent 68%);
  }
}

/* 2. Base ------------------------------------------------------------------ */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 640;
  line-height: 1.15;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

h1 { font-size: var(--step-4); letter-spacing: -0.03em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }

p { margin: 0 0 var(--space-4); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 0.18em;
}
a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }

ul, ol { margin: 0 0 var(--space-4); padding-left: 1.25em; }
li { margin-bottom: var(--space-2); }

code, kbd, samp { font-family: var(--font-mono); font-size: 0.92em; }

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

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-6) 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--accent-ring); }

/* 3. Layout ---------------------------------------------------------------- */

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-2);
  z-index: 100;
  transform: translateY(-200%);
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: var(--step--1);
  text-decoration: none;
  transition: transform 120ms ease;
}
.skip-link:focus { transform: translateY(0); color: var(--accent-fg); }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--header-h);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--fg);
  font-weight: 680;
  font-size: 1.0625rem;
  letter-spacing: -0.03em;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark:hover { color: var(--fg); }
.wordmark-glyph {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #12b5c9));
  color: #ffffff;
  flex: none;
}
.wordmark-glyph svg { display: block; }
.wordmark-suffix { color: var(--fg-muted); font-weight: 560; }

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.nav-link {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  font-size: 0.9375rem;
  font-weight: 520;
  text-decoration: none;
}
.nav-link:hover { color: var(--fg); background: var(--surface-2); }

.nav-cta {
  margin-left: var(--space-2);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  background: var(--fg);
  color: var(--bg);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.nav-cta:hover { background: var(--fg); color: var(--bg); opacity: 0.85; }

main { flex: 1 0 auto; padding-bottom: var(--space-8); }

.prose { max-width: var(--prose); }

.section { padding-block: var(--space-6) var(--space-7); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}
.section-head p { margin: 0; color: var(--fg-muted); font-size: 0.9375rem; }

.eyebrow {
  margin: 0 0 var(--space-2);
  font-size: var(--step--1);
  font-weight: 620;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  padding-block: var(--space-4) 0;
  font-size: var(--step--1);
  color: var(--fg-muted);
}
.breadcrumbs a { color: var(--fg-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--fg); text-decoration: underline; }
.breadcrumbs [aria-current="page"] { color: var(--fg); font-weight: 560; }
.crumb-sep { color: var(--border-strong); }

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  padding-block: var(--space-6);
  font-size: var(--step--1);
  color: var(--fg-muted);
}
.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
}
.footer-links a { color: var(--fg-muted); text-decoration: none; }
.footer-links a:hover { color: var(--fg); text-decoration: underline; }
.footer-legal { max-width: 78ch; margin: 0 0 var(--space-3); line-height: 1.6; }
/* No opacity here: dimming --fg-muted any further drops 13px text below
   4.5:1 against --bg-subtle (Lighthouse colour-contrast). */
.footer-fineprint { margin: 0 0 var(--space-2); color: var(--fg-muted); }
.footer-fineprint:last-child { margin-bottom: 0; }

/* 4. Components ------------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem 1.125rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.btn:hover { background: var(--accent-hover); color: var(--accent-fg); }
.btn:active { transform: translateY(1px); }

.btn--secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--fg);
}
.btn--secondary:hover { background: var(--surface-hover); color: var(--fg); }

.btn-icon { flex: none; opacity: 0.7; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: var(--step--1);
  font-weight: 520;
  white-space: nowrap;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.chip-row li { margin: 0; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.7rem 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--neutral-border);
  background: var(--neutral-bg);
  color: var(--neutral-fg);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.pill .dot { background: var(--neutral-dot); }

.pill--fault { border-color: var(--fault-border); background: var(--fault-bg); color: var(--fault-fg); }
.pill--fault .dot { background: var(--fault-dot); }
.pill--warning { border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning-fg); }
.pill--warning .dot { background: var(--warning-dot); }
.pill--info { border-color: var(--info-border); background: var(--info-bg); color: var(--info-fg); }
.pill--info .dot { background: var(--info-dot); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neutral-dot);
  flex: none;
}
.dot--fault { background: var(--fault-dot); }
.dot--warning { background: var(--warning-dot); }
.dot--info { background: var(--info-dot); }

.callout {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-2);
  margin-block: var(--space-6);
}
.callout-icon { flex: none; margin-top: 2px; color: var(--fg-muted); }
.callout-body { min-width: 0; }
.callout h2 {
  font-size: var(--step-2);
  margin-bottom: var(--space-2);
}
.callout p { margin-bottom: var(--space-3); }
.callout p:last-child { margin-bottom: 0; }

.callout--danger {
  border-color: var(--fault-border);
  background: var(--fault-bg);
}
.callout--danger .callout-icon { color: var(--fault-dot); }
.callout--danger h2 { color: var(--fault-fg); }

.callout--neutral { border-color: var(--border); background: var(--surface-2); }

.checklist { list-style: none; margin: 0 0 var(--space-4); padding: 0; }
.checklist li {
  position: relative;
  padding-left: 1.75rem;
  margin-bottom: var(--space-3);
}
.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 2px solid var(--accent);
}

details.disclosure {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--space-3) var(--space-4);
  margin-block: var(--space-4);
}
details.disclosure > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9375rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 140ms ease;
  color: var(--fg-muted);
  flex: none;
}
details.disclosure[open] > summary::before { transform: rotate(90deg); }
details.disclosure .disclosure-body {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.9375rem;
}

/* Search + in-page filter */

.searchbox { position: relative; width: 100%; max-width: 34rem; }
.searchbox--wide { max-width: none; }

.search-field {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.searchbox:focus-within .search-field {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}
.search-field .search-icon { flex: none; color: var(--fg-muted); }

.search-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.85rem 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: var(--step-0);
}
.search-input:focus { outline: none; }
.search-input::placeholder { color: var(--fg-muted); }
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.search-kbd {
  flex: none;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--fg-muted);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
}

.search-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  margin: 0;
  padding: var(--space-2);
  list-style: none;
  max-height: 22rem;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  /* The hero centres its text; result rows must not inherit that. */
  text-align: left;
}
.search-results:empty,
.search-results[hidden] { display: none; }
.search-results li { margin: 0; }

.search-result {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--fg);
  text-decoration: none;
}
.search-result:hover,
.search-result[data-active="true"] { background: var(--surface-hover); color: var(--fg); }
.search-result .rcode {
  flex: none;
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 4.25rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
}
.search-result .rtitle {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9375rem;
}
.search-result .rmeta {
  flex: none;
  color: var(--fg-muted);
  font-size: var(--step--1);
  white-space: nowrap;
}
.search-status {
  padding: var(--space-3);
  color: var(--fg-muted);
  font-size: 0.9375rem;
}
.search-hint {
  margin: var(--space-3) 0 0;
  color: var(--fg-muted);
  font-size: var(--step--1);
}

.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}
.filter-count { color: var(--fg-muted); font-size: var(--step--1); margin: 0; }

.empty-state {
  padding: var(--space-6);
  text-align: center;
  color: var(--fg-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
[hidden] { display: none !important; }

/* 5. Page blocks ----------------------------------------------------------- */

/* Hero (home) */
.hero {
  position: relative;
  padding-block: var(--space-8) var(--space-6);
  text-align: center;
}
/* No `overflow: hidden` on .hero — it would clip the search dropdown. The
   glow is bounded by its own box instead. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 26rem;
  background: var(--hero-glow);
  pointer-events: none;
}
.hero > * { position: relative; }
.hero h1 {
  font-size: var(--step-5);
  margin-bottom: var(--space-4);
  max-width: 18ch;
  margin-inline: auto;
}
.hero-sub {
  max-width: 56ch;
  margin: 0 auto var(--space-6);
  color: var(--fg-muted);
  font-size: var(--step-1);
  line-height: 1.55;
  text-wrap: pretty;
}
.hero .searchbox { margin-inline: auto; }

.hero-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin: var(--space-5) 0 0;
  padding: 0;
  list-style: none;
  color: var(--fg-muted);
  font-size: var(--step--1);
}
.hero-stats li { margin: 0; display: inline-flex; align-items: center; gap: var(--space-2); }
.hero-stats strong { color: var(--fg); font-weight: 640; font-variant-numeric: tabular-nums; }

/* Brand grid (home) */
.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}
.brand-grid li { margin: 0; }

.brand-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  height: 100%;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: var(--fg);
  text-decoration: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.brand-card:hover {
  color: var(--fg);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.brand-card-name {
  font-size: var(--step-2);
  font-weight: 640;
  letter-spacing: -0.02em;
}
.brand-card-meta {
  color: var(--fg-muted);
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
}
.brand-card-families {
  padding-top: var(--space-3);
  color: var(--fg-muted);
  font-size: var(--step--1);
  line-height: 1.5;
  border-top: 1px solid var(--border);
}
.brand-card-go {
  margin-top: auto;
  padding-top: var(--space-3);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent);
  font-size: var(--step--1);
  font-weight: 600;
}

/* How it works */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li {
  margin: 0;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
}
.step-num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: var(--space-3);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.step-title { font-size: var(--step-0); font-weight: 620; margin-bottom: var(--space-1); }
.step-body { color: var(--fg-muted); font-size: 0.9375rem; margin: 0; line-height: 1.55; }

/* App CTA */
.app-cta {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--space-6);
  align-items: center;
  padding: var(--space-6) var(--space-7);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, var(--surface) 0%, var(--bg-subtle) 100%);
  box-shadow: var(--shadow-sm);
}
.app-cta h2 { margin-bottom: var(--space-3); }
.app-cta-lead { color: var(--fg-muted); margin-bottom: var(--space-5); max-width: 44ch; }
/* `.benefit-points` (home page's "Make your heat pump run better" block)
   reuses this exact bullet treatment — same checkmark, same spacing. */
.benefits, .benefit-points { list-style: none; margin: 0 0 var(--space-5); padding: 0; }
.benefits li, .benefit-points li {
  position: relative;
  padding-left: 1.75rem;
  margin-bottom: var(--space-3);
  font-size: 0.9375rem;
  color: var(--fg);
}
.benefits li:last-child, .benefit-points li:last-child { margin-bottom: 0; }
.benefits li::before, .benefit-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.36em;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: var(--accent-soft);
}
.benefits li::after, .benefit-points li::after {
  content: "";
  position: absolute;
  left: 0.3rem;
  top: 0.62em;
  width: 0.45rem;
  height: 0.22rem;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}
.optimize-cta { margin-top: var(--space-5); }
.app-cta-aside { justify-self: center; text-align: center; }
.badge-link {
  display: inline-block;
  border-radius: 10px;
  line-height: 0;
}
.badge-link img { width: 156px; height: 52px; }
@media (prefers-color-scheme: dark) {
  .badge-link {
    background: #ffffff;
    padding: 4px 6px;
  }
}
.app-cta-note { margin: var(--space-3) 0 0; color: var(--fg-muted); font-size: var(--step--1); }

/* Compact CTA card used on brand/family/code pages */
.cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  flex-wrap: wrap;
  margin-block: var(--space-7) 0;
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
}
.cta-copy { min-width: 0; }
.cta-title { font-size: var(--step-2); font-weight: 640; letter-spacing: -0.02em; margin-bottom: var(--space-1); }
.cta-sub { margin: 0; color: var(--fg-muted); font-size: 0.9375rem; }

/* Above-the-fold variant under a code page's heading */
.cta--compact { margin-block: var(--space-5) 0; padding: var(--space-4) var(--space-5); }
.cta--compact .cta-title { font-size: var(--step-1); }
.cta--compact .cta-sub { font-size: 0.875rem; }

/* Header language switcher */
.lang-switch { display: inline-flex; gap: var(--space-1); align-items: center; }
.lang-link { padding: 0.15rem 0.45rem; border-radius: var(--radius-sm, 6px); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.04em; color: var(--fg-muted); text-decoration: none; }
.lang-link:hover { color: var(--fg); background: var(--bg-subtle); }
.lang-link[aria-current="true"] { color: var(--fg); background: var(--bg-subtle); }

/* Page header card (brand / family) */
.page-head {
  padding-block: var(--space-6) var(--space-5);
}
.page-head h1 { margin-bottom: var(--space-3); }
.page-head-lead { color: var(--fg-muted); max-width: var(--prose); font-size: var(--step-1); }
.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-4);
  color: var(--fg-muted);
  font-size: var(--step--1);
}

/* Family card grid (brand page) */
.family-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}
.family-grid li { margin: 0; }
.family-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  height: 100%;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: var(--fg);
  text-decoration: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.family-card:hover {
  color: var(--fg);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.family-card-name { font-size: var(--step-1); font-weight: 640; letter-spacing: -0.02em; }
.family-card-count { color: var(--fg-muted); font-size: var(--step--1); font-variant-numeric: tabular-nums; }
.family-card-models {
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: var(--step--1);
  line-height: 1.5;
}

/* A family page is a long scannable list: cap it at a measure where the code,
   the title and the severity stay visually related instead of stretching to
   the full 1120px grid the brand-card page needs. */
.family-page { max-width: 60rem; }

/* Code table (family page) */
.code-table {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}
.code-table li { margin: 0; border-top: 1px solid var(--border); }
.code-table li:first-child { border-top: 0; }

.code-row {
  display: grid;
  grid-template-columns: auto 7rem minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--fg);
  text-decoration: none;
}
.code-row:hover { background: var(--surface-hover); color: var(--fg); }
.code-row .rcode {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 640;
  color: var(--accent);
  min-width: 0;
  overflow-wrap: anywhere;
}
.code-row .rtitle { min-width: 0; font-size: 0.9375rem; }
.code-row .rsev {
  color: var(--fg-muted);
  font-size: var(--step--1);
  text-transform: capitalize;
}
.code-row .rgo { color: var(--fg-muted); flex: none; }

/* Code page */
.code-hero { padding-block: var(--space-5) var(--space-2); }
.code-hero h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}
.code-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius);
  background: var(--fg);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.82em;
  font-weight: 700;
  letter-spacing: -0.01em;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.code-h1-title { font-weight: 640; }
.code-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.code-context { color: var(--fg-muted); font-size: 0.9375rem; margin: 0; }
.code-context a { color: var(--fg-muted); }

.code-section { margin-block: var(--space-6) var(--space-5); }
.code-hero + .code-section { margin-top: var(--space-5); }
.related-all { margin: var(--space-3) 0 0; font-size: 0.9375rem; }
.code-section h2 { margin-bottom: var(--space-3); }
.code-section .prose p { font-size: var(--step-1); line-height: 1.7; }

.manual-link { margin-block: var(--space-5); }
.manual-note { display: block; margin-top: var(--space-2); color: var(--fg-muted); font-size: var(--step--1); }

.related { margin-block: var(--space-7); }
.related h2 { font-size: var(--step-2); margin-bottom: var(--space-4); }
.related-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
/* Grid and flex children default to `min-width: auto`, which lets a long
   Swedish code string ("Avfrostningsfel/Smältningsfel larm") push the row
   past the viewport on a 390px phone. Opt every level of the row out. */
.related-list li { margin: 0; min-width: 0; }
.related-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  text-decoration: none;
  font-size: 0.9375rem;
  min-width: 0;
}
.related-link:hover { background: var(--surface-hover); color: var(--fg); border-color: var(--border-strong); }
.related-link .rcode {
  font-family: var(--font-mono);
  font-weight: 640;
  color: var(--accent);
  min-width: 0;
  overflow-wrap: anywhere;
}
.related-link .rtitle { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
  flex-wrap: wrap;
}
.pager a {
  flex: 1 1 12rem;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
  text-decoration: none;
}
.pager a:hover { border-color: var(--border-strong); background: var(--surface-hover); color: var(--fg); }
.pager .pager-dir { display: block; color: var(--fg-muted); font-size: var(--step--1); margin-bottom: 2px; }
.pager .pager-code { font-family: var(--font-mono); font-weight: 640; overflow-wrap: anywhere; }
.pager .pager-next { text-align: right; }

/* Safe-actions card (code page). The element itself carries only
   `class="safe-actions"` — see render/codePage.ts. */
.safe-actions {
  margin-block: var(--space-6);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.safe-actions h2 { font-size: var(--step-2); margin-bottom: var(--space-4); }
.still-wrong { color: var(--fg-muted); font-size: 0.9375rem; margin: 0; }

/* A code page is a reading page, not a dashboard: cap it at a comfortable
   measure instead of letting it stretch to the full 1120px grid. */
.code-page { max-width: 46rem; }

#search-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.pill--neutral { border-color: var(--neutral-border); background: var(--neutral-bg); color: var(--neutral-fg); }
.dot--neutral { background: var(--neutral-dot); }

.manual-link { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); }

/* Legal pages (/privacy/, /terms/) — long-form prose in the reading column,
   using the same tokens as everything else. Rendered by render/legalPage.ts,
   which this stylesheet must not require changes to. */

.legal-page {
  max-width: var(--prose);
  padding-block: var(--space-6) var(--space-4);
}
.legal-page h1 { margin-bottom: var(--space-3); }

/* Shown only on a non-English render of /privacy/ or /terms/ — the legal
   body itself is never translated. */
.legal-lang-note {
  color: var(--fg-muted);
  font-size: var(--step--1);
  margin: 0 0 var(--space-3);
}

.legal-updated {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: var(--step--1);
  font-weight: 520;
  margin: 0 0 var(--space-4);
}

.subtitle {
  color: var(--fg-muted);
  font-size: var(--step-1);
  line-height: 1.6;
  margin-bottom: var(--space-6);
  text-wrap: pretty;
}

.legal-toc {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-block: var(--space-5) var(--space-7);
}
.legal-toc h2 {
  font-size: var(--step--1);
  font-weight: 620;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  margin: 0 0 var(--space-3);
}
.legal-toc ol {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9375rem;
  columns: 2;
  column-gap: var(--space-5);
}
.legal-toc li { margin: 0; padding: 0.15rem 0; break-inside: avoid; }
.legal-toc a { text-decoration: none; }
.legal-toc a:hover { text-decoration: underline; }

.legal-section {
  margin-block: var(--space-7);
  scroll-margin-top: calc(var(--header-h) + var(--space-5));
}
.legal-section h2 {
  font-size: var(--step-2);
  margin: 0 0 var(--space-4);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
}
.legal-section li { margin: var(--space-2) 0; }
.legal-section strong { font-weight: 620; }

.legal-address {
  font-style: normal;
  line-height: 1.8;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

/* 6. Responsive, motion, print --------------------------------------------- */

@media (max-width: 860px) {
  .app-cta { grid-template-columns: 1fr; padding: var(--space-6); }
  .app-cta-aside { justify-self: start; text-align: left; }
}

@media (max-width: 640px) {
  :root { --space-7: 2.5rem; --space-8: 3rem; }
  .wrap { padding-inline: var(--space-4); }
  .hero { padding-block: var(--space-6) var(--space-6); text-align: left; }
  .hero h1 { margin-inline: 0; max-width: none; }
  .hero-sub { margin-inline: 0; }
  .hero-stats { justify-content: flex-start; }
  .nav-link--hide-sm { display: none; }
  .search-kbd { display: none; }
  .code-row { grid-template-columns: auto 5rem minmax(0, 1fr); }
  .code-row .rsev, .code-row .rgo { display: none; }
  .cta { padding: var(--space-5); }
  .callout { flex-direction: column; gap: var(--space-3); padding: var(--space-4); }
}

/* At 360px the wordmark plus "Brands" plus the pill CTA is 1px wider than
   the viewport with the default paddings — tighten the nav rather than let
   the page scroll sideways. */
@media (max-width: 420px) {
  .wordmark { font-size: 1rem; }
  .nav-link { padding: var(--space-2); }
  .nav-cta { margin-left: var(--space-1); padding: 0.35rem 0.7rem; font-size: 0.875rem; }
  .header-inner { gap: var(--space-2); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .brand-card:hover, .family-card:hover { transform: none; }
}

@media print {
  .site-header, .site-nav, .cta, .app-cta, .searchbox, .filter-row { display: none !important; }
  body { color: #000; background: #fff; }
}

@media (max-width: 640px) {
  .legal-toc ol { columns: 1; }
}
