/* =========================================================
   style.css — HomeFix Calc

   Light industrial: off-white ground, white cards that sit one
   step brighter, safety orange for action, steel blue for the
   secondary series. Small radii, hard shadows, no gradients and
   no decorative flourishes — the page should read like a spec
   sheet, not a brochure.

   No webfonts are loaded on purpose. Inter and Barlow are named
   first because they are the intended faces, but the stack falls
   back to system UI fonts: loading a font would be an external
   request, and the site promises to work with the network off.
   ========================================================= */

:root {
  color-scheme: light;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-alt: #eceff3;
  --surface-raised: #f7f8fa;

  /* Near-black with a blue cast rather than #000 — pure black on a
     grey ground reads as a printing error. 15.9:1 on --surface. */
  --text: #16181d;
  --text-soft: #4a5160;
  /* Dates, units and table captions. #646c7a is 5.4:1 on white. */
  --muted: #646c7a;

  --border: #d7dbe3;
  --border-strong: #b9c0cc;

  /* Safety orange, taken one step deeper than the pure ANSI hue so a
     white label clears 4.5:1 (white on #e8590c is only 3.6:1, and
     near-black fails the moment the hover state darkens it). */
  --primary: #c74a08;
  --primary-strong: #a33c06;
  --primary-tint: #fdf0e8;

  /* Steel blue, used for the second data series and for links. */
  --accent: #1f4e79;
  --accent-strong: #16395a;
  --accent-tint: #eaf1f8;

  --ok: #1d7a46;
  --ok-tint: #e8f5ee;
  --warn: #9a6400;
  --warn-tint: #fdf3e0;
  --err: #b3261e;
  --err-tint: #fdeceb;

  /* Shadows are tinted with --text rather than pure black. A neutral
     #000 drop shadow on a cool grey page reads as a smudge. */
  --shadow: 0 1px 2px rgba(22, 24, 29, 0.06), 0 2px 8px rgba(22, 24, 29, 0.05);
  --shadow-hover: 0 2px 4px rgba(22, 24, 29, 0.08), 0 8px 20px rgba(22, 24, 29, 0.09);

  --r: 4px;
  --r-lg: 6px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Barlow", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "SF Mono", ui-monospace, "Roboto Mono", Menlo, Consolas, monospace;

  --maxw: 1120px;
}

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

/* Inline icons have no width/height attributes, so without this they
   fall back to the 300×150 default and blow up any flex container. */
svg { width: 1em; height: 1em; flex: none; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  line-height: 1.2;
  letter-spacing: -0.011em;
  margin: 0 0 0.5em;
  font-weight: 700;
}

h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.85rem); }
h3 { font-size: 1.08rem; }

p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-alt);
  padding: 1px 5px;
  border-radius: 3px;
}
img { max-width: 100%; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 780px; margin-left: auto; margin-right: auto; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--text); color: #fff; padding: 10px 16px; z-index: 100;
}
.skip-link:focus { left: 0; }

/* Keyboard focus. The UA ring is nearly invisible against the orange
   fill, and `:focus-visible` keeps it off mouse clicks so the buttons
   do not flash a ring every time they are pressed. Steel blue is used
   rather than the accent-adjacent orange so the ring still separates
   from an orange button. */
a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; gap: 24px; min-height: 62px; }

.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  background: var(--primary); color: #fff;
  border-radius: var(--r);
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-name { font-family: var(--font-head); font-size: 1.06rem; letter-spacing: -0.01em; }

.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a {
  color: var(--text-soft); padding: 7px 11px; border-radius: var(--r);
  font-size: 0.92rem; font-weight: 500;
}
.nav a:hover { background: var(--surface-alt); color: var(--text); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--surface-alt); font-weight: 600; }
.nav .nav-cta { margin-left: 8px; }

.nav-toggle {
  display: none; margin-left: auto;
  background: none; border: 1px solid var(--border); border-radius: var(--r);
  width: 40px; height: 36px; padding: 9px 8px; cursor: pointer;
}
.nav-toggle span { display: block; height: 2px; background: var(--text); margin: 0 0 4px; }
.nav-toggle span:last-child { margin-bottom: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r);
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-family: var(--font);
  font-weight: 600; font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, box-shadow 0.14s;
}
/* White on #e8590c is only 3.6:1, so the label goes near-black.
   This is why the orange reads as industrial signage rather than a
   consumer app button — and it is the accessible choice. */
.btn:hover { background: var(--primary-strong); border-color: var(--primary-strong); color: #fff; text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-sm { padding: 6px 12px; font-size: 0.84rem; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); border-color: var(--text-soft); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }

/* ---------- breadcrumb ---------- */
.breadcrumb {
  padding: 14px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 6px;
}
.breadcrumb a { color: var(--text-soft); }
.breadcrumb .sep { color: var(--border-strong); }
.breadcrumb span[aria-current] { color: var(--muted); }

/* ---------- hero ---------- */
.hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 64px 0 56px;
}
.hero h1 { margin: 12px 0 16px; max-width: 16ch; }
.hero-sub { font-size: 1.08rem; color: var(--text-soft); max-width: 58ch; margin-bottom: 28px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 26px; }
.hero-note {
  display: flex; align-items: center; gap: 7px;
  font-size: 0.84rem; color: var(--muted); margin: 0;
}
.hero-note svg { color: var(--ok); width: 15px; height: 15px; }

.eyebrow {
  display: inline-block;
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--primary-strong);
}

/* ---------- sections ---------- */
.section { padding: 56px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-tight { padding: 28px 0; }
.section-head { max-width: 68ch; margin-bottom: 32px; }
.section-head h2 { margin: 8px 0 10px; }
.section-head p { color: var(--text-soft); margin: 0; }
.center-row { display: flex; justify-content: center; margin-top: 28px; }

/* ---------- cards ---------- */
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  color: var(--text);
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 6px; }
.card p { color: var(--text-soft); font-size: 0.9rem; margin: 0 0 12px; }

.card-hover { transition: border-color 0.14s, box-shadow 0.14s, transform 0.14s; }
.card-hover:hover {
  text-decoration: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

/* Guide cards sit in a 3-across grid and their summaries differ in
   length, so the "Read the guide" link has to be pushed to the
   bottom of the card — otherwise it floats mid-card on short entries
   and the row looks ragged. */
.guide-card { display: flex; flex-direction: column; }
.guide-card h3 { font-size: 1rem; line-height: 1.35; }
.guide-card .card-link { margin-top: auto; }
.guide-card .guide-tool { margin-top: 6px; }

.tool-card { display: flex; flex-direction: column; }
.tool-icon {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: var(--primary-tint); color: var(--primary-strong);
  border-radius: var(--r); margin-bottom: 14px;
}
.tool-icon svg { width: 20px; height: 20px; }
/* The sample line is live output from the calculator, so it gets the
   mono treatment — it is data, not prose. */
.tool-sample {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--text-soft);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px 10px;
  margin: auto 0 12px;
}
.tool-sample b { color: var(--text); font-weight: 600; }
.card-link { font-size: 0.84rem; font-weight: 600; color: var(--accent); }

.audience-card { text-align: left; }
.audience-icon {
  width: 32px; height: 32px; display: grid; place-items: center;
  color: var(--accent); background: var(--accent-tint);
  border-radius: var(--r); margin-bottom: 12px;
}
.audience-icon svg { width: 18px; height: 18px; }
.audience-card h3 { font-size: 1rem; }
.audience-card p { margin: 0; }

.post-list { display: grid; gap: 14px; }
.post-meta { font-size: 0.78rem; color: var(--muted); margin-bottom: 6px; font-family: var(--font-mono); }
.post-card h3 { font-size: 1.05rem; }
.post-excerpt { margin-bottom: 10px; }

/* ---------- page head ---------- */
.page-head { padding: 28px 0 8px; max-width: 74ch; }
.page-lead { color: var(--text-soft); font-size: 1.02rem; margin: 0; }

/* ---------- article ---------- */
.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 40px;
  align-items: start;
  padding: 24px 0 56px;
}
.article { min-width: 0; }
/* Measure. The article track is 780px, which renders about 103 characters
   per line at 16px — past the ~75 where the eye starts losing its place
   on the return sweep, and these guides run 900+ words. Cap the prose at
   70ch (≈66 characters) and leave tables and code at full width: exhibits
   are read column-wise, not line-wise, so they are allowed to be wider
   than the text beside them. */
.article > p,
.article > ul,
.article > ol,
.article > blockquote,
.article > h2,
.article > h3 { max-width: 70ch; }
.article h2 {
  margin: 1.9em 0 0.6em;
  padding-top: 0.2em;
  font-size: 1.34rem;
  border-top: 1px solid var(--border);
  padding-top: 1.1em;
}
.article h2:first-child { border-top: 0; padding-top: 0; margin-top: 0.4em; }
.article h3 { margin: 1.5em 0 0.5em; }
.article ul, .article ol { padding-left: 1.35em; margin: 0 0 1em; }
.article li { margin-bottom: 0.4em; }
.article blockquote {
  margin: 1.2em 0; padding: 12px 18px;
  border-left: 3px solid var(--primary);
  background: var(--primary-tint);
  color: var(--text-soft);
}
.article blockquote p { margin: 0; }
.article hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.article pre {
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px; overflow-x: auto;
}
.article pre code { background: none; padding: 0; }

.toc { position: sticky; top: 82px; }
.toc-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  font-size: 0.86rem;
}
.toc-box h4 {
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 10px;
}
.toc-box ol { margin: 0; padding-left: 1.1em; }
.toc-box li { margin-bottom: 6px; }
.toc-box a { color: var(--text-soft); }
.toc-box a:hover { color: var(--accent); }
.toc-cta { margin-top: 14px; }

.related {
  margin-top: 40px; padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r);
}
.related h3 { font-size: 0.95rem; margin: 0 0 10px; }
.related ul { margin: 0; padding-left: 1.1em; }
.related li { margin-bottom: 6px; font-size: 0.9rem; }

/* ---------- filter bar ---------- */
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  margin-bottom: 24px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px;
}
.filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-label {
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); flex: none;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--font); font-size: 0.84rem;
  padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-soft); cursor: pointer;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--text); border-color: var(--text); color: #fff; }
.filter-count { margin: 0 0 0 auto; font-size: 0.82rem; color: var(--muted); font-family: var(--font-mono); }
.filter-empty { color: var(--muted); padding: 24px 0; }

.guide-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tag {
  font-size: 0.7rem; padding: 2px 8px; border-radius: 3px;
  background: var(--surface-alt); color: var(--text-soft);
  border: 1px solid var(--border);
}
/* Level is a different axis from topic, so it is drawn differently
   rather than as another identical pill. */
.tag-dim { border-style: dashed; background: transparent; color: var(--muted); }
.guide-tool { display: block; margin-top: 8px; font-size: 0.78rem; color: var(--muted); }

/* ---------- tool layout ---------- */
.tool-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 20px 0 8px;
}
.panel {
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  padding: 20px;
}
.panel-in { background: var(--surface-alt); }
.panel-out { background: var(--surface); box-shadow: var(--shadow); }

/* ---------- form ---------- */
.field { margin-bottom: 16px; }
.field > label {
  display: block; font-size: 0.82rem; font-weight: 600;
  margin-bottom: 6px; color: var(--text);
}
.field input[type="number"], .field input[type="text"], .field select {
  width: 100%;
  font-family: var(--font); font-size: 0.92rem;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
}
.field input:focus, .field select:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
  border-color: var(--primary);
}
.field select { appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a5160' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.num-wrap { display: flex; align-items: stretch; }
.num-wrap input { border-radius: var(--r) 0 0 var(--r) !important; }
.field-unit {
  display: flex; align-items: center; padding: 0 10px;
  background: var(--surface-alt); border: 1px solid var(--border-strong); border-left: 0;
  border-radius: 0 var(--r) var(--r) 0;
  font-size: 0.82rem; color: var(--muted); white-space: nowrap;
}
.num-wrap input:only-child { border-radius: var(--r) !important; }
.field-hint { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 5px; line-height: 1.45; }

.segmented { display: flex; flex-wrap: wrap; gap: 4px; }
.seg {
  font-family: var(--font); font-size: 0.84rem;
  padding: 6px 12px; border-radius: var(--r);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-soft); cursor: pointer;
}
.seg:hover { border-color: var(--text-soft); color: var(--text); }
.seg.active { background: var(--text); border-color: var(--text); color: #fff; font-weight: 600; }

/* ---------- status ---------- */
.status {
  border-radius: var(--r); padding: 12px 14px; margin-bottom: 18px;
  border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}
.status strong { font-family: var(--font-head); font-size: 1.05rem; }
.status span { font-size: 0.84rem; color: var(--text-soft); }
.status.ok { background: var(--ok-tint); border-color: rgba(29, 122, 70, 0.28); }
.status.ok strong { color: var(--ok); }
.status.info { background: var(--accent-tint); border-color: rgba(31, 78, 121, 0.26); }
.status.info strong { color: var(--accent); }
.status.warn { background: var(--warn-tint); border-color: rgba(154, 100, 0, 0.3); }
.status.warn strong { color: var(--warn); }
.status.err { background: var(--err-tint); border-color: rgba(179, 38, 30, 0.28); }
.status.err strong { color: var(--err); }

/* ---------- stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.stat {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
}
.stat.hl { border-color: var(--primary); background: var(--primary-tint); }
.stat-label { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px; }
.stat-num {
  font-family: var(--font-mono); font-size: 1.5rem; font-weight: 600;
  line-height: 1.15; color: var(--text);
  overflow-wrap: anywhere;
}
.stat-unit { font-size: 0.78rem; color: var(--muted); margin-left: 3px; font-family: var(--font); }
.stat-note { font-size: 0.76rem; color: var(--muted); margin-top: 4px; line-height: 1.4; }

.sub-title {
  font-family: var(--font-head); font-weight: 700; font-size: 0.92rem;
  margin: 22px 0 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 1em; border: 1px solid var(--border); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; background: var(--surface); }
th {
  text-align: left; font-weight: 600; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--surface-alt); color: var(--text-soft);
  padding: 9px 12px; border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:nth-child(even) { background: var(--surface-raised); }
tbody tr:last-child td { border-bottom: 0; }
/* Numbers right-aligned and monospaced so columns of figures line up. */
th.num, td.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
/* Short tokens ("Self-drilling", "3/16 in") stay on one line: a hyphen is
   a legal break point, and the browser will split the word rather than
   let the table scroll. Long prose columns still wrap normally. */
th.nw, td.nw { white-space: nowrap; }

/* ---------- notes ---------- */
.note-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--r);
  padding: 14px 18px;
  font-size: 0.88rem;
  color: var(--text-soft);
  line-height: 1.6;
}
.note-box strong { color: var(--text); }

/* ---------- material rows (project cost) ---------- */
.mat-head {
  display: grid; grid-template-columns: 1fr 62px 76px 26px; gap: 6px;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); margin-bottom: 4px; padding: 0 1px;
}
.mat-row {
  display: grid; grid-template-columns: 1fr 62px 76px 26px; gap: 6px;
  margin-bottom: 6px; align-items: center;
}
.mat-row input {
  font-family: var(--font); font-size: 0.86rem;
  padding: 6px 8px; width: 100%;
  border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--surface); color: var(--text);
}
.mat-row input[type="number"] { font-family: var(--font-mono); text-align: right; }
/* A grid child defaults to min-width:auto, so a long material name
   refuses to shrink below its content width and pushes the row wider
   than the panel. This is the one line that stops that. */
.mat-name { min-width: 0; }
.mat-qty, .mat-price { font-variant-numeric: tabular-nums; }
.mat-row input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.mat-del {
  width: 26px; height: 26px; line-height: 1;
  border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: var(--r); color: var(--muted); cursor: pointer;
  font-size: 1rem; padding: 0;
}
.mat-del:hover { border-color: var(--err); color: var(--err); }
#mat-add { margin-top: 4px; }

/* ---------- FAQ ---------- */
.faq-group { margin-bottom: 32px; }
.faq-group h2 { font-size: 1.1rem; margin-bottom: 12px; color: var(--text-soft); }
.faq-item {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 8px;
  color: var(--text);
}
.faq-item:hover { border-color: var(--primary); text-decoration: none; }
.faq-item h3 { font-size: 0.96rem; margin: 0 0 4px; }
.faq-item p { font-size: 0.86rem; color: var(--text-soft); margin: 0 0 6px; }

/* ---------- footer ---------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 44px 0 24px;
  margin-top: 40px;
  font-size: 0.86rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr 0.9fr;
  gap: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.footer-brand {
  font-family: var(--font-head); font-weight: 700; font-size: 1.05rem;
  color: var(--text); display: block; margin-bottom: 8px;
}
.footer-about { color: var(--text-soft); font-size: 0.84rem; margin-bottom: 12px; max-width: 34ch; }
.footer-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.footer-badges span {
  font-size: 0.72rem; padding: 2px 8px;
  border: 1px solid var(--border); border-radius: 3px;
  color: var(--muted); background: var(--surface-raised);
}
.footer-col h4 {
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin: 0 0 10px; font-weight: 700;
}
.footer-col ul { list-style: none; margin: 0 0 12px; padding: 0; }
.footer-col li { margin-bottom: 6px; }
.footer-col a { color: var(--text-soft); font-size: 0.84rem; }
.footer-col a:hover { color: var(--accent); }
.footer-col .btn { font-size: 0.78rem; padding: 5px 10px; }

.footer-bottom {
  padding-top: 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.footer-bottom p { margin: 0; font-size: 0.78rem; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .toc { position: static; }
  .toc-box ol { columns: 2; }
  .tool-layout { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-brand-col { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav {
    display: none;
    position: absolute; left: 0; right: 0; top: 62px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column; align-items: stretch;
    padding: 10px 20px 16px;
    box-shadow: var(--shadow);
  }
  .nav.open { display: flex; }
  .nav a { padding: 10px 8px; }
  .nav .nav-cta { margin: 6px 0 0; text-align: center; }

  .hero { padding: 40px 0 36px; }
  .section { padding: 40px 0; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .filter-count { margin-left: 0; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
  .mat-head, .mat-row { grid-template-columns: 1fr 52px 66px 26px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .card-hover:hover { transform: none; }
}
