/* house-design components, v0.1.0
 *
 * Load after tokens.css and after the page's theme-input block. Class names carry the
 * hd- prefix so the system can live inside a host project without collisions.
 * Markup for every pattern is in references/components.md; docs/index.html renders them.
 *
 * Behaviour sources (credited in ../NOTICE.md): the error summary and field-error
 * pattern follow the GOV.UK Design System's documented validation pattern (govuk-frontend,
 * MIT); disclosure, tabs and dialog behaviour follow the WAI-ARIA Authoring Practices.
 * Motion rules follow Emil Kowalski's review-animations standards (MIT).
 */

/* =================================================================== BASE */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--surface);
  scroll-padding-top: var(--space-8);
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-text);
  font-size: var(--step-0);
  line-height: var(--leading-body);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--accent);
  accent-color: var(--accent);
}
body > main, body > .hd-main { flex: 1 0 auto; }
body > footer, body > .hd-footer { margin-top: auto; }
img, picture, video, svg { display: block; max-width: 100%; height: auto; }
img { background: var(--surface-sunk); }  /* a calm block while a photo loads */
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--selection); color: var(--text); }
/* The browser's code elements default to monospace. The house floor forbids monospace in
   product UI, so they inherit the text face and are marked by colour and a quiet ground. */
code, kbd, samp, pre { font-family: inherit; font-size: 0.95em; }
code, kbd, samp { background: var(--surface-sunk); border-radius: var(--radius-s); padding: 0.05em 0.3em; color: var(--text-accent); }
pre { white-space: pre-wrap; background: var(--surface-sunk); padding: var(--space-4); border-radius: var(--radius-m); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-heading);
  margin: 0;
  text-wrap: balance;
  font-weight: 600;
}
h1 { font-size: var(--step-5); line-height: var(--leading-tight); letter-spacing: var(--tracking-display); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); }
h4 { font-size: var(--step-0); }
p, ul, ol, dl, figure, blockquote { margin: 0; }
p { text-wrap: pretty; }
/* More space above a heading than below it. */
.hd-flow > * + * { margin-top: var(--flow, 1em); }
.hd-flow > * + :is(h2, h3, h4) { margin-top: 1.6em; }
.hd-flow > :is(h2, h3, h4) + * { margin-top: 0.5em; }

a { color: var(--text-accent); text-decoration-line: underline; text-decoration-thickness: 0.07em; text-underline-offset: 0.18em; text-decoration-color: color-mix(in oklch, currentColor 45%, transparent); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
:focus:not(:focus-visible) { outline: none; }

.hd-num { font-variant-numeric: tabular-nums lining-nums; }
.hd-small { font-size: var(--step--1); }
.hd-muted { color: var(--text-muted); }
.hd-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.hd-skip { position: absolute; left: var(--space-4); top: -100px; z-index: var(--z-dialog); background: var(--surface-raised); padding: var(--space-3) var(--space-4); border-radius: var(--radius-m); box-shadow: var(--shadow-2); }
.hd-skip:focus { top: var(--space-4); }

/* =================================================================== LAYOUT PRIMITIVES */
.hd-container { width: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.hd-container--wide { max-width: calc(var(--container-wide) + 2 * var(--gutter)); }
.hd-measure { max-width: var(--measure); }
.hd-measure--narrow { max-width: var(--measure-narrow); }
.hd-stack { display: flex; flex-direction: column; gap: var(--gap, var(--space-4)); }
.hd-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, var(--space-3)); }
/* Asymmetric split: --split is the two column shares, default "7fr 5fr" (write "6fr 6fr",
   "4fr 8fr" and so on). Stacked under 860px. */
.hd-split { display: grid; gap: var(--gap, var(--space-7)); grid-template-columns: minmax(0, 1fr); align-items: var(--align, start); }
.hd-split > * { min-width: 0; }
@media (min-width: 860px) {
  .hd-split { grid-template-columns: var(--split, 7fr 5fr); }
  .hd-split--reverse > :first-child { order: 2; }
}
.hd-grid { display: grid; gap: var(--gap, var(--space-5)); grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 260px)), 1fr)); }
.hd-bleed { width: 100%; }
.hd-section { padding-block: var(--section); }
.hd-section--tight { padding-block: var(--section-tight); }
.hd-section--loose { padding-block: var(--section-loose); }
.hd-section--sunk { background: var(--surface-sunk); }
.hd-section--tint { background: var(--surface-tint); }
.hd-section--rule { border-top: 1px solid var(--border-quiet); }

/* =================================================================== HEADER AND NAVIGATION */
.hd-header { position: sticky; top: 0; z-index: var(--z-sticky); background: color-mix(in oklch, var(--surface) 94%, transparent); border-bottom: 1px solid var(--border-quiet); }
@supports (backdrop-filter: blur(1px)) {
  .hd-header { backdrop-filter: blur(10px) saturate(140%); }
  @media (prefers-reduced-transparency: reduce) { .hd-header { background: var(--surface); backdrop-filter: none; } }
}
.hd-header__inner { display: flex; align-items: center; gap: var(--space-5); min-height: 64px; }
.hd-brand { font-family: var(--font-display); font-weight: 700; font-size: var(--step-1); color: var(--text); text-decoration: none; letter-spacing: var(--tracking-heading); margin-right: auto; }
.hd-nav { display: flex; align-items: center; }
.hd-nav__list { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--space-5); }
.hd-nav__list a { color: var(--text); text-decoration: none; font-family: var(--font-ui); padding-block: var(--space-2); }
.hd-nav__list a:hover { color: var(--text-accent); }
.hd-nav__list a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.4em; text-decoration-color: var(--accent); }
.hd-nav__toggle { display: none; }
@media (max-width: 759px) {
  .hd-header .hd-header__cta { display: none; }
  .hd-js .hd-nav__toggle { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-4); background: transparent; border: 1px solid var(--border-control); border-radius: var(--radius-m); cursor: pointer; }
  .hd-js .hd-nav:has(.hd-nav__toggle) .hd-nav__list { position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; gap: 0; padding: var(--space-2) var(--gutter) var(--space-5); background: var(--surface); border-bottom: 1px solid var(--border-quiet); box-shadow: var(--shadow-2); visibility: hidden; opacity: 0; transform: translateY(-6px); transition: opacity var(--dur-quick) var(--ease-out), transform var(--dur-quick) var(--ease-out), visibility 0s linear var(--dur-quick); }
  .hd-js .hd-nav:has(.hd-nav__toggle) .hd-nav__list a { display: block; padding-block: var(--space-3); font-size: var(--step-1); border-bottom: 1px solid var(--border-quiet); }
  .hd-js .hd-nav[data-open] .hd-nav__list { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
  html:not(.hd-js) .hd-nav__list { flex-wrap: wrap; gap: var(--space-3); }
}

/* =================================================================== HERO VARIANTS
   Pick the one that fits the subject. The type-led hero has no image at all. */
.hd-hero { padding-block: var(--section-tight) var(--section); }
.hd-hero__title { font-size: var(--step-6); line-height: var(--leading-tight); letter-spacing: var(--tracking-display); max-width: 16ch; }
.hd-hero__lede { font-size: var(--step-1); color: var(--text-muted); max-width: 40ch; margin-top: var(--space-5); }
.hd-hero__actions { margin-top: var(--space-6); }
.hd-hero--split .hd-hero__media img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius-media); }
@media (min-width: 860px) { .hd-hero--split .hd-split { align-items: end; } }
.hd-hero--type .hd-hero__title { max-width: 20ch; font-size: var(--step-6); }
.hd-hero--bleed { padding: 0; position: relative; }
.hd-hero--bleed .hd-hero__media img { width: 100%; height: min(78vh, 760px); object-fit: cover; border-radius: 0; }
.hd-hero--bleed .hd-hero__panel { background: var(--surface); padding: var(--space-6) var(--gutter); }
@media (min-width: 860px) {
  .hd-hero--bleed .hd-hero__panel { position: absolute; left: var(--gutter); bottom: var(--space-7); max-width: 560px; padding: var(--space-7); box-shadow: var(--shadow-3); }
}

/* =================================================================== SECTION PATTERNS */
.hd-lead { font-size: var(--step-2); line-height: 1.3; font-family: var(--font-display); letter-spacing: var(--tracking-heading); max-width: 30ch; }
.hd-figure img { width: 100%; object-fit: cover; border-radius: var(--radius-media); }
.hd-figure figcaption { margin-top: var(--space-3); font-size: var(--step--1); color: var(--text-muted); max-width: var(--measure-narrow); }
.hd-quote { font-family: var(--font-display); font-size: var(--step-3); line-height: 1.2; letter-spacing: var(--tracking-heading); max-width: 26ch; text-wrap: balance; }
.hd-quote footer, .hd-quote__by { margin-top: var(--space-4); font-family: var(--font-text); font-size: var(--step--1); color: var(--text-muted); letter-spacing: 0; }
.hd-feature-row { display: grid; gap: var(--space-6); align-items: center; }
@media (min-width: 860px) {
  .hd-feature-row { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: var(--space-9); }
  .hd-feature-row--flip > :first-child { order: 2; }
}
.hd-band { background: var(--accent); color: var(--text-on-solid); padding-block: var(--section-tight); }
.hd-band a:not(.hd-btn) { color: inherit; }
.hd-band .hd-btn--primary { background: var(--white); color: var(--brand-12); border-color: var(--white); }

/* =================================================================== CARD (use sparingly)
   One level of card per page, never nested. A card is a border or a shadow, not both. */
.hd-card { background: var(--surface-raised); border: 1px solid var(--border-quiet); border-radius: var(--radius-l); padding: var(--space-5); }
.hd-card--lifted { border-color: transparent; box-shadow: var(--shadow-1); }
.hd-card__media { margin: calc(var(--space-5) * -1) calc(var(--space-5) * -1) var(--space-4); }
.hd-card__media img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius-l) var(--radius-l) 0 0; }
a.hd-card { display: block; color: inherit; text-decoration: none; transition: border-color var(--dur-quick) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { a.hd-card:hover { border-color: var(--border-control); } }

/* =================================================================== BUTTONS */
.hd-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 0 calc(var(--space-5) * var(--in-density));
  font-family: var(--font-ui); font-weight: 600; font-size: var(--step-0); line-height: 1.1;
  border-radius: var(--radius-m); border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background-color var(--dur-quick) var(--ease-out), border-color var(--dur-quick) var(--ease-out), color var(--dur-quick) var(--ease-out), transform var(--dur-instant) var(--ease-out);
}
.hd-btn:active:not([disabled]):not([aria-disabled="true"]) { transform: translateY(1px); }
.hd-btn--primary { background: var(--accent); color: var(--text-on-solid); }
.hd-btn--primary:hover { background: var(--accent-hover); }
.hd-btn--secondary { background: transparent; color: var(--text); border-color: var(--border-control); }
.hd-btn--secondary:hover { background: var(--surface-sunk); }
.hd-btn--quiet { background: transparent; color: var(--text-accent); padding-inline: var(--space-2); text-decoration: underline; text-underline-offset: 0.2em; }
.hd-btn--danger { background: var(--danger); color: var(--white); }
.hd-btn--small { min-height: 36px; font-size: var(--step--1); padding-inline: var(--space-4); }
.hd-btn[disabled], .hd-btn[aria-disabled="true"] { background: var(--neutral-4); color: var(--neutral-11); border-color: transparent; cursor: not-allowed; }
.hd-btn[aria-busy="true"] { cursor: progress; }
.hd-btn[aria-busy="true"]::before { content: ""; width: 1em; height: 1em; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: hd-spin 0.8s linear infinite; }
@keyframes hd-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .hd-btn[aria-busy="true"]::before { animation-duration: 2.4s; } }
.hd-btn__reason { display: block; margin-top: var(--space-2); font-size: var(--step--1); color: var(--text-muted); }

/* =================================================================== FORMS */
.hd-field { display: flex; flex-direction: column; gap: var(--space-2); max-width: 34rem; }
.hd-field + .hd-field, .hd-fieldset + .hd-field, .hd-field + .hd-fieldset { margin-top: var(--space-5); }
.hd-label { font-family: var(--font-ui); font-weight: 600; font-size: var(--step-0); }
.hd-hint { font-size: var(--step--1); color: var(--text-muted); margin-top: calc(var(--space-1) * -1); }
.hd-input, .hd-select, .hd-textarea {
  width: 100%; min-height: 48px; padding: var(--space-3) var(--space-4);
  font-size: max(16px, var(--step-0));   /* 16px stops phone browsers zooming on focus */
  background: var(--surface-raised); border: 1px solid var(--border-control); border-radius: var(--radius-m);
  transition: border-color var(--dur-quick) var(--ease-out), box-shadow var(--dur-quick) var(--ease-out);
}
.hd-textarea { min-height: 8rem; resize: vertical; line-height: var(--leading-body); }
.hd-input:hover, .hd-select:hover, .hd-textarea:hover { border-color: var(--neutral-10); }
.hd-input:focus-visible, .hd-select:focus-visible, .hd-textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.hd-input::placeholder, .hd-textarea::placeholder { color: var(--neutral-8); }
.hd-input[disabled], .hd-select[disabled], .hd-textarea[disabled] { background: var(--surface-sunk); color: var(--text-muted); cursor: not-allowed; }
.hd-field--error .hd-input, .hd-field--error .hd-select, .hd-field--error .hd-textarea { border-color: var(--danger); border-width: 2px; }
.hd-error { color: var(--danger-text); font-weight: 600; font-size: var(--step--1); }
.hd-fieldset { border: 0; padding: 0; margin: 0; }
.hd-fieldset legend { font-family: var(--font-ui); font-weight: 600; margin-bottom: var(--space-3); padding: 0; }
.hd-check { display: flex; gap: var(--space-3); align-items: flex-start; min-height: 32px; padding-block: var(--space-1); }
.hd-check input { width: 22px; height: 22px; margin: 0.15em 0 0; flex: none; accent-color: var(--accent); }
.hd-switch { display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; min-height: 44px; }
.hd-switch input { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; margin: 0; border-radius: var(--radius-pill); background: var(--neutral-7); position: relative; cursor: pointer; transition: background-color var(--dur-quick) var(--ease-out); }
.hd-switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--white); box-shadow: var(--shadow-1); transition: transform var(--dur-quick) var(--ease-out); }
.hd-switch input:checked { background: var(--accent); }
.hd-switch input:checked::after { transform: translateX(18px); }
/* Error summary at the top of a form (GOV.UK validation pattern): focus moves here on submit. */
.hd-error-summary { border: 2px solid var(--danger); border-radius: var(--radius-m); padding: var(--space-5); background: var(--danger-surface); margin-bottom: var(--space-6); max-width: 40rem; }
.hd-error-summary h2 { font-size: var(--step-1); color: var(--danger-text); }
.hd-error-summary ul { margin-top: var(--space-3); padding-left: 1.1em; }
.hd-error-summary a { color: var(--danger-text); font-weight: 600; }

/* =================================================================== TABLE */
.hd-table-wrap { overflow-x: auto; border: 1px solid var(--border-quiet); border-radius: var(--radius-m); background: var(--surface-raised); }
.hd-table { width: 100%; border-collapse: collapse; font-size: var(--step--1); font-variant-numeric: tabular-nums lining-nums; }
.hd-table caption { text-align: left; padding: var(--space-4); font-weight: 600; font-family: var(--font-ui); }
.hd-table th, .hd-table td { text-align: left; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-quiet); vertical-align: top; }
.hd-table thead th { font-weight: 600; color: var(--text-muted); background: var(--surface-sunk); position: sticky; top: 0; }
.hd-table td.hd-num, .hd-table th.hd-num { text-align: right; }
.hd-table tbody tr:last-child td { border-bottom: 0; }
@media (hover: hover) { .hd-table tbody tr:hover { background: var(--brand-1); } }
/* At narrow widths a table can stack into labelled rows: add .hd-table--stack and a
   data-label on each cell. Otherwise it scrolls sideways inside .hd-table-wrap. */
@media (max-width: 639px) {
  .hd-table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .hd-table--stack tr { display: block; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-quiet); }
  .hd-table--stack td { display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-1) 0; border: 0; }
  .hd-table--stack td::before { content: attr(data-label); color: var(--text-muted); font-weight: 600; }
  .hd-table--stack td.hd-num { text-align: right; }
}

/* =================================================================== LISTS */
.hd-list { list-style: none; padding: 0; }
.hd-list > li { padding-block: var(--space-4); border-top: 1px solid var(--border-quiet); }
.hd-list > li:last-child { border-bottom: 1px solid var(--border-quiet); }
.hd-defs { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); gap: var(--space-2) var(--space-6); }
.hd-defs dt { color: var(--text-muted); overflow-wrap: anywhere; }
.hd-defs dd { margin: 0; }
@media (max-width: 559px) {
  .hd-defs { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .hd-defs dd { margin-bottom: var(--space-3); }
}
/* Steps: only for content that really is a sequence. */
.hd-steps { list-style: none; padding: 0; counter-reset: hd-step; display: grid; gap: var(--space-5); }
.hd-steps > li { counter-increment: hd-step; display: grid; grid-template-columns: 2.4em 1fr; gap: var(--space-3); }
.hd-steps > li::before { content: counter(hd-step); font-family: var(--font-display); font-size: var(--step-2); line-height: 1; color: var(--text-accent); font-variant-numeric: lining-nums; }

/* =================================================================== STATUS, ALERTS, STATES */
.hd-badge { display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px var(--space-2); border-radius: var(--radius-s); font-size: var(--step--2); font-weight: 600; background: var(--surface-sunk); color: var(--text-muted); border: 1px solid var(--border-quiet); }
.hd-badge--success { background: var(--success-surface); color: var(--success-text); border-color: var(--success-border); }
.hd-badge--warning { background: var(--warning-surface); color: var(--warning-text); border-color: var(--warning-border); }
.hd-badge--danger { background: var(--danger-surface); color: var(--danger-text); border-color: var(--danger-border); }
.hd-alert { display: grid; grid-template-columns: auto 1fr; gap: var(--space-3); padding: var(--space-4) var(--space-5); border: 1px solid var(--info-border); background: var(--info-surface); color: var(--info-text); border-radius: var(--radius-m); max-width: 44rem; }
.hd-alert svg { width: 20px; height: 20px; margin-top: 0.2em; }
.hd-alert p { color: var(--text); }
.hd-alert--success { border-color: var(--success-border); background: var(--success-surface); color: var(--success-text); }
.hd-alert--warning { border-color: var(--warning-border); background: var(--warning-surface); color: var(--warning-text); }
.hd-alert--danger { border-color: var(--danger-border); background: var(--danger-surface); color: var(--danger-text); }
.hd-empty { padding: var(--space-8) var(--space-5); text-align: left; border: 1px dashed var(--border); border-radius: var(--radius-l); max-width: 44rem; }
.hd-empty h3 { font-size: var(--step-2); }
.hd-empty p { color: var(--text-muted); margin-top: var(--space-2); max-width: 46ch; }
.hd-empty .hd-btn { margin-top: var(--space-5); }
.hd-skeleton { display: block; height: 1em; border-radius: var(--radius-s); background: var(--neutral-3); }
@media (prefers-reduced-motion: no-preference) {
  .hd-skeleton { animation: hd-breathe 1.6s var(--ease-in-out) infinite alternate; }
}
@keyframes hd-breathe { from { background: var(--neutral-3); } to { background: var(--neutral-4); } }
.hd-toast { position: fixed; right: var(--gutter); bottom: var(--space-5); z-index: var(--z-toast); background: var(--neutral-12); color: var(--white); padding: var(--space-3) var(--space-5); border-radius: var(--radius-m); box-shadow: var(--shadow-3); max-width: min(420px, calc(100vw - 2 * var(--gutter))); }
.hd-toast--inline { position: static; display: inline-block; }

/* =================================================================== PRODUCT PIECES */
.hd-app { display: grid; min-height: 100dvh; grid-template-columns: 1fr; }
@media (min-width: 960px) { .hd-app { grid-template-columns: 248px 1fr; } }
.hd-app__side { background: var(--surface-sunk); border-right: 1px solid var(--border-quiet); padding: var(--space-5); }
.hd-app__main { padding: var(--space-6) var(--gutter); min-width: 0; }
.hd-pagehead { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--space-4); padding-bottom: var(--space-5); border-bottom: 1px solid var(--border-quiet); margin-bottom: var(--space-6); }
.hd-pagehead h1 { font-size: var(--step-3); }
.hd-sidenav { list-style: none; padding: 0; display: grid; gap: 2px; }
.hd-sidenav a { display: block; padding: var(--space-2) var(--space-3); border-radius: var(--radius-m); color: var(--text); text-decoration: none; }
.hd-sidenav a:hover { background: var(--neutral-3); }
.hd-sidenav a[aria-current="page"] { background: var(--surface-raised); box-shadow: var(--shadow-1); font-weight: 600; }
.hd-tabs [role="tablist"] { display: flex; gap: var(--space-5); border-bottom: 1px solid var(--border-quiet); overflow-x: auto; }
.hd-tabs [role="tab"] { appearance: none; background: none; border: 0; padding: var(--space-3) 0; min-height: 44px; cursor: pointer; color: var(--text-muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.hd-tabs [role="tab"][aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.hd-tabs [role="tabpanel"] { padding-top: var(--space-5); }
.hd-breadcrumb ol { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); font-size: var(--step--1); color: var(--text-muted); }
.hd-breadcrumb li + li::before { content: "/"; margin-right: var(--space-2); color: var(--neutral-7); }
.hd-pagination { display: flex; gap: var(--space-2); list-style: none; padding: 0; }
.hd-pagination a, .hd-pagination span { display: inline-flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; border-radius: var(--radius-m); text-decoration: none; color: var(--text); }
.hd-pagination a:hover { background: var(--surface-sunk); }
.hd-pagination [aria-current="page"] { background: var(--accent); color: var(--text-on-solid); }
dialog.hd-dialog { border: 0; border-radius: var(--radius-l); padding: var(--space-6); max-width: min(520px, calc(100vw - 2 * var(--gutter))); box-shadow: var(--shadow-3); background: var(--surface-raised); color: var(--text); }
dialog.hd-dialog::backdrop { background: oklch(0.2 0.02 var(--in-neutral-hue) / 0.45); }
.hd-dialog--inline { position: static; display: block; box-shadow: var(--shadow-2); }

/* =================================================================== FOOTER */
.hd-footer { background: var(--surface-sunk); border-top: 1px solid var(--border-quiet); padding-block: var(--space-8) var(--space-6); font-size: var(--step--1); }
.hd-footer__grid { display: grid; gap: var(--space-6); grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.hd-footer h2 { font-size: var(--step-0); font-family: var(--font-ui); }
.hd-footer ul { list-style: none; padding: 0; margin-top: var(--space-3); display: grid; gap: var(--space-2); }
.hd-footer a { color: var(--text); }
.hd-footer__base { margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--border-quiet); color: var(--text-muted); display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-6); justify-content: space-between; }

/* =================================================================== HEADER AND FOOTER VARIANTS
   Two shapes each, so sites on the system do not share one frame. */
.hd-header--plain { position: static; background: transparent; border-bottom: 0; backdrop-filter: none; }
.hd-header--plain .hd-header__inner { min-height: 88px; border-bottom: 1px solid var(--text); }
.hd-footer--line { background: transparent; border-top: 0; padding-block: var(--space-7) var(--space-6); }
.hd-footer--line .hd-footer__grid { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-7); border-top: 1px solid var(--text); padding-top: var(--space-4); }
.hd-footer--line .hd-footer__grid section { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: baseline; }
.hd-footer--line .hd-footer__grid ul { display: flex; flex-wrap: wrap; gap: var(--space-4); margin: 0; }
.hd-footer--line .hd-footer__base { margin-top: var(--space-5); padding-top: 0; border-top: 0; }

/* =================================================================== PRICING */
.hd-plans { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); align-items: stretch; }
.hd-plan { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-6) var(--space-5); border: 1px solid var(--border-quiet); border-radius: var(--radius-l); background: var(--surface-raised); }
.hd-plan h3 { font-size: var(--step-1); }
.hd-plan__price { font-family: var(--font-display); font-size: var(--step-4); line-height: 1; font-variant-numeric: tabular-nums lining-nums; }
.hd-plan__price small { font-family: var(--font-text); font-size: var(--step--1); color: var(--text-muted); }
.hd-plan ul { list-style: none; padding: 0; display: grid; gap: var(--space-2); color: var(--text-muted); margin-block: var(--space-2) var(--space-4); }
.hd-plan .hd-btn { margin-top: auto; }
.hd-plan--recommended { border: 2px solid var(--accent); }
.hd-plan__flag { align-self: flex-start; font-size: var(--step--2); font-weight: 600; color: var(--text-accent); }

/* =================================================================== FAQ AND DISCLOSURE */
.hd-faq { border-top: 1px solid var(--border-quiet); max-width: 46rem; }
.hd-faq details { border-bottom: 1px solid var(--border-quiet); }
.hd-faq summary { cursor: pointer; list-style: none; padding: var(--space-4) var(--space-6) var(--space-4) 0; position: relative; font-weight: 600; min-height: 44px; }
.hd-faq summary::-webkit-details-marker { display: none; }
.hd-faq summary::after { content: ""; position: absolute; right: 4px; top: 50%; width: 10px; height: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-70%) rotate(45deg); transition: transform var(--dur-quick) var(--ease-out); }
.hd-faq details[open] summary::after { transform: translateY(-30%) rotate(225deg); }
.hd-faq details > :not(summary) { padding-bottom: var(--space-4); color: var(--text-muted); max-width: var(--measure); }

/* =================================================================== ARTICLE (long reading) */
.hd-prose { max-width: var(--measure); font-size: var(--step-0); }
.hd-prose > * + * { margin-top: 1em; }
.hd-prose > * + :is(h2, h3) { margin-top: 2em; }
.hd-prose > :is(h2, h3) + * { margin-top: 0.5em; }
.hd-prose h2 { font-size: var(--step-2); }
.hd-prose h3 { font-size: var(--step-1); }
.hd-prose blockquote { border-left: 0; padding-left: var(--space-5); font-family: var(--font-display); font-size: var(--step-1); position: relative; }
.hd-prose blockquote::before { content: ""; position: absolute; left: 0; top: 0.2em; bottom: 0.2em; width: 1px; background: var(--border); }
.hd-prose figure { margin-block: var(--space-6); }
.hd-prose ul, .hd-prose ol { padding-left: 1.2em; }
.hd-prose li + li { margin-top: 0.4em; }
.hd-byline { font-size: var(--step--1); color: var(--text-muted); }

/* =================================================================== SEARCH, DATE AND SETTINGS */
.hd-search { display: flex; gap: var(--space-2); max-width: 34rem; }
.hd-search .hd-input { flex: 1; }
.hd-input[type="date"], .hd-input[type="time"] { max-width: 16rem; }
.hd-settings { display: grid; gap: 0; max-width: 56rem; }
.hd-settings__group { display: grid; gap: var(--space-4) var(--space-8); padding-block: var(--space-6); border-top: 1px solid var(--border-quiet); }
@media (min-width: 860px) { .hd-settings__group { grid-template-columns: 16rem minmax(0, 1fr); } }
.hd-settings__group h2 { font-size: var(--step-1); }
.hd-settings__group > div > p { color: var(--text-muted); font-size: var(--step--1); margin-top: var(--space-2); }
.hd-settings__actions { display: flex; gap: var(--space-3); justify-content: flex-end; padding-top: var(--space-5); border-top: 1px solid var(--border-quiet); }

/* =================================================================== SORTABLE TABLE HEADERS */
.hd-table th[aria-sort] button { all: unset; cursor: pointer; display: inline-flex; gap: var(--space-1); align-items: center; font-weight: 600; }
.hd-table th[aria-sort] button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hd-table th[aria-sort] button::after { content: ""; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--neutral-7); }
.hd-table th[aria-sort="ascending"] button::after { border-top: 0; border-bottom: 5px solid var(--text); }
.hd-table th[aria-sort="descending"] button::after { border-top-color: var(--text); }
.hd-table-note { font-size: var(--step--1); color: var(--text-muted); padding: var(--space-3) var(--space-4); }

/* =================================================================== ERROR PAGE (404, 500) */
.hd-errorpage { padding-block: var(--section-loose); }
.hd-errorpage h1 { font-size: var(--step-5); max-width: 18ch; }
.hd-errorpage p { color: var(--text-muted); max-width: 46ch; margin-top: var(--space-4); }
.hd-errorpage .hd-cluster { margin-top: var(--space-6); }

/* =================================================================== HEADLINE EMPHASIS (0.2.4)
   One or two words of a headline set apart to carry its focus (references/type.md section 5).
   One variant per page, at most one span per headline, never on body copy, buttons or labels.
   Markup: <h1>See what your money does to your <em class="hd-em hd-em--italic">future.</em></h1>
   The family, style, weight, width and colour come from the --em-* tokens (tokens.css section 4);
   a page tunes them in theme.css, never inline. font-synthesis none: a real italic or weight or
   nothing, never a faked slant. line-height 0: a second family's taller ascent or descent never
   opens the gap between the headline's lines; the headline's own line height sets the rhythm. */
.hd-em { font-synthesis: none; line-height: 0; }
.hd-em--italic { font-family: inherit; font-style: italic; font-weight: var(--em-italic-weight); letter-spacing: var(--em-italic-tracking); }
.hd-em--serif { font-family: var(--em-serif-family); font-style: italic; font-weight: var(--em-serif-weight); font-size: var(--em-serif-size); letter-spacing: var(--em-serif-tracking); }
.hd-em--cut { font-family: var(--em-cut-family); font-style: normal; font-weight: var(--em-cut-weight); font-stretch: var(--em-cut-stretch); }
.hd-em--accent { font-style: normal; color: var(--em-accent-colour); }

/* =================================================================== MOTION
   1. One authored entrance on load: .hd-enter (time-based, plays once at the top of
      the page, where no scroll position exists to reverse).
   2. Everything that moves with scroll is scroll-linked, so it plays backwards when the
      reader scrolls up. CSS view() timelines where supported; house.js drives the same
      states from --hd-p elsewhere. Never a reveal-once observer.
   3. Reduced motion: no movement, nothing hidden. */
@keyframes hd-enter { from { opacity: 0.001; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes hd-rise  { from { opacity: 0.001; transform: translateY(var(--reveal-distance)); } to { opacity: 1; transform: none; } }
@keyframes hd-fade  { from { opacity: 0.001; } to { opacity: 1; } }
/* 0.2.3: the clip opens from every side, so the reveal shows on whatever part of the photo is on
   screen (the 0.2.2 clip trimmed only the bottom edge, which was still below the fold while it moved,
   so a reader, and a render, saw nothing). No scale: a scaled full-bleed image would overflow sideways. */
@keyframes hd-clip  { from { clip-path: inset(8% 6% 8% 6%); } to { clip-path: inset(0 0 0 0); } }

@media (prefers-reduced-motion: no-preference) {
  .hd-enter { animation: hd-enter var(--dur-scene) var(--ease-out-strong) both; animation-delay: calc(var(--i, 0) * 70ms); }

  /* Ranges (0.2.3): a rise or fade plays over the element's first 30 percent of its trip across the
     screen (it is fully readable by the time its top reaches about two thirds of the way up); a clip
     plays over 45 percent, more than half a screen of scrolling for any photo taller than 100px. The
     0.2.2 ranges ended at 75 percent of the entry, a few dozen pixels at the bottom edge. */
  @supports (animation-timeline: view()) {
    [data-hd-reveal] { animation: hd-rise linear both; animation-timeline: view(); animation-range: entry 0% cover 30%; }
    [data-hd-reveal="fade"] { animation-name: hd-fade; }
    [data-hd-reveal="clip"] { animation-name: hd-clip; animation-range: entry 0% cover 45%; }
  }
  /* Fallback engine (house.js sets html.hd-scroll-js and writes --hd-p from 0 to 1 over the same ranges). */
  .hd-scroll-js [data-hd-reveal] { animation: none; opacity: calc(0.001 + 0.999 * var(--hd-p, 1)); transform: translateY(calc((1 - var(--hd-p, 1)) * var(--reveal-distance))); }
  .hd-scroll-js [data-hd-reveal="fade"] { transform: none; }
  .hd-scroll-js [data-hd-reveal="clip"] { opacity: 1; clip-path: inset(calc((1 - var(--hd-p, 1)) * 8%) calc((1 - var(--hd-p, 1)) * 6%)); transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  [data-hd-reveal], .hd-enter { animation: none !important; opacity: 1 !important; transform: none !important; clip-path: none !important; }
}
@media (prefers-reduced-motion: no-preference) { html:focus-within { scroll-behavior: smooth; } }

/* =================================================================== PRINT */
@media print { .hd-header, .hd-nav__toggle, .hd-skip { display: none; } body { background: white; } }
