@font-face { font-family: 'Source Sans Fallback'; src: local('Arial'); size-adjust: 94%; ascent-override: 104%; descent-override: 29%; line-gap-override: 0%; }
@font-face { font-family: 'Archivo Fallback'; src: local('Arial'); size-adjust: 104%; ascent-override: 90%; descent-override: 22%; }
/* PayMaths — eucalyptus ink on paper; figures set like a payslip. */
:root {
  --bg: #f3f5f1;
  --surface: #ffffff;
  --surface-2: #e8eee8;
  --ink: #14201b;
  --muted: #56655d;
  --line: #d3dcd5;
  --accent: #0f5c4a;
  --accent-hover: #0b4a3b;
  --accent-ink: #ffffff;
  --accent-soft: #dcebe4;
  --gold: #b7791f;
  --minus: #9b3b2e;
  --warn-bg: #fbf2dd;
  --warn-line: #e5c98a;
  --focus: #b7791f;
  --radius: 10px;
  --display: 'Archivo', 'Archivo Fallback', 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;
  --body: 'Source Sans 3', 'Source Sans Fallback', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1412; --surface: #151d1a; --surface-2: #1c2622; --ink: #e6ede8; --muted: #9aaaa1; --line: #2b3732;
    --accent: #5cc3a0; --accent-hover: #7fd3b5; --accent-ink: #06231a; --accent-soft: #173229; --gold: #e3b04b;
    --minus: #f08c7a; --warn-bg: #2a2314; --warn-line: #5e4a1f; --focus: #e3b04b; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1412; --surface: #151d1a; --surface-2: #1c2622; --ink: #e6ede8; --muted: #9aaaa1; --line: #2b3732;
  --accent: #5cc3a0; --accent-hover: #7fd3b5; --accent-ink: #06231a; --accent-soft: #173229; --gold: #e3b04b;
  --minus: #f08c7a; --warn-bg: #2a2314; --warn-line: #5e4a1f; --focus: #e3b04b; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.55; }
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 16px; }

.wrap { max-width: 1120px; margin-inline: auto; padding-inline: 16px; }
@media (min-width: 700px) { .wrap { padding-inline: 28px; } }

h1, h2, h3 { font-family: var(--display); font-stretch: 112%; line-height: 1.12; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 800; }
h3 { font-size: 1.1rem; font-weight: 800; }
.lead { font-size: 1.15rem; color: var(--ink); max-width: 64ch; margin: 0; }
.eyebrow { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; padding-block: 8px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-stretch: 112%; font-weight: 800; font-size: 1.3rem; color: var(--ink); text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); font-family: var(--mono); font-size: 1.2rem; line-height: 1; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--ink); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-weight: 600; font-size: 0.98rem; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }

main { padding-block: 20px 56px; display: grid; gap: 36px; }

.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; font-size: 0.9rem; color: var(--muted); }
.crumbs li + li::before { content: '/'; margin-right: 6px; color: var(--line); }
.crumbs a { color: var(--muted); }
.crumbs + .page-head, .crumbs + article { margin-top: -20px; }

.page-head { display: grid; gap: 12px; }
.trust { font-size: 0.92rem; color: var(--muted); margin: 0; }

/* Calculator */
.calc { display: grid; gap: 20px; }
@media (min-width: 880px) { .calc { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; } }
.calc-inputs { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.calc-form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label, .field legend { font-weight: 600; font-size: 0.97rem; }
.hint { color: var(--muted); font-size: 0.86rem; }
input[type="number"], input[type="date"], input[type="search"], select {
  width: 100%; font: inherit; font-size: 1.05rem; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 46px;
}
input:hover, select:hover { border-color: var(--muted); }
.money-input { position: relative; }
.money-input span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-family: var(--mono); pointer-events: none; }
.money-input input { padding-left: 28px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.field-check { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field-check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.field-check label { font-weight: 400; flex: 1; min-width: 0; }
.field-check .hint { flex-basis: 100%; }
.field-radio { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.field-radio legend { margin-bottom: 6px; padding: 0; }
.seg { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: inline-block; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); cursor: pointer; font-size: 0.95rem; }
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.more { border-top: 1px dashed var(--line); padding-top: 12px; }
.more summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.more[open] { display: grid; gap: 16px; }

/* Result: the payslip */
.calc-result {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px 20px;
  position: relative; display: grid; gap: 14px; min-width: 0;
}
.calc-result::before {
  content: ''; position: absolute; left: 14px; right: 14px; top: 0; height: 0;
  border-top: 2px dashed var(--gold); opacity: 0.7;
}
.headline { display: grid; gap: 2px; }
.headline-label { font-family: var(--mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.headline-value { font-family: var(--mono); font-weight: 500; font-size: clamp(2rem, 1.5rem + 2.2vw, 2.9rem); line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.headline-value small { font-family: var(--body); font-size: 1rem; letter-spacing: 0; color: var(--muted); font-weight: 400; }
.headline-sub { color: var(--muted); font-size: 0.97rem; }

.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 0.97rem; }
table.grid th, table.grid td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.grid td { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid thead th { font-family: var(--mono); font-weight: 500; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); text-align: right; }
table.grid thead th:first-child { text-align: left; }
table.grid tbody th { font-weight: 400; }
table.grid tr.minus td { color: var(--minus); }
table.grid tr.total th, table.grid tr.total td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; }
table.grid tr.subtotal th { font-weight: 600; }
table.grid tr.aside th, table.grid tr.aside td { color: var(--muted); }
.prose table.grid td:not(:first-child) { white-space: normal; }

.note { margin: 0; font-size: 0.93rem; color: var(--muted); }
.note.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--ink); padding: 10px 12px; border-radius: 8px; }
.verify { font-size: 0.9rem; margin: 0; padding-left: 12px; border-left: 3px solid var(--accent); color: var(--muted); }
.verify-secondary { border-left-color: var(--gold); }
.verify-partial { border-left-color: var(--gold); }

/* Ads */
.ad { display: grid; gap: 4px; justify-items: center; }
.ad-label { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ad-placeholder { min-height: 110px; border: 1px dashed var(--line); border-radius: var(--radius); align-content: center; }

/* Content */
.prose-grid { display: grid; gap: 24px; }
@media (min-width: 880px) { .prose-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); align-items: start; } }
.prose { display: grid; gap: 14px; max-width: 70ch; }
.prose p, .prose ul, .prose ol { margin: 0; }
.prose ul, .prose ol { padding-left: 1.2em; display: grid; gap: 6px; }
.prose h2 { margin-top: 8px; }
.prose-page { max-width: 760px; }
.statement { background: var(--surface-2); border-radius: var(--radius); padding: 18px; display: grid; gap: 10px; font-size: 0.92rem; }
.statement h2 { font-size: 1.05rem; }
.statement p { margin: 0; }

.faq { display: grid; gap: 8px; max-width: 760px; }
.faq h2 { margin-bottom: 6px; }
.faq details { border-bottom: 1px solid var(--line); padding-block: 10px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 8px 0 0; }

.facts { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 2px; align-content: start; }
.fact span { font-size: 0.88rem; color: var(--muted); }
.fact strong { font-family: var(--mono); font-weight: 500; font-size: 1.45rem; font-variant-numeric: tabular-nums; }
.fact small { color: var(--muted); font-size: 0.86rem; }

.related { display: grid; gap: 12px; }
.tool-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tool-link { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--ink); }
.tool-link strong { color: var(--accent); font-size: 1.02rem; }
.tool-link span { color: var(--muted); font-size: 0.92rem; }
.tool-link:hover { border-color: var(--accent); }
.tool-list-lg .tool-link { padding: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-family: var(--mono); font-size: 0.9rem; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); text-decoration: none; color: var(--ink); font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.sources ul { margin: 0; padding-left: 1.2em; font-size: 0.92rem; display: grid; gap: 4px; }
.sources h2 { font-size: 1.05rem; margin-bottom: 8px; }

/* Home */
.hero { display: grid; gap: 28px; padding-top: 12px; }
@media (min-width: 980px) { .hero-copy { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); column-gap: 48px; align-items: end; } .hero-copy .eyebrow, .hero-copy h1 { grid-column: 1 / -1; } .hero-copy .finder, .hero-copy .finder-results { grid-column: 2; } .hero-copy .lead { grid-row: 3 / span 2; } }
.hero-copy { display: grid; gap: 16px; align-content: start; }
.hero h1 { font-size: clamp(2.2rem, 1.5rem + 3vw, 3.4rem); max-width: 18ch; }
.finder { display: block; margin-top: 6px; }
.finder input { background: var(--surface); }
.finder-results { list-style: none; margin: 0; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 2px; }
.finder-results a { display: block; padding: 8px 10px; border-radius: 6px; text-decoration: none; }
.finder-results a:hover { background: var(--surface-2); }
.finder-results .empty { padding: 8px 10px; color: var(--muted); }
.changes { background: var(--accent); color: var(--accent-ink); border-radius: var(--radius); padding: 22px; display: grid; gap: 16px; }
.changes a { color: var(--accent-ink); }
.change-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.change-list li { display: grid; gap: 2px; border-top: 1px solid color-mix(in srgb, var(--accent-ink) 30%, transparent); padding-top: 10px; }
.change-list strong { font-family: var(--mono); font-weight: 500; font-size: 1.7rem; }
.change-list span { opacity: 0.9; }
.more-link { font-weight: 600; }
.home-group { display: grid; gap: 12px; }
.home-group h2 a { color: var(--ink); text-decoration: none; }
.home-group h2 a:hover { color: var(--accent); }

/* Footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding-block: 32px; font-size: 0.93rem; }
.footer-inner { display: grid; gap: 18px; }
@media (min-width: 800px) { .footer-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); } .footer-legal { grid-column: 1 / -1; } }
.footer-brand p { margin: 4px 0 0; color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 18px; align-content: start; }
.footer-legal { color: var(--muted); margin: 0; font-size: 0.86rem; max-width: 90ch; }
.copy-text { font-family: var(--mono); user-select: all; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- Usability additions ---- */
.live-hint { margin: 0 0 12px; font-size: 0.86rem; color: var(--muted); }
.calc-side { display: grid; gap: 10px; min-width: 0; align-content: start; }
@media (min-width: 880px) { .calc-side { position: sticky; top: 84px; } }
.calc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { font: inherit; font-size: 0.93rem; font-weight: 600; padding: 9px 14px; min-height: 42px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-quiet { background: transparent; color: var(--accent); border-color: var(--line); }
.btn-quiet:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.action-status { font-size: 0.88rem; color: var(--muted); overflow-wrap: anywhere; }
input[type="text"] { width: 100%; font: inherit; font-size: 1.05rem; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 46px; font-variant-numeric: tabular-nums; }
.suffix-input { position: relative; }
.suffix-input .suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.suffix-input input { padding-right: 32px; }
.field-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 14px; margin: 0; }
.field-group legend { font-weight: 600; padding: 0 6px; font-size: 0.97rem; }
.group-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.group-grid .field label { font-weight: 400; font-size: 0.9rem; }
.muted { color: var(--muted); font-weight: 400; }
.sticky-result { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 6; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--ink); color: var(--bg); text-decoration: none; box-shadow: 0 8px 24px rgb(0 0 0 / 0.25); }
.sticky-result .sticky-label { font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.75; }
.sticky-result .sticky-value { font-family: var(--mono); font-weight: 500; font-size: 1.25rem; grid-row: 2; }
.sticky-result .sticky-value small { font-family: var(--body); font-size: 0.8rem; opacity: 0.8; }
.sticky-result .sticky-go { grid-row: 1 / span 2; grid-column: 2; font-size: 0.85rem; font-weight: 600; }
.sticky-result:hover { color: var(--bg); }
@media (min-width: 880px) { .sticky-result { display: none !important; } }
.nav a { white-space: nowrap; }
@media (max-width: 520px) { .nav { width: 100%; justify-content: space-between; } .nav a { padding: 6px 6px; font-size: 0.92rem; } }
.money-input input { padding-left: 28px; }

/* Guides */
.guide-layout { display: grid; gap: 28px; }
@media (min-width: 980px) { .guide-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } .guide-aside { position: sticky; top: 84px; } }
.guide { max-width: 720px; }
.guide h2 { margin-top: 18px; }
.guide .lead { font-size: 1.2rem; }
.guide-aside { display: grid; gap: 12px; }
.guide-aside h2 { font-size: 1.05rem; }
.guide-aside .tool-list { grid-template-columns: 1fr; }
.guide-link strong { color: var(--ink); }
.guide-link:hover strong { color: var(--accent); }
/* Rendering performance for long pages */
.site-footer, .sources, .faq, .related { content-visibility: auto; contain-intrinsic-size: auto 400px; }

/* Stop grid children from forcing horizontal scroll on phones */
main, .guide-layout, .prose.guide { grid-template-columns: minmax(0, 1fr); }
main > *, .guide-layout > *, .prose.guide > * { min-width: 0; }
@media (min-width: 980px) { .guide-layout { grid-template-columns: minmax(0, 1fr) 320px; } }
@media (max-width: 700px) {
  .header-inner { gap: 4px; }
  .nav { width: 100%; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; margin-inline: -6px; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 6px 8px; font-size: 0.92rem; flex: none; }
}
