/* ==========================================================================
   Ancient Family Roots — Design System
   Heritage warmth + modern software clarity.
   Audience skews 60+: 17px base, AAA text contrast, 48px tap targets.
   ========================================================================== */

/* ---------- 1. TOKENS ---------- */
:root {
  /* Surfaces */
  --bg-primary:   #FBF9F4;
  --bg-surface:   #FFFFFF;
  --bg-elevated:  #F3EFE7;
  --bg-sunken:    #F7F3EA;

  /* Text */
  --text-primary:   #1C2321;
  --text-secondary: #55615C;
  --text-onaccent:  #FFFFFF;

  /* Accents */
  --accent-primary: #2D6A4F;
  --accent-hover:   #245741;
  --accent-soft:    #E4EFE8;
  --accent-warm:    #8A5F27;
  --accent-warm-soft: #F6EEE0;

  /* Feedback */
  --border:      #DFD9CD;
  --border-strong: #C9C1B1;
  --success:     #14622A;
  --success-soft:#E3F2E6;
  --warning:     #8A4008;
  --warning-soft:#FBEDDF;

  /* Type */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* User-adjustable base size — driven by the A- A A+ control */
  --font-scale: 1;
  --fs-base: calc(1.0625rem * var(--font-scale)); /* 17px */
  --fs-sm:   calc(0.9375rem * var(--font-scale));
  --fs-xs:   calc(0.85rem * var(--font-scale));
  --fs-lg:   calc(1.1875rem * var(--font-scale));
  --fs-xl:   calc(1.375rem * var(--font-scale));

  /* Spacing */
  --sp-1: 0.25rem; --sp-2: 0.5rem;  --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.5rem;  --sp-6: 2rem;    --sp-7: 3rem;    --sp-8: 4rem;
  --sp-9: 6rem;

  /* Geometry */
  --radius-sm: 6px;
  --radius:    12px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --maxw: 1180px;
  --maxw-prose: 68ch;

  /* Elevation — warm-tinted, never neutral grey */
  --shadow-sm: 0 1px 2px rgba(28, 35, 33, .06), 0 1px 3px rgba(28, 35, 33, .04);
  --shadow:    0 2px 4px rgba(28, 35, 33, .05), 0 6px 16px rgba(28, 35, 33, .07);
  --shadow-lg: 0 4px 8px rgba(28, 35, 33, .05), 0 16px 40px rgba(28, 35, 33, .11);

  --ease: cubic-bezier(.22, .61, .36, 1);
  --header-h: 68px;
}

:root[data-theme="dark"] {
  --bg-primary:   #14171A;
  --bg-surface:   #1D2125;
  --bg-elevated:  #262B30;
  --bg-sunken:    #101315;

  --text-primary:   #E8E6E1;
  --text-secondary: #A7B0AB;
  --text-onaccent:  #0E1512;

  --accent-primary: #52B788;
  --accent-hover:   #74C79F;
  --accent-soft:    #1B2E25;
  --accent-warm:    #D4A05F;
  --accent-warm-soft: #2C2418;

  --border:        #343A40;
  --border-strong: #454C53;
  --success:       #3FB950;
  --success-soft:  #16281A;
  --warning:       #F59E0B;
  --warning-soft:  #2B2010;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 2px 4px rgba(0,0,0,.3), 0 6px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 4px 8px rgba(0,0,0,.3), 0 16px 40px rgba(0,0,0,.5);
}

/* ---------- 2. RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

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

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
ul, ol { list-style: none; padding: 0; }

a { color: var(--accent-primary); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

:focus-visible {
  outline: 3px solid var(--accent-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- 3. TYPOGRAPHY ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  font-variation-settings: "SOFT" 0, "WONK" 0;
}
h1 { font-size: clamp(2.15rem, 1.5rem + 2.7vw, 3.6rem); font-weight: 700; letter-spacing: -0.028em; }
h2 { font-size: clamp(1.7rem, 1.35rem + 1.5vw, 2.5rem); }
h3 { font-size: clamp(1.2rem, 1.08rem + .5vw, 1.45rem); }
h4 { font-size: var(--fs-lg); }

p { max-width: var(--maxw-prose); }
code, kbd, .mono { font-family: var(--font-mono); font-size: .9em; }

.lede {
  font-size: clamp(1.1rem, 1rem + .5vw, 1.32rem);
  line-height: 1.6;
  color: var(--text-secondary);
}
.eyebrow {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent-warm);
}

/* ---------- 4. LAYOUT ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--sp-5); }
.section { padding-block: clamp(3.5rem, 7vw, 6rem); }
.section--sunken { background: var(--bg-sunken); border-block: 1px solid var(--border); }
.section-head { max-width: 60ch; margin-bottom: var(--sp-7); }
.section-head p { margin-top: var(--sp-4); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head--center p { margin-inline: auto; }

.skip-link {
  position: absolute; left: var(--sp-4); top: -100px; z-index: 200;
  background: var(--accent-primary); color: var(--text-onaccent);
  padding: var(--sp-3) var(--sp-5); border-radius: var(--radius);
  font-weight: 600; transition: top .2s var(--ease);
}
.skip-link:focus { top: var(--sp-4); color: var(--text-onaccent); }

/* ---------- 5. BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 48px; padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-pill);
  font-weight: 600; font-size: var(--fs-base); text-decoration: none;
  border: 1.5px solid transparent; white-space: nowrap;
  transition: background-color .18s var(--ease), border-color .18s var(--ease),
              transform .18s var(--ease), box-shadow .18s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent-primary); color: var(--text-onaccent); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--accent-hover); color: var(--text-onaccent); box-shadow: var(--shadow); }
.btn--ghost { border-color: var(--border-strong); color: var(--text-primary); background: var(--bg-surface); }
.btn--ghost:hover { border-color: var(--accent-primary); color: var(--accent-primary); background: var(--bg-surface); }
.btn--lg { min-height: 56px; padding-inline: var(--sp-6); font-size: var(--fs-lg); }
.btn--block { width: 100%; }

/* ---------- 6. DISCLAIMER BAR ---------- */
.disclaimer-bar {
  background: var(--accent-warm-soft);
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  line-height: 1.5;
  text-align: center;
  padding: var(--sp-2) var(--sp-4);
}
.disclaimer-bar strong { color: var(--text-primary); font-weight: 600; }
.disclaimer-bar a { color: var(--text-primary); }

/* ---------- 7. HEADER ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg-primary) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.site-header.is-stuck { border-bottom-color: var(--border); box-shadow: var(--shadow-sm); }
.header-inner {
  display: flex; align-items: center; gap: var(--sp-5);
  min-height: var(--header-h);
}

.brand { display: inline-flex; align-items: center; gap: var(--sp-3); text-decoration: none; color: var(--text-primary); flex-shrink: 0; }
.brand:hover { color: var(--text-primary); }
.brand-mark { width: 34px; height: 34px; flex-shrink: 0; color: var(--accent-primary); }
.brand-text { font-family: var(--font-display); font-weight: 700; font-size: 1.28rem; letter-spacing: -.02em; }
.brand-text span { color: var(--accent-primary); }

.nav { display: flex; align-items: center; gap: var(--sp-1); margin-left: auto; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px;
  padding: var(--sp-2) var(--sp-4);
  color: var(--text-secondary); text-decoration: none;
  font-size: var(--fs-sm); font-weight: 500; border-radius: var(--radius-sm);
  transition: color .15s var(--ease), background-color .15s var(--ease);
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--text-primary); background: var(--bg-elevated); }

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

.fontsize-control {
  display: inline-flex; align-items: center;
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  background: var(--bg-surface); overflow: hidden;
}
.fontsize-control button {
  min-width: 40px; height: 40px;
  color: var(--text-secondary); font-weight: 600; line-height: 1;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.fontsize-control button:hover { background: var(--bg-elevated); color: var(--text-primary); }
.fontsize-control button[disabled] { opacity: .35; cursor: not-allowed; }
.fontsize-control .fs-sm { font-size: .78rem; }
.fontsize-control .fs-md { font-size: .95rem; border-inline: 1px solid var(--border); }
.fontsize-control .fs-lg { font-size: 1.15rem; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--bg-surface);
  color: var(--text-secondary);
  transition: color .15s var(--ease), border-color .15s var(--ease), background-color .15s var(--ease);
}
.icon-btn:hover { color: var(--text-primary); border-color: var(--border-strong); background: var(--bg-elevated); }
.icon-btn svg { width: 20px; height: 20px; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
.icon-sun { display: none; }
.icon-moon { display: block; }

/* Header phone — display only, deliberately not a link.
   Background is fixed dark green in both themes so white text keeps
   ~5.9:1 contrast; the themed --accent-primary is too light in dark mode. */
.header-phone {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: 44px; padding: var(--sp-2) var(--sp-5);
  background: #2D6A4F; color: #FFFFFF;
  border-radius: var(--radius-pill);
  font-weight: 600; font-size: var(--fs-sm);
  letter-spacing: .01em; white-space: nowrap;
  user-select: all;               /* one click selects the whole number */
  cursor: default;
}
.header-phone svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .9; }

@media (max-width: 860px) {
  .nav .header-phone { margin-top: var(--sp-4); justify-content: center; width: 100%; }
}

.nav-toggle { display: none; }

/* ---------- 8. HERO ---------- */
.hero { position: relative; padding-block: clamp(3rem, 6vw, 5.5rem) clamp(3rem, 6vw, 5rem); overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 70% 55% at 78% 8%, var(--accent-soft) 0%, transparent 62%),
    radial-gradient(ellipse 55% 45% at 8% 92%, var(--accent-warm-soft) 0%, transparent 60%);
  opacity: .85;
}
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  gap: clamp(2rem, 5vw, 4.5rem); align-items: center;
}
.hero h1 { margin-bottom: var(--sp-5); }
.hero h1 em { font-style: normal; color: var(--accent-primary); }
.hero .lede { margin-bottom: var(--sp-6); max-width: 52ch; }

.hero-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-6); }

.trust-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); }
.trust-chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); color: var(--text-secondary);
}
.trust-chip svg { width: 18px; height: 18px; color: var(--success); flex-shrink: 0; }

/* ==========================================================================
   HERO ART — "The Rescue"
   A fanned stack of archival portraits joined by tree lines. One is damaged;
   it recovers. Built entirely in CSS/SVG so it ships before any photography
   exists, and swaps to real scans later by replacing .frame-img contents.
   ========================================================================== */
/* flex, not grid+place-items — a centred grid track is content-sized, which
   makes the stage's width:100% resolve circularly to 0 */
.hero-art { position: relative; display: flex; align-items: center; justify-content: center; min-height: 420px; }

.photo-stage {
  position: relative;
  width: 100%; max-width: 460px;
  aspect-ratio: 1 / .94;
}

/* connector lines behind the frames */
.photo-stage .lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.photo-stage .lines path {
  fill: none; stroke: var(--accent-primary); stroke-width: 2; stroke-linecap: round;
  opacity: .32;
}
/* Entrance animation is opt-in via :root.anim, added by the head script.
   If JS never runs, everything stays visible instead of stuck at opacity 0. */
:root.anim .photo-stage .lines path {
  stroke-dasharray: var(--len, 160); stroke-dashoffset: var(--len, 160);
  animation: draw 1.1s var(--ease) forwards var(--d, 0s);
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---- archival photo frame ---- */
.frame {
  position: absolute;
  width: 40%;
  background: var(--bg-surface);
  border-radius: 4px;
  padding: 7px 7px 26px;
  box-shadow: var(--shadow-lg);
  transform: rotate(var(--r, 0deg));
  border: 1px solid var(--border);
}
:root.anim .frame {
  opacity: 0; transform: rotate(var(--r, 0deg)) translateY(14px);
  animation: frame-in .7s var(--ease) forwards var(--d, 0s);
}
@keyframes frame-in {
  to { opacity: 1; transform: rotate(var(--r, 0deg)) translateY(0); }
}

.frame-img {
  position: relative; aspect-ratio: 1 / 1.08; border-radius: 2px; overflow: hidden;
  /* Fallback plate — shows through if a photograph hasn't been added yet,
     so a missing file degrades to a blank sepia print, never a broken icon. */
  background: linear-gradient(160deg, #d9c9ad 0%, #bfa77f 45%, #9c8259 100%);
}
:root[data-theme="dark"] .frame-img {
  background: linear-gradient(160deg, #6b5c44 0%, #52462f 45%, #3b3222 100%);
}

/* Real photographs.
   The unifying treatment matters: three portraits from three different
   archives will not match. Sepia + reduced saturation makes them read as
   one family album rather than three stock images. */
.frame-img img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center 32%;
  filter: sepia(.42) saturate(.82) contrast(1.06) brightness(1.02);
}
:root[data-theme="dark"] .frame-img img {
  filter: sepia(.42) saturate(.72) contrast(1.02) brightness(.86);
}

/* Authoring aid — appears only when the <img> failed to load */
.frame-img.is-empty::before {
  content: "add photo";
  position: absolute; inset: 8%;
  display: grid; place-items: center; text-align: center;
  border: 2px dashed rgba(255,255,255,.55); border-radius: 3px;
  font-family: var(--font-mono); font-size: .62rem; letter-spacing: .06em;
  color: rgba(255,255,255,.75); text-transform: uppercase;
}

/* paper grain + vignette, over the photograph */
.frame-img::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.16) 0 1px, transparent 1px),
    radial-gradient(circle at 70% 60%, rgba(0,0,0,.10) 0 1px, transparent 1px),
    radial-gradient(ellipse 78% 78% at 50% 45%, transparent 55%, rgba(60,44,26,.28) 100%);
  background-size: 7px 7px, 11px 11px, 100% 100%;
  opacity: .8;
}

.frame-cap {
  position: absolute; left: 0; right: 0; bottom: 7px;
  text-align: center;
  font-family: var(--font-display);
  font-size: .72rem; font-style: italic;
  color: var(--text-secondary);
  letter-spacing: .01em;
}

/* placement */
.frame--a { --r: -5deg;  --d: .15s; top: 2%;  left: 4%; }
.frame--b { --r:  4deg;  --d: .3s;  top: 0;   right: 3%; }
.frame--c { --r: -3deg;  --d: .45s; bottom: 8%; left: 26%; width: 42%; z-index: 2; }

/* the damaged one */
.frame--damaged { --r: 6deg; --d: .6s; top: 34%; right: 0; width: 34%; }
.frame--damaged .frame-img {
  background: linear-gradient(160deg, #c9b596 0%, #a8916c 100%);
  filter: saturate(.35);
}
.frame--damaged::before {
  content: ""; position: absolute; inset: -2px;
  border: 2px dashed var(--warning); border-radius: 6px;
  opacity: .9;
  animation: pulse-warn 2.6s var(--ease) infinite 1.4s;
}
@keyframes pulse-warn { 0%,100% { opacity: .9; } 50% { opacity: .35; } }
/* the tear */
.frame--damaged .tear {
  position: absolute; inset: 0; z-index: 3;
  background: linear-gradient(104deg,
    transparent 0 46%, var(--bg-surface) 46% 50%, transparent 50% 100%);
}

/* ---- floating status cards ---- */
.hero-chip {
  position: absolute; z-index: 4;
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-3) var(--sp-4);
}
:root.anim .hero-chip {
  opacity: 0; transform: translateY(10px) scale(.94);
  animation: chip-in .6s var(--ease) forwards var(--d, 1s);
}
@keyframes chip-in { to { opacity: 1; transform: none; } }

.hero-chip .dot {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
}
.hero-chip .dot svg { width: 16px; height: 16px; }
.hero-chip .k { font-size: .72rem; color: var(--text-secondary); line-height: 1.3; display: block; }
.hero-chip .v { font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary); line-height: 1.3; white-space: nowrap; }

.chip--alert { --d: 1.1s; top: 26%; left: -6%; }
.chip--alert .dot { background: var(--warning-soft); color: var(--warning); }
.chip--ok { --d: 1.7s; bottom: 2%; right: -4%; }
.chip--ok .dot { background: var(--success-soft); color: var(--success); }

/* sweep of light across the stack — the "restore" moment */
.photo-stage::after {
  content: ""; position: absolute; inset: -8%; z-index: 5; pointer-events: none;
  background: linear-gradient(104deg, transparent 42%, rgba(255,255,255,.42) 50%, transparent 58%);
  transform: translateX(-120%);
  animation: sweep 2.4s var(--ease) 1.35s;
}
:root[data-theme="dark"] .photo-stage::after {
  background: linear-gradient(104deg, transparent 42%, rgba(82,183,136,.20) 50%, transparent 58%);
}
@keyframes sweep { to { transform: translateX(120%); } }

@media (prefers-reduced-motion: reduce) {
  .frame, .hero-chip { opacity: 1; transform: rotate(var(--r, 0deg)); }
  .photo-stage .lines path { stroke-dashoffset: 0; }
  .photo-stage::after, .frame--damaged::before { animation: none; }
}

@media (max-width: 1000px) {
  .hero-art { min-height: 0; }
  .photo-stage { max-width: 400px; }
  .chip--alert { left: 0; }
  .chip--ok { right: 0; }
}
/* Narrow screens: keep the chips fully inside the viewport */
@media (max-width: 560px) {
  .hero-chip { padding: var(--sp-2) var(--sp-3); gap: var(--sp-2); }
  .hero-chip .v { font-size: .78rem; }
  .hero-chip .k { font-size: .66rem; }
  .hero-chip .dot { width: 26px; height: 26px; }
  .chip--alert { left: 2%; top: 20%; }
  .chip--ok { right: 2%; bottom: 0; }
}

/* ---------- 9. SYMPTOM SEARCH ---------- */
.symptom-search {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-5);
  max-width: 640px;
}
.symptom-search h2 { font-size: var(--fs-xl); margin-bottom: var(--sp-2); }
.symptom-search > p { font-size: var(--fs-sm); color: var(--text-secondary); margin-bottom: var(--sp-4); }

.search-field { position: relative; }
.search-field svg {
  position: absolute; left: var(--sp-4); top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; color: var(--text-secondary); pointer-events: none;
}
.search-field input {
  width: 100%; min-height: 54px;
  padding: var(--sp-3) var(--sp-4) var(--sp-3) 3.1rem;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius);
  background: var(--bg-primary); color: var(--text-primary);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.search-field input::placeholder { color: var(--text-secondary); opacity: .85; }
.search-field input:focus {
  outline: none; border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.search-results { margin-top: var(--sp-4); display: grid; gap: var(--sp-1); }
.search-results li a {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 48px; padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm); text-decoration: none;
  color: var(--text-primary); font-size: var(--fs-sm); font-weight: 500;
  transition: background-color .15s var(--ease);
}
.search-results li a:hover { background: var(--accent-soft); color: var(--text-primary); }
.search-results li a::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-primary); flex-shrink: 0;
}
.search-results mark { background: var(--accent-warm-soft); color: var(--text-primary); font-weight: 700; padding: 0 2px; border-radius: 3px; }
.search-empty { padding: var(--sp-4); font-size: var(--fs-sm); color: var(--text-secondary); }
.search-empty a { font-weight: 600; }

/* ---------- 10. CARDS & GRIDS ---------- */
.grid { display: grid; gap: var(--sp-4); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}
.card--link { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: var(--sp-3); }
.card--link:hover { border-color: var(--accent-primary); box-shadow: var(--shadow); transform: translateY(-3px); color: inherit; }
.card h3 { font-size: var(--fs-lg); }
.card p { font-size: var(--fs-sm); color: var(--text-secondary); margin: 0; }

.card-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-primary);
  margin-bottom: var(--sp-1);
}
.card-icon svg { width: 22px; height: 22px; }
.card-arrow {
  margin-top: auto; padding-top: var(--sp-2);
  font-size: var(--fs-sm); font-weight: 600; color: var(--accent-primary);
  display: inline-flex; align-items: center; gap: var(--sp-2);
}
.card--link:hover .card-arrow svg { transform: translateX(4px); }
.card-arrow svg { width: 16px; height: 16px; transition: transform .2s var(--ease); }

/* Fix cards (popular problems) */
.fix-card { display: flex; flex-direction: column; gap: var(--sp-2); }
.fix-card .version-badge { margin-top: auto; }

.version-badge {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-mono); font-size: .78rem;
  color: var(--text-secondary);
  background: var(--bg-elevated); border: 1px solid var(--border);
  padding: 3px var(--sp-3); border-radius: var(--radius-pill);
  align-self: flex-start;
}

/* ---------- 11. STEPS ---------- */
.steps { counter-reset: step; display: grid; gap: var(--sp-5); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.step { position: relative; padding-top: var(--sp-6); }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; top: 0; left: 0;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
  background: var(--accent-primary); color: var(--text-onaccent);
}
.step h3 { margin-bottom: var(--sp-2); }
.step p { font-size: var(--fs-sm); color: var(--text-secondary); }

/* ---------- 12. SECURITY NOTE ---------- */
.security-note {
  display: grid; grid-template-columns: auto 1fr; gap: var(--sp-5);
  align-items: start;
  background: var(--success-soft);
  border: 1px solid color-mix(in srgb, var(--success) 28%, transparent);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 3vw, 2.25rem);
}
.security-note .shield {
  width: 52px; height: 52px; border-radius: var(--radius);
  display: grid; place-items: center;
  background: var(--success); color: var(--bg-surface);
}
.security-note .shield svg { width: 27px; height: 27px; }
.security-note h2 { font-size: clamp(1.4rem, 1.2rem + .8vw, 1.85rem); margin-bottom: var(--sp-3); }
.security-list { display: grid; gap: var(--sp-3); margin-top: var(--sp-4); }
.security-list li { display: flex; gap: var(--sp-3); align-items: flex-start; font-size: var(--fs-sm); }
.security-list svg { width: 19px; height: 19px; color: var(--success); flex-shrink: 0; margin-top: 4px; }

/* ---------- 13. EXPERT / AUTHOR ---------- */
.expert {
  display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem); align-items: center;
}
.expert-photo {
  aspect-ratio: 1; border-radius: var(--radius-lg); overflow: hidden;
  background: var(--bg-elevated); border: 1px solid var(--border);
  display: grid; place-items: center; text-align: center;
  color: var(--text-secondary); font-size: var(--fs-xs); padding: var(--sp-4);
}
/* Illustration in place of a technician portrait. Width/height are set in the
   markup too so the column is reserved before the SVG loads. */
.expert-figure {
  display: block; width: 100%; height: auto; aspect-ratio: 1;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

/* "Judge us on the guides" — evidence rather than a claim. */
.proof-note {
  margin-top: var(--sp-5); padding: var(--sp-4) var(--sp-5);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-primary);
  border-radius: var(--radius);
}
.proof-note p { font-size: var(--fs-sm); margin: 0; }

.credentials { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }
.credential {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-xs); font-weight: 500;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-pill);
}
.credential svg { width: 15px; height: 15px; color: var(--accent-primary); }

/* ---------- 15. FAQ ---------- */
.faq { max-width: 800px; display: grid; gap: var(--sp-3); }
.faq details {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color .2s var(--ease);
}
.faq details[open] { border-color: var(--accent-primary); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5); min-height: 56px;
  font-weight: 600; cursor: pointer; list-style: none;
  transition: background-color .15s var(--ease);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { background: var(--bg-elevated); }
.faq summary::after {
  content: ""; flex-shrink: 0;
  width: 12px; height: 12px;
  border-right: 2.5px solid var(--accent-primary);
  border-bottom: 2.5px solid var(--accent-primary);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .22s var(--ease);
}
.faq details[open] summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.faq .faq-body { padding: 0 var(--sp-5) var(--sp-5); }
.faq .faq-body p + p { margin-top: var(--sp-3); }

/* ---------- 16. CTA BAND ---------- */
.cta-band {
  background: var(--accent-primary); color: var(--text-onaccent);
  border-radius: var(--radius-lg);
  padding: clamp(2rem, 5vw, 3.5rem);
  text-align: center;
}
.cta-band h2 { color: var(--text-onaccent); margin-bottom: var(--sp-4); }
.cta-band p { color: color-mix(in srgb, var(--text-onaccent) 88%, transparent); margin: 0 auto var(--sp-6); max-width: 54ch; }
.cta-band .btn--primary { background: var(--bg-surface); color: var(--accent-primary); }
.cta-band .btn--primary:hover { background: var(--bg-elevated); color: var(--accent-primary); }
.cta-band .btn--ghost { background: transparent; border-color: color-mix(in srgb, var(--text-onaccent) 45%, transparent); color: var(--text-onaccent); }
.cta-band .btn--ghost:hover { background: color-mix(in srgb, var(--text-onaccent) 12%, transparent); border-color: var(--text-onaccent); color: var(--text-onaccent); }
.cta-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); justify-content: center; }

/* ---------- 17. FOOTER ---------- */
.site-footer {
  background: var(--bg-sunken);
  border-top: 1px solid var(--border);
  padding-block: var(--sp-7) var(--sp-5);
  margin-top: var(--sp-8);
}
.footer-grid {
  display: grid; gap: var(--sp-6);
  grid-template-columns: minmax(0, 1.6fr) repeat(auto-fit, minmax(150px, 1fr));
  padding-bottom: var(--sp-6); border-bottom: 1px solid var(--border);
}
.footer-brand p { font-size: var(--fs-sm); color: var(--text-secondary); margin-top: var(--sp-3); max-width: 38ch; }
.footer-col h3 { font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: var(--sp-4); }
.footer-col ul { display: grid; gap: var(--sp-1); }
.footer-col a {
  display: inline-flex; align-items: center; min-height: 36px;
  color: var(--text-secondary); text-decoration: none; font-size: var(--fs-sm);
}
.footer-col a:hover { color: var(--accent-primary); text-decoration: underline; }

.legal-notice {
  margin-top: var(--sp-5);
  font-size: var(--fs-xs); line-height: 1.65; color: var(--text-secondary);
  max-width: none;
}
.legal-notice p + p { margin-top: var(--sp-3); }
.legal-notice strong { color: var(--text-primary); }

/* ---------- 18. REVEAL ANIMATION ----------
   Hidden only when :root.anim is present, so a JS failure can never
   leave the page blank. */
:root.anim .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
:root.anim .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- 19. UTILITIES ---------- */
.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;
}
.stack-4 > * + * { margin-top: var(--sp-4); }
.stack-5 > * + * { margin-top: var(--sp-5); }
.text-center { text-align: center; }

/* ---------- 20. RESPONSIVE ---------- */
@media (max-width: 1000px) {
  .hero-grid { grid-template-columns: 1fr; }
  /* width:100% is required — margin-inline:auto shrink-to-fits a grid item,
     and every child of .photo-stage is absolutely positioned (content = 0) */
  .hero-art { order: -1; width: 100%; max-width: 400px; margin-inline: auto; }
  .expert { grid-template-columns: 1fr; }
  .expert-photo { max-width: 220px; }
}

@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: var(--radius-pill);
    border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-primary);
  }
  .nav-toggle svg { width: 22px; height: 22px; }
  .nav {
    position: fixed; inset: calc(var(--header-h) + 34px) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg-surface); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-3) var(--sp-5) var(--sp-5);
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: opacity .2s var(--ease), transform .2s var(--ease);
    max-height: calc(100vh - var(--header-h)); overflow-y: auto;
  }
  .nav.is-open { transform: none; opacity: 1; pointer-events: auto; }
  .nav a { min-height: 52px; font-size: var(--fs-base); border-bottom: 1px solid var(--border); border-radius: 0; }
  .nav .btn { margin-top: var(--sp-4); }
  .fontsize-control { display: none; }
  .header-inner { gap: var(--sp-3); }
  .header-tools { margin-left: auto; }
}

@media (max-width: 560px) {
  .wrap { padding-inline: var(--sp-4); }
  .hero-actions .btn, .cta-actions .btn { width: 100%; }
  .security-note { grid-template-columns: 1fr; }
  .brand-text { font-size: 1.12rem; }
  .symptom-search { padding: var(--sp-4); }
}

/* ---------- 20b. PAGE HEADER (interior pages) ---------- */
.page-head { position: relative; padding-block: clamp(2.5rem, 5vw, 4rem) clamp(2rem, 4vw, 3rem); overflow: hidden; }
.page-head::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(ellipse 60% 60% at 50% 0%, var(--accent-soft) 0%, transparent 65%);
  opacity: .8;
}
.page-head .lede { margin-top: var(--sp-4); }
.page-head-inner { max-width: 62ch; }
.page-head-inner--center { margin-inline: auto; text-align: center; }
.page-head-inner--center .lede { margin-inline: auto; }

/* ---------- 20c. BREADCRUMBS ---------- */
.breadcrumbs { padding-block: var(--sp-4) 0; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }
.breadcrumbs li { display: flex; align-items: center; gap: var(--sp-2); color: var(--text-secondary); }
.breadcrumbs li + li::before { content: "/"; color: var(--border-strong); }
.breadcrumbs a { color: var(--text-secondary); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent-primary); text-decoration: underline; }
.breadcrumbs [aria-current="page"] { color: var(--text-primary); font-weight: 500; }

/* ---------- 20d. COMPARISON TABLE ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); border: 1px solid var(--border); }
.comparison-table { width: 100%; border-collapse: collapse; background: var(--bg-surface); min-width: 640px; }
.comparison-table th, .comparison-table td {
  padding: var(--sp-4); text-align: left; border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm); vertical-align: top;
}
.comparison-table thead th {
  background: var(--bg-elevated); font-family: var(--font-display);
  font-size: var(--fs-base); font-weight: 600; white-space: nowrap;
}
.comparison-table tbody tr:last-child td { border-bottom: none; }
.comparison-table th[scope="row"] { font-weight: 600; color: var(--text-primary); font-family: var(--font-body); }
.comparison-table td { color: var(--text-secondary); }
.comparison-table .yes { color: var(--success); font-weight: 600; }
.comparison-table .no  { color: var(--text-secondary); opacity: .6; }
.comparison-table .col-featured { background: var(--accent-soft); }

@media (max-width: 700px) {
  .comparison-table { min-width: 560px; }
  .table-hint { display: block; }
}
.table-hint { display: none; font-size: var(--fs-xs); color: var(--text-secondary); margin-bottom: var(--sp-3); }

/* ---------- 20e. NOTE BOX ---------- */
.note-box {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-left: 4px solid var(--accent-warm);
  border-radius: var(--radius); padding: var(--sp-5);
}
.note-box h3 { font-family: var(--font-body); font-size: var(--fs-base); margin-bottom: var(--sp-2); }
.note-box p { font-size: var(--fs-sm); color: var(--text-secondary); }

/* ==========================================================================
   ARTICLE / KNOWLEDGE-BASE COMPONENTS
   ========================================================================== */

/* ---------- 22. ARTICLE LAYOUT ---------- */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.article-body { min-width: 0; }
.article-body > * + * { margin-top: var(--sp-5); }
.article-body h2 {
  font-size: clamp(1.45rem, 1.25rem + .8vw, 1.95rem);
  margin-top: var(--sp-8) !important;
  scroll-margin-top: calc(var(--header-h) + 2rem);
}
.article-body h3 { margin-top: var(--sp-6) !important; }
.article-body p, .article-body li { max-width: var(--maxw-prose); }
.article-body ul:not([class]) { display: grid; gap: var(--sp-2); }
.article-body ul:not([class]) li { position: relative; padding-left: var(--sp-5); }
.article-body ul:not([class]) li::before {
  content: ""; position: absolute; left: 6px; top: .72em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent-primary);
}
.article-body strong { font-weight: 600; color: var(--text-primary); }
.article-body code {
  background: var(--bg-elevated); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 5px; font-size: .88em; white-space: nowrap;
}
.article-body hr { border: none; border-top: 1px solid var(--border); margin-block: var(--sp-7) !important; }

/* Menu path: File → Backup → Save */
.menu-path {
  font-family: var(--font-mono); font-size: .88em;
  background: var(--accent-soft); color: var(--text-primary);
  border: 1px solid color-mix(in srgb, var(--accent-primary) 25%, transparent);
  padding: 2px 8px; border-radius: 5px; white-space: nowrap;
}

/* ---------- 23. SIDEBAR / TOC ---------- */
.article-side { position: sticky; top: calc(var(--header-h) + var(--sp-5)); display: grid; gap: var(--sp-4); }
.toc {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--sp-5);
}
.toc h2 {
  font-family: var(--font-body) !important; font-size: var(--fs-xs) !important;
  font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-secondary); margin: 0 0 var(--sp-3) !important;
}
.toc ol { display: grid; gap: 2px; counter-reset: toc; }
.toc a {
  display: block; padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-sm); color: var(--text-secondary);
  text-decoration: none; border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
}
.toc a:hover { color: var(--text-primary); background: var(--bg-elevated); }
.toc a.is-active { color: var(--accent-primary); border-left-color: var(--accent-primary); background: var(--accent-soft); font-weight: 600; }

/* ---------- 24. VERSION BAR ---------- */
.applies-to {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4);
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm);
}
.applies-to dt { font-weight: 600; color: var(--text-secondary); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; }
.applies-to dd { margin: 0; font-family: var(--font-mono); font-size: .85rem; color: var(--text-primary); }

/* ---------- 25. REASSURANCE / CALLOUTS ---------- */
.callout {
  border-radius: var(--radius); padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--border); background: var(--bg-elevated);
  display: grid; grid-template-columns: auto 1fr; gap: var(--sp-4); align-items: start;
}
.callout svg { width: 22px; height: 22px; margin-top: 3px; flex-shrink: 0; }
.callout p { margin: 0 !important; font-size: var(--fs-sm); }
.callout p + p { margin-top: var(--sp-3) !important; }
.callout strong { display: block; margin-bottom: 4px; }

.callout--calm { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 28%, transparent); }
.callout--calm svg { color: var(--success); }
.callout--warn { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 32%, transparent); }
.callout--warn svg { color: var(--warning); }
.callout--info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent-primary) 25%, transparent); }
.callout--info svg { color: var(--accent-primary); }

/* Error code block */
.error-callout {
  font-family: var(--font-mono); font-size: .9rem;
  background: var(--bg-sunken); border: 1px solid var(--border-strong);
  border-left: 4px solid var(--warning);
  border-radius: var(--radius-sm); padding: var(--sp-4);
  color: var(--text-primary); overflow-x: auto; white-space: pre-wrap;
}

/* ---------- 26. FIX STEPS ---------- */
.fix-block {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: clamp(1.25rem, 3vw, 2rem);
}
.fix-block > h3 { margin-top: 0 !important; display: flex; align-items: center; gap: var(--sp-3); }
.fix-label {
  font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  background: var(--accent-primary); color: var(--text-onaccent);
  padding: 3px 10px; border-radius: var(--radius-pill); white-space: nowrap;
}
.fix-meta { font-size: var(--fs-xs); color: var(--text-secondary); margin-top: var(--sp-2) !important; }

.fix-steps { counter-reset: fix; display: grid; gap: var(--sp-5); margin-top: var(--sp-5) !important; }
.fix-steps > li { position: relative; padding-left: 3.25rem; max-width: none !important; }
.fix-steps > li::before {
  counter-increment: fix; content: counter(fix);
  position: absolute; left: 0; top: -2px;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: .95rem;
  background: var(--accent-soft); color: var(--accent-primary);
  border: 1.5px solid color-mix(in srgb, var(--accent-primary) 35%, transparent);
}
.fix-steps > li > p:first-child { margin: 0 0 var(--sp-2); }
.fix-steps figure { margin: var(--sp-3) 0 0; }
.fix-steps figcaption { font-size: var(--fs-xs); color: var(--text-secondary); margin-top: var(--sp-2); }

/* Marks a diagram as an orientation aid rather than a real screen capture.
   Honesty here matters: a reader comparing a drawing to their own screen and
   finding it different loses trust in the whole guide. */
.fig-note { display: block; margin-top: 2px; font-style: normal; opacity: .85; }

/* Diagram figures. Width/height attributes are set in the markup too, so the
   box is reserved before the SVG loads and the step never shifts (CLS). */
.shot {
  display: block; width: 100%; height: auto;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
}

/* ---------- 27. STILL STUCK CTA ---------- */
.still-stuck {
  display: grid; grid-template-columns: auto 1fr auto; gap: var(--sp-5);
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent-primary) 30%, transparent);
  border-radius: var(--radius-lg); padding: clamp(1.25rem, 3vw, 1.85rem);
}
.still-stuck .ss-icon {
  width: 48px; height: 48px; border-radius: var(--radius);
  display: grid; place-items: center;
  background: var(--accent-primary); color: var(--text-onaccent);
}
.still-stuck .ss-icon svg { width: 25px; height: 25px; }
.still-stuck h3 { margin: 0 0 var(--sp-2) !important; font-size: var(--fs-lg); }
.still-stuck p { margin: 0 !important; font-size: var(--fs-sm); color: var(--text-secondary); }
@media (max-width: 760px) {
  .still-stuck { grid-template-columns: 1fr; text-align: left; }
  .still-stuck .btn { width: 100%; }
}

/* ---------- 27a. FOOTER SOCIAL LINKS ----------
   44px targets: this audience skews 60+, and small icon links are the
   commonest accessibility failure in a footer. */
.social-links {
  list-style: none; margin: var(--sp-5) 0 0; padding: 0;
  display: flex; gap: var(--sp-2);
}
.social-links li { margin: 0; }
.social-links a {
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: var(--radius);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.social-links a:hover,
.social-links a:focus-visible {
  color: var(--accent-primary);
  border-color: color-mix(in srgb, var(--accent-primary) 45%, transparent);
  background: var(--accent-soft);
}
.social-links svg { width: 19px; height: 19px; }
@media (prefers-reduced-motion: reduce) { .social-links a { transition: none; } }

/* ---------- 27b. HTML SITEMAP ---------- */
.sitemap-list { list-style: none; padding: 0; margin: var(--sp-4) 0 0; }
.sitemap-list li { margin: 0; border-bottom: 1px solid var(--border); }
.sitemap-list li:last-child { border-bottom: none; }
.sitemap-list a {
  display: block; padding: var(--sp-3) 0;
  min-height: 44px; /* keeps the 60+ audience's tap target honest */
}

/* ---------- 28. AUTHOR BOX ---------- */
.author-box {
  display: grid; grid-template-columns: 64px 1fr; gap: var(--sp-4);
  align-items: center;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--sp-5);
}
.author-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--bg-elevated); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: .6rem; text-align: center;
  color: var(--text-secondary); font-family: var(--font-mono); overflow: hidden;
}
.author-box .name { font-weight: 600; }
.author-box .name a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.author-box p { margin: 0 !important; font-size: var(--fs-sm); color: var(--text-secondary); }

/* Entity author box — the expertise chips are the machine-readable signal of
   what this byline actually knows about, and the human one too. */
.author-avatar--mark {
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-primary);
  border: 1px solid color-mix(in srgb, var(--accent-primary) 30%, transparent);
}
.author-avatar--mark svg { width: 34px; height: 34px; }
.author-role {
  font-weight: 400; font-size: var(--fs-xs); color: var(--text-secondary);
}
.author-cred {
  list-style: none; margin: var(--sp-3) 0 0 !important; padding: 0;
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
}
.author-cred li {
  margin: 0; padding: 3px var(--sp-3);
  font-size: var(--fs-xs); color: var(--text-secondary);
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 999px;
}
.author-review {
  margin-top: var(--sp-3) !important; font-size: var(--fs-xs) !important;
}
.updated {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-xs); color: var(--text-secondary); margin-top: var(--sp-2);
}
.updated svg { width: 14px; height: 14px; }

/* ==========================================================================
   29. KNOWLEDGE BASE  (v2 — sidebar nav + dense article cards)
   ========================================================================== */

.kb-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
}
.kb-main { min-width: 0; }

/* ---- Sticky category rail ---- */
.kb-nav { position: sticky; top: calc(var(--header-h) + var(--sp-5)); }
.kb-nav h2 {
  font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--text-secondary);
  margin-bottom: var(--sp-3);
}
.kb-nav ul { display: grid; gap: 2px; }
.kb-nav a {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 44px; padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm); text-decoration: none;
  color: var(--text-secondary); font-size: var(--fs-sm); font-weight: 500;
  border-left: 2px solid transparent;
  transition: color .15s var(--ease), background-color .15s var(--ease);
}
.kb-nav a:hover { color: var(--text-primary); background: var(--bg-elevated); }
.kb-nav a.is-active {
  color: var(--accent-primary); background: var(--accent-soft);
  border-left-color: var(--accent-primary); font-weight: 600;
}
.kb-nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; }
.kb-nav .count {
  margin-left: auto; font-family: var(--font-mono); font-size: .72rem;
  color: var(--text-secondary); opacity: .8;
}

/* ---- Featured / most-read strip ---- */
.kb-featured { display: grid; gap: var(--sp-3); grid-template-columns: repeat(3, 1fr); }
.kb-feat {
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-5);
  background: var(--bg-surface);
  border: 1px solid var(--border); border-top: 3px solid var(--accent-primary);
  border-radius: var(--radius); text-decoration: none;
  transition: box-shadow .18s var(--ease), transform .18s var(--ease), border-color .18s var(--ease);
}
.kb-feat:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.kb-feat .rank {
  font-family: var(--font-display); font-size: 1.6rem; font-weight: 700;
  color: var(--accent-primary); opacity: .35; line-height: 1;
}
.kb-feat .t { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; color: var(--text-primary); line-height: 1.28; }
.kb-feat .d { font-size: var(--fs-sm); color: var(--text-secondary); margin: 0; }

/* ---- Category block ---- */
.kb-group { scroll-margin-top: calc(var(--header-h) + 2rem); }
.kb-group + .kb-group { margin-top: var(--sp-8); }
.kb-group-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding-bottom: var(--sp-3); margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.kb-group-head .ico {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-primary);
}
.kb-group-head .ico svg { width: 17px; height: 17px; }
.kb-group-head h2 {
  font-size: 1.32rem !important; margin: 0 !important;
  letter-spacing: -.012em; line-height: 1.3;
}
.kb-group-head .count {
  margin-left: auto; flex-shrink: 0;
  font-family: var(--font-mono); font-size: .74rem;
  color: var(--text-secondary);
  background: var(--bg-elevated); border: 1px solid var(--border);
  padding: 2px 9px; border-radius: var(--radius-pill);
}
.kb-group > .intro { font-size: var(--fs-sm); color: var(--text-secondary); margin: calc(var(--sp-4) * -1) 0 var(--sp-4); }

/* ---- Article cards: even 2-col grid, never ragged ---- */
.kb-list { display: grid; gap: var(--sp-3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kb-item {
  display: grid; grid-template-columns: 34px minmax(0, 1fr);
  gap: var(--sp-1) var(--sp-4);
  padding: var(--sp-4);
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); text-decoration: none;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background-color .16s var(--ease);
}
.kb-item:hover { border-color: var(--accent-primary); box-shadow: var(--shadow-sm); background: var(--bg-surface); }
.kb-item .sym {
  grid-row: 1 / span 3;
  width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--bg-elevated); color: var(--text-secondary);
  transition: background-color .16s var(--ease), color .16s var(--ease);
}
.kb-item:hover .sym { background: var(--accent-soft); color: var(--accent-primary); }
.kb-item .sym svg { width: 17px; height: 17px; }

.kb-item .t {
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  font-weight: 600; font-size: var(--fs-base); color: var(--text-primary); line-height: 1.35;
}
.kb-item:hover .t { color: var(--accent-primary); }
.kb-item .d {
  font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.55;
  margin: 0; max-width: none;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.kb-item .m {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4);
  margin-top: var(--sp-2);
  font-family: var(--font-mono); font-size: .72rem; color: var(--text-secondary);
}
.kb-item .m span { display: inline-flex; align-items: center; gap: 5px; }
.kb-item .m svg { width: 13px; height: 13px; opacity: .75; }

/* Tag: quiet, not alarming */
.kb-tag {
  font-family: var(--font-body); font-size: .68rem; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  background: var(--accent-soft); color: var(--accent-primary);
  border: 1px solid color-mix(in srgb, var(--accent-primary) 22%, transparent);
  padding: 2px 7px; border-radius: 4px; white-space: nowrap;
}

@media (max-width: 1080px) {
  .kb-featured { grid-template-columns: 1fr; }
}
@media (max-width: 940px) {
  .kb-layout { grid-template-columns: 1fr; }
  .kb-nav { position: static; }
  .kb-nav ul { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
  .kb-nav a { border-left: none; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--bg-surface); }
  .kb-nav a.is-active { border-color: var(--accent-primary); }
  .kb-nav .count { display: none; }
}
@media (max-width: 680px) {
  .kb-list { grid-template-columns: 1fr; }
}

/* ---------- 30. RELATED GRID ---------- */
.related-grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.related-grid a {
  display: block; padding: var(--sp-4);
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); text-decoration: none;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.related-grid a:hover { border-color: var(--accent-primary); box-shadow: var(--shadow-sm); }
.related-grid .rel-kicker { font-size: var(--fs-xs); color: var(--text-secondary); display: block; margin-bottom: 4px; }
.related-grid .rel-title { font-weight: 600; color: var(--text-primary); font-size: var(--fs-sm); }

@media (max-width: 940px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-side { position: static; }
  .toc { order: -1; }
}

/* ==========================================================================
   31. FORMS  (inline enquiry form on each /services/ page)
   ========================================================================== */
.form-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: clamp(1.5rem, 4vw, 2.5rem);
  box-shadow: var(--shadow);
}
.form-grid { display: grid; gap: var(--sp-5); }
.form-row { display: grid; gap: var(--sp-5); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.field { display: grid; gap: var(--sp-2); }
.field > label { font-weight: 600; font-size: var(--fs-sm); }
.field .hint { font-size: var(--fs-xs); color: var(--text-secondary); }
.field .req { color: var(--warning); font-weight: 400; }

.field input[type="text"], .field input[type="email"], .field input[type="tel"],
.field select, .field textarea {
  width: 100%; min-height: 52px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-primary); color: var(--text-primary);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.field textarea { min-height: 130px; resize: vertical; line-height: 1.6; }
.field select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235F6B66' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--sp-4) center; background-size: 18px;
  padding-right: 3rem;
}
:root[data-theme="dark"] .field select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239AA5A0' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-secondary); opacity: .8; }

/* Radio cards — pick a service */
.choice-grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; width: 0; height: 0; }
.choice span {
  display: flex; flex-direction: column; gap: 4px;
  min-height: 76px; padding: var(--sp-4);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius);
  background: var(--bg-primary); cursor: pointer;
  transition: border-color .16s var(--ease), background-color .16s var(--ease);
}
.choice span strong { font-size: var(--fs-sm); font-weight: 600; }
.choice span em { font-style: normal; font-size: var(--fs-xs); color: var(--text-secondary); }
.choice input:hover + span { border-color: var(--accent-primary); }
.choice input:checked + span { border-color: var(--accent-primary); border-width: 2px; background: var(--accent-soft); padding: calc(var(--sp-4) - 0.5px); }
.choice input:focus-visible + span { outline: 3px solid var(--accent-primary); outline-offset: 3px; }

/* Consent checkbox */
.check { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-3); align-items: start; }
.check input { width: 22px; height: 22px; margin-top: 3px; accent-color: var(--accent-primary); cursor: pointer; }
.check label { font-size: var(--fs-sm); color: var(--text-secondary); cursor: pointer; }

.form-footnote { font-size: var(--fs-xs); color: var(--text-secondary); margin-top: var(--sp-4); }

/* ---------- 32. SERVICE PAGES ---------- */
.svc-list { display: grid; gap: var(--sp-4); }
.svc-item {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: var(--sp-2) var(--sp-5); align-items: center;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--sp-5);
  text-decoration: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
.svc-item:hover { border-color: var(--accent-primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.svc-item .ico {
  grid-row: 1 / span 2; width: 52px; height: 52px; border-radius: var(--radius);
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-primary);
}
.svc-item .ico svg { width: 26px; height: 26px; }
.svc-item h3 { font-size: var(--fs-lg); margin: 0; }
.svc-item p { font-size: var(--fs-sm); color: var(--text-secondary); margin: 0; max-width: 62ch; }
.svc-item .go {
  grid-row: 1 / span 2; align-self: center;
  color: var(--accent-primary); font-weight: 600; font-size: var(--fs-sm);
  display: inline-flex; align-items: center; gap: var(--sp-2); white-space: nowrap;
}
.svc-item .go svg { width: 16px; height: 16px; transition: transform .18s var(--ease); }
.svc-item:hover .go svg { transform: translateX(4px); }

@media (max-width: 680px) {
  .svc-item { grid-template-columns: 44px minmax(0,1fr); }
  .svc-item .ico { width: 44px; height: 44px; grid-row: 1; }
  .svc-item .ico svg { width: 22px; height: 22px; }
  .svc-item h3, .svc-item p { grid-column: 1 / -1; }
  .svc-item .go { grid-row: auto; grid-column: 1 / -1; }
}

/* ==========================================================================
   31. SERVICE CARDS
   ========================================================================== */
.svc-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.svc-card {
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: clamp(1.25rem, 3vw, 1.85rem);
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); text-decoration: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
.svc-card:hover { border-color: var(--accent-primary); box-shadow: var(--shadow); transform: translateY(-3px); }
.svc-card .ico {
  width: 46px; height: 46px; border-radius: var(--radius); flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-primary);
}
.svc-card .ico svg { width: 23px; height: 23px; }
.svc-card h3 { font-size: var(--fs-xl); margin: 0; }
.svc-card > p { font-size: var(--fs-sm); color: var(--text-secondary); margin: 0; }
.svc-good {
  display: grid; gap: var(--sp-2);
  margin-top: var(--sp-1); padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}
.svc-good dt {
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-secondary);
}
.svc-good dd { margin: 0; font-size: var(--fs-sm); color: var(--text-primary); display: flex; gap: var(--sp-3); }
.svc-good dd svg { width: 17px; height: 17px; color: var(--accent-primary); flex-shrink: 0; margin-top: 4px; }
.svc-card .card-arrow { margin-top: var(--sp-2); }

@media (max-width: 760px) { .svc-grid { grid-template-columns: 1fr; } }

/* ==========================================================================
   32. BOOKING FORM
   ========================================================================== */
.book-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px;
  gap: clamp(2rem, 5vw, 3.5rem); align-items: start;
}
.book-side { position: sticky; top: calc(var(--header-h) + var(--sp-5)); display: grid; gap: var(--sp-4); }

.form-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: clamp(1.5rem, 4vw, 2.5rem);
}
.fieldset { border: none; padding: 0; margin: 0; }
.fieldset + .fieldset { margin-top: var(--sp-7); }
.fieldset > legend {
  font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 600;
  padding: 0; margin-bottom: var(--sp-2);
}
.fieldset > .hint { font-size: var(--fs-sm); color: var(--text-secondary); margin: 0 0 var(--sp-5); }

.field { display: grid; gap: var(--sp-2); }
.field + .field { margin-top: var(--sp-5); }
.field-row { display: grid; gap: var(--sp-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-row + .field { margin-top: var(--sp-5); }
.field-row .field + .field { margin-top: 0; }

.field label { font-weight: 600; font-size: var(--fs-sm); }
.field label .opt { font-weight: 400; color: var(--text-secondary); }
.field .help { font-size: var(--fs-xs); color: var(--text-secondary); }

.field input[type="text"], .field input[type="email"], .field select, .field textarea {
  width: 100%; min-height: 50px;
  padding: var(--sp-3) var(--sp-4);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius);
  background: var(--bg-primary); color: var(--text-primary);
  font-size: var(--fs-base);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.field textarea { min-height: 132px; resize: vertical; line-height: 1.6; }
.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%;
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
  padding-right: 2.75rem;
}
.field :is(input, select, textarea):focus {
  outline: none; border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.field :is(input, select, textarea):user-invalid {
  border-color: var(--warning); box-shadow: 0 0 0 4px var(--warning-soft);
}

/* radio / checkbox cards */
.choice-list { display: grid; gap: var(--sp-2); }
.choice {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-4); min-height: 56px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--bg-primary); cursor: pointer;
  transition: border-color .16s var(--ease), background-color .16s var(--ease);
}
.choice:hover { border-color: var(--border-strong); }
.choice input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent-primary); flex-shrink: 0; }
.choice:has(input:checked) { border-color: var(--accent-primary); background: var(--accent-soft); }
.choice:has(input:focus-visible) { outline: 3px solid var(--accent-primary); outline-offset: 2px; }
.choice .t { font-weight: 600; font-size: var(--fs-sm); display: block; }
.choice .d { font-size: var(--fs-xs); color: var(--text-secondary); display: block; margin-top: 2px; }

.form-actions { margin-top: var(--sp-7); padding-top: var(--sp-5); border-top: 1px solid var(--border); }
.form-actions .btn { min-width: 220px; }
.form-actions .after { font-size: var(--fs-xs); color: var(--text-secondary); margin-top: var(--sp-4); }

@media (max-width: 940px) {
  .book-layout { grid-template-columns: 1fr; }
  .book-side { position: static; }
}
@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
  .field-row .field + .field { margin-top: var(--sp-5); }
  .form-actions .btn { width: 100%; }
}

/* ---------- 21. PRINT ---------- */
@media print {
  .site-header, .disclaimer-bar, .cta-band, .symptom-search, .nav-toggle { display: none; }
  body { background: #fff; color: #000; }
  a::after { content: " (" attr(href) ")"; font-size: .8em; }
}
