/* =========================================================
   MyHouseLogic — "Home Editorial" Design System
   v3.0 — Full redesign around the brand hero photograph
   Identity: warm home-improvement magazine + practical tools
   Palette derived from the hero image: warm cream sky,
   deep forest-sage green, cedar wood, architectural charcoal.
   Numerals in calculators remain monospaced. Cards are
   editorial, not app widgets. HOME FIRST. TOOLS SECOND.
   ========================================================= */

/* ---------- 1. Design Tokens ---------- */
:root {
  /* Brand identity — forest sage + warm paper (from hero photo) */
  --forest:          #4A5426;   /* primary accent — deep forest sage */
  --forest-deep:     #3C451F;   /* pressed / borders */
  --forest-hover:    #2E3617;   /* hover state */
  --forest-soft:     #EBEAD9;   /* sage tint background */

  /* Color — warm paper from the hero's cream sky */
  --paper:           #FAF7F0;   /* base canvas */
  --paper-deep:      #F1EDE2;   /* section breaks */
  --paper-card:      #FFFFFF;   /* discrete modules */
  --ink:             #2A241B;   /* primary text — warm architectural charcoal */
  --ink-soft:        #4C463A;   /* secondary text */
  --ink-muted:       #6F6858;   /* tertiary text */
  --ink-faint:       #A39A88;   /* placeholder, disabled */
  --steel:           #57534A;   /* chrome — borders, nav bg */
  --steel-light:     #E3DCCC;   /* hairline borders */
  --steel-lighter:   #F0EBDD;   /* subtle backgrounds */
  --accent:          var(--forest);
  --accent-hover:    var(--forest-hover);
  --accent-soft:     var(--forest-soft);

  /* Category tick colors — natural materials, tag-only */
  --cat-roofing:      #47554E;  /* weathered slate */
  --cat-paint:        #A0522D;  /* clay */
  --cat-flooring:     #8C6746;  /* oak */
  --cat-concrete:     #6F695C;  /* warm stone */
  --cat-kitchen:      #96742E;  /* brass */
  --cat-garden:       #5B7A29;  /* moss */
  --cat-maintenance:  #55603F;  /* olive steel */
  --cat-pools:        #4E6E75;  /* still water — v36 */
  --cat-garage:       #5C5F66;  /* workshop steel — v36 */
  --cat-world:        #7A5C3E;  /* aged timber — v36 */

  /* Semantic (AA-verified on paper-deep) */
  --success:  #2F6B33;
  --warning:  #7E5B12;   /* deep bronze — 5.3:1 on paper-deep */
  --error:    #9C3325;   /* warm brick — 6.2:1 on paper-deep */

  /* Typography — editorial serif display + warm humanist sans body */
  --font-display: Georgia, "Iowan Old Style", Charter, "Bitstream Charter", "Cambria", "Times New Roman", serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;

  /* Type scale — editorial hierarchy */
  --fs-xs:    0.75rem;    /* 12px */
  --fs-sm:    0.875rem;   /* 14px */
  --fs-base:  1.0625rem;  /* 17px — comfortable reading */
  --fs-md:    1.125rem;   /* 18px */
  --fs-lg:    1.3125rem;  /* 21px */
  --fs-xl:    1.5rem;     /* 24px */
  --fs-2xl:   1.9375rem;  /* 31px */
  --fs-3xl:   2.4375rem;  /* 39px */
  --fs-4xl:   3.0625rem;  /* 49px */

  --lh-tight:   1.15;
  --lh-snug:    1.35;
  --lh-normal:  1.55;
  --lh-relaxed: 1.7;

  --fw-normal:  400;
  --fw-medium:  500;
  --fw-semibold: 600;
  --fw-bold:    700;

  /* Spacing — generous, airy */
  --sp-1: 0.25rem;  --sp-2: 0.5rem;   --sp-3: 0.75rem;  --sp-4: 1rem;
  --sp-5: 1.5rem;   --sp-6: 2rem;     --sp-7: 2.5rem;   --sp-8: 3rem;
  --sp-10: 4rem;    --sp-12: 5rem;    --sp-14: 6rem;    --sp-16: 7rem;

  /* Radii — soft but not bubbly */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* Layout */
  --container-max: 1120px;
  --measure: 66ch;               /* comfortable paragraph width */

  /* Elevation — whisper, not app shadows */
  --shadow-sm: 0 1px 2px rgba(42, 36, 27, 0.05);
  --shadow-md: 0 4px 16px rgba(42, 36, 27, 0.07);
  --shadow-lg: 0 12px 32px rgba(42, 36, 27, 0.12);

  /* Borders */
  --border-hair: 1px solid var(--steel-light);

  color-scheme: light;
}

/* ---------- 2. Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
ul, ol { padding: 0; list-style: none; }
strong { font-weight: var(--fw-semibold); color: var(--ink); }

/* Focus — visible, warm */
:focus-visible {
  outline: 3px solid var(--forest);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
::selection { background: var(--forest-soft); color: var(--forest-hover); }

/* ---------- 3. Editorial Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  font-weight: var(--fw-bold);
  text-wrap: balance;
}
h1 { font-size: var(--fs-3xl); letter-spacing: -0.015em; }
h2 { font-size: var(--fs-2xl); margin-bottom: var(--sp-3); }
h3 { font-size: var(--fs-lg); line-height: var(--lh-snug); margin-bottom: var(--sp-2); }
h4 { font-family: var(--font-sans); font-size: var(--fs-sm); font-weight: var(--fw-bold); }

p { margin-bottom: var(--sp-4); line-height: var(--lh-relaxed); }
p:last-child { margin-bottom: 0; }
main p, .article p { max-width: var(--measure); }

/* Skip link + screen-reader helpers */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: var(--sp-3) var(--sp-5);
  border-radius: 0 0 var(--r-sm) 0;
  z-index: 3000;
}
.skip-link:focus { left: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 4. Layout ---------- */
.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}
main { display: block; flex: 1 0 auto; }
main:focus { outline: none; }

.section { padding-block: var(--sp-12); }
.section--tight { padding-block: var(--sp-8); }
.section__header { margin-bottom: var(--sp-8); }
.section__header p { color: var(--ink-muted); font-size: var(--fs-md); max-width: 58ch; }
.section__label {
  display: inline-block;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: var(--fw-bold);
  color: var(--accent);
  margin-bottom: var(--sp-2);
}
.section__header h2 { margin-bottom: var(--sp-2); }

/* ---------- 5. Icons ---------- */
.icon { width: 20px; height: 20px; flex-shrink: 0; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 28px; height: 28px; }

/* ---------- 6. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: var(--font-sans);
  font-weight: var(--fw-semibold);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  padding: 12px 22px;
  font-size: var(--fs-sm);
  line-height: 1.2;
  transition: background-color 0.18s ease, color 0.18s ease,
              border-color 0.18s ease, transform 0.18s ease,
              box-shadow 0.18s ease;
  text-align: center;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary {
  background: var(--forest);
  color: #FFFDF5;
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover {
  background: var(--forest-hover);
  color: #FFFDF5;
  box-shadow: var(--shadow-md);
}
.btn--secondary {
  background: var(--ink);
  color: var(--paper);
}
.btn--secondary:hover { background: #3F3829; color: var(--paper); }
.btn--ghost {
  background: rgba(255, 253, 245, 0.86);
  color: var(--ink);
  border: 1.5px solid rgba(42, 36, 27, 0.42);
  backdrop-filter: blur(4px);
  box-shadow: var(--shadow-sm);
}
.btn--ghost:hover {
  border-color: var(--ink);
  background: #FFFDF5;
  color: var(--ink);
}
.btn--outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--forest-light, #77804A);
}
.btn--outline:hover {
  background: var(--forest-soft);
  color: var(--forest-hover);
  border-color: var(--forest);
}
.btn--block { display: flex; width: 100%; }
.btn--lg { padding: 15px 28px; font-size: var(--fs-md); border-radius: var(--r-md); }
.btn--sm { padding: 8px 14px; font-size: var(--fs-xs); }

/* ---------- 7. Header / Navigation ---------- */
.site-header {
  background: rgba(250, 247, 240, 0.94);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: var(--border-hair);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: 68px;
  position: relative;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}
.wordmark__mark svg { width: 34px; height: 34px; }
.wordmark__text {
  font-family: var(--font-sans);
  font-size: 1.35rem;
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
  color: var(--ink);
}
.wordmark__text span { color: var(--forest); }

.nav { display: flex; align-items: center; gap: var(--sp-1); }
.nav__link {
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  padding: 9px 13px;
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.nav__link:hover { color: var(--forest-hover); background: var(--forest-soft); }
.nav__link--active,
.nav__link[aria-current="page"] {
  color: var(--forest-hover);
  background: var(--forest-soft);
  font-weight: var(--fw-semibold);
}
.nav__cta {
  margin-left: var(--sp-2);
  padding: 10px 18px;
}

.nav-toggle {
  display: none;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--steel-light);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  color: var(--ink);
  background: var(--paper-card);
}
.nav-toggle:hover { border-color: var(--accent); color: var(--accent); }
.nav-toggle svg { width: 18px; height: 18px; }
.nav-toggle span { white-space: nowrap; font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.nav-toggle[aria-expanded="true"] + .nav { display: flex; }

.header-actions { display: flex; align-items: center; gap: var(--sp-3); }

/* Unit toggle — quiet, chrome-like */
.unit-toggle {
  display: inline-flex;
  border: 1px solid var(--steel-light);
  border-radius: var(--r-pill);
  overflow: hidden;
  background: var(--paper-card);
}
.unit-toggle__btn {
  padding: 6px 13px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.unit-toggle__btn:hover { color: var(--ink); }
.unit-toggle__btn.is-active {
  background: var(--ink);
  color: var(--paper);
}

@media (max-width: 1024px) {
  .site-header__inner { flex-wrap: wrap; }
  .nav {
    display: none;
    order: 3;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: var(--sp-3) 0 var(--sp-4);
  }
  .nav__link { display: block; padding: 12px 14px; font-size: var(--fs-md); }
  .nav__cta { margin: var(--sp-2) 14px 0; justify-content: center; }
  .nav-toggle { display: inline-flex; order: 2; }
  .header-actions { order: 1; }
  .wordmark { order: 0; }
}
@media (max-width: 480px) {
  .nav-toggle { padding: 9px 11px; gap: 0; }
  .nav-toggle span { display: none; }
  .wordmark__text { font-size: 1.2rem; }
  .wordmark__mark svg { width: 30px; height: 30px; }
}

/* ---------- 8. Hero — photographic, editorial ---------- */
/* Higgsfield golden-hour photograph: the deep shrubs and shadowed
   foreground on the left anchor white editorial text; the lit
   stone-and-timber facade and the evening sky stay clear to the
   right of the text block. A soft dark scrim (left band + gentle
   base) guarantees AA contrast without dimming the photograph. */
.hero--image {
  position: relative;
  background: var(--ink);   /* warm-dark placeholder while the photo loads */
  overflow: hidden;
}
.hero__media {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero__media img,
.hero__media picture {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 55% 42%;   /* keep the sky, whole house in frame */
}
.hero__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg,
      rgba(26, 30, 20, 0.74) 0%,
      rgba(26, 30, 20, 0.52) 32%,
      rgba(26, 30, 20, 0.16) 54%,
      rgba(26, 30, 20, 0) 70%),
    linear-gradient(180deg,
      rgba(26, 30, 20, 0.24) 0%,
      rgba(26, 30, 20, 0) 24%,
      rgba(26, 30, 20, 0) 58%,
      rgba(26, 30, 20, 0.40) 100%);
}
.hero__inner {
  position: relative;
  z-index: 2;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}
.hero--image .hero__inner {
  display: flex;
  align-items: center;
  min-height: 520px;   /* editorial header band — premium, not full-screen */
  padding-block: var(--sp-7);
}
.hero__content { max-width: 560px; }
.hero__kicker {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: var(--fw-bold);
  color: var(--forest-hover);
  background: rgba(235, 234, 217, 0.94);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  margin-bottom: var(--sp-5);
}
.hero--image .hero__headline {
  font-family: var(--font-display);
  font-size: var(--fs-4xl);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-4);
  color: #FFFDF5;
  text-wrap: balance;
}
.hero__sub {
  color: rgba(255, 253, 245, 0.88);
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  margin-bottom: var(--sp-6);
  max-width: 44ch;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}
/* CTAs over the photograph invert to paper-on-ink (same pattern as .cta-banner) */
.hero--image .btn--primary {
  background: #FFFDF5;
  color: var(--forest-hover);
}
.hero--image .btn--primary:hover { background: var(--forest-soft); }
.hero--image .btn--ghost {
  background: rgba(255, 253, 245, 0.14);
  color: #FFFDF5;
  border: 1.5px solid rgba(255, 253, 245, 0.48);
}
.hero--image .btn--ghost:hover {
  background: rgba(255, 253, 245, 0.24);
  border-color: #FFFDF5;
  color: #FFFDF5;
}
.hero__standards {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  color: rgba(255, 253, 245, 0.78);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: var(--fw-semibold);
}
.hero__standards svg { color: #C9D0AC; }

/* Tablet: 450–500px band. At these widths cover shows the full
   house height (container aspect is wider than the photo), so the
   default object-position needs no change. */
@media (min-width: 601px) and (max-width: 900px) {
  .hero--image .hero__inner { min-height: 480px; }
  .hero--image .hero__headline { font-size: var(--fs-3xl); }  /* keeps the band 450-500px */
}

/* Mobile: art-directed portrait crop (gable, entry and picture
   window). Compact editorial header — text stacks over the lower
   half on a rising scrim so the roofline and sky stay uncovered. */
@media (max-width: 600px) {
  .hero__media img,
  .hero__media picture {
    object-position: 50% 32%;   /* roofline high, darker base under text */
  }
  .hero__scrim {
    background: linear-gradient(180deg,
      rgba(26, 30, 20, 0.12) 0%,
      rgba(26, 30, 20, 0) 20%,
      rgba(26, 30, 20, 0.22) 40%,
      rgba(26, 30, 20, 0.52) 58%,
      rgba(26, 30, 20, 0.82) 80%,
      rgba(26, 30, 20, 0.92) 100%);
  }
  .hero--image .hero__inner {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 420px;
    padding-block: var(--sp-5);
    padding-bottom: calc(var(--sp-5) + env(safe-area-inset-bottom, 0px));
  }
  .hero__content { max-width: none; }
  .hero__kicker { margin-bottom: var(--sp-2); }
  .hero--image .hero__headline {
    font-size: var(--fs-2xl);
    line-height: 1.08;
    margin-bottom: var(--sp-2);
  }
  .hero__sub { font-size: var(--fs-sm); max-width: 40ch; margin-bottom: var(--sp-4); }
  .hero__actions { gap: var(--sp-2); margin-bottom: var(--sp-3); }
  .hero__actions .btn { flex: 1 1 auto; padding-block: 12px; }
}

/* Headline base — the element lives inside .hero--image;
   type sizing is overridden by the .hero--image .hero__headline rules above. */
.hero__headline {
  font-size: var(--fs-3xl);
  line-height: 1.12;
  margin-bottom: var(--sp-3);
}

/* Search box — keeps #global-search / #search-results JS contract */
.search-box {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--paper-card);
  border: 1px solid var(--steel-light);
  border-radius: var(--r-pill);
  padding: 4px 4px 4px 18px;
  box-shadow: var(--shadow-sm);
  max-width: 480px;
  margin-bottom: var(--sp-3);
}
.search-box:focus-within { border-color: var(--forest); box-shadow: var(--shadow-md); }
.search-box input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: var(--fs-sm);
  color: var(--ink);
  min-width: 0;
}
.search-box input::placeholder { color: #8A8272; }
.search-box button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--forest);
  color: #FFFDF5;
  border-radius: var(--r-pill);
  padding: 9px 16px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.search-box button:hover { background: var(--forest-hover); }
.search-results {
  display: none;
  background: var(--paper-card);
  border: var(--border-hair);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  overflow: hidden;
  margin-bottom: var(--sp-3);
}
.search-results.is-visible { display: block; }
.search-results a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 12px 16px;
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  border-bottom: 1px solid var(--steel-lighter);
  text-decoration: none;
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--forest-soft); }
.search-results__empty {
  padding: 12px 16px;
  color: var(--ink-muted);
  font-size: var(--fs-sm);
}

/* ---------- 8b. Search strip — relocated from the hero ---------- */
/* The hero photograph stays clean editorial (kicker, headline, copy,
   CTAs); site search lives in a slim paper strip directly below it. */
.search-strip {
  background: var(--paper);
  padding-block: var(--sp-5);
}
.search-strip .search-box { margin-bottom: 0; }
.search-strip .search-results { margin: var(--sp-3) 0 0; }

/* ---------- 9. Category Cards — "What are you planning?" ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
}
.cat-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  background: var(--paper-card);
  border: var(--border-hair);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  text-decoration: none;
  color: var(--ink);
  position: relative;
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.cat-card:hover {
  border-color: var(--forest);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.cat-card__icon {
  width: 46px;
  height: 46px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  background: var(--forest-soft);
  color: var(--forest-hover);
}
.cat-card__icon svg { width: 24px; height: 24px; }
.cat-card__name {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--ink);
  line-height: 1.25;
}
.cat-card__desc {
  color: var(--ink-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  max-width: 34ch;
}
.cat-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--forest-hover);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.cat-card__meta .dot { margin: 0; }
/* Featured category — Roofing & Solar gets visual presence */
.cat-card--featured {
  grid-column: span 2;
  grid-row: span 1;
  flex-direction: row;
  align-items: center;
  gap: var(--sp-6);
  padding: 0;
  background: var(--cat-roofing);
  border-color: transparent;
}
.cat-card--featured:hover { border-color: var(--forest-deep); }
.cat-card--featured .cat-card__body {
  flex: 1 1 320px;
  padding: var(--sp-7) 0 var(--sp-7) var(--sp-7);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.cat-card--featured .cat-card__name { color: #FFFDF5; font-size: var(--fs-xl); }
.cat-card--featured .cat-card__desc { color: #D8DCD4; max-width: 40ch; }
.cat-card--featured .cat-card__meta { color: #C7D2C4; }
.cat-card--featured .cat-card__photo {
  flex: 1 1 260px;
  align-self: stretch;
  min-height: 220px;
  background-size: cover;
  background-position: 72% 30%;
  border-radius: 0 var(--r-lg) var(--r-lg) 0;
}
@media (max-width: 900px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .cat-grid { grid-template-columns: 1fr; }
  .cat-card--featured {
    grid-column: span 1;
    flex-direction: column;
    padding: 0;
  }
  .cat-card--featured .cat-card__body { padding: var(--sp-6); }
  .cat-card--featured .cat-card__photo {
    width: 100%;
    min-height: 150px;
    border-radius: 0 0 var(--r-lg) var(--r-lg);
    background-position: 70% 35%;
    order: 2;
    flex: none;
  }
}

/* Legacy cat-list (category page related sections) */
.cat-list { display: grid; gap: var(--sp-2); }
.cat-list__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: var(--border-hair);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--ink);
  background: var(--paper-card);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cat-list__item:hover { border-color: var(--forest); box-shadow: var(--shadow-sm); }
.cat-list__name { flex: 1; }
.cat-list__count { font-size: var(--fs-xs); color: var(--ink-muted); }

/* ---------- 10. Tool Cards — "Calculate Before You Buy" ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
}
.tool-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  background: var(--paper-card);
  border: var(--border-hair);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.tool-card:hover {
  border-color: var(--forest);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.tool-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}
.tool-card__icon {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  background: var(--forest-soft);
  color: var(--forest-hover);
}
.tool-card__icon svg { width: 22px; height: 22px; }
.tool-card__title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--ink);
  line-height: 1.3;
}
.tool-card__desc {
  color: var(--ink-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  flex-grow: 1;
}
.tool-card__go {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--forest);
}
.tool-card:hover .tool-card__go { color: var(--forest-hover); }
@media (max-width: 900px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .tool-grid { grid-template-columns: 1fr; } }

/* Legacy tool list (existing hub/category pages) — restyled as warm cards */
.tool-list { display: grid; gap: var(--sp-3); }
.tool-list__item {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  background: var(--paper-card);
  border: var(--border-hair);
  border-radius: var(--r-md);
  padding: var(--sp-5) var(--sp-6);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.tool-list__item:hover {
  border-color: var(--forest);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  color: var(--ink);
}
.tool-list__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tool-list__title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--ink);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}
.tool-list__desc { color: var(--ink-muted); font-size: var(--fs-sm); line-height: var(--lh-normal); }
.tool-list__badge {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  border: 1px solid var(--steel-light);
  padding: 3px 9px;
  border-radius: var(--r-pill);
}
.tool-list__item--coming { opacity: 0.75; }
@media (max-width: 640px) {
  .tool-list__item { padding: var(--sp-4); }
  .tool-list__title { font-size: var(--fs-md); }
}

/* ---------- 11. Guide Cards — editorial article teasers ---------- */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
}
.guide-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  background: var(--paper-card);
  border: var(--border-hair);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.guide-card:hover {
  border-color: var(--forest);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.guide-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
}
.guide-card__title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--ink);
  line-height: 1.3;
}
.guide-card__excerpt {
  color: var(--ink-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  flex-grow: 1;
}
.guide-card:hover .guide-card__title { color: var(--forest-hover); }
@media (max-width: 900px) { .guide-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .guide-grid { grid-template-columns: 1fr; } }

/* ---------- 12. Editorial feature sections ---------- */
/* Steps — "Your Home. Your Project. Your Numbers." */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-6);
  counter-reset: step;
}
.step {
  position: relative;
  padding-top: var(--sp-2);
}
.step__num {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  color: var(--forest);
  line-height: 1;
  margin-bottom: var(--sp-2);
}
.step__title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  margin-bottom: var(--sp-2);
}
.step__text { color: var(--ink-muted); font-size: var(--fs-sm); line-height: var(--lh-relaxed); }
.step__rule {
  width: 44px;
  height: 3px;
  background: var(--forest);
  border-radius: var(--r-pill);
  margin-bottom: var(--sp-4);
}
@media (max-width: 768px) { .steps { grid-template-columns: 1fr; gap: var(--sp-6); } }

/* Editorial lead — big serif statement */
.editorial-lead {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  line-height: var(--lh-snug);
  color: var(--ink);
  max-width: 34ch;
}
.editorial-lead em { color: var(--forest-hover); font-style: italic; }

/* Split feature — image + text */
.feature-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-10);
  align-items: center;
}
.feature-split__media {
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  aspect-ratio: 4 / 3;
}
.feature-split__media img { width: 100%; height: 100%; object-fit: cover; }
.feature-split__body h2 { margin-bottom: var(--sp-4); }
@media (max-width: 860px) {
  .feature-split { grid-template-columns: 1fr; gap: var(--sp-6); }
}

/* ---------- 13. Trust / Methodology ---------- */
.trust-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-5);
}
.trust-item {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-6);
  background: var(--paper-card);
  border: var(--border-hair);
  border-radius: var(--r-lg);
}
.trust-item svg { color: var(--forest); }
.trust-item__title {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
}
.trust-item__text { color: var(--ink-muted); font-size: var(--fs-sm); line-height: var(--lh-normal); }
@media (max-width: 960px) { .trust-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .trust-grid { grid-template-columns: 1fr; } }

/* ---------- 14. Final CTA banner ---------- */
.cta-banner {
  background: linear-gradient(135deg, var(--forest) 0%, var(--forest-deep) 100%);
  color: #FFFDF5;
  padding-block: var(--sp-14);
}
.cta-banner h2 {
  color: #FFFDF5;
  font-size: var(--fs-2xl);
  max-width: 24ch;
  margin-inline: auto;
  margin-bottom: var(--sp-3);
  text-align: center;
}
.cta-banner p {
  color: #E4E7D8;
  text-align: center;
  max-width: 52ch;
  margin-inline: auto;
  font-size: var(--fs-md);
}
.cta-banner__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-3);
  margin-top: var(--sp-7);
}
.cta-banner .btn--ghost {
  background: rgba(255, 253, 245, 0.12);
  color: #FFFDF5;
  border-color: rgba(255, 253, 245, 0.45);
}
.cta-banner .btn--ghost:hover { background: rgba(255, 253, 245, 0.22); border-color: #FFFDF5; }
.cta-banner .btn--primary { background: #FFFDF5; color: var(--forest-hover); }
.cta-banner .btn--primary:hover { background: var(--forest-soft); }

/* ---------- 15. Badges / Tags / Dots ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.06em;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  background: var(--forest-soft);
  color: var(--forest-hover);
  white-space: nowrap;
}
.badge--cat { background: var(--steel-lighter); color: var(--ink-soft); }
.badge--roofing-solar   { color: var(--cat-roofing); }
.badge--painting-walls  { color: var(--cat-paint); }
.badge--flooring        { color: var(--cat-flooring); }
.badge--concrete-building { color: var(--cat-concrete); }
.badge--kitchen-bathroom  { color: var(--cat-kitchen); }
.badge--garden-outdoor    { color: var(--cat-garden); }
.badge--home-maintenance  { color: var(--cat-maintenance); }
.badge--pools-water       { color: var(--cat-pools); }
.badge--garage-workshop   { color: var(--cat-garage); }
.badge--homes-around-world { color: var(--cat-world); }
.badge--projects          { color: var(--forest); }
.badge--accent { background: var(--forest-soft); color: var(--forest-hover); }

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot--roofing-solar        { background: var(--cat-roofing); }
.dot--painting-walls       { background: var(--cat-paint); }
.dot--flooring             { background: var(--cat-flooring); }
.dot--concrete-building    { background: var(--cat-concrete); }
.dot--kitchen-bathroom     { background: var(--cat-kitchen); }
.dot--garden-outdoor       { background: var(--cat-garden); }
.dot--home-maintenance     { background: var(--cat-maintenance); }
.dot--pools-water          { background: var(--cat-pools); }
.dot--garage-workshop      { background: var(--cat-garage); }
.dot--homes-around-world   { background: var(--cat-world); }
.dot--projects             { background: var(--forest); }

/* ---------- 16. Breadcrumbs & Quick Jump ---------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  padding-block: var(--sp-5) 0;
}
.breadcrumb a { color: var(--ink-muted); font-weight: var(--fw-medium); }
.breadcrumb a:hover { color: var(--forest-hover); }
.breadcrumb__sep { color: var(--ink-faint); }
.breadcrumb__current { color: var(--ink-soft); font-weight: var(--fw-semibold); }

.quick-jump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  margin-block: var(--sp-4) var(--sp-5);
}
.quick-jump strong { color: var(--ink-muted); font-weight: var(--fw-semibold); }
.quick-jump a {
  color: var(--ink-soft);
  padding: 5px 12px;
  border: 1px solid var(--steel-light);
  border-radius: var(--r-pill);
  font-weight: var(--fw-medium);
}
.quick-jump a:hover { border-color: var(--forest); color: var(--forest-hover); }

/* ---------- 17. Page hero (interior pages) ---------- */
.page-hero { padding-block: var(--sp-8) var(--sp-6); }
.page-hero h1 { margin-bottom: var(--sp-4); text-wrap: balance; }
.page-hero__sub {
  color: var(--ink-muted);
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  max-width: 62ch;
}
.page-hero__kicker {
  display: inline-block;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: var(--fw-bold);
  color: var(--forest-hover);
  margin-bottom: var(--sp-3);
}

/* ---------- 18. Tool page layout ---------- */
.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--sp-8);
  align-items: start;
  padding-block: var(--sp-6) var(--sp-12);
}
.tool-layout__main { min-width: 0; }
.tool-layout__sidebar { display: grid; gap: var(--sp-5); position: sticky; top: 92px; }
@media (max-width: 980px) {
  .tool-layout { grid-template-columns: 1fr; }
  .tool-layout__sidebar { position: static; }
}
@media (min-width: 768px) {
  .tool-layout__sidebar { grid-row: span 1; }
}

/* ---------- 19. Calculator — approachable, not laboratory ---------- */
.calc-form {
  background: var(--paper-card);
  border: var(--border-hair);
  border-radius: var(--r-lg);
  padding: var(--sp-7);
  box-shadow: var(--shadow-sm);
}
.calc-form h2 { font-size: var(--fs-xl); }
@media (max-width: 560px) { .calc-form { padding: var(--sp-5); } }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--sp-5) var(--sp-4);
}
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
/* Mulch calculator rectangle group: spans two tracks of the form grid on
   wide screens (moved here from an inline style). Reset to the single
   track at mobile widths — a hard "span 2" spills past the one-column
   grid and causes horizontal overflow. */
#mulch-rect-group { grid-column: span 2; }
@media (max-width: 560px) { #mulch-rect-group { grid-column: auto; } }

.form-field { display: flex; flex-direction: column; gap: 7px; }
.form-field label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--ink);
}
.hint {
  color: var(--ink-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
}
.input-wrap { position: relative; display: flex; }
.input-wrap input,
.input-wrap select {
  width: 100%;
  padding: 12px 44px 12px 15px;
  background: var(--paper);
  border: 1px solid var(--steel-light);
  border-radius: var(--r-sm);
  font-size: var(--fs-md);
  font-family: var(--font-sans);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.input-wrap input:hover,
.input-wrap select:hover { border-color: var(--steel); }
.input-wrap input:focus,
.input-wrap select:focus {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(74, 84, 38, 0.18);
  background: #FFFDF5;
}
.input-wrap input::placeholder { color: var(--ink-faint); }
.input-wrap .unit {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  font-family: var(--font-mono);
  pointer-events: none;
}

/* Takeoff — results, styled like a warm material slip */
.takeoff {
  background: var(--paper-card);
  border: 1px solid var(--steel-light);
  border-radius: var(--r-lg);
  margin-top: var(--sp-6);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.takeoff__header {
  background: var(--ink);
  color: var(--paper);
  padding: var(--sp-4) var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}
.takeoff__title {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: var(--fw-bold);
  color: var(--paper);
  display: flex;
  align-items: center;
  gap: 8px;
}
.takeoff__title svg { color: var(--forest-soft); opacity: 0.9; }
.takeoff__standards {
  font-size: var(--fs-xs);
  color: #B8B2A4;
  font-family: var(--font-mono);
}
.takeoff__body { padding: var(--sp-3) var(--sp-6) var(--sp-5); }
.takeoff__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-block: 13px;
  border-bottom: 1px solid var(--steel-lighter);
}
.takeoff__row:last-of-type { border-bottom: none; }
.takeoff__label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--ink);
}
.takeoff__label-sub {
  display: block;
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  font-weight: var(--fw-normal);
  margin-top: 2px;
}
.takeoff__value-group { display: flex; align-items: baseline; gap: 7px; }
.takeoff__value {
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--forest-hover);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.takeoff__total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-top: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: var(--forest-soft);
  border-radius: var(--r-md);
}
.takeoff__total-label {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  color: var(--forest-hover);
}
.takeoff__total-value {
  font-family: var(--font-mono);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  color: var(--forest-hover);
  font-variant-numeric: tabular-nums;
}
.takeoff__actions {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: 0 var(--sp-6) var(--sp-5);
}
@media (max-width: 560px) {
  .takeoff__header, .takeoff__body, .takeoff__actions { padding-inline: var(--sp-4); }
  .takeoff__row { flex-wrap: wrap; }
}

/* Formula box — methodology, kept credible */
.formula-box {
  background: var(--ink);
  color: #E8E4D8;
  border-radius: var(--r-md);
  padding: var(--sp-5) var(--sp-6);
  margin-block: var(--sp-6);
  overflow-x: auto;
}
.formula-box h3,
.formula-box h2 { color: var(--paper); }
.formula-box code {
  font-family: var(--font-mono);
  background: none;
  color: #D6D2BC;
  padding: 0;
  font-size: var(--fs-sm);
}
.formula-box p { color: #B8B2A4; font-size: var(--fs-sm); }

/* Canvas visualizer */
.canvas-wrap {
  margin-block: var(--sp-5);
  border: var(--border-hair);
  border-radius: var(--r-md);
  background: var(--paper-card);
  padding: var(--sp-3);
  overflow: hidden;
}
canvas { max-width: 100%; height: auto; border-radius: var(--r-sm); }

/* Supporting photo banner on tool pages — always placed after the calculator
   so the form stays the first thing on mobile. Same figure DNA as
   .article figure, scoped to tool pages. */
.tool-figure {
  margin-block: var(--sp-6);
  border: var(--border-hair);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--paper-card);
}
.tool-figure img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;   /* keeps the photo modest on wide screens */
  object-fit: cover;
  object-position: center;
}
.tool-figure figcaption {
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  padding: 10px 15px;
  border-top: 1px solid var(--steel-lighter);
}

/* ---------- 20. Callouts ---------- */
.callout {
  background: var(--paper-deep);
  border-left: 4px solid var(--steel);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: var(--sp-5) var(--sp-6);
  margin-block: var(--sp-6);
}
.callout__label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: var(--fw-bold);
  color: var(--ink);
  margin-bottom: var(--sp-2);
}
.callout p { color: var(--ink-soft); font-size: var(--fs-sm); line-height: var(--lh-relaxed); }
.callout p:last-child { margin: 0; }
.callout strong { color: var(--ink); }
.callout--tip { border-left-color: var(--cat-garden); }
.callout--tip .callout__label { color: #2F6B33; }
.callout--warning { border-left-color: var(--warning); }
.callout--warning .callout__label { color: var(--warning); }
.callout--reminder { border-left-color: var(--cat-paint); }
.callout--reminder .callout__label { color: var(--cat-paint); }
.callout--safety { border-left-color: var(--error); }
.callout--safety .callout__label { color: var(--error); }

/* Checklist — "what you need before you start" */
.checklist { display: grid; gap: 9px; margin: 0; }
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  line-height: var(--lh-normal);
}
.checklist li::before {
  content: "";
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--forest-soft);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234A5426' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 13 4 4L19 7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 11px;
}

/* Reference tables — one global treatment for every data table.
   Professional information table, not a spreadsheet pasted on the page:
   capped width so it sits inside the reading column, compact cells,
   hairline dividers, tabular digits, single-line headers. */
.ref-table {
  width: 100%;
  max-width: 760px;   /* sit inside the content column, never edge-to-edge */
  border-collapse: collapse;
  font-size: var(--fs-sm);
  line-height: 1.45;
  font-variant-numeric: tabular-nums;   /* digits align column-to-column */
  margin-block: var(--sp-5);
  background: var(--paper-card);
  border: var(--border-hair);
  border-radius: var(--r-md);
  overflow: hidden;
}
/* Comparison tables (3–4 content columns) get a little more room,
   still well short of the section width. */
.ref-table--compare { max-width: 840px; }
.table-scroll { overflow-x: auto; margin-block: var(--sp-5); border-radius: var(--r-md); }
.table-scroll .ref-table { margin: 0; border: var(--border-hair); }
/* Inside a scroll wrapper the table keeps a readable floor width —
   rows stay compact and scannable instead of crushing to the phone. */
.table-scroll .ref-table { min-width: 480px; }
.ref-table th {
  text-align: left;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: var(--fw-bold);
  color: var(--ink-muted);
  background: var(--paper-deep);
  padding: 10px 14px;
  white-space: nowrap;   /* headers never wrap onto data rows */
  border-bottom: 1px solid var(--steel-light);
}
.ref-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--steel-lighter);
  color: var(--ink-soft);
  vertical-align: top;
}
.ref-table tr:last-child td { border-bottom: none; }
.ref-table tbody tr:hover td { background: var(--forest-soft); }
.ref-table--compare th:first-child { width: 26%; }
/* Label column never crushes: auto table layout starves short leading
   columns, which wraps row labels ("Level 4") onto two lines. */
.ref-table th:first-child,
.ref-table td:first-child { min-width: 96px; }

/* ---------- 21. Article / Editorial pages ---------- */
.article-header { padding-block: var(--sp-6) 0; }
.article-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.4375rem);
  line-height: 1.15;
  margin-bottom: var(--sp-4);
}
.article-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.article {
  font-size: var(--fs-base);
  line-height: var(--lh-relaxed);
  color: var(--ink-soft);
  padding-top: var(--sp-6);
}
.article h2 {
  font-size: var(--fs-xl);
  margin-top: var(--sp-10);
  margin-bottom: var(--sp-3);
}
.article h3 { margin-top: var(--sp-7); }
.article > h2:first-child,
.article > h3:first-child {
  margin-top: 0;
}
.article p { max-width: var(--measure); }
.article ul, .article ol {
  padding-left: 22px;
  margin-block: var(--sp-4);
  display: grid;
  gap: 9px;
  max-width: var(--measure);   /* lists keep the same reading measure as paragraphs */
}
.article ul { list-style: disc; }
.article ol { list-style: decimal; }
.article li { color: var(--ink-soft); line-height: var(--lh-normal); padding-left: 4px; }
.article strong { color: var(--ink); }
.article figure {
  margin-block: var(--sp-6);
  border: var(--border-hair);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--paper-card);
}
.article figcaption {
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  padding: 10px 15px;
  border-top: 1px solid var(--steel-lighter);
}
/* Inline SVG diagram inside an article figure (e.g. tile layout patterns).
   Explicit sizing class so the SVG never falls back to default 300x150. */
.figure-diagram {
  width: 100%;
  height: auto;
  background: var(--paper);
  border: 1px solid var(--steel-light);
  border-radius: var(--r-sm);
}
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--steel-lighter);
  padding: 2px 7px;
  border-radius: var(--r-xs);
  color: var(--forest-hover);
}

/* Sidebar widgets */
.widget {
  background: var(--paper-card);
  border: var(--border-hair);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
}
.widget h3 {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  padding-bottom: var(--sp-3);
  border-bottom: var(--border-hair);
  margin-bottom: var(--sp-4);
}
.widget ul { display: grid; gap: var(--sp-3); }
.widget li { font-size: var(--fs-sm); line-height: var(--lh-normal); }
.widget a { color: var(--ink-soft); font-weight: var(--fw-medium); }
.widget a:hover { color: var(--forest-hover); }
.tip-box {
  background: var(--forest-soft);
  border-color: transparent;
}
.tip-box h3 { border-bottom-color: rgba(74, 84, 38, 0.25); }
.tip-box p { color: var(--forest-hover); font-size: var(--fs-sm); line-height: var(--lh-normal); }

/* Related guides / tools widgets */
.related-tools { margin-top: var(--sp-6); padding-top: var(--sp-6); border-top: var(--border-hair); }
.related-tools h2 { font-size: var(--fs-lg); }
.related-guides { margin-top: var(--sp-8); padding-top: var(--sp-6); border-top: var(--border-hair); }
.related-guides h2 { font-size: var(--fs-xl); }

/* ---------- 22. FAQ Accordion ---------- */
.faq { margin-top: var(--sp-8); }
.faq h2 { font-size: var(--fs-xl); }
.faq__item {
  border: var(--border-hair);
  border-radius: var(--r-md);
  background: var(--paper-card);
  margin-bottom: 10px;
  overflow: hidden;
}
.faq__item[open] { border-color: var(--forest); }
.faq__question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: 16px 20px;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}
.faq__question::-webkit-details-marker { display: none; }
.faq__question::after {
  content: "+";
  font-family: var(--font-sans);
  font-size: var(--fs-lg);
  color: var(--forest);
  font-weight: var(--fw-normal);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.faq__item[open] .faq__question::after { content: "−"; }
.faq__answer {
  padding: 0 20px 18px;
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
}
.faq__answer p { max-width: 64ch; margin: 0; }

/* ---------- 23. Toast ---------- */
.toast {
  position: fixed;
  bottom: var(--sp-5);
  left: 50%;
  transform: translateX(-50%) translateY(150%);
  background: var(--ink);
  color: var(--paper);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md);
  z-index: 2000;
  transition: transform 0.3s ease;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  box-shadow: var(--shadow-lg);
}
.toast.is-visible { transform: translateX(-50%) translateY(0); }
.toast__icon { color: #C9CDA6; display: flex; }
.toast__icon svg { width: 16px; height: 16px; }

/* ---------- 24. Mobile Sticky Summary ---------- */
.mobile-summary {
  display: none;
  position: fixed;
  /* When the cookie notice is visible, main.js exposes its height as
     --cookie-notice-h on <body>; the summary sits above the notice instead
     of being covered by it. Falls back to 0 when the notice is absent. */
  bottom: var(--cookie-notice-h, 0px);
  left: 0;
  right: 0;
  background: var(--paper-card);
  border-top: 2px solid var(--forest);
  padding: var(--sp-3) var(--sp-4);
  z-index: 900;
  box-shadow: 0 -4px 12px rgba(42, 36, 27, 0.10);
  transition: bottom 0.2s ease;
}
.mobile-summary__inner {
  max-width: var(--container-max);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.mobile-summary__label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: var(--fw-bold);
  color: var(--ink-muted);
}
@media (max-width: 980px) {
  body.has-sticky-summary .mobile-summary { display: block; }
  /* Clear content behind BOTH bottom bars while the cookie notice is up. */
  body.has-sticky-summary { padding-bottom: calc(64px + var(--cookie-notice-h, 0px)); }
}

/* ---------- 26. Coming Soon ---------- */
.coming-soon {
  border: 1px dashed var(--steel-light);
  border-radius: var(--r-md);
  padding: var(--sp-6);
  text-align: center;
  color: var(--ink-muted);
  background: var(--paper);
  font-size: var(--fs-sm);
}
.coming-soon strong { color: var(--ink-soft); }

/* ---------- 27. Footer ---------- */
.site-footer {
  background: #26241C;
  color: #B8B2A4;
  padding-block: var(--sp-12) var(--sp-5);
  margin-top: auto;
  border-top: 1px solid #26241C;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--sp-8);
  margin-bottom: var(--sp-10);
}
.footer-col .wordmark { margin-bottom: var(--sp-3); }
.footer-col .wordmark__text { color: #FFFDF5; }
.footer-col .wordmark__text span { color: #C9CDA6; }
.footer-col > p { font-size: var(--fs-sm); color: #9A968E; max-width: 34ch; line-height: var(--lh-normal); }
.footer-col h4 {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #FFFDF5;
  margin-bottom: var(--sp-4);
  font-weight: var(--fw-bold);
}
.footer-col ul { display: grid; gap: 10px; }
.footer-col a {
  color: #B8B2A4;
  font-size: var(--fs-sm);
  text-decoration: none;
}
.footer-col a:hover { color: #C9CDA6; border-bottom: none; }
.footer-bottom {
  border-top: 1px solid rgba(184, 178, 164, 0.2);
  padding-top: var(--sp-5);
  display: grid;
  gap: var(--sp-3);
}
.footer-bottom > div:last-child {
  font-size: var(--fs-xs);
  color: #7E7A70;
}
@media (max-width: 980px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 768px) { .footer-grid { grid-template-columns: 1fr; gap: var(--sp-7); } }

/* ---------- 28. Legal Pages ---------- */
.legal-body { max-width: 72ch; }
.legal-body h2 { font-size: var(--fs-lg); margin-top: var(--sp-8); }
.legal-body p, .legal-body li { color: var(--ink-soft); font-size: var(--fs-sm); line-height: var(--lh-relaxed); }

/* ---------- 29. Cookie Notice ---------- */
/* restore [hidden] semantics: .cookie-notice's display:flex above
   otherwise overrides the UA stylesheet, so the notice could never
   be hidden after dismissal */
.cookie-notice[hidden] { display: none; }
.cookie-notice {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--ink);
  color: var(--paper);
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  z-index: 2500;
  box-shadow: 0 -8px 24px rgba(42, 36, 27, 0.22);
}
.cookie-notice p { font-size: var(--fs-sm); color: #D6D2C6; margin: 0; max-width: 72ch; }
.cookie-notice a { color: #C9CDA6; text-decoration: underline; }
.cookie-notice .btn { flex-shrink: 0; border: 1px solid rgba(250, 247, 240, 0.55); }
@media (min-width: 641px) {
  .cookie-notice { padding: var(--sp-3) var(--sp-5); }
  .cookie-notice p { font-size: var(--fs-xs); max-width: 88ch; }
}
@media (max-width: 640px) {
  .cookie-notice { flex-direction: column; align-items: stretch; text-align: left; }
  .cookie-notice .btn { justify-content: center; }
}

/* ---------- 30. Print ---------- */
@media print {
  .site-header, .site-footer, .cookie-notice, .nav-toggle, .header-actions,
  .mobile-summary, .toast, .quick-jump, .search-box, .search-results {
    display: none !important;
  }
  body { background: #fff; color: #000; display: block; }
  .tool-layout { grid-template-columns: 1fr; }
  .calc-form, .takeoff { border-color: #000; box-shadow: none; }
  .takeoff { border-color: #000; }
  .takeoff__header { background: #000 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .takeoff__total-value { color: var(--forest-hover) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .formula-box { background: #fff; color: #000; border: 1px solid #000; }
  .callout { break-inside: avoid; }
  /* Print: unclip the table scroll areas and let tables use the paper */
  .table-scroll { overflow: visible; }
  .table-scroll .ref-table { min-width: 0; max-width: 100%; }
  .ref-table { break-inside: avoid; font-size: 11px; }
  .faq__item { break-inside: avoid; }
  .cat-card, .tool-card, .guide-card, .trust-item { break-inside: avoid; }
  a { text-decoration: underline; }
  .hero__scrim { display: none; }
  .hero--image .hero__headline,
  .hero__sub,
  .hero__standards { color: var(--ink); }
  .hero__standards svg { color: var(--forest); }
  .hero--image .btn--ghost {
    background: none;
    color: var(--ink);
    border-color: var(--ink);
  }
  .hero--image .hero__inner { min-height: 0; }
}

/* ---------- 31. Reduced Motion ---------- */
@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;
  }
}

/* ---------- 32. Utilities ---------- */
.text-center { text-align: center; }
.stack-sm > * + * { margin-top: var(--sp-2); }
.stack-md > * + * { margin-top: var(--sp-4); }
.row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.muted { color: var(--ink-muted); }
.mb-0 { margin-bottom: 0; }
.bg-deep { background: var(--paper-deep); }

/* ---------- 33. Project cards (projects page) ---------- */
.proj-card .proj-card__line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  flex-wrap: wrap;
}
.proj-card__hint {
  color: var(--ink-muted);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}
.proj-card .proj-card__line a {
  color: var(--forest-hover);
  font-weight: var(--fw-semibold);
}
.proj-card .proj-card__line a:hover { color: var(--ink); text-decoration: underline; }
.proj-card a.proj-card__tool {
  background: var(--forest-soft);
  border-radius: var(--r-xs);
  padding: 2px 8px;
}
.proj-card a.proj-card__tool:hover { text-decoration: none; background: #DFE0C8; }

/* Related-categories responsive grid (category pages) */
.cat-list--grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
@media (max-width: 900px) { .cat-list--grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .cat-list--grid { grid-template-columns: 1fr; } }
