/*!
 * PolarCount — application stylesheet.
 *
 * The third site in the family, and deliberately the third reading of the same
 * component language: the shell, the 63px app bar, the pill buttons, the four-up
 * card grid, the centred herd block and the quiet footer are the ones BeaverFile
 * established and MoosePic reuses, so the sites feel related before you read a word.
 *
 * What is PolarCount's own is the weather. BeaverFile is warm paper and forest
 * green; MoosePic is cream and bark. PolarCount is an ice field: cold blue-white
 * ground, deep navy ink, a single mint aurora that appears only as a hairline, and
 * one warm amber reserved for results — the only warm thing on the page, and it is
 * always a number.
 *
 * No web fonts, no third-party assets, no network requests. Style-src is 'self',
 * so nothing here is inline and nothing here loads from anywhere but this origin.
 *
 * 1 tokens · 2 reset · 3 shell · 4 app bar · 5 hero · 6 calculator ·
 * 7 points · 8 sections and cards · 9 herd · 10 prose · 11 footer · 12 responsive
 */

/* 1 --------------------------------------------------------------- tokens */

:root {
  --bg: #F4F8FB;
  --bg-deep: #E7EFF6;
  --surface: #FDFEFF;
  --surface-2: #EDF4F9;
  --surface-3: #E1EBF3;
  --ink: #12212E;
  --ink-2: #47606F;
  --ink-3: #77909F;
  --line: #D6E3ED;
  --line-strong: #B7CCDB;
  --acc: #2C6E9B;
  --acc-hi: #215A80;
  --acc-soft: #E1EDF6;
  --acc-ink: #1B4F72;
  --ice: #7FB6D4;
  --aurora: #9FD8CF;
  --result: #A6600F;
  --amber: #E0A458;
  --warn: #8A5A06;
  --warn-soft: #F8EEDC;
  --bad: #A3291F;
  --bad-soft: #FAEBE9;
  --shadow-1: 0 1px 2px rgba(18, 33, 46, .05), 0 1px 3px rgba(18, 33, 46, .04);
  --shadow-2: 0 10px 30px -14px rgba(18, 33, 46, .28), 0 2px 8px rgba(18, 33, 46, .05);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --ease: cubic-bezier(.22, .86, .28, 1);
  --shell: 1160px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0A141C;
  --bg-deep: #071019;
  --surface: #101F2A;
  --surface-2: #152837;
  --surface-3: #1B3242;
  --ink: #E9F2F8;
  --ink-2: #A5BAC9;
  --ink-3: #79909F;
  --line: #1D3243;
  --line-strong: #2A4557;
  --acc: #6FB3D8;
  --acc-hi: #8FC8E6;
  --acc-soft: #0F2634;
  --acc-ink: #B9E0F4;
  --ice: #7FB6D4;
  --aurora: #7FC9BC;
  --result: #E0A458;
  --amber: #E0A458;
  --warn: #E0AE63;
  --warn-soft: #241C10;
  --bad: #FF9086;
  --bad-soft: #2B1614;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-2: 0 10px 34px -14px rgba(0, 0, 0, .75);
  color-scheme: dark;
}

/* 2 ---------------------------------------------------------------- reset */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 78px;
  -webkit-tap-highlight-color: transparent;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
/* The ice field: a cold glow overhead, falling into a frozen ground. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(80rem 34rem at 50% -18%, var(--acc-soft), transparent 68%),
    radial-gradient(50rem 22rem at 88% 8%, color-mix(in srgb, var(--aurora) 30%, transparent), transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  opacity: .85;
}
a { color: var(--acc); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--acc-hi); }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.02em; margin: 0; font-weight: 650; overflow-wrap: break-word; }
p { margin: 0; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, label, input, select, textarea { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 6px; }

/* 3 ---------------------------------------------------------------- shell */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 max(24px, env(safe-area-inset-right)) 0 max(24px, env(safe-area-inset-left));
}
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -60px;
  background: var(--surface); color: var(--ink); padding: 10px 14px;
  border-radius: var(--r-sm); z-index: 50; box-shadow: var(--shadow-2);
}
.skip:focus { top: 12px; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* 4 -------------------------------------------------------------- app bar */

.appbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.appbar__in { display: flex; align-items: center; gap: 18px; height: 63px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); text-decoration: none; font-size: 17px; }
.brand:hover { color: var(--ink); }
.brand__mark { width: 30px; height: 30px; }
.brand__tag { display: none; color: var(--ink-3); font-weight: 400; font-size: 13px; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { color: var(--ink-2); text-decoration: none; font-size: 14.5px; padding: 7px 10px; border-radius: 8px; }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.appbar__end { display: flex; align-items: center; gap: 6px; }
.iconbtn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-2); border-radius: 999px; padding: 7px 12px;
  font-size: 14px; cursor: pointer; min-height: 44px; min-width: 44px;
  justify-content: center;
}
.iconbtn:hover { color: var(--ink); border-color: var(--line-strong); }
.iconbtn .i-moon { display: none; }
html[data-theme="dark"] .iconbtn .i-sun { display: none; }
html[data-theme="dark"] .iconbtn .i-moon { display: block; }

/* 5 ----------------------------------------------------------------- hero */

.hero { position: relative; padding: 46px 0 30px; }
.hero::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--acc) 0%, var(--ice) 46%, var(--aurora) 72%, var(--amber) 100%);
  opacity: .55;
}
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr);
  gap: 40px;
  align-items: start;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--acc-ink); background: var(--acc-soft);
  border: 1px solid color-mix(in srgb, var(--acc) 22%, transparent);
  padding: 5px 12px 5px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.eyebrow .ico { width: 15px; height: 15px; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); margin: 18px 0 14px; letter-spacing: -.035em; }
.hero h1 em { font-style: normal; color: var(--acc); }
.hero__sub { color: var(--ink-2); font-size: 18px; max-width: 32em; }
.hero__sub strong { color: var(--ink); font-weight: 600; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.hero__note { font-size: 13px; color: var(--ink-3); margin-top: 14px; max-width: 34em; }
.hero__aside { display: flex; flex-direction: column; gap: 12px; }
.hero__mascot { width: 96px; height: auto; margin: 0 0 10px; filter: drop-shadow(0 14px 22px rgba(18, 33, 46, .16)); }

/* 6 ----------------------------------------------------------- calculator */

.calc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  padding: 20px;
  display: grid;
  gap: 16px;
}
.calc__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.calc__title { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.calc__badge {
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--acc-ink); background: var(--acc-soft);
  border-radius: 999px; padding: 4px 9px;
}
.calc__field { display: grid; gap: 6px; }
.calc__field label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.calc__money { position: relative; display: flex; align-items: center; }
.calc__unit {
  position: absolute; left: 14px; color: var(--ink-3); font-size: 17px;
  font-weight: 600; pointer-events: none;
}
.calc input[type="text"] {
  width: 100%;
  font-size: 22px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  padding: 12px 14px 12px 30px;
  min-height: 54px;
}
.calc input[type="text"]:focus { border-color: var(--acc); background: var(--surface); }
.calc__hint { font-size: 12.5px; color: var(--ink-3); }
.calc__checks { display: grid; gap: 10px; }
.calc__check {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 14px; color: var(--ink-2); line-height: 1.45; cursor: pointer;
  padding: 2px 0;
}
.calc__check input {
  appearance: none; -webkit-appearance: none;
  flex: none; width: 20px; height: 20px; margin: 1px 0 0;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: 6px; cursor: pointer; position: relative;
}
.calc__check input:checked { background: var(--acc); border-color: var(--acc); }
.calc__check input:checked::after {
  content: ""; position: absolute; left: 5px; top: 2px;
  width: 6px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}
.calc__out {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  display: grid;
  gap: 2px;
}
.calc__label { font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.calc__figure {
  font-size: clamp(2rem, 5.2vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  color: var(--result);
  line-height: 1.1;
}
.calc__figure--muted { color: var(--ink-3); }
.calc__sub { font-size: 13.5px; color: var(--ink-2); }
.calc__sub strong { color: var(--ink); }
.calc__error { font-size: 13.5px; color: var(--bad); }
.calc__break { border-top: 1px solid var(--line); padding-top: 12px; }
.calc__break summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--acc); }
.calc__lines { display: grid; gap: 6px; margin-top: 10px; }
.calc__row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13px; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.calc__row span:last-child { color: var(--ink); font-weight: 600; }
.calc__note { font-size: 12px; color: var(--ink-3); line-height: 1.5; }

/* The calculator also sits inside a prose page (every tool page), and there
   `.page p` is more specific than `.calc__figure` and `.calc__label` — so the
   result silently lost its amber and every line in the card gained a paragraph
   margin. Caught by looking at the tool page, not by the build. Reset inside the
   card, then restate the intended values at a specificity that wins. */
.page .calc p { margin: 0; color: var(--ink-2); }
.page .calc .calc__figure { color: var(--result); }
.page .calc .calc__label { color: var(--ink-3); }
.page .calc .calc__note,
.page .calc .calc__hint { color: var(--ink-3); }
.page .calc .calc__error { color: var(--bad); }
.calc__source { font-size: 12px; color: var(--ink-3); }
.calc__source a { color: var(--acc); }

/* 6a ----------------------------------------------------- Open Terminal */
.terminal-calc { background: var(--surface); }
.terminal-tagline { color: var(--ink-2); font-size: 14px; }
.terminal-screen {
  min-height: 230px; max-height: 420px; overflow: auto;
  background: #101820; color: #DDE9F0; border: 1px solid #2D4658;
  border-radius: var(--r); padding: 16px;
  font: 14px/1.65 var(--mono); box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
}
.terminal-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.terminal-line--system { color: #9FC9D5; }
.terminal-line--input { color: #F2F6F8; margin-top: 6px; }
.terminal-line--answer { color: #A9E2C1; padding-left: 14px; }
.terminal-line--error { color: #F2B0A7; padding-left: 14px; }
.terminal-entry { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.terminal-prompt { color: var(--acc); font: 700 18px/1 var(--mono); }
.terminal-input {
  width: 100%; min-height: 48px; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: var(--r); font: 16px/1.4 var(--mono);
}
.terminal-input:focus { border-color: var(--acc); background: var(--surface); outline: none; }
.terminal-run { border-radius: var(--r); padding-inline: 17px; }
.page .terminal-calc p { margin: 0; }

/* 7 --------------------------------------------------------------- points */

.points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.point { display: flex; gap: 12px; align-items: flex-start; padding: 4px 0; }
.point__icon {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  background: var(--acc-soft); color: var(--acc-ink);
  display: grid; place-items: center;
}
.point h3 { font-size: 15px; margin-bottom: 3px; }
.point p { color: var(--ink-2); font-size: 14px; }

/* 8 --------------------------------------------------- sections and cards */

.section { padding: 32px 0; }
.section__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section__head h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.section__head p { color: var(--ink-2); max-width: 44em; margin-top: 6px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px; text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow-1);
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), border-color .16s var(--ease);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); color: var(--ink); }
.card__icon { width: 38px; height: 38px; border-radius: 10px; background: var(--acc-soft); color: var(--acc-ink); display: grid; place-items: center; }
.card h3 { font-size: 16px; }
.card p { color: var(--ink-2); font-size: 14px; }
.card__more { margin-top: auto; color: var(--acc); font-size: 13.5px; font-weight: 600; }
.card__cluster { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }

/* Coming-soon cards are announced, never clickable: a <div>, no href, dashed edge,
   no hover lift. A plan must not look like a product. */
.card--soon { cursor: default; border-style: dashed; background: var(--surface-2); box-shadow: none; user-select: none; }
.card--soon:hover { transform: none; box-shadow: none; border-color: var(--line); }
.card--soon h3 { color: var(--ink-2); }
.card__soon {
  margin-top: auto; align-self: flex-start;
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px 10px;
}
.note-row { margin-top: 18px; font-size: 13.5px; color: var(--ink-3); }

/* 9 ----------------------------------------------------------------- herd */

.herd { padding: 40px 0 10px; }
.herd__head { text-align: center; max-width: 640px; margin: 0 auto 22px; }
.herd__head h2 { font-size: clamp(1.5rem, 2.8vw, 2.05rem); }
.herd__head p { color: var(--ink-2); margin-top: 8px; }
.herd__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 320px)); justify-content: center; gap: 14px; }
.herd__card {
  display: flex; align-items: center; gap: 14px;
  text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 14px 16px;
  box-shadow: var(--shadow-1);
  transition: transform .16s var(--ease), box-shadow .16s var(--ease);
}
.herd__card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); color: var(--ink); }
.herd__mascot { flex: none; width: 40px; height: 40px; display: grid; place-items: center; }
.herd__mascot svg { width: 40px; height: 40px; }
.herd__name { display: block; font-weight: 650; font-size: 15px; }
.herd__tagline { display: block; font-size: 13.5px; color: var(--ink-2); }
.herd__cta { margin-left: auto; color: var(--acc); font-size: 18px; }
.herd__promise { text-align: center; color: var(--ink-3); font-size: 13px; margin-top: 16px; }

/* 10 ---------------------------------------------------------------- prose */

.page { max-width: 780px; padding-top: 44px; padding-bottom: 50px; }
.page h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: 12px; }
.page .lede { font-size: 18px; color: var(--ink-2); }
.page h2 { font-size: 1.4rem; margin: 34px 0 10px; }
.page h3 { font-size: 1.08rem; margin: 22px 0 8px; }
.page p { margin: 10px 0; color: var(--ink-2); }
.page ul, .page ol { color: var(--ink-2); padding-left: 22px; margin: 10px 0; }
.page li { margin: 6px 0; }
.page .callout {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--acc); border-radius: var(--r);
  padding: 14px 16px; margin: 18px 0;
}
.page .callout p { margin: 0; }
.page .callout--warm { border-left-color: var(--amber); }
.page__cta { margin-top: 26px; display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--acc); color: #fff; border: 1px solid transparent;
  border-radius: 999px; padding: 11px 20px; font-weight: 600; font-size: 15px;
  text-decoration: none; cursor: pointer; min-height: 44px;
  transition: transform .16s var(--ease), background .16s var(--ease);
}
.btn:hover { background: var(--acc-hi); color: #fff; transform: translateY(-1px); }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); }

.steps { display: grid; gap: 12px; counter-reset: step; }
.steps li {
  list-style: none; display: flex; gap: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px 16px;
  counter-increment: step; color: var(--ink-2);
}
.steps li::before {
  content: counter(step); flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--acc); color: #fff; font: 650 13px/26px var(--font); text-align: center;
}
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.faq details p { margin-top: 8px; }
.sources { display: grid; gap: 10px; padding: 0; list-style: none; margin: 14px 0; }
.sources li {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px 14px; font-size: 14px; color: var(--ink-2);
}
/* Source links are long unbroken tokens (ministry URLs). Without this they set a
   min-content width wider than a phone and push the page sideways. */
.sources a { display: block; margin-bottom: 3px; font-weight: 600; overflow-wrap: anywhere; }
.sources .checked { font-size: 12.5px; color: var(--ink-3); }
.checked-on { font-size: 13px; color: var(--ink-3); }

/* 11 --------------------------------------------------------------- footer */

.footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 30px 0 40px; background: color-mix(in srgb, var(--surface) 55%, transparent); }
.footer__in { display: flex; flex-wrap: wrap; gap: 22px; justify-content: space-between; align-items: flex-start; }
.footer__brand { display: flex; gap: 12px; align-items: flex-start; max-width: 360px; }
.footer__brand img { width: 40px; height: 40px; }
.footer__brand strong { display: block; }
.footer__brand p { color: var(--ink-2); font-size: 13.5px; margin-top: 4px; }
.footer nav { display: grid; gap: 6px; font-size: 14px; }
.footer nav a { color: var(--ink-2); text-decoration: none; }
.footer nav a:hover { color: var(--ink); }
.footer__legal { color: var(--ink-3); font-size: 12.5px; margin-top: 24px; }

/* 12 ----------------------------------------------------------- responsive */

@media (max-width: 1020px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .points { grid-template-columns: 1fr; }
  .hero__grid { grid-template-columns: 1fr; gap: 28px; }
  .hero__mascot { display: none; }
}
@media (max-width: 760px) {
  .brand__tag { display: none; }
  .nav { gap: 2px; }
  .nav a { padding: 7px 8px; font-size: 14px; }
  .section__head { flex-direction: column; align-items: flex-start; }
  .hero { padding: 34px 0 22px; }
  .hero__sub { font-size: 17px; }
  .calc { padding: 16px; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .nav a:nth-child(4) { display: none; }
  .footer__in { flex-direction: column; gap: 18px; }
  .footer nav { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: clamp(1.95rem, 8.5vw, 2.5rem); }
  .terminal-entry { grid-template-columns: auto minmax(0, 1fr); }
  .terminal-run { grid-column: 2; justify-self: start; }
}
/* Small phones. Measured at 390 CSS px: mark + wordmark + three nav links + the
   theme button needed 405 px inside a 390 px bar, so the button was clipped off
   the right edge. Dropping the wordmark leaves the mark as the brand and buys
   back ~70 px, which keeps every nav link and the full-size touch target. */
@media (max-width: 480px) {
  .brand span { display: none; }
  .appbar__in { gap: 10px; }
  .nav { gap: 0; }
  .nav a { padding: 8px 7px; font-size: 13.5px; }
  .footer nav { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* 6b ------------------------------ selects, radios and the two-up field row
 *
 * Added when the second, third and fourth calculators arrived. The land
 * transfer tax page only ever needed one text field and two checkboxes, so the
 * card had no select styling and no radio dot at all.
 */

.calc select {
  width: 100%;
  min-height: 54px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  padding: 12px;
  cursor: pointer;
}
.calc select:focus { border-color: var(--acc); background: var(--surface); outline: none; }

/* A field with no currency symbol in front of it still matches the text input
   rule above, which indents by 30px for the $. Reset it, and leave room on the
   right for a suffix such as % or yr.
 *
 * Both selectors have to outrank `.calc input[type="text"]` (class + attribute +
 * type), whose padding SHORTHAND would otherwise reset the right padding to
 * 14px and let a right-aligned number run straight under the suffix. The 390 px
 * screenshot showed exactly that: "5" and "30" with no % or yr beside them. */
.calc input[type="text"].calc__plain { padding-left: 14px; }
.calc .calc__money input[type="text"].calc__plain { padding: 12px 52px 12px 14px; text-align: right; }
.calc__unit--suffix { left: auto; right: 14px; }

/* Two or three short fields side by side, stacking before they get cramped. */
.calc__pair { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }

/* Radio buttons: the shared .calc__check style draws a tick, which is wrong for
   a radio. Draw a dot instead, at the same 20px size and touch target. */
.calc__check input[type="radio"] { border-radius: 50%; }
.calc__check input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  inset: 4px;
  width: auto;
  height: auto;
  border: 0;
  border-radius: 50%;
  background: #fff;
  transform: none;
}

/* The final line of a breakdown — the total, or the effective rate. */
.calc__row--total {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 2px;
}
.calc__row--total span:last-child { font-weight: 700; }

/* 6c ------------------------------ take-home pay
 *
 * The year-to-date fields sit inside a <details>, where the first row of the
 * grid otherwise butts straight against the summary line. Naming the inset here
 * keeps the inline style out of the markup, which the build refuses anyway.
 */
.calc__pair--inset { margin-top: 10px; }

/* The two totals under the headline figure: a three-up row that stacks to one
   column on a narrow phone. Each cell is a label and a figure, not a table. */
.calc__totals { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.calc__totals div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.calc__totals dt { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 4px; }
.calc__totals dd { margin: 0; font-size: 18px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Print / Save as PDF
   --------------------------------------------------------------------------
   The screen is a dark, control-heavy application. A printed sheet is a light,
   flat record: what you typed, what it assumed, and what came out.

   The approach is subtraction rather than addition. Everything in <main> that
   is not the calculator form is hidden, then everything in the form that is not
   the generated .print-block is hidden. So a control can never be printed by
   accident, and a new control added later does not have to be remembered here.

   The .print-block itself is display:none on screen and block in print, and its
   contents are produced by the same render function that fills the screen — so
   the sheet cannot disagree with the page.
   ========================================================================== */

.print-block { display: none; }

@media print {
  /* Light, ink-friendly palette whatever theme was on. */
  html, body { background: #fff !important; color: #000 !important; }
  :root, html[data-theme="dark"], html[data-theme="light"] {
    --ink: #000; --ink-2: #222; --ink-3: #444; --line: #b8b8b8;
    --surface: #fff; --surface-2: #fff; --acc: #000; --bg: #fff;
  }
  * { box-shadow: none !important; text-shadow: none !important; }

  /* The printed name lives in the print block, not in the page chrome. */
  .appbar, .herd, .footer, .skip, .iconbtn { display: none !important; }

  /* Nothing in <main> but the calculator survives. */
  main.page > *:not(form.calc) { display: none !important; }

  /* Nothing in the calculator but the record survives. */
  form.calc > *:not(.print-block) { display: none !important; }
  form.calc {
    border: 0 !important; padding: 0 !important; margin: 0 !important;
    background: #fff !important; box-shadow: none !important; border-radius: 0 !important;
    display: block !important;
  }

  .print-block { display: block !important; }
  .print-block h1 { font-size: 18pt; line-height: 1.15; margin: 0 0 1.5mm; }
  .print-block .print-meta { font-size: 8.5pt; color: #333; margin: 0 0 4mm; }
  .print-block h2 {
    font-size: 10.5pt; text-transform: none; letter-spacing: 0;
    margin: 6mm 0 1.8mm; padding-bottom: 1mm; border-bottom: 1px solid #999;
    break-after: avoid; page-break-after: avoid;
  }
  .print-block dl {
    display: grid; grid-template-columns: 46mm 1fr; gap: 1.1mm 3mm;
    margin: 0; font-size: 9.5pt;
  }
  .print-block dt { color: #333; }
  .print-block dd { margin: 0; font-weight: 600; }

  .print-block table { width: 100%; border-collapse: collapse; font-size: 9pt; }
  .print-block th, .print-block td {
    border-bottom: 1px solid #c9c9c9; padding: 1.4mm 2mm; text-align: left; vertical-align: top;
  }
  .print-block th { border-bottom: 1px solid #666; font-weight: 700; }
  .print-block .num { text-align: right; font-variant-numeric: tabular-nums; }
  /* Column headings repeat at the top of every page a long table runs onto. */
  .print-block thead { display: table-header-group; }
  .print-block tfoot { display: table-footer-group; }
  /* A row never straddles a page break; the table itself may. */
  .print-block tr, .print-block .print-row { break-inside: avoid; page-break-inside: avoid; }
  .print-block table { break-inside: auto; page-break-inside: auto; }

  .print-block .print-note { font-size: 8.5pt; color: #333; line-height: 1.45; margin-top: 4mm; }
  .print-block .print-warn {
    border: 1.2px solid #000; padding: 2mm 3mm; font-size: 9pt; margin-top: 3mm; font-weight: 600;
  }
  .print-block .print-total td { font-weight: 700; border-top: 1.2px solid #666; }

  @page { margin: 14mm 13mm 15mm; }
}

/* ---- Debt planner and print controls ------------------------------------- */

.tool-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 4px; }
.tool-actions .calc__check { margin: 0; }

.btn--print { background: var(--acc); color: #fff; }
.btn--print:hover { background: color-mix(in srgb, var(--acc) 84%, #000); color: #fff; }

.calc__debts { display: grid; gap: 12px; }
.calc__debt {
  border: 1px solid var(--line); border-radius: var(--r); padding: 12px;
  background: var(--surface-2); display: grid; gap: 10px;
}
.calc__debt-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.calc__debt-name {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-2);
  border-radius: var(--r); background: var(--surface); color: var(--ink);
  font: 600 14.5px/1.3 var(--sans);
}
.calc__debt-name:focus { border-color: var(--acc); outline: none; }
.calc__debt-remove { padding: 9px 13px; font-size: 13px; }

.calc__fieldset { border: 0; padding: 0; margin: 0; }
.calc__fieldset legend { font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }

/* A long table scrolls inside its own box rather than pushing the page sideways,
   and it does the same on a phone where the columns cannot fit. */
.calc__table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 10px; }
.calc__table-wrap table { width: 100%; border-collapse: collapse; font-size: 13px; }
.calc__table-wrap th, .calc__table-wrap td {
  border-bottom: 1px solid var(--line); padding: 7px 9px; text-align: left; white-space: nowrap;
}
.calc__table-wrap th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.calc__table-wrap td.num, .calc__table-wrap th.num { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
  .tool-actions { flex-direction: column; align-items: stretch; }
  .calc__debt-head { grid-template-columns: minmax(0, 1fr); }
}
