/*
  One stylesheet for the whole site. No external fonts or files.
  Look: a checker's desk. Blue-black ink on off-white paper, white audit sheets,
  an apricot highlighter for anything flagged, and red for the checker's notes.
  Colour jobs: the highlighter is only for flagged values and the logo;
  red is only for the checker's notes and form errors.
  The page is light only, by design (see color-scheme below).
*/
:root {
  color-scheme: light;

  --ink: #1d2a3a;
  --ink-soft: #4a5563;
  --paper: #f6f3ea;
  --sheet: #ffffff;
  --line: #d9d3c3;
  --highlight: #ffbe73;
  --flag: #b3261e;
  --ink-deep: #141c27;
  --on-ink: #ffffff;
  --foot-text: #eef0f3;
  --foot-soft: #c6ccd4;

  --serif: Charter, "Sitka Text", Cambria, "Iowan Old Style", "Noto Serif", Georgia, serif;
  --sans: Seravek, "Segoe UI Variable Text", "Segoe UI", Ubuntu, "Helvetica Neue", Roboto, "Noto Sans", "Liberation Sans", Arial, sans-serif;

  --fs-small: 0.9375rem;
  --fs-body: 1.0625rem;
  --fs-lede: 1.2rem;
  --fs-h3: 1.3rem;

  --measure: 38rem;
  --wrap: 68rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.55;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.01em;
  font-variant-numeric: lining-nums;
  margin: 0 0 0.6em;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 4.4vw, 3rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.18; }
h3 { font-size: var(--fs-h3); line-height: 1.25; margin-top: 1.6em; }
h3:first-child, h2 + h3 { margin-top: 0; }

p, ul, ol, dl, table { margin: 0 0 1.1em; }
p, li, dd { max-width: var(--measure); text-wrap: pretty; }
ul, ol { padding-left: 1.25em; }
li { margin-bottom: 0.35em; }

a { color: var(--ink); text-decoration-thickness: 0.09em; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 0.18em; }

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
  box-shadow: 0 0 0 3px var(--sheet);
}

section[id] { scroll-margin-top: 1rem; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.skip {
  position: absolute; left: -999rem; top: 0;
  background: var(--ink); color: var(--on-ink); padding: 0.75rem 1rem; z-index: 10;
}
.skip:focus { left: 0; outline-color: var(--highlight); }

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

.lede { font-size: var(--fs-lede); line-height: 1.5; color: var(--ink); }
.small { font-size: var(--fs-small); color: var(--ink-soft); }
.small h2 { font-size: 1.2rem; color: var(--ink); }

/* ---------- Header ---------- */
.site-head .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem 1.5rem; padding-top: 1.1rem; padding-bottom: 1.1rem;
}
.wordmark {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--serif); font-weight: 700; font-size: 1.4rem; letter-spacing: -0.015em;
  white-space: nowrap;
  text-decoration: none; color: var(--ink);
}
.wordmark img { width: 1.65rem; height: 1.65rem; flex: none; }
.site-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem 1.35rem; margin: 0; padding: 0; align-items: center; }
.site-nav li { margin: 0; }
.site-nav a { display: inline-block; padding: 0.45rem 0; text-decoration: none; font-weight: 600; }
.site-nav a:hover { text-decoration: underline; text-decoration-thickness: 0.12em; }
.site-nav a[aria-current] { box-shadow: inset 0 -2px 0 var(--ink); }
/* The order link is a status, not a destination: lighter, and set apart at the end. */
.site-nav a[data-order-link] { font-weight: 400; color: var(--ink-soft); }
@media (min-width: 56rem) {
  .site-nav li:last-child { margin-left: 0.5rem; padding-left: 1.35rem; border-left: 1px solid var(--line); }
}

/* ---------- Independence statement ---------- */
.independent {
  background: var(--sheet);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.independent p {
  max-width: none; margin: 0; padding: 0.55rem 0 0.55rem 0.85rem;
  border-left: 0.2rem solid var(--ink);
  font-size: var(--fs-small); line-height: 1.5;
}
@media (max-width: 40rem) {
  .site-head .wrap { padding-top: 0.7rem; padding-bottom: 0.5rem; }
  .site-nav ul { gap: 0 1.1rem; font-size: var(--fs-small); }
  .site-nav a { padding: 0.35rem 0; }
  /* Phones show the bold sentence only. The full statement is in the footer of every page. */
  .independent .extra { display: none; }
}

/* ---------- Buttons ---------- */
.button {
  display: inline-block;
  background: var(--ink); color: var(--on-ink);
  font: inherit; font-weight: 700;
  padding: 0.8rem 1.4rem;
  border: 2px solid var(--ink); border-radius: 0.4rem;
  text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--ink-deep); border-color: var(--ink-deep); }
.button:active { transform: translateY(1px); }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.6rem 0 0; }

/* ---------- Sections ---------- */
main > section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
main > section + section { border-top: 1px solid var(--line); }
main > section.on-sheet { background: var(--sheet); }
main > section > .wrap > :last-child { margin-bottom: 0; }
main > section > .wrap + .wrap { margin-top: clamp(2rem, 4vw, 3rem); }
.page-top { padding-top: clamp(1.75rem, 4vw, 3rem); padding-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.page-top h1 { max-width: 24ch; }
.page-top + section { padding-top: clamp(1.75rem, 4vw, 3rem); }

.split { display: grid; gap: clamp(2rem, 5vw, 4rem); }
@media (min-width: 56rem) {
  .split { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: start; }
  .split.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .split > div > h3:first-child { margin-top: 0.45rem; }
}

/*
  Side headings on wide screens: the h2 sits in a left column and the content
  in the right, like a printed report. Opt-in. Each .wrap inside a .sidehead
  section must have exactly one h2 as a direct child.
*/
@media (min-width: 60rem) {
  .sidehead > .wrap { display: grid; grid-template-columns: 15rem minmax(0, 1fr); column-gap: 3rem; }
  .sidehead > .wrap > * { grid-column: 2; }
  .sidehead > .wrap > h2 { grid-column: 1; grid-row: 1 / span 40; font-size: 1.55rem; }
  .sidehead > .wrap > .steps, .sidehead > .wrap > .guide-list { margin-top: 0; }
  .sidehead > .wrap > table.wide { grid-column: 1 / -1; margin-top: 0.5rem; }
  .sidehead > .wrap > .sheet.example { margin-top: 0.5rem; }
  .sidehead > .wrap > h3:has(+ table.wide) { grid-column: 1 / -1; }
}

/* ---------- Hero ---------- */
.hero { padding: clamp(1.75rem, 4vw, 3rem) 0 clamp(2.5rem, 6vw, 4.5rem); }
.hero h1 { font-size: clamp(2.1rem, 5.2vw, 3.6rem); max-width: 14ch; }
.hero .split { align-items: center; }
.hero-note { margin: 1rem 0 0; }

/* ---------- The audit sheet (signature element; also the calculator result) ---------- */
.sheet {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  box-shadow: 0.55rem 0.55rem 0 var(--line);
  padding: clamp(1.1rem, 3vw, 1.75rem);
}
.sheet h2, .sheet h3 { font-size: 1.25rem; margin-top: 0; margin-bottom: 0.2em; }
.sheet h2 + .sheet-rows { margin-top: 0.7rem; }
.sheet-sub { color: var(--ink-soft); font-size: var(--fs-small); margin-bottom: 0.9rem; }
.sheet-rows { margin: 0; border-top: 2px solid var(--ink); }
.sheet-row {
  display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: 0.2rem 1rem;
  padding: 0.7rem 0; border-bottom: 1px solid var(--line);
}
.sheet-row dt { font-weight: 600; color: var(--ink-soft); }
.sheet-row dd { margin: 0; max-width: none; }
.sheet-row .value, .sheet-row .mark { font-weight: 700; display: inline; }
.sheet-row .value.answer { font-family: var(--serif); font-size: 1.6rem; line-height: 1.2; font-variant-numeric: lining-nums; }
.mark {
  background: var(--highlight);
  padding: 0.05em 0.3em; margin: 0 -0.1em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  border-radius: 0.15em;
}
.sheet-note { display: block; font-size: var(--fs-small); color: var(--ink-soft); margin-top: 0.15rem; }
.checker-note {
  display: block; font-family: var(--serif); font-style: italic; color: var(--flag);
  font-size: 1rem; margin-top: 0.15rem;
}
.sheet-foot { font-size: var(--fs-small); color: var(--ink-soft); margin: 1rem 0 0; max-width: none; }
.signoff { margin: 1.1rem 0 0; font-size: var(--fs-small); color: var(--ink-soft); max-width: none; }
.signed { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.4rem; color: var(--ink); margin-left: 0.2rem; }
.sheet.example { max-width: 42rem; margin: 1.5rem 0 2rem; }
/* The tilt is only applied where the screen is sharp enough to draw it cleanly. */
@media (min-width: 56rem) and (min-resolution: 2dppx) {
  .hero .sheet { transform: rotate(-1.1deg); }
}
@media (max-width: 38rem) {
  .sheet-row { grid-template-columns: 1fr; }
}

/* ---------- Steps (a real sequence, one plain numbered column) ---------- */
.steps { list-style: none; padding: 0; margin: 1.5rem 0 1.1em; counter-reset: step; max-width: var(--measure); border-top: 2px solid var(--ink); }
.steps li {
  counter-increment: step; margin: 0; max-width: none;
  display: grid; grid-template-columns: 2.75rem minmax(0, 1fr); column-gap: 0.5rem;
  padding: 0.9rem 0; border-bottom: 1px solid var(--line);
}
.steps li::before {
  content: counter(step);
  grid-row: 1 / span 2;
  font-family: var(--serif); font-weight: 700; font-size: 1.9rem; line-height: 1;
  font-variant-numeric: lining-nums;
}
.steps h3 { grid-column: 2; margin: 0 0 0.25em; font-size: 1.2rem; }
.steps p { grid-column: 2; margin: 0; color: var(--ink-soft); }

/* ---------- Two audiences ---------- */
.pair { display: grid; gap: 2rem 3rem; margin-top: 1.5rem; }
@media (min-width: 56rem) { .pair { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pair > div { border-top: 2px solid var(--ink); padding-top: 0.9rem; }
.pair p:last-child { margin-bottom: 0; }

/* ---------- Tables ---------- */
table {
  width: auto; min-width: min(100%, 30rem); max-width: 100%;
  border-collapse: collapse; border-top: 2px solid var(--ink);
}
caption { text-align: left; color: var(--ink-soft); font-size: var(--fs-small); padding-bottom: 0.6rem; }
th, td {
  text-align: left; vertical-align: top; padding: 0.8rem 2.25rem 0.8rem 0;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums lining-nums;
}
th:last-child, td:last-child { padding-right: 0; }
thead th { font-size: var(--fs-small); color: var(--ink-soft); font-weight: 600; }
tbody th { font-weight: 700; }
table.wide { width: 100%; }
table.wide th, table.wide td { padding-right: 1rem; }
table.wide th:last-child, table.wide td:last-child { padding-right: 0; }
#fee-table td:last-child, table.fee-days td:last-child { font-weight: 700; }
td.price { white-space: nowrap; }
td.price b { font-family: var(--serif); font-size: 1.35rem; }
/* Short row headings (regions, dates) stay on one line on wider screens. */
@media (min-width: 38.0625rem) { table.short-head tbody th { white-space: nowrap; } }
@media (max-width: 38rem) {
  table { width: 100%; }
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  table.stack tr { display: block; padding: 0.8rem 0; border-bottom: 1px solid var(--line); }
  table.stack th, table.stack td { display: block; padding: 0.1rem 0; border: 0; }
  table.stack td { font-weight: 600; }
  table.stack td[data-label]::before { content: attr(data-label); color: var(--ink-soft); font-weight: 400; }
  /* The day counts are repeated in the Sum cell, so they are left out on phones. */
  table.fee-days td:nth-of-type(-n+3) { display: none; }
}

/* ---------- Notices ---------- */
.notice {
  background: var(--sheet); border: 1px solid var(--line); border-left: 0.35rem solid var(--ink);
  padding: 0.85rem 1rem; max-width: var(--measure);
}
.on-sheet .notice, .sheet .notice { background: var(--paper); }
.sheet .notice { margin-top: 0.75rem; }

/* ---------- Forms ---------- */
form { max-width: var(--measure); }
.field { margin: 0 0 1.25rem; }
label { font-weight: 700; display: block; margin-bottom: 0.25rem; }
.hint { display: block; color: var(--ink-soft); font-size: var(--fs-small); margin-bottom: 0.4rem; font-weight: 400; }
input[type="text"], input[type="email"], input[type="tel"], input[type="date"], input[type="number"], select, textarea {
  font: inherit; color: var(--ink); background: var(--sheet);
  width: 100%; max-width: 24rem; padding: 0.65rem 0.75rem;
  border: 2px solid var(--ink-soft); border-radius: 0.3rem;
  min-height: 2.9rem;
}
textarea { max-width: none; min-height: 7rem; }
input.short { max-width: 11rem; }
input[type="date"] { max-width: 13rem; }
input[aria-invalid="true"] { border-color: var(--flag); border-width: 3px; }
.error { color: var(--flag); font-weight: 700; margin: 0.35rem 0 0; }
#calc-form .button { margin-top: 0.5rem; }
.calc-grid { display: grid; gap: clamp(2rem, 5vw, 3.5rem); }
@media (min-width: 60rem) { .calc-grid { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); align-items: start; } }
#calc-result:not([hidden]) { margin-bottom: 2.5rem; }

/* ---------- Footer ---------- */
.site-foot { background: var(--ink-deep); color: var(--foot-text); padding: clamp(2rem, 5vw, 3.5rem) 0; }
.site-foot a { color: var(--on-ink); }
.site-foot :focus-visible { outline-color: var(--highlight); box-shadow: none; }
.site-foot p { max-width: 38rem; }
.site-foot .statement { font-size: 1.05rem; border-left: 0.2rem solid var(--foot-soft); padding-left: 1rem; }
.site-foot ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; margin: 1.5rem 0 0.5rem; }
.site-foot ul.official { margin: 0 0 1.5rem; }
.site-foot li { margin: 0; }
.site-foot li a { display: inline-block; padding: 0.15rem 0; }
.site-foot .small { color: var(--foot-soft); margin-bottom: 0.6em; font-size: 0.875rem; }

/* ---------- Guides and trust pages ---------- */
.crumbs { font-size: var(--fs-small); color: var(--ink-soft); margin: 0 0 1.25rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.5rem; margin: 0; padding: 0; }
.crumbs li { margin: 0; max-width: none; }
.crumbs li + li::before { content: "/"; margin-right: 0.5rem; }
.crumbs a { display: inline-block; padding: 0.15rem 0; }
.byline { margin-bottom: 0; }
.guide-list { list-style: none; padding: 0; max-width: var(--measure); border-top: 2px solid var(--ink); }
.guide-list li { margin: 0; padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.guide-list a { display: inline-block; padding: 0.15rem 0; font-family: var(--serif); font-weight: 700; font-size: 1.2rem; text-decoration: none; }
.guide-list a:hover { text-decoration: underline; }
.guide-list span { display: block; color: var(--ink-soft); margin-top: 0.15rem; }
@media (min-width: 56rem) {
  .guide-list { max-width: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 3rem; }
}
.log { max-width: var(--measure); border-top: 2px solid var(--ink); margin-top: 1.5rem; }
.log > li { list-style: none; margin: 0; padding: 1rem 0; border-bottom: 1px solid var(--line); }
ol.log { padding: 0; }
.log h2 { font-size: 1.25rem; }
.worked { max-width: var(--measure); }

@media (forced-colors: active) {
  .site-nav a[aria-current] { text-decoration: underline; text-decoration-thickness: 0.2em; }
  .mark { outline: 1px solid; }
}

@media (prefers-reduced-motion: no-preference) {
  .button { transition: background-color 120ms ease; }
}

@media print {
  .site-nav, .skip, .crumbs, #calc-form, .site-foot nav, .actions { display: none; }
  body, main > section.on-sheet, .independent { background: var(--sheet); }
  main > section { padding: 1.2rem 0; border: 0; }
  .sheet { box-shadow: none; transform: none; break-inside: avoid; }
  tr, .steps li, .sheet-row { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
  .site-foot { background: none; color: var(--ink); padding: 1rem 0; border-top: 1px solid var(--line); }
  .site-foot .small { color: var(--ink); }
  main a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; word-break: break-all; }
}
