/* ecocitizenz.org — institutional documentary system.
   System fonts only, no external runtime. Status is always text, never colour alone.
   Contrast: every text/background pair below is >= 4.5:1 (most >= 7:1). */

:root {
  --ink: #15181d;
  --ink-2: #3c424b;
  --paper: #fbfbf8;
  --surface: #ffffff;
  --rule: #d4d4cc;
  --rule-strong: #2a2f36;
  --accent: #0d5a3d;
  --accent-ink: #ffffff;
  --accent-soft: #e8f1ec;
  --draft: #7a4f00;
  --draft-soft: #fbf3e2;
  --focus: #1748c4;
  --measure: 72ch;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-family: var(--sans); font-size: 100%; line-height: 1.6; color: var(--ink); background: var(--paper); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font-size: 1.0625rem; overflow-wrap: break-word; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

a { color: var(--accent); text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
main:focus { outline: none; }

h1, h2, h3 { line-height: 1.2; color: var(--ink); }
h1 { font-size: clamp(1.9rem, 1.4rem + 2.2vw, 2.75rem); margin: 0.2rem 0 0.75rem; letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; margin: 2.25rem 0 0.75rem; }
h3 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
p, ul, ol, dl { margin: 0 0 1rem; }
code { font-family: var(--mono); font-size: 0.92em; background: #f0f0ea; padding: 0.05em 0.3em; border-radius: 3px; }

.wrap { width: 100%; max-width: 76rem; margin: 0 auto; padding-inline: 1.25rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.print-only { display: none; }
.small { font-size: 0.9rem; color: var(--ink-2); }

/* Skip link: visible on focus. */
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 10; background: var(--surface); color: var(--ink); padding: 0.6rem 1rem; border: 2px solid var(--ink); font-weight: 600; }
.skip-link:focus { top: 1rem; }

/* ---------- header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--rule); }
.site-header__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; padding-block: 0.9rem; }
.brand { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.35rem; color: var(--ink); text-decoration: none; min-height: 44px; align-content: center; }
.brand__name { font-weight: 800; font-size: 1.35rem; letter-spacing: 0.01em; }
.brand__suffix { font-weight: 600; font-size: 1.1rem; color: var(--accent); }
.brand__sub { flex-basis: 100%; font-size: 0.8rem; color: var(--ink-2); letter-spacing: 0.04em; }
.utility ul, .primary-nav ul, .site-footer ul { list-style: none; margin: 0; padding: 0; }
.utility ul { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; align-items: center; }
.utility a { display: inline-block; padding: 0.35rem 0; font-size: 0.95rem; font-weight: 600; }
.utility a.utility__primary { padding: 0.45rem 0.85rem; background: var(--accent); color: var(--accent-ink); text-decoration: none; border-radius: 4px; }
.utility a.utility__primary:hover { background: var(--ink); color: var(--accent-ink); }
.primary-nav { border-top: 1px solid var(--rule); }
.primary-nav ul { display: flex; flex-wrap: wrap; gap: 0 0.25rem; }
.primary-nav a { display: inline-block; padding: 0.7rem 0.6rem; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.98rem; border-bottom: 3px solid transparent; }
.primary-nav li:first-child a { padding-left: 0; }
.primary-nav a:hover { color: var(--accent); border-bottom-color: var(--rule); }
.primary-nav a[aria-current="page"] { border-bottom-color: var(--accent); }

/* ---------- main / document ---------- */
main { display: block; padding-block: 1.5rem 3rem; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0 0 1rem; padding: 0; font-size: 0.9rem; color: var(--ink-2); }
.breadcrumbs li + li::before { content: "/"; margin-right: 0.35rem; color: var(--ink-2); }
.eyebrow { margin: 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
.lede { font-size: 1.2rem; max-width: var(--measure); color: var(--ink); }
.doc-header { border-bottom: 2px solid var(--rule-strong); padding-bottom: 1.5rem; margin-bottom: 1.5rem; }

.status-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1rem; }
.badge { display: inline-block; padding: 0.15rem 0.6rem; border: 1.5px solid var(--ink-2); border-radius: 999px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); background: var(--surface); }
.badge--life { border-color: var(--draft); color: var(--draft); background: var(--draft-soft); }
.badge--type { text-transform: none; letter-spacing: 0; font-weight: 600; }

.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 0; margin: 1.25rem 0 0; border: 1px solid var(--rule); background: var(--surface); }
.meta-grid div { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--rule); border-right: 1px solid var(--rule); }
.meta-grid dt { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.meta-grid dd { margin: 0.15rem 0 0; font-size: 0.95rem; }
.unset { color: var(--ink-2); font-style: italic; }

.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; }
@media (min-width: 64rem) {
  .doc-layout { grid-template-columns: 15rem minmax(0, 1fr); }
  .toc { position: sticky; top: 1rem; align-self: start; max-height: calc(100vh - 2rem); overflow-y: auto; }
}
.toc { font-size: 0.93rem; border-left: 3px solid var(--rule); padding-left: 1rem; }
.toc__title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; margin: 0 0 0.5rem; color: var(--ink-2); }
.toc ol { margin: 0; padding-left: 1.2rem; }
.toc li { margin: 0.3rem 0; }
.doc-body { max-width: 52rem; }
.doc-body > .doc-section:first-child h2 { margin-top: 0; }
.doc-section p, .doc-section ul, .doc-section ol { max-width: var(--measure); }
.doc-section h2 { border-top: 1px solid var(--rule); padding-top: 1.25rem; scroll-margin-top: 1rem; }
.doc-body > .doc-section:first-child h2 { border-top: 0; padding-top: 0; }
.anchor { margin-left: 0.35rem; font-size: 0.85em; font-weight: 400; color: var(--ink-2); text-decoration: none; padding: 0 0.25rem; display: inline-block; min-width: 24px; min-height: 24px; text-align: center; }
.anchor:hover, .anchor:focus-visible { color: var(--accent); text-decoration: underline; }

.deflist div { padding: 0.65rem 0; border-bottom: 1px solid var(--rule); }
.deflist div:first-child { border-top: 1px solid var(--rule); }
.deflist dt { font-weight: 700; }
.deflist dd { margin: 0.15rem 0 0; max-width: var(--measure); }

.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 0.5rem 2rem; }
.two-col h3 { margin-top: 0.5rem; }

/* ReferenceTable: overflow scrolls inside its own keyboard-focusable region, never the page. */
.table-wrap { overflow-x: auto; margin: 0 0 1.25rem; border: 1px solid var(--rule); background: var(--surface); }
.ref-table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.ref-table caption { text-align: left; font-weight: 700; padding: 0.6rem 0.75rem; caption-side: top; border-bottom: 1px solid var(--rule); }
.ref-table th, .ref-table td { text-align: left; vertical-align: top; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--rule); }
.ref-table thead th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); background: #f4f4ef; }
.ref-table tbody tr:last-child > * { border-bottom: 0; }
.ref-table tbody th { font-weight: 600; }

/* Accountability chain: an ordered list whose text is the whole diagram. */
.chain-figure { margin: 1.25rem 0 1.5rem; }
.chain-figure figcaption { font-size: 0.85rem; color: var(--ink-2); margin-bottom: 0.5rem; }
.chain { list-style: none; counter-reset: stage; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 0.2rem; font-family: var(--mono); font-size: 0.82rem; font-weight: 700; letter-spacing: 0.02em; }
.chain li { counter-increment: stage; display: inline-flex; align-items: center; }
.chain li::before { content: counter(stage); display: inline-block; min-width: 1.4rem; margin-right: 0.3rem; color: var(--ink-2); font-weight: 400; text-align: right; }
.chain li { padding: 0.35rem 0.6rem; border: 1.5px solid var(--rule-strong); background: var(--surface); border-radius: 3px; }
.chain li:not(:last-child)::after { content: "→"; margin-left: 0.5rem; margin-right: -0.25rem; color: var(--accent); }
[data-chain-subset] .chain li { border-style: dashed; }

/* Callouts: labelled text, border + label rather than colour alone. */
.callout { margin: 1.25rem 0; padding: 0.85rem 1rem; border: 1px solid var(--rule); border-left: 5px solid var(--ink-2); background: var(--surface); max-width: 52rem; }
.callout__label { margin: 0 0 0.25rem; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.callout__body p:last-child { margin-bottom: 0; }
.callout--proof { border-left-color: var(--accent); background: var(--accent-soft); }
.callout--status, .callout--evidence { border-left-color: var(--draft); background: var(--draft-soft); }
.callout--implementation { border-left-color: var(--focus); }

/* SurfaceHandoff */
.handoffs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 1rem; }
.handoff { border: 1px solid var(--rule); border-top: 4px solid var(--accent); background: var(--surface); padding: 1rem 1.1rem; }
.handoff__title { margin: 0 0 0.6rem; font-size: 1.05rem; }
.handoff__facts { margin: 0; font-size: 0.92rem; }
.handoff__facts div { margin: 0 0 0.45rem; }
.handoff__facts dt { font-weight: 700; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.handoff__facts dd { margin: 0; }
.host { font-family: var(--mono); font-size: 0.85em; color: var(--ink-2); }

.machine-link { margin: 0.4rem 0; }
.machine-link__label { display: inline-block; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; border: 1px solid var(--ink-2); padding: 0 0.4rem; border-radius: 3px; margin-right: 0.35rem; }
.machine-link__note { color: var(--ink-2); font-size: 0.92rem; }
.citation code { display: block; white-space: pre-wrap; padding: 0.75rem 0.9rem; background: var(--surface); border: 1px solid var(--rule); font-size: 0.9rem; }
.copy-button { margin-top: 0.5rem; font: inherit; font-size: 0.88rem; font-weight: 600; padding: 0.35rem 0.8rem; min-height: 32px; border: 1.5px solid var(--ink-2); background: var(--surface); color: var(--ink); border-radius: 4px; cursor: pointer; }
.copy-button:hover { border-color: var(--accent); color: var(--accent); }
.boundary-line { font-weight: 700; }

/* ---------- home ---------- */
.home-hero { padding: 1rem 0 1.5rem; border-bottom: 2px solid var(--rule-strong); }
.h1-sub { display: block; font-size: 0.55em; font-weight: 600; color: var(--ink-2); margin-top: 0.4rem; letter-spacing: 0; }
.home-section { padding: 0.5rem 0 1rem; }
.home-section .handoffs { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15.5rem), 1fr)); }
.route-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1rem; }
.route-card { border: 1px solid var(--rule); background: var(--surface); padding: 1rem 1.1rem; }
.route-card h3 { margin: 0 0 0.4rem; }
.route-card p { margin: 0; font-size: 0.95rem; color: var(--ink-2); }
.route-cards--compact .route-card p { font-size: 0.9rem; }

/* ---------- footer ---------- */
.site-footer { border-top: 2px solid var(--rule-strong); background: var(--surface); font-size: 0.93rem; }
.site-footer__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 1.5rem 2rem; padding-block: 2rem 1.25rem; }
.footer-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-2); margin: 0 0 0.6rem; }
.site-footer li { margin: 0 0 0.45rem; }
.site-footer a { display: inline-block; padding: 0.1rem 0; }
.footer-note { display: block; font-size: 0.85rem; color: var(--ink-2); }
/* Operator Business Passport proof: a small badge and one text link, both to Resolver. */
.footer-proof { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; margin: 0; }
.footer-proof__badge { line-height: 0; }
.footer-proof__badge img { display: block; width: 12rem; max-width: 100%; height: auto; }
.site-footer__base { border-top: 1px solid var(--rule); padding-block: 1rem 1.5rem; font-size: 0.86rem; color: var(--ink-2); }
.site-footer__base p { margin: 0; }

.not-found h2 { font-size: 1.25rem; }

@media (max-width: 40rem) {
  body { font-size: 1rem; }
  .lede { font-size: 1.08rem; }
  .utility ul { gap: 0.35rem 0.9rem; }
  .primary-nav a { padding: 0.6rem 0.45rem; }
}

/* ---------- forced colours ---------- */
@media (forced-colors: active) {
  .badge, .callout, .handoff, .chain li, .route-card { border-color: CanvasText; }
  .utility a.utility__primary { border: 1px solid ButtonText; }
}

/* ---------- print: keep title, status, metadata, URL, tables, citation; drop navigation ---------- */
@media print {
  @page { margin: 18mm 16mm; }
  html { background: #fff; font-size: 11pt; }
  body { font-size: 11pt; }
  .skip-link, .site-header .utility, .primary-nav, .breadcrumbs, .toc, .site-footer nav, .copy-button, .anchor { display: none !important; }
  .site-header { border: 0; }
  .site-header__bar { padding: 0 0 6pt; }
  .print-only { display: block; font-size: 9.5pt; color: #333; }
  .doc-layout { display: block; }
  .doc-body { max-width: none; }
  .table-wrap { overflow: visible; border: 0; }
  .ref-table { font-size: 9.5pt; }
  .ref-table th, .ref-table td { border: 1px solid #999; }
  .callout, .handoff, .route-card, .ref-table tr, .meta-grid div { break-inside: avoid; }
  .doc-section h2, h3 { break-after: avoid; }
  .doc-body a[href^="http"]::after { content: " <" attr(href) ">"; font-size: 0.85em; color: #333; word-break: break-all; }
  .chain li { border-color: #000; }
}
