/* =====================================================================
   HomeScope.ie site styles (every page except the home page map, which uses css/app.css).
   Tokens are shared with css/app.css; see docs/DESIGN.md.
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. Tokens
   --------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* HomeScope.ie brand (docs/brand/): emerald, aged brass, slate charcoal, parchment */
  --page: #F8F3E6;
  --surface: #FFFDF7;
  --surface-2: #F1EAD8;
  --surface-3: #E5DAC0;
  --ink: #1F2A24;
  --ink-2: #4A5560;
  --ink-3: #5E6770;
  --line: rgba(31, 42, 36, 0.12);
  --line-strong: rgba(31, 42, 36, 0.22);
  --primary: #0B6623;
  --on-primary: #FFFDF7;
  --focus: #0B6623;
  --brand: #0A4F1C;
  --on-brand: #FFFDF7;
  --on-brand-2: #C9D6CC;
  --brass: #C8A951;
  --brass-hi: #E3CB7F;
  --brass-ink: #7A6224;
  --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .3 0 0 0 0 .2 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  /* Verdict status: always shown with an icon and a label, never colour alone */
  --good: #0ca30c;     --good-ink: #006300;
  --warning: #fab219;  --warning-ink: #7a5200;
  --serious: #ec835a;  --serious-ink: #9a3d17;
  --critical: #d03b3b; --critical-ink: #a32424;

  /* Sequential price ramp (map shading) */
  --p1: #80c092; --p2: #57a970; --p3: #2f8550; --p4: #1d703d; --p5: #0b5126;   /* one green, light to dark (validated ordinal ramp, as Insights) */

  /* Chart series and axes */
  --s1: #1d703d; --s2: #b07d1a; --s3: #2a78d6;   /* emerald, brass, blue: dataviz validator, all checks pass (light) */ --grid: #E6DDC8; --axis: #CBBF9F;

  /* Map overlays (labels sit on busy tiles, so they're dark in both themes) */
  --map-label-bg: rgba(26, 31, 36, 0.92);
  --map-label-ink: #ffffff;
  --map-label-ink-2: #E3CB7F;
  --river: #0369a1;

  /* Type scale (base 15px body) */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-2xs: 0.75rem;    /* 12px  legal, axis ticks (one caption size) */
  --fs-xs: 0.75rem;     /* 12px  captions, sources */
  --fs-sm: 0.875rem;    /* 14px  labels, meta */
  --fs-md: 0.875rem;    /* 14px  secondary text, controls */
  --fs-base: 0.9375rem; /* 15px  body */
  --fs-lg: 1.0625rem;   /* 17px  card titles */
  --fs-xl: 1.25rem;     /* 20px  figures, section titles */
  --fs-2xl: 1.5rem;     /* 24px  panel titles */
  --fs-3xl: 1.875rem;   /* 30px  big figures */
  --fs-display: clamp(1.75rem, 3.4vw, 2.75rem);
  --fw-regular: 400; --fw-medium: 600; --fw-bold: 700; --fw-heavy: 700;

  /* Spacing scale (4px base) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-7: 32px; --sp-8: 40px; --sp-9: 56px;

  /* Shape, depth, motion, layers */
  --radius-xs: 6px; --radius-sm: 8px; --radius: 12px; --radius-lg: 16px; --radius-pill: 999px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.06), 0 1px 1px rgba(0,0,0,.04);
  --shadow-2: 0 8px 28px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
  --shadow-3: 0 24px 60px rgba(0,0,0,.22);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur: .16s;
  --z-map-ui: 500; --z-sticky: 900; --z-topbar: 1000; --z-pop: 1100;

  /* Layout */
  --topbar-h: 64px;
  --filterbar-h: 56px;
  --control-h: 36px;
  --control-h-lg: 42px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #111417; --surface: #181C20; --surface-2: #20252A; --surface-3: #2A3036;
    --ink: #F3EDDC; --ink-2: #C9C2AE; --ink-3: #A39D89;
    --line: rgba(243,237,220,.11); --line-strong: rgba(243,237,220,.22);
    --primary: #C8A951; --on-primary: #14171A; --focus: #E3CB7F;
    --brand: #1A1F24; --on-brand: #F3EDDC; --on-brand-2: #C9C2AE; --brass-ink: #D9BF6E;
    --texture: none;
    --shadow-1: 0 1px 2px rgba(0,0,0,.5); --shadow-2: 0 10px 30px rgba(0,0,0,.55); --shadow-3: 0 24px 60px rgba(0,0,0,.7);
    --good-ink: #3fcf3f; --warning-ink: #fab219; --serious-ink: #f09a78; --critical-ink: #ef7272;
    --p1: #2a7a45; --p2: #3d9659; --p3: #5bb274; --p4: #82cb95; --p5: #b3e2bf;
    --s1: #278047; --s2: #b58e3c; --s3: #4d8ee6;   /* validated for dark */ --grid: #2c2c2a; --axis: #383835;
    --river: #5cb4e6;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #111417; --surface: #181C20; --surface-2: #20252A; --surface-3: #2A3036;
  --ink: #F3EDDC; --ink-2: #C9C2AE; --ink-3: #A39D89;
  --line: rgba(243,237,220,.11); --line-strong: rgba(243,237,220,.22);
  --primary: #C8A951; --on-primary: #14171A; --focus: #E3CB7F;
  --brand: #1A1F24; --on-brand: #F3EDDC; --on-brand-2: #C9C2AE; --brass-ink: #D9BF6E;
  --texture: none;
  --shadow-1: 0 1px 2px rgba(0,0,0,.5); --shadow-2: 0 10px 30px rgba(0,0,0,.55); --shadow-3: 0 24px 60px rgba(0,0,0,.7);
  --good-ink: #3fcf3f; --warning-ink: #fab219; --serious-ink: #f09a78; --critical-ink: #ef7272;
  --p1: #2a7a45; --p2: #3d9659; --p3: #5bb274; --p4: #82cb95; --p5: #b3e2bf;
  --s1: #278047; --s2: #b58e3c; --s3: #4d8ee6;   /* validated for dark */ --grid: #2c2c2a; --axis: #383835;
  --river: #5cb4e6;
}


/* ---------------------------------------------------------------------
   2. Base
   --------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: var(--fs-base); line-height: 1.5; color: var(--ink); background: var(--page) var(--texture); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
a:hover { text-decoration-color: currentColor; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.015em; }
h1 { font-size: var(--fs-display); font-weight: var(--fw-heavy); letter-spacing: -0.03em; }
h2 { font-size: var(--fs-2xl); font-weight: var(--fw-bold); margin-bottom: var(--sp-3); }
h3 { font-size: var(--fs-lg); font-weight: var(--fw-bold); }
p { margin: 0 0 var(--sp-3); }
small { font-size: .8em; }
.muted { color: var(--ink-3); }
.note { font-size: var(--fs-sm); color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.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; }
.eyebrow { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--sp-2); }
.lede { font-size: var(--fs-lg); color: var(--ink-2); max-width: 64ch; margin-top: var(--sp-3); }
.source { font-size: var(--fs-xs); color: var(--ink-3); margin-top: var(--sp-2); max-width: 90ch; }
.source a { color: var(--ink-2); }
.skip { position: absolute; left: var(--sp-3); top: -60px; z-index: 2000; background: var(--primary); color: var(--on-primary); padding: var(--sp-2) var(--sp-4); border-radius: var(--radius-sm); }
.skip:focus { top: var(--sp-3); }
main { outline: none; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 var(--sp-5); }
.prose-wrap { max-width: 860px; }

/* ---------------------------------------------------------------------
   3. Components
   --------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: var(--control-h-lg); padding: 0 var(--sp-5); border-radius: var(--radius-pill); border: 1px solid var(--primary); background: var(--primary); color: var(--on-primary); font-weight: var(--fw-bold); text-decoration: none; }
.btn:hover { opacity: .9; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { opacity: 1; border-color: var(--ink); }
.btn-ghost[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.btn.ext svg { opacity: .7; }
.icon-btn { position: relative; width: var(--control-h-lg); height: var(--control-h-lg); border-radius: var(--radius-pill); display: grid; place-items: center; border: 1px solid transparent; background: none; color: var(--ink-2); text-decoration: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.badge { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary); color: var(--on-primary); font-size: 11px; font-weight: var(--fw-bold); line-height: 18px; text-align: center; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .i-sun { display: block; } :root:not([data-theme="light"]) .i-moon { display: none; } }

.chip { min-height: 38px; padding: 0 var(--sp-4); border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--surface); font-weight: var(--fw-medium); font-size: var(--fs-md); }
.chip:hover { border-color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; margin-top: var(--sp-4); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--sp-5); margin: var(--sp-4) 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field-label { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--ink-2); }
.field-label small { font-weight: var(--fw-regular); color: var(--ink-3); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-3); }
.field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.money { display: flex; align-items: center; min-height: 44px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); padding: 0 10px; }
.money i { font-style: normal; color: var(--ink-3); }
.money input { border: 0; background: none; outline: none; width: 100%; padding: 10px 6px; font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.money:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.select { min-height: 44px; padding: 0 32px 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background-color: var(--surface); appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%23888' stroke-width='2.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.seg { display: inline-grid; grid-auto-flow: column; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: var(--radius-pill); border: 1px solid var(--line); }
.seg button, .seg label { border: 0; background: none; padding: 7px 14px; border-radius: var(--radius-pill); font-weight: var(--fw-medium); font-size: var(--fs-md); color: var(--ink-2); white-space: nowrap; cursor: pointer; }
.seg label { display: inline-flex; align-items: center; gap: 6px; }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg button[aria-checked="true"], .seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
input[type="range"] { accent-color: var(--ink); width: 100%; }

.toggle-chip { display: inline-flex; align-items: center; gap: 6px; height: var(--control-h); padding: 0 14px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--surface); font-weight: var(--fw-medium); font-size: var(--fs-md); cursor: pointer; position: relative; }
.toggle-chip input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-dot { width: 28px; height: 16px; border-radius: var(--radius-pill); background: var(--surface-3); position: relative; }
.toggle-dot::after { content: ''; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform var(--dur); }
.toggle-chip input:checked + .toggle-dot { background: var(--ink); }
.toggle-chip input:checked + .toggle-dot::after { transform: translateX(12px); background: var(--on-primary); }
.toggle-chip:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }

.verdict { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px 0 6px; border-radius: var(--radius-pill); font-weight: var(--fw-bold); font-size: var(--fs-sm); white-space: nowrap; background: color-mix(in srgb, var(--v) 14%, var(--surface)); color: var(--v-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--v) 45%, transparent); }
.verdict .vi { width: 18px; height: 18px; border-radius: 50%; background: var(--v); display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.verdict.sm { height: 24px; font-size: var(--fs-xs); padding-right: var(--sp-2); }
.verdict.sm .vi { width: 16px; height: 16px; }
.v-reach { --v: var(--good); --v-ink: var(--good-ink); }
.v-stretch { --v: var(--warning); --v-ink: var(--warning-ink); }
.v-stretch .vi { color: #3d2a00; }
.v-out { --v: var(--serious); --v-ink: var(--serious-ink); }
.v-far { --v: var(--critical); --v-ink: var(--critical-ink); }

/* Stat tiles */
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); }
.tiles { margin: var(--sp-6) 0 var(--sp-2); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--sp-4); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile-label, .tile > span:first-child { font-size: var(--fs-sm); color: var(--ink-2); font-weight: var(--fw-medium); display: flex; align-items: center; gap: 4px; }
.tile-value, .tile > strong { font-size: var(--fs-3xl); font-weight: var(--fw-heavy); letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile-value small, .tile > strong small { font-size: var(--fs-base); color: var(--ink-3); font-weight: var(--fw-medium); letter-spacing: 0; }
.tile-sub { font-size: var(--fs-sm); color: var(--ink-2); }
.tile-note { font-size: var(--fs-xs); color: var(--ink-3); margin-top: auto; padding-top: var(--sp-2); }
.tile-note a { color: var(--ink-2); }
.tile > p { margin: 0; font-size: var(--fs-xs); color: var(--ink-3); }
.split-v { display: block; font-size: var(--fs-xl); letter-spacing: -0.02em; }
.split-v small { font-size: var(--fs-xs); color: var(--ink-3); font-weight: var(--fw-medium); letter-spacing: 0; margin-right: 4px; }
.info { border: 0; background: none; padding: 2px; color: var(--ink-3); display: inline-grid; place-items: center; border-radius: 50%; position: relative; }
.info:hover, .info:focus-visible { color: var(--ink); }
.tipbox { position: absolute; z-index: 50; max-width: 260px; background: var(--ink); color: var(--page); font-size: var(--fs-sm); font-weight: var(--fw-regular); line-height: 1.4; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); box-shadow: var(--shadow-2); }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: var(--fw-bold); font-size: var(--fs-md); letter-spacing: 0; white-space: nowrap; color: var(--ink-2); }
.tile-value .trend { font-size: var(--fs-2xl); }
.trend svg { flex-shrink: 0; }

/* Sections, tables, disclosure */
.section { margin: var(--sp-8) 0; }
.section > p { max-width: 75ch; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
table.data caption { text-align: left; font-size: var(--fs-sm); color: var(--ink-2); font-weight: var(--fw-medium); padding: var(--sp-3) var(--sp-4) var(--sp-2); }
table.data th, table.data td { padding: 10px var(--sp-4); border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data thead th { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: var(--fw-bold); white-space: nowrap; }
table.data tbody th { font-weight: var(--fw-medium); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data small { color: var(--ink-3); }
table.data tr.is-ref { background: var(--surface-2); }
table.data.compact th, table.data.compact td { padding: 6px var(--sp-3); }
.table-scroll + .table-scroll { margin-top: var(--sp-3); }
details.more { margin: var(--sp-4) 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
details.more > summary { cursor: pointer; padding: var(--sp-3) var(--sp-4); font-weight: var(--fw-bold); list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: '+'; font-size: 1.3em; color: var(--ink-3); }
details.more[open] > summary::after { content: '–'; }
details.more > :not(summary) { margin-left: var(--sp-4); margin-right: var(--sp-4); }
details.more > :last-child { margin-bottom: var(--sp-4); }
details.more .table-scroll { margin-bottom: var(--sp-3); }
.callout { background: var(--surface-2); border-left: 4px solid var(--ink); border-radius: var(--radius-sm); padding: var(--sp-3) var(--sp-4); margin: var(--sp-4) 0; max-width: 80ch; }
.callout p:last-child { margin: 0; }
.callout.warn { border-left-color: var(--warning); }
.pending { display: inline-block; padding: 1px 8px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--ink-2); font-size: var(--fs-xs); font-weight: var(--fw-bold); }

/* Comparison bars (anchoring): one scale, the current area highlighted */
.cbars { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--sp-4); }
.cbars figcaption { font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: var(--sp-3); }
.cbars ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.cbars li { display: grid; grid-template-columns: minmax(120px, 30%) 1fr auto; gap: var(--sp-3); align-items: center; font-size: var(--fs-md); }
.cb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-track { height: 12px; }
.cb-bar { display: block; height: 100%; background: var(--surface-3); border-radius: 0 4px 4px 0; }
.cbars li.is-current .cb-bar { background: var(--s1); }
.cbars li.is-current { font-weight: var(--fw-bold); }
.cbars li.is-ref .cb-bar { background: repeating-linear-gradient(135deg, var(--surface-3) 0 4px, transparent 4px 7px); box-shadow: inset 0 0 0 1px var(--line-strong); }
.cbars li.is-ref .cb-label { color: var(--ink-2); }
.cb-value { font-variant-numeric: tabular-nums; font-weight: var(--fw-bold); }

/* Build-time line charts */
.chart { margin: 0 0 var(--sp-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--sp-4); }
.chart-title { font-weight: var(--fw-bold); margin-bottom: var(--sp-2); }
.lc-svg { display: block; width: 100%; max-width: 760px; height: auto; overflow: visible; }
.lc-grid { stroke: var(--grid); stroke-width: 1; }
.lc-tick { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.lc-svg .lc-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.lc-line.s1 { stroke: var(--s1); } .lc-line.s2 { stroke: var(--s2); } .lc-line.s3 { stroke: var(--s3); }
.lc-pt { stroke: var(--surface); stroke-width: 2; }
.lc-pt.s1 { fill: var(--s1); } .lc-pt.s2 { fill: var(--s2); } .lc-pt.s3 { fill: var(--s3); }
.lc-pt:hover { r: 6; }
.lc-endval { fill: var(--ink); font-size: 12px; font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.lc-key i.s1 { background: var(--s1); } .lc-key i.s2 { background: var(--s2); } .lc-key i.s3 { background: var(--s3); }
details.lc-table { margin-top: var(--sp-2); }
details.lc-table summary { cursor: pointer; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--ink-2); width: max-content; }
details.lc-table table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); }
details.lc-table th, details.lc-table td { padding: 5px 10px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
details.lc-table th:first-child { text-align: left; }
.chart-tip { position: fixed; z-index: 60; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-2); padding: 6px 10px; font-size: var(--fs-sm); }

/* Cards, link grids, paths */
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-3); }
.card a { display: flex; flex-direction: column; gap: 2px; height: 100%; padding: var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); text-decoration: none; }
.card a:hover { border-color: var(--ink); }
.saving { font-size: var(--fs-xl); font-weight: var(--fw-heavy); color: var(--good-ink); }
.link-grid { list-style: none; margin: 0 0 var(--sp-4); padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px var(--sp-4); }
.link-grid li { display: flex; justify-content: space-between; gap: var(--sp-2); padding: 6px 0; border-bottom: 1px solid var(--line); }
.link-grid .muted { font-variant-numeric: tabular-nums; white-space: nowrap; }
.paths { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-3); }
.paths a { display: flex; flex-direction: column; gap: var(--sp-1); height: 100%; padding: var(--sp-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); text-decoration: none; }
.paths a:hover { border-color: var(--ink); }
.paths strong { font-size: var(--fs-lg); }
.paths span { color: var(--ink-2); }
.xlink { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); }
.rules { padding-left: var(--sp-5); display: grid; gap: var(--sp-2); max-width: 80ch; }
.pager { display: flex; justify-content: space-between; margin: var(--sp-6) 0; }
.pager a { font-weight: var(--fw-bold); }

/* Schemes */
.schemes { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.schemes > li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--sp-4) var(--sp-5); }
.scheme-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.schemes p { margin: 0 0 var(--sp-2); max-width: 80ch; }

/* FAQ */
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: var(--sp-4) 0; list-style: none; display: flex; justify-content: space-between; gap: var(--sp-3); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-size: 1.4em; line-height: 1; color: var(--ink-3); }
.faq details[open] summary::after { content: '–'; }
.faq summary h3 { font-size: var(--fs-base); }
.faq-a p { color: var(--ink-2); max-width: 75ch; }

/* Calculators */
.calc { margin: var(--sp-3) 0; }
.calc .field { max-width: 320px; }
.calc .field-row .field { max-width: none; }
.calc-out { margin-top: var(--sp-3); }
.clock-out, .big-answer { font-size: var(--fs-xl); font-weight: var(--fw-bold); }
.calc-result { margin: var(--sp-4) 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
.big { font-size: var(--fs-3xl); font-weight: var(--fw-heavy); letter-spacing: -0.03em; margin: 0; }
.big small { font-size: var(--fs-base); color: var(--ink-3); font-weight: var(--fw-medium); }
.result-table { width: 100%; border-collapse: collapse; }
.result-table th, .result-table td { padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); text-align: left; }
.result-table td { text-align: right; font-variant-numeric: tabular-nums; font-weight: var(--fw-bold); }
.two-col + .note, .result-table + .note { margin-top: var(--sp-3); }

/* ---------------------------------------------------------------------
   4. Layout: header, footer, breadcrumbs
   --------------------------------------------------------------------- */
.site-head { position: sticky; top: 0; z-index: var(--z-topbar); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.5) blur(10px); border-bottom: 1px solid var(--line); }
.head-row { display: flex; align-items: center; gap: var(--sp-5); height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); }
.brand-name { font-size: 1.15rem; font-weight: 500; letter-spacing: -0.02em; }
.brand-name b { font-weight: var(--fw-heavy); }
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a { padding: 8px 12px; border-radius: var(--radius-pill); font-weight: var(--fw-medium); color: var(--ink-2); text-decoration: none; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.head-actions { display: flex; gap: 2px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: var(--sp-5) 0 0; padding: 0; font-size: var(--fs-sm); color: var(--ink-3); }
.crumbs li + li::before { content: '›'; margin-right: 4px; }
.crumbs a { color: var(--ink-2); }
.area-head { margin: var(--sp-5) 0 var(--sp-2); }
.area-head h1 { max-width: 24ch; }
.area-actions { margin-top: var(--sp-4); }
.site-foot { margin-top: var(--sp-9); border-top: 1px solid var(--line); background: var(--surface); padding: var(--sp-7) 0 var(--sp-5); font-size: var(--fs-md); color: var(--ink-2); }
.foot-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--sp-6); }
.foot-grid nav { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2) var(--sp-4); align-content: start; }
.foot-brand { font-size: var(--fs-lg); color: var(--ink); }
.foot-brand b { font-weight: var(--fw-heavy); }
.foot-small { margin-top: var(--sp-5); font-size: var(--fs-xs); color: var(--ink-3); }

/* ---------------------------------------------------------------------
   5. Pages
   --------------------------------------------------------------------- */
/* Home hero */
.hero { background: var(--surface); border-bottom: 1px solid var(--line); padding: var(--sp-9) 0 var(--sp-8); }
.hero-inner { text-align: center; max-width: 820px; }
.hero h1 { margin: 0 auto; max-width: 18ch; }
.hero .lede { margin: var(--sp-3) auto var(--sp-6); }
.trust-line { margin-top: var(--sp-5); font-size: var(--fs-sm); color: var(--ink-3); }

/* Search combobox */
.search { position: relative; }
.search.big { max-width: 680px; margin: 0 auto; text-align: left; }
.search input { width: 100%; min-height: 48px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface); outline: none; }
.search.big input { min-height: 60px; padding: 0 20px 0 52px; border-radius: var(--radius-pill); font-size: var(--fs-lg); border-width: 2px; border-color: var(--ink); box-shadow: var(--shadow-2); }
.search input:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 30%, transparent); }
.search-icon { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); display: grid; color: var(--ink-3); pointer-events: none; }
.search.big .suggest { top: calc(60px + 6px); }
.search.big { }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 80; list-style: none; margin: 0; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-3); max-height: min(420px, 60vh); overflow: auto; }
.suggest li { display: flex; justify-content: space-between; gap: var(--sp-3); padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--surface-2); }
.suggest .s-name { font-weight: var(--fw-bold); }
.suggest .s-meta { display: block; font-size: var(--fs-xs); color: var(--ink-3); }
.suggest .s-price { text-align: right; font-variant-numeric: tabular-nums; font-weight: var(--fw-bold); white-space: nowrap; }
.suggest .s-price small { display: block; font-weight: var(--fw-regular); color: var(--ink-3); }
.suggest .s-empty { display: block; cursor: default; color: var(--ink-2); }
.suggest .s-empty:hover { background: none; }

/* Area cards on the home page */
.acards { list-style: none; margin: 0; padding: 0 0 var(--sp-2); display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: var(--sp-3); overflow-x: auto; scroll-snap-type: x mandatory; }
.acard { scroll-snap-align: start; }
.acard a { display: flex; flex-direction: column; gap: var(--sp-1); height: 100%; padding: var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); text-decoration: none; }
.acard a:hover { border-color: var(--ink); }
.acard-type { font-size: var(--fs-xs); color: var(--ink-3); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: .05em; }
.acard-name { font-size: var(--fs-lg); }
.acard-fig { display: grid; grid-template-columns: 1fr auto; align-items: baseline; column-gap: var(--sp-2); font-size: var(--fs-sm); color: var(--ink-2); margin-top: var(--sp-2); }
.acard-fig > span:first-child { grid-column: 1 / -1; }
.acard-fig .trend { justify-self: end; font-size: var(--fs-sm); }
.acard-fig b { color: var(--ink); font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.acard-fig small { color: var(--ink-3); }
.acard-note { margin-top: auto; font-size: var(--fs-xs); color: var(--ink-3); }

/* Static SVG maps */
.map-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.map-head h2 { margin: 0; }
.map-wrap { display: grid; grid-template-columns: minmax(0, 420px) 1fr; gap: var(--sp-6); align-items: start; }
.cmap { width: 100%; height: auto; display: block; }
.cmap .mc { fill: var(--surface-3); stroke: var(--surface); stroke-width: 1; stroke-linejoin: round; transition: opacity var(--dur); }
.cmap a:hover .mc, .cmap a:focus-visible .mc { stroke: var(--ink); stroke-width: 2; }
.cmap a:focus-visible { outline: none; }
.mc.p1 { fill: var(--p1); } .mc.p2 { fill: var(--p2); } .mc.p3 { fill: var(--p3); } .mc.p4 { fill: var(--p4); } .mc.p5 { fill: var(--p5); }
.mc.v-reach { fill: var(--good); } .mc.v-stretch { fill: var(--warning); } .mc.v-out { fill: var(--serious); } .mc.v-far { fill: var(--critical); }
.mc-label { fill: var(--ink); font-size: 10px; font-weight: var(--fw-bold); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; pointer-events: none; }
.legend { display: grid; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: var(--sp-3); }
.legend-title { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: var(--fw-bold); }
.legend-row { display: flex; align-items: center; gap: var(--sp-2); }
.legend-row em { font-style: normal; color: var(--ink-3); margin-left: auto; }
.sw { width: 16px; height: 16px; border-radius: 4px; display: inline-block; flex-shrink: 0; }
.sw.p1 { background: var(--p1); } .sw.p2 { background: var(--p2); } .sw.p3 { background: var(--p3); } .sw.p4 { background: var(--p4); } .sw.p5 { background: var(--p5); }

.trust-list { list-style: none; padding: 0; margin: 0 0 var(--sp-3); display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--sp-2) var(--sp-4); }
.trust-list li { padding: var(--sp-3) var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.trust-list a { font-weight: var(--fw-bold); }

/* Info pages */
.log { list-style: none; padding: 0; }
.log li { padding: var(--sp-4) 0; border-bottom: 1px solid var(--line); }
.log time { font-size: var(--fs-sm); color: var(--ink-3); }
.log h2 { font-size: var(--fs-lg); margin: var(--sp-1) 0; }
.downloads { list-style: none; padding: 0; display: grid; gap: var(--sp-3); }
.downloads > li { padding: var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.downloads a { font-weight: var(--fw-bold); }
pre.cite { white-space: pre-wrap; background: var(--surface-2); padding: var(--sp-3); border-radius: var(--radius-sm); font-size: var(--fs-sm); }
.sources ul { padding-left: var(--sp-5); display: grid; gap: var(--sp-1); font-size: var(--fs-sm); color: var(--ink-2); }

/* Compare and my areas */
.cmp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.cmp-table th { width: 34%; }
.my-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-3); }
.my-list li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); }
.my-list textarea { width: 100%; min-height: 60px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); padding: var(--sp-2); font: inherit; font-size: var(--fs-sm); }
.my-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.my-actions button { min-height: 34px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.toast { position: fixed; left: 50%; bottom: var(--sp-6); transform: translateX(-50%); z-index: 1500; background: var(--ink); color: var(--page); padding: var(--sp-3) var(--sp-5); border-radius: var(--radius-pill); box-shadow: var(--shadow-3); font-weight: var(--fw-medium); }
.share-menu { position: absolute; z-index: 90; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-3); padding: 6px; display: grid; min-width: 200px; }
.share-menu a, .share-menu button { text-align: left; padding: 10px 12px; border-radius: var(--radius-sm); border: 0; background: none; text-decoration: none; font-weight: var(--fw-medium); }
.share-menu a:hover, .share-menu button:hover { background: var(--surface-2); }

/* Trends (charts drawn by js/trends.js) */
.trends { display: flex; flex-direction: column; gap: 36px; margin-top: var(--sp-5); }
.m-hero h1, .m-hero h2 { font-size: var(--fs-display); letter-spacing: -0.03em; max-width: 22ch; }
.m-hero p { font-size: var(--fs-lg); color: var(--ink-2); max-width: 64ch; margin: var(--sp-3) 0 0; }
.m-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); }
.t-loading { color: var(--ink-3); padding: var(--sp-8) 0; }
.t-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); margin-bottom: calc(var(--sp-3) * -1); font-size: var(--fs-md); }
.t-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.t-card { padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.t-card.t-wide, #t-long, #t-ratio { grid-column: 1 / -1; }
.t-card header h2 { font-size: var(--fs-lg); }
.t-card header p { margin: var(--sp-1) 0 0; color: var(--ink-2); font-size: var(--fs-md); max-width: 72ch; }
.t-card h3 { font-size: var(--fs-md); color: var(--ink-2); margin-bottom: 6px; }
.t-source { font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.45; border-top: 1px solid var(--line); padding-top: 10px; }
.t-two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
.t-select { display: inline-flex; align-items: center; gap: var(--sp-2); margin-top: 10px; font-weight: var(--fw-medium); font-size: var(--fs-md); }
.t-select .select { min-width: 160px; }
.lc { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.lc-legend { display: flex; flex-wrap: wrap; gap: 6px var(--sp-4); font-size: var(--fs-sm); color: var(--ink-2); }
.lc-key { display: inline-flex; align-items: center; gap: 6px; }
.lc-key i { width: 16px; height: 2px; border-radius: 2px; display: inline-block; }
.lc-key i.dash { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px) !important; color: var(--ink-3); }
.lc-plot { position: relative; width: 100%; }
.lc-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.lc-gridline { stroke: var(--grid); stroke-width: 1; }
.lc-base { stroke: var(--axis); stroke-width: 1; }
.lc-ytick, .lc-xtick { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.lc-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.lc-line.dash { stroke-dasharray: 5 4; stroke-width: 1.5; }
.lc-ref { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 4 4; }
.lc-reflabel { fill: var(--ink-2); font-size: 11px; font-weight: var(--fw-medium); }
.lc-band { fill: var(--ink); opacity: .045; }
.lc-bandlabel { fill: var(--ink-3); font-size: 11px; font-weight: var(--fw-medium); }
.lc-note-dot { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; }
.lc-note { fill: var(--ink); font-size: 11px; font-weight: var(--fw-bold); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.lc-enddot { stroke: var(--surface); stroke-width: 2; }
.lc-leader { stroke: var(--ink-3); stroke-width: 1; fill: none; }
.lc-endval { fill: var(--ink); font-size: 12px; font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.lc-endname { fill: var(--ink-3); font-size: 11px; }
.lc-cross { stroke: var(--ink-3); stroke-width: 1; }
.lc-hoverdot { stroke: var(--surface); stroke-width: 2; }
.lc-hit { cursor: crosshair; outline: none; }
.lc-hit:focus-visible { outline: none; }
.lc-plot:has(.lc-hit:focus-visible) { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: var(--radius-xs); }
.lc-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 170px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-2); padding: var(--sp-2) 10px; font-size: var(--fs-sm); }
.lc-tip-x { font-weight: var(--fw-bold); color: var(--ink-2); margin-bottom: var(--sp-1); }
.lc-tip-row { display: grid; grid-template-columns: 14px auto 1fr; align-items: center; gap: var(--sp-2); padding: 1px 0; }
.lc-tip-row i { width: 14px; height: 2px; border-radius: 2px; }
.lc-tip-row strong { font-variant-numeric: tabular-nums; }
.lc-tip-row span { color: var(--ink-3); white-space: nowrap; }
.lc-tip-extra { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--line); color: var(--ink-2); }
.lc-table summary { cursor: pointer; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--ink-2); width: max-content; }
.lc-table-scroll { max-height: 260px; overflow: auto; margin-top: var(--sp-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.lc-table table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); }
.lc-table th, .lc-table td { padding: 5px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.lc-table th:first-child, .lc-table td:first-child { text-align: left; }
.lc-table th { position: sticky; top: 0; background: var(--surface); color: var(--ink-3); font-weight: var(--fw-bold); }

/* ---------------------------------------------------------------------
   6. Responsive and preferences
   --------------------------------------------------------------------- */
@media (max-width: 960px) {
  .grid-4, .m-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-wrap { grid-template-columns: 1fr; }
  .cmap { max-width: 420px; margin: 0 auto; }
  .t-grid, .t-two { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 var(--sp-4); }
  .head-row { height: auto; min-height: 56px; flex-wrap: wrap; gap: 0 var(--sp-2); padding: var(--sp-2) var(--sp-4); }
  .brand-name { display: none; }
  .nav { order: 3; width: 100%; margin: 0; justify-content: space-between; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 8px 9px; font-size: var(--fs-md); white-space: nowrap; flex: none; }
  .head-actions { margin-left: auto; }
  .hero { padding: var(--sp-7) 0 var(--sp-6); }
  .field-row, .field-row.three, .two-col, .cmp-grid, .foot-grid, .foot-grid nav { grid-template-columns: 1fr; }
  .tile { padding: var(--sp-3); }
  .tile-value, .tile > strong { font-size: var(--fs-2xl); }
  .cbars li { grid-template-columns: minmax(90px, 36%) 1fr auto; gap: var(--sp-2); font-size: var(--fs-sm); }
  table.data th, table.data td { padding: 8px var(--sp-3); }
  details.more[data-mobile-closed]:not([data-user]) { }
  .section { margin: var(--sp-7) 0; }
  .search.big input { font-size: var(--fs-base); }
}
@media (max-width: 380px) { .grid-4 { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media (forced-colors: active) { .cb-bar, .sw, .mc { forced-color-adjust: none; } }
@media print { .site-head, .site-foot, .area-actions, .chips, .skip { display: none; } }
.my-list h2 { font-size: var(--fs-lg); margin: 0; }

/* Afford form: the "Buying as" switch needs a full row below desktop width */
fieldset.field { min-width: 0; }
@media (max-width: 1000px) {
  .afford-form .field-row.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .afford-form .field-row.three fieldset { grid-column: 1 / -1; }
}
@media (max-width: 560px) { .afford-form .field-row.three { grid-template-columns: 1fr; } }

/* Portal link-out cards: our own map picture on the left, the link text on the right */
.portal-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin: var(--sp-3) 0; }
.portal-card { display: flex; align-items: stretch; gap: var(--sp-4); padding: var(--sp-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.portal-card:hover { border-color: var(--ink); box-shadow: var(--shadow-1); }
.portal-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.pc-pic { position: relative; flex: none; display: grid; place-items: center; width: 108px; min-height: 120px; border-radius: calc(var(--radius-lg) - 4px); background: var(--surface-2); }
.pc-pic .place-thumb { width: 86px; height: auto; }
.pt-land { fill: var(--line-strong); stroke: var(--surface-2); stroke-width: .5; stroke-linejoin: round; }
.pt-here { fill: var(--ink); stroke: var(--surface-2); stroke-width: .5; stroke-linejoin: round; }
.pc-badge { position: absolute; right: 6px; top: 6px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--on-primary); box-shadow: 0 0 0 2px var(--surface-2); }
.pc-badge svg { width: 15px; height: 15px; }
.pc-body { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; }
.pc-title { font-weight: var(--fw-bold); font-size: var(--fs-base); line-height: 1.3; }
.pc-meta { color: var(--ink-2); font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.pc-go { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-weight: var(--fw-medium); font-size: var(--fs-md); text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 720px) { .portal-cards { grid-template-columns: 1fr; } .pc-pic { width: 92px; min-height: 104px; } .pc-pic .place-thumb { width: 72px; } .pc-badge { width: 24px; height: 24px; } }

/* /trends/: keep room for the charts while they draw, so the footer doesn't jump (layout shift) */
#trends { min-height: 100vh; }

/* =====================================================================
   HomeScope.ie brand (docs/brand/README.md), as on the home page: the emerald band with the
   brass mark, serif headings, parchment surfaces, brass rules, the emerald footer.
   Data colours (verdicts, price shading, chart series) are unchanged.
   ===================================================================== */
@font-face { font-family: "Playfair Display"; src: url("/fonts/playfair-display-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
b, strong { font-weight: var(--fw-bold); }

/* Headings in the serif; figures stay in the sans */
h1, h2, h3, .foot-brand { font-family: var(--font-serif); font-weight: 700; letter-spacing: 0; }
h1 { font-weight: 700; }

/* Header: the emerald band, brass rule, brass mark */
.site-head { --focus: var(--brass-hi); background: var(--brand); color: var(--on-brand); border-bottom: 2px solid var(--brass); backdrop-filter: none; }
.brand { gap: 12px; color: var(--on-brand); }
.brand-mark { width: auto; height: auto; background: none; border-radius: 0; display: block; }
.brand-mark .mark { display: block; }
.brand-mark .h, .brand-mark .p { stroke: var(--brass-hi); }
.brand-mark .i { stroke: var(--brass); }
.brand-name { font-size: var(--fs-lg); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: .14em; color: var(--on-brand); }
.site-head .nav a { color: var(--on-brand-2); border-radius: 0; padding-left: 4px; padding-right: 4px; margin: 0 8px; }
.site-head .nav a:hover { background: none; color: var(--on-brand); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--brass) 60%, transparent); }
.site-head .nav a[aria-current="page"] { background: none; color: var(--on-brand); box-shadow: inset 0 -2px 0 var(--brass); }
.site-head .icon-btn { color: var(--on-brand); }
.site-head .icon-btn:hover { background: rgba(255, 255, 255, .1); color: var(--on-brand); }
.site-head .badge { background: var(--brass-hi); color: #14201A; }

/* Accents: brass eyebrows and rules, links underlined in brass */
.eyebrow { color: var(--brass-ink); }
a { text-decoration-color: color-mix(in srgb, var(--brass) 75%, transparent); }
a:hover { text-decoration-color: var(--brass); }
.crumbs a { color: var(--primary); }
.callout { border-left-color: var(--brass); background: var(--surface); border: 1px solid color-mix(in srgb, var(--brass) 45%, transparent); border-left-width: 4px; }
.callout.warn { border-left-color: var(--warning); }
.card a:hover { border-color: var(--brass); box-shadow: var(--shadow-1); }
.tile { box-shadow: var(--shadow-1); }

/* Footer: an emerald block with a brass rule */
.site-foot { --focus: var(--brass-hi); background: var(--brand); color: var(--on-brand-2); border-top: 3px solid var(--brass); }
.site-foot a { color: var(--on-brand); text-decoration-color: color-mix(in srgb, var(--brass) 70%, transparent); }
.site-foot strong { color: var(--on-brand); }
.foot-brand { color: var(--on-brand); font-size: var(--fs-xl); }
.foot-brand b { font-weight: 700; color: var(--brass-hi); }
.foot-small { color: var(--on-brand-2); }

@media (max-width: 720px) {
  .site-head .nav a { margin: 0; padding: 8px 4px; }
}
@media (max-width: 380px) { .site-head .nav a { padding: 8px 2px; font-size: var(--fs-sm); } }
@media (max-width: 1000px) { .site-head .brand-name { display: none; } }
@media (min-width: 721px) and (max-width: 1000px) { .site-head .nav a { margin: 0 4px; } }

/* =====================================================================
   Begin here (/begin-here/): the first-time buyer's guide. New components only; nothing above changes.
   ===================================================================== */
.begin .area-head h1 { max-width: 20ch; }
.toc { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-5); }
.toc a { display: inline-flex; align-items: center; gap: var(--sp-2); padding: 5px 14px 5px 5px; border-radius: var(--radius-pill); background: var(--surface); border: 1px solid var(--line); font-weight: var(--fw-medium); font-size: var(--fs-md); color: var(--ink); text-decoration: none; }
.toc a:hover { border-color: var(--brass); }
.toc b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-size: var(--fs-xs); }
.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--sp-2) var(--sp-5); margin-bottom: var(--sp-4); }
.sec-head h2 { margin: 0; }
.steps-progress { margin: 0; color: var(--ink-2); font-size: var(--fs-md); }
.stages { columns: 2; column-gap: var(--sp-4); }
.stage { break-inside: avoid; margin: 0 0 var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--sp-5); box-shadow: var(--shadow-1); }
.stage h3 { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-xl); margin-bottom: var(--sp-4); }
.stage-n { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--brass); color: var(--brass-ink); font-family: var(--font); font-size: var(--fs-md); font-weight: var(--fw-bold); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.step { padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.step:first-child { padding-top: 0; border-top: 0; }
.step-check { display: flex; align-items: flex-start; gap: var(--sp-3); cursor: pointer; font-weight: var(--fw-bold); font-size: var(--fs-lg); line-height: 1.35; }
.step-check input { -webkit-appearance: none; appearance: none; flex: none; display: grid; place-items: center; width: 24px; height: 24px; margin: 0; border: 2px solid var(--line-strong); border-radius: 7px; background: var(--surface); cursor: pointer; }
.step-check input::after { content: ''; width: 11px; height: 6px; border: solid var(--on-primary); border-width: 0 0 3px 3px; transform: translateY(-2px) rotate(-45deg); opacity: 0; }
.step-check input:checked { background: var(--primary); border-color: var(--primary); }
.step-check input:checked::after { opacity: 1; }
.step-check input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.step-n { color: var(--brass-ink); margin-right: 6px; font-variant-numeric: tabular-nums; }
.step p { margin: var(--sp-1) 0 0 36px; color: var(--ink-2); max-width: 70ch; }
.step p.source { margin-top: var(--sp-1); }
.step.is-done .step-title { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--brass); text-decoration-thickness: 2px; }
.begin-form { margin-top: 0; }
.begin-form .note { margin: 0; }
.save-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: var(--sp-5); align-items: start; margin-top: var(--sp-4); }
.save-table th small { display: block; margin-top: 2px; font-size: var(--fs-xs); font-weight: var(--fw-regular); color: var(--ink-3); }
.save-table tr.total th, .save-table tr.total td { border-top: 2px solid var(--ink); font-size: var(--fs-lg); font-weight: var(--fw-bold); }
#save-out .big-answer, #time-out .big-answer { margin-bottom: var(--sp-3); max-width: 60ch; }
#save-out .note { margin-top: var(--sp-3); }
.callout.family { margin: 0; }
.callout.family h3 { font-size: var(--fs-lg); margin-bottom: var(--sp-2); }
.quotes-field { max-width: 380px; margin-top: var(--sp-4); }
.time-fields { max-width: 760px; }
.scen-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); margin: var(--sp-4) 0 var(--sp-3); }
.tile.scen .tile-value { font-size: var(--fs-2xl); }
.tile-when { font-size: var(--fs-md); font-weight: var(--fw-medium); color: var(--brass-ink); }
.tile.scen.is-now { border-color: var(--good); }
.tile.scen.is-na { background: var(--surface-2); box-shadow: none; }
.tile.scen.is-na .tile-value { color: var(--ink-3); }
.begin-schemes { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: var(--sp-4); }
.begin-schemes .scheme-head h3 { margin: 0; }
.tag { display: inline-block; padding: 2px 10px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--ink-2); font-size: var(--fs-xs); font-weight: var(--fw-bold); }
.scheme-facts { margin: 0 0 var(--sp-3); }
.scheme-facts dt { margin-top: var(--sp-2); font-size: var(--fs-xs); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: .05em; color: var(--brass-ink); }
.scheme-facts dd { margin: 2px 0 0; }
.scheme-links a { font-weight: var(--fw-bold); }
.costs-table td:nth-child(2) { min-width: 30ch; }
.costs-table td:last-child { font-size: var(--fs-sm); white-space: nowrap; }
.begin .paths + .note { margin-top: var(--sp-4); }
.glossary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--sp-6); margin: 0 0 var(--sp-3); }
.glossary div { padding: var(--sp-3) 0; border-top: 1px solid var(--line); }
.glossary dt { font-weight: var(--fw-bold); }
.glossary dd { margin: 2px 0 0; color: var(--ink-2); }
@media (max-width: 960px) { .begin-schemes, .save-grid, .scen-grid { grid-template-columns: 1fr; } .stages { columns: 1; } .costs-table td:last-child { white-space: normal; } }
@media (max-width: 720px) { .glossary { grid-template-columns: 1fr; } .stage { padding: var(--sp-4); } .step p { margin-left: 0; } .toc a { font-size: var(--fs-sm); } }
