/*
  Brievox design system. One stylesheet for the Web host and the materialized pages (CSP: styles and fonts
  from 'self' only, no inline styles), mobile first, light and dark from prefers-color-scheme.

  Patterns, named by function and shared by every page:
    layout      .container  .site-header  .site-nav  .site-footer  main.page (.page--narrow, .page--wide)
    headings    .page-header  .kicker  .page-title  .dek  .section  .section-title  .label
    stories     .story-front  .story-card (--lead, --compact, --thumb, __source)  .publisher-image (--thumb)  .story-river  .story-meta  .badge (--breaking ...)
    navigation  .breadcrumb  .tabs  .pagination  .chip-list/.chip
    content     .callout  .claim-group (--disputed ...)  .citations  .coverage  .facts
    forms       .form  .field  .form-row  .checkbox (__note)  .check-tree via TopicChecklist  .form-actions  .search-bar  .panel  details/summary
                .button (--primary, --quiet, --danger)  .link-button; a bare submit is primary, one with .button is not
    feedback    .notice (--success, --error, --info)  .empty-state (actions: p.cluster > a.button)  .status-page via StatusMessage
    data        .table-scroll/.data-table (.numeric, .phrase, .url)  .stat-grid  .status  .code-block
*/

:root {
    color-scheme: light dark;
    --paper: #f8f7f3;
    --surface: #ffffff;
    --surface-sunken: #f0eee8;
    --ink: #121214;
    --ink-soft: #3a3a40;
    --muted: #64646c;
    --rule: #e2dfd7;
    --rule-strong: #c9c5bb;
    /* Borders that identify a control (inputs, selects, secondary buttons): at least 3:1 against both backgrounds. */
    --control-border: #8a877f;
    --accent: #d2361b;
    --accent-ink: #ffffff;
    --accent-soft: #fbe1da;
    --link-hover: #b02a12;
    --focus: #2a5bd7;
    --breaking: #c2271a;
    --breaking-soft: #fbe3df;
    --developing: #9a5b00;
    --developing-soft: #fbedd5;
    --updated: #1f4fb8;
    --updated-soft: #e2eafb;
    --positive: #1d6b3a;
    --positive-soft: #e0f1e5;
    --negative: #b3261e;
    --negative-soft: #fbe4e2;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", "Helvetica Neue", Roboto, Arial, sans-serif;
    --font-serif: "Charter", "Iowan Old Style", "Sitka Text", "Bitstream Charter", Cambria, Georgia, serif;
    --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;

    --gutter: clamp(1rem, 4vw, 2.5rem);
    --measure: 42rem;
    --page: 76rem;
    --radius: 6px;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4.5rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #0f1012;
        --surface: #16171a;
        --surface-sunken: #1c1d21;
        --ink: #eceae4;
        --ink-soft: #cfcdc6;
        --muted: #9d9ca3;
        --rule: #2a2b30;
        --rule-strong: #3d3e45;
        --control-border: #6b6c74;
        --accent: #ff6b4f;
        --accent-ink: #160805;
        --accent-soft: #4a1d14;
        --link-hover: #ff8a73;
        --focus: #7aa2ff;
        --breaking: #ff7a68;
        --breaking-soft: #3a1714;
        --developing: #f2b24c;
        --developing-soft: #33240b;
        --updated: #8fb0ff;
        --updated-soft: #172443;
        --positive: #6fcf8f;
        --positive-soft: #11291a;
        --negative: #ff8a80;
        --negative-soft: #3a1714;
    }
}

/* Base */

*,
*::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(--font-sans);
    font-size: 1rem;
    line-height: 1.55;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    font-weight: 700;
    line-height: 1.15;
    text-wrap: balance;
    overflow-wrap: anywhere;
}

p,
ul,
ol,
dl,
figure {
    margin: 0;
}

p {
    text-wrap: pretty;
    overflow-wrap: anywhere;
}

a {
    color: inherit;
    text-decoration-line: underline;
    text-decoration-thickness: 1px;
    text-decoration-color: var(--rule-strong);
    text-underline-offset: 0.2em;
}

a:hover {
    color: var(--link-hover);
    text-decoration-color: currentColor;
}

:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
    border-radius: 2px;
}

time,
.tabular {
    font-variant-numeric: tabular-nums;
}

small {
    font-size: 0.8125rem;
}

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

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

.skip-link {
    position: absolute;
    left: var(--gutter);
    top: -4rem;
    z-index: 20;
    padding: var(--space-2) var(--space-3);
    background: var(--ink);
    color: var(--paper);
    font-weight: 600;
    text-decoration: none;
}

.skip-link:focus {
    top: var(--space-2);
}

/* Layout */

.container {
    width: 100%;
    max-width: var(--page);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

main.page {
    width: 100%;
    max-width: var(--page);
    margin-inline: auto;
    padding: var(--space-5) var(--gutter) var(--space-8);
}

main.page--narrow {
    max-width: calc(30rem + 2 * var(--gutter));
}

/* Data-dense pages widen the whole frame, header and footer included, so every edge stays aligned. */
body:has(main.page--wide) {
    --page: 110rem;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
}

.site-header__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    min-height: 3.25rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
}

.brand:hover {
    color: var(--ink);
}

.brand__mark {
    width: 0.8rem;
    height: 0.8rem;
    background: var(--accent);
    box-shadow: 0.3rem 0.3rem 0 -0.05rem var(--ink);
}

.brand__tagline {
    display: none;
    padding-left: 0.6rem;
    border-left: 1px solid var(--rule-strong);
    color: var(--muted);
    font-weight: 500;
}

@media (min-width: 40rem) {
    .brand__tagline {
        display: inline;
    }
}

.site-header__tools {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.tool-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.5rem;
    padding: 0 var(--space-2);
    border-radius: var(--radius);
    color: var(--ink-soft);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}

.tool-link:hover,
.tool-link[aria-current="page"] {
    background: var(--surface-sunken);
    color: var(--ink);
}

.tool-link svg {
    width: 1.1rem;
    height: 1.1rem;
}

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

@media (min-width: 30rem) {
    .tool-link {
        padding: 0 var(--space-3);
    }

    .tool-link__label {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        clip-path: none;
    }
}

.site-nav {
    border-top: 1px solid var(--rule);
}

.site-nav ul {
    display: flex;
    gap: var(--space-5);
    overflow-x: auto;
    margin-block: 0;
    padding-block: 0;
    list-style: none;
    scrollbar-width: none;
}

.site-nav ul::-webkit-scrollbar {
    display: none;
}

.site-nav a {
    display: block;
    padding: 0.7rem 0 0.6rem;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.site-nav a:hover {
    color: var(--ink);
}

.site-nav a[aria-current="page"] {
    border-bottom-color: var(--accent);
    color: var(--ink);
}

.site-footer {
    margin-top: var(--space-8);
    padding: var(--space-6) 0 var(--space-7);
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-size: 0.875rem;
}

.site-footer__grid {
    display: grid;
    gap: var(--space-6);
}

.site-footer__about {
    max-width: 34rem;
}

.site-footer__about p + p {
    margin-top: var(--space-3);
}

.site-footer nav ul {
    display: grid;
    gap: var(--space-2);
    padding: 0;
    list-style: none;
}

.site-footer a {
    color: var(--ink-soft);
}

.site-footer nav a {
    text-decoration: none;
}

.site-footer nav a:hover {
    text-decoration: underline;
}

.site-footer nav .label {
    margin-bottom: var(--space-3);
}

@media (min-width: 48rem) {
    .site-footer__grid {
        grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr));
    }
}

/* Headings and text */

.page-header {
    display: grid;
    gap: var(--space-3);
    padding-bottom: var(--space-5);
    margin-bottom: var(--space-5);
    border-bottom: 1px solid var(--ink);
}

.page-header--plain {
    border-bottom-color: var(--rule);
}

/* Account and administration: the same header, sized for tools rather than reading. */
.page-header--compact .page-title {
    font-size: clamp(1.625rem, 1.3rem + 1.3vw, 2.375rem);
}

.breadcrumb + .page-header,
.breadcrumb + .article {
    margin-top: var(--space-5);
}

.kicker,
.label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    line-height: 1.4;
    text-transform: uppercase;
}

.kicker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    color: var(--accent);
}

.kicker a {
    color: inherit;
    text-decoration: none;
}

.kicker a:hover {
    text-decoration: underline;
}

.label {
    color: var(--muted);
}

.page-title {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 1.35rem + 2.8vw, 3.5rem);
    letter-spacing: -0.015em;
}

.dek {
    max-width: var(--measure);
    color: var(--ink-soft);
    font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
    line-height: 1.5;
}

.section {
    margin-top: var(--space-7);
}

.section-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-1) var(--space-3);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--ink);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.section-title .label {
    font-weight: 500;
}

.prose {
    max-width: var(--measure);
    font-size: 1.0625rem;
    line-height: 1.65;
}

.prose p + p {
    margin-top: var(--space-4);
}

.prose ul {
    padding-left: 1.2rem;
}

.prose li + li {
    margin-top: var(--space-2);
}

.prose dt {
    font-weight: 600;
}

.prose dd {
    margin: 0;
}

.prose dd + dt {
    margin-top: var(--space-3);
}

/* Navigation patterns */

.breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: 0;
    list-style: none;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.breadcrumb li + li::before {
    content: "/";
    margin-right: var(--space-2);
    color: var(--rule-strong);
}

.breadcrumb a {
    color: var(--muted);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--ink);
}

/* On a phone the page title follows at once; the trail keeps only the way back. */
.breadcrumb li:last-child:not(:first-child) {
    display: none;
}

@media (min-width: 40rem) {
    .breadcrumb li:last-child:not(:first-child) {
        display: list-item;
    }
}

.breadcrumb [aria-current="page"] {
    display: inline-block;
    max-width: 22ch;
    overflow: hidden;
    color: var(--ink);
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.tabs ul {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--rule);
    border-radius: calc(var(--radius) + 3px);
    background: var(--surface-sunken);
    list-style: none;
}

.tabs a {
    display: block;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.tabs a:hover {
    color: var(--ink);
}

.tabs a[aria-current="page"] {
    background: var(--surface);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 0 0 1px var(--rule);
    color: var(--ink);
}

.pagination {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--rule);
}

.pagination a {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
}

.pagination a[rel="next"] {
    margin-left: auto;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: 0;
    list-style: none;
}

.chip {
    display: inline-block;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--rule-strong);
    border-radius: 999px;
    color: var(--ink);
    font-size: 0.875rem;
    line-height: 1.3;
    text-decoration: none;
}

a.chip:hover {
    border-color: var(--ink);
    color: var(--ink);
}

.chip small {
    margin-left: var(--space-1);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Stories */

.story-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-4);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    background: var(--surface-sunken);
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.4;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Story lifecycle: a dot and a word, quiet enough to repeat down a list. */
.badge--new,
.badge--developing,
.badge--updated {
    padding: 0;
    background: none;
}

.badge--new::before,
.badge--developing::before,
.badge--updated::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: currentColor;
}

.badge--new {
    color: var(--breaking);
}

.badge--developing {
    color: var(--developing);
}

.badge--updated {
    color: var(--updated);
}

.badge--positive {
    background: var(--positive-soft);
    color: var(--positive);
}

.badge--negative {
    background: var(--negative-soft);
    color: var(--negative);
}

.story-card {
    display: grid;
    align-content: start;
    gap: var(--space-2);
}

.story-card__title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    letter-spacing: -0.005em;
    line-height: 1.22;
}

.story-card__title a {
    text-decoration: none;
}

.story-card__title a:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
}

.story-card__summary {
    display: -webkit-box;
    max-width: var(--measure);
    overflow: hidden;
    color: var(--ink-soft);
    font-size: 0.9375rem;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.story-card--lead {
    gap: var(--space-3);
}

.story-card--lead .story-card__title {
    font-size: clamp(1.75rem, 1.2rem + 2.6vw, 3rem);
    letter-spacing: -0.02em;
    line-height: 1.08;
}

.story-card--lead .story-card__summary {
    font-size: clamp(1rem, 0.95rem + 0.3vw, 1.1875rem);
    -webkit-line-clamp: 4;
    line-clamp: 4;
}

/* A publisher's description standing in for a summary, led by the publisher's name. */
.story-card__source {
    margin-right: var(--space-1);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* A card with a thumbnail: the text keeps the first column, the image sits beside it on every screen. */
.story-card--thumb {
    grid-template-columns: minmax(0, 1fr) clamp(5.5rem, 24vw, 9.5rem);
    column-gap: var(--space-4);
}

.story-card--thumb > * {
    grid-column: 1;
}

.story-card--thumb > .publisher-image {
    grid-row: 1 / span 3;
    grid-column: 2;
}

.story-card--compact .story-card__title {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.35;
}

.story-front {
    display: grid;
    gap: var(--space-5);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--rule);
}

.story-front__secondary {
    display: grid;
    gap: var(--space-5);
    padding: 0;
    list-style: none;
}

.story-front__secondary > li {
    padding-top: var(--space-4);
    border-top: 1px solid var(--rule);
}

@media (min-width: 40rem) {
    .story-front__secondary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: var(--space-6);
    }
}

@media (min-width: 64rem) {
    .story-front {
        grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
        column-gap: var(--space-7);
    }

    .story-front__secondary {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-4);
    }

    .story-front__secondary > li:first-child {
        padding-top: 0;
        border-top: 0;
    }
}

.story-river {
    padding: 0;
    list-style: none;
    counter-reset: story;
}

.story-river > li {
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr);
    gap: var(--space-3);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--rule);
    counter-increment: story;
}

.story-river > li::before {
    content: counter(story, decimal-leading-zero);
    padding-top: 0.2rem;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}

.story-river--after-front {
    counter-reset: story 5;
}

.story-river--plain > li {
    grid-template-columns: minmax(0, 1fr);
}

.story-river--plain > li::before {
    content: none;
}

@media (min-width: 64rem) {
    .story-river--columns {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: var(--space-7);
    }
}

/* Search (Search page, SearchResultsView, search.js). The form stays put while results below it are replaced; a thin
   bar under the form shows a request in flight, and the reader's words are marked in the results. */
.search-form {
    position: relative;
}

.search-progress {
    height: 2px;
    overflow: hidden;
    border-radius: 1px;
}

.search-form.is-searching .search-progress {
    background: var(--rule);
}

.search-form.is-searching .search-progress::before {
    content: "";
    display: block;
    width: 40%;
    height: 100%;
    background: var(--accent);
}

@media (prefers-reduced-motion: no-preference) {
    .search-form.is-searching .search-progress::before {
        animation: search-progress 0.9s ease-in-out infinite;
    }

    @keyframes search-progress {
        from {
            transform: translateX(-100%);
        }

        to {
            transform: translateX(250%);
        }
    }
}

.search-results {
    min-height: 50vh;
}

.search-results[aria-busy="true"] {
    opacity: 0.72;
}

@media (prefers-reduced-motion: no-preference) {
    .search-results {
        transition: opacity 120ms ease;
    }
}

mark {
    padding: 0 0.05em;
    border-radius: 2px;
    background: var(--accent-soft);
    color: inherit;
}

/* Publisher image (PublisherImage): the publisher's own URL, credited with a link to its article. */
.publisher-image {
    display: grid;
    align-content: start;
    gap: var(--space-1);
    margin: 0;
}

.publisher-image img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius);
    background: var(--surface-sunken);
    color: transparent;
}

.publisher-image--thumb img {
    aspect-ratio: 4 / 3;
}

/* The credit is never cut short: under a narrow thumbnail it wraps instead. */
.publisher-image figcaption {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
    line-height: 1.35;
    overflow-wrap: anywhere;
    text-transform: uppercase;
}

.publisher-image figcaption a {
    color: inherit;
    text-decoration: none;
}

.publisher-image figcaption a:hover {
    color: var(--ink);
    text-decoration: underline;
}

/* Story page */

.article {
    display: grid;
    gap: var(--space-6);
}

.article__header {
    display: grid;
    gap: var(--space-4);
    max-width: 52rem;
}

.article__title {
    font-family: var(--font-serif);
    font-size: clamp(2.125rem, 1.4rem + 3.2vw, 3.75rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
}

.article__dek {
    max-width: var(--measure);
    color: var(--ink-soft);
    font-family: var(--font-serif);
    font-size: clamp(1.1875rem, 1.05rem + 0.6vw, 1.5rem);
    line-height: 1.45;
}

.article__body {
    display: grid;
    gap: var(--space-7);
    min-width: 0;
}

/* A publisher's description quoted in place of a summary, credited to the publisher. */
.article__excerpt {
    display: grid;
    gap: var(--space-2);
    max-width: var(--measure);
    margin: 0;
    padding-left: var(--space-4);
    border-left: 3px solid var(--rule-strong);
}

.article__excerpt p {
    color: var(--ink-soft);
    font-family: var(--font-serif);
    font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
    line-height: 1.5;
}

.article__excerpt footer {
    color: var(--muted);
    font-size: 0.875rem;
}

.article__excerpt cite {
    font-style: normal;
    font-weight: 600;
}

.article__aside {
    display: grid;
    align-content: start;
    gap: var(--space-6);
}

@media (min-width: 64rem) {
    .article {
        grid-template-columns: minmax(0, var(--measure)) minmax(15rem, 19rem);
        column-gap: var(--space-8);
        align-items: start;
    }

    .article__header {
        grid-column: 1 / -1;
    }

    .article__aside {
        position: sticky;
        top: 7rem;
    }
}

.facts {
    display: grid;
    gap: var(--space-3);
    max-width: var(--measure);
    padding: var(--space-4) 0;
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--rule);
}

.section-title + .facts {
    padding-top: 0;
    border-top: 0;
}

.facts div {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
}

.facts dt {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.facts dd {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.callout {
    display: grid;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-5);
    border-left: 3px solid var(--accent);
    background: var(--surface);
}

.callout p {
    font-family: var(--font-serif);
    font-size: 1.125rem;
    line-height: 1.5;
}

.claim-group + .claim-group {
    margin-top: var(--space-6);
}

.claim-group__title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.claim-group__title::before {
    content: "";
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 2px;
    background: var(--rule-strong);
}

.claim-group--disputed .claim-group__title::before {
    background: var(--developing);
}

.claim-group--confirmed .claim-group__title::before {
    background: var(--positive);
}

.claim-group--single .claim-group__title::before {
    background: var(--updated);
}

.claim-group--open .claim-group__title::before {
    background: transparent;
    box-shadow: inset 0 0 0 1.5px var(--muted);
}

.claim-list {
    display: grid;
    gap: var(--space-3);
    padding: 0;
    list-style: none;
}

.claim-list > li {
    padding-left: var(--space-4);
    border-left: 1px solid var(--rule-strong);
    font-size: 1.0625rem;
    line-height: 1.55;
}

.dispute {
    display: grid;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--surface);
}

.dispute__subject {
    font-weight: 700;
}

.dispute .claim-list > li {
    border-left-color: var(--developing);
}

.citations {
    display: inline;
    color: var(--muted);
    font-size: 0.8125rem;
    white-space: normal;
}

.citations a {
    color: var(--muted);
    text-decoration-color: var(--rule-strong);
}

.citations a:hover {
    color: var(--ink);
}

.coverage {
    padding: 0;
    list-style: none;
}

.coverage > li {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-1);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--rule);
}

.coverage__source {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-2) var(--space-3);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.coverage__source a {
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
}

.coverage__source a:hover {
    text-decoration: underline;
}

.coverage__title {
    font-weight: 600;
    line-height: 1.4;
}

.coverage__title a {
    text-decoration: none;
}

.coverage__title a:hover {
    text-decoration: underline;
}

.external::after {
    content: " ↗";
    color: var(--muted);
    font-family: var(--font-sans);
    font-size: 0.85em;
}

.note {
    color: var(--muted);
    font-size: 0.875rem;
}

.coverage + .note {
    margin-top: var(--space-3);
}

/* Forms and buttons */

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 2.5rem;
    padding: 0 var(--space-4);
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.button:hover,
button:hover {
    border-color: var(--ink);
    color: var(--ink);
}

.button:active,
button:active {
    transform: translateY(1px);
}

/* A bare submit is the form's primary action; a submit that names a .button class chose its own weight. */
.button--primary,
button[type="submit"]:not(.button, .link-button) {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--paper);
}

.button--primary:hover,
button[type="submit"]:not(.button, .link-button):hover {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
}

.button--quiet {
    border-color: transparent;
    background: transparent;
}

.button--danger {
    border-color: var(--negative);
    background: transparent;
    color: var(--negative);
}

.button--danger:hover {
    background: var(--negative);
    border-color: var(--negative);
    color: var(--surface);
}

button:disabled,
.button[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.link-button {
    display: inline;
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--rule-strong);
    text-underline-offset: 0.2em;
}

.link-button:hover {
    border: 0;
    color: var(--link-hover);
}

input:not([type="checkbox"], [type="radio"], [type="hidden"]),
select,
textarea {
    width: 100%;
    min-height: 2.5rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.4;
}

textarea {
    min-height: 7rem;
    resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--muted);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    border-color: var(--focus);
    outline: 2px solid var(--focus);
    outline-offset: 0;
}

input[type="checkbox"],
input[type="radio"] {
    flex-shrink: 0;
    width: 1.05rem;
    height: 1.05rem;
    margin: 0;
    accent-color: var(--ink);
}

input[aria-invalid="true"],
.invalid {
    border-color: var(--negative);
}

.form {
    display: grid;
    gap: var(--space-4);
    max-width: 48rem;
}

.field {
    display: grid;
    gap: var(--space-1);
    font-size: 0.875rem;
    font-weight: 600;
}

.field__hint {
    color: var(--muted);
    font-size: 0.8125rem;
    font-weight: 400;
}

.form-row {
    display: grid;
    gap: var(--space-4);
}

@media (min-width: 40rem) {
    .form-row {
        grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
        align-items: start;
    }

    .form-row > :is(button, .button, .form-actions) {
        align-self: end;
    }
}

/* Nested choices (topic tree): one block per top-level topic, flowing into columns where there is room; each level
   below it indents by one step. */
.check-tree {
    margin: 0;
    padding: 0;
    list-style: none;
    columns: 14rem;
    column-gap: var(--space-6);
}

.check-tree > li {
    break-inside: avoid;
    padding-bottom: var(--space-4);
}

.check-tree ul {
    display: grid;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.check-tree .depth-0 .checkbox {
    font-weight: 700;
}

.check-tree .depth-1 {
    padding-left: var(--space-5);
}

.check-tree .depth-2 {
    padding-left: calc(2 * var(--space-5));
}

.check-tree .depth-3 {
    padding-left: calc(3 * var(--space-5));
}

.checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.9375rem;
    font-weight: 500;
}

/* A quiet qualifier after a choice: "disabled", a confidence score. */
.checkbox__note {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
}

fieldset {
    min-width: 0;
    margin: 0;
    padding: var(--space-4);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
}

legend {
    padding: 0 var(--space-2);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
}

.validation-message,
.validation-errors {
    margin: 0;
    padding: 0;
    color: var(--negative);
    font-size: 0.875rem;
    font-weight: 500;
    list-style: none;
}

.search-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-2);
}

.search-bar input {
    min-height: 3rem;
    font-size: 1.125rem;
}

.search-bar button {
    min-height: 3rem;
}

.panel {
    padding: var(--space-5);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--surface);
}

/* Feedback */

.notice {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--rule);
    border-left-width: 3px;
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 0.9375rem;
}

.notice--success {
    border-color: var(--positive);
    background: var(--positive-soft);
}

.notice--error {
    border-color: var(--negative);
    background: var(--negative-soft);
}

.notice--info {
    border-color: var(--updated);
    background: var(--updated-soft);
}

.empty-state {
    display: grid;
    gap: var(--space-2);
    padding: var(--space-6) 0;
    color: var(--muted);
}

.empty-state strong {
    color: var(--ink);
    font-size: 1.0625rem;
}

.status-page {
    display: grid;
    gap: var(--space-4);
    max-width: var(--measure);
    padding: var(--space-7) 0;
}

.status-page__code {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

/* Data */

.table-scroll {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--surface);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th,
.data-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--rule);
    text-align: left;
    vertical-align: top;
}

.data-table thead th {
    position: sticky;
    top: 0;
    background: var(--surface-sunken);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.data-table tbody tr:last-child > * {
    border-bottom: 0;
}

.data-table tbody tr:hover {
    background: var(--surface-sunken);
}

.data-table .numeric {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.data-table th[scope="row"] {
    min-width: 12rem;
}

.data-table time,
.data-table code {
    white-space: nowrap;
}

.data-table code {
    overflow-wrap: normal;
}

/* A column of short phrases (a reason, a description): wide enough to read as a line, not a word per line. */
.data-table .phrase {
    min-width: 12rem;
}

.data-table .url {
    min-width: 12rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    word-break: break-all;
}

.data-table tr.is-failing {
    box-shadow: inset 3px 0 0 var(--negative);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
    gap: var(--space-2);
}

.stat-grid > div {
    display: grid;
    align-content: space-between;
    gap: var(--space-2);
    padding: var(--space-4);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--surface);
}

.stat-grid dt {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.stat-grid dd {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

.status::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--muted);
}

.status--ok::before {
    background: var(--positive);
}

.status--warn::before {
    background: var(--developing);
}

.status--error::before {
    background: var(--negative);
}

.code-block,
pre {
    max-width: 100%;
    overflow-x: auto;
    padding: var(--space-4);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--surface-sunken);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    overflow-wrap: anywhere;
}

/* Disclosure for optional or long content (advanced fields, raw payloads). */
details > summary {
    cursor: pointer;
    font-weight: 600;
}

details[open] > summary {
    margin-bottom: var(--space-3);
}

.stack {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
}

.cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
}
