/* Handmade Margin: shared styling for every page except the calculator.
   The landing page keeps its CSS inline for Core Web Vitals; these pages
   are read less often and can afford one extra request.

   Fonts are served from this domain (see /fonts). Nothing here reaches a
   third-party CDN, which is what lets the privacy policy say there are no
   third-party requests at all. */

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
}

:root {
  --ground: #faf8f8;
  --surface: #ffffff;
  --sunk: #f1eeee;
  --ink: #201c20;
  --ink-soft: #5d545a;
  /* AA at small sizes: 4.85:1 on --sunk, the worst background it lands on. */
  --ink-faint: #6f656b;
  --rule: #e2dcde;
  /* Interactive-control borders need 3:1 (WCAG 1.4.11). */
  --rule-strong: #8e838a;
  --accent: #7a2f4f;
  --accent-soft: #f6eaef;
  --on-accent: #fffafc;

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;

  /* One self-hosted family, with system sans-serif as the loading fallback.
     Figures use tabular numerals wherever they appear. */
  --display: "Inter Variable", Inter, system-ui, sans-serif;
  --body: "Inter Variable", Inter, system-ui, sans-serif;
  --mono: "Inter Variable", Inter, system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #171416;
    --surface: #1f1b1e;
    --sunk: #272227;
    --ink: #ece7e9;
    --ink-soft: #ada3a8;
    --ink-faint: #9a9095;
    --rule: #332c31;
    --rule-strong: #786c73;
    --accent: #e08bab;
    --accent-soft: #33202a;
    --on-accent: #201217;
  }
}

:root[data-theme="dark"] {
  --ground: #171416;
  --surface: #1f1b1e;
  --sunk: #272227;
  --ink: #ece7e9;
  --ink-soft: #ada3a8;
  --ink-faint: #9a9095;
  --rule: #332c31;
  --rule-strong: #786c73;
  --accent: #e08bab;
  --accent-soft: #33202a;
  --on-accent: #201217;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--on-accent);
  padding: var(--s3) var(--s4);
  z-index: 10;
}
.skip:focus { left: var(--s2); top: var(--s2); }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 var(--s5) var(--s8); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  padding: var(--s5) 0 var(--s4);
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--s5);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s2);
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-decoration: none;
  margin: 0;
}
.brand .mark {
  width: 15px; height: 15px; flex: none; align-self: center;
  background: var(--accent);
  clip-path: polygon(0 22%, 22% 22%, 22% 0, 78% 0, 78% 22%, 100% 22%, 100% 78%, 78% 78%, 78% 100%, 22% 100%, 22% 78%, 0 78%);
}
.brand em { font-style: normal; font-weight: 500; color: var(--accent); }

.topbar a.back {
  font-size: 0.875rem;
  color: var(--ink-faint);
  text-decoration: none;
}
.topbar a.back:hover { color: var(--accent); }
.topbar a.back:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.crumbs {
  margin: 0 0 var(--s6);
  font-size: 0.875rem;
  color: var(--ink-faint);
}
.crumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) var(--s2);
  margin: 0;
  padding: 0;
}
.crumbs li { color: var(--ink-faint); margin: 0; }
.crumbs li + li::before { content: "/"; margin-right: var(--s2); color: var(--rule-strong); }
.crumbs a { color: var(--accent); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 4.5vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: -0.022em;
  text-wrap: balance;
  margin: 0 0 var(--s3);
}

.updated {
  font-size: 0.875rem;
  color: var(--ink-faint);
  margin: 0 0 var(--s6);
}

.standfirst {
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 var(--s6);
  max-width: 58ch;
}

h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.015em;
  margin: var(--s7) 0 var(--s3);
  padding-top: var(--s5);
  border-top: 1px solid var(--rule);
  text-wrap: balance;
}

h3 { font-size: 1.05rem; font-weight: 600; margin: var(--s6) 0 var(--s2); }

p, li { color: var(--ink-soft); }
p { margin: 0 0 var(--s4); }
li { margin-bottom: var(--s2); }
ul, ol { padding-left: var(--s5); margin: 0 0 var(--s5); }

strong { color: var(--ink); font-weight: 600; }

a { color: var(--accent); text-underline-offset: 2px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.callout {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: var(--s5);
  margin: 0 0 var(--s6);
}
.callout p:last-child { margin-bottom: 0; }

.note {
  background: var(--sunk);
  border: 1px solid var(--rule);
  padding: var(--s5);
  margin: 0 0 var(--s6);
  font-size: 0.95rem;
}
.note p:last-child { margin-bottom: 0; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.plain-table { width: 100%; border-collapse: collapse; margin: 0; font-size: 0.95rem; }
.plain-table th, .plain-table td {
  text-align: left; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--rule); vertical-align: top;
}
.plain-table td { color: var(--ink-soft); }
.plain-table tbody th { color: var(--ink); font-weight: 600; }
.plain-table thead th {
  font-size: 0.875rem; color: var(--ink-faint); font-weight: 600; background: var(--sunk);
}
.plain-table .num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tablewrap { overflow-x: auto; border: 1px solid var(--rule); background: var(--surface); margin: 0 0 var(--s6); }

.cta-inline {
  border: 1px solid var(--rule-strong);
  background: var(--accent-soft);
  padding: var(--s5);
  margin: var(--s7) 0 0;
}
.cta-inline p:last-child { margin-bottom: 0; }

footer {
  margin-top: var(--s7);
  padding-top: var(--s5);
  border-top: 1px solid var(--rule-strong);
  font-size: 0.9rem;
  color: var(--ink-faint);
}
footer a { color: var(--ink-soft); }
footer nav { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin-bottom: var(--s4); }
footer .disclaimer {
  border: 1px solid var(--rule);
  background: var(--sunk);
  padding: var(--s4);
  margin: 0 0 var(--s4);
  color: var(--ink-soft);
}
footer .disclaimer strong { color: var(--ink); }
