/* Shared styles for the secondary pages (404, legal documents, archive).
   Same tokens as the homepage: white, near-black, one sans-serif. */

:root {
    --bg: #ffffff;
    --text: #111111;
    --muted: #666666;
    --line: #e8e8e8;
    --hover: #f5f5f5;
    --code: #f2f2f2;
    --wrap: min(760px, calc(100% - 48px));
    color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
    :root { --bg: #0a0a0a; --text: #ededed; --muted: #a1a1a1; --line: #262626; --hover: #161616; --code: #1c1c1c; }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 3px; }

/* ---------- header / footer ---------- */
.site-header { width: var(--wrap); min-height: 72px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.wordmark { display: inline-flex; align-items: center; min-height: 44px; font-size: 0.95rem; font-weight: 600; text-decoration: none; letter-spacing: -0.01em; }
.mark { display: none; }
.header-nav { display: flex; gap: 22px; }
.header-nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-size: 0.92rem; text-decoration: none; }
.header-nav a:hover { color: var(--text); }

footer { width: var(--wrap); margin: 72px auto 40px; padding-top: 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 18px; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--text); }

/* ---------- buttons (plain text links) ---------- */
.button { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--text); font-size: 0.95rem; font-weight: 500; text-decoration: underline; text-decoration-color: var(--line); text-decoration-thickness: 1px; text-underline-offset: 5px; }
.button:hover { text-decoration-color: var(--text); }
.button svg { width: 15px; height: 15px; flex: 0 0 auto; }

/* ---------- 404 ---------- */
.lost { width: var(--wrap); margin: 0 auto; padding: clamp(64px, 12vw, 140px) 0 24px; }
.lost-code { margin: 0 0 8px; color: var(--muted); font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.lost h1 { margin: 0 0 16px; font-size: clamp(2rem, 5vw, 2.75rem); font-weight: 600; line-height: 1.15; letter-spacing: -0.025em; }
.lost-intro { max-width: 52ch; margin-bottom: 28px; color: var(--muted); }
.lost-intro a { color: var(--text); text-underline-offset: 4px; }
.lost .button-row { display: flex; flex-wrap: wrap; gap: 4px 28px; }

/* ---------- legal documents ---------- */
.doc-masthead { width: var(--wrap); margin: 0 auto; padding: clamp(48px, 9vw, 100px) 0 32px; }
.doc-kicker { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 12px; color: var(--muted); font-size: 0.88rem; }
.doc-kicker .tick, .doc-kicker .span { display: none; }
.doc-masthead h1 { margin: 0 0 14px; font-size: clamp(2rem, 5vw, 2.75rem); font-weight: 600; line-height: 1.15; letter-spacing: -0.025em; }
.doc-standfirst { max-width: 60ch; margin: 0; color: var(--muted); font-size: 1.05rem; }
.doc-standfirst a { color: var(--text); text-underline-offset: 4px; }

.doc-layout { width: var(--wrap); margin: 0 auto; }
.doc-toc { margin: 0 0 8px; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.doc-toc h2 { margin: 0 0 8px; color: var(--muted); font-size: 0.85rem; font-weight: 500; }
.doc-toc ol { margin: 0; padding: 0; list-style: none; columns: 2; column-gap: 32px; }
.doc-toc li { break-inside: avoid; }
.doc-toc a { display: inline-block; padding: 3px 0; font-size: 0.92rem; text-decoration: none; }
.doc-toc a:hover { text-decoration: underline; text-underline-offset: 4px; }

.doc-body { padding-bottom: 8px; }
.doc-body section { padding-top: 40px; }
.doc-body h2 { margin: 0 0 14px; font-size: 1.3rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.015em; }
.doc-body h3 { margin: 26px 0 8px; font-size: 1rem; font-weight: 600; }
.doc-body p { margin-bottom: 16px; }
.doc-body p, .doc-body li { text-wrap: pretty; }
.doc-body ul { margin: 0 0 16px; padding-left: 20px; }
.doc-body ul li { margin-bottom: 6px; }
.doc-body ul li::marker { color: var(--muted); }
.doc-body strong { font-weight: 600; }
.doc-body a[href] { color: var(--text); text-decoration: underline; text-decoration-color: var(--muted); text-underline-offset: 3px; }
.doc-body a[href]:hover { text-decoration-color: var(--text); }
.doc-body code { padding: 1px 5px; background: var(--code); border-radius: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86em; }

/* a value the site owner still has to fill in */
.doc-body .fill { padding: 1px 6px; background: #fff3c4; color: #111; border-radius: 4px; font-size: 0.9em; }

.callout { margin: 0 0 20px; padding: 16px 18px; background: var(--hover); border-radius: 8px; }
.callout p:last-child { margin-bottom: 0; }

.doc-table { width: 100%; margin: 0 0 18px; border-collapse: collapse; font-size: 0.92rem; }
.doc-table th, .doc-table td { padding: 12px 16px 12px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.doc-table th { color: var(--muted); font-size: 0.85rem; font-weight: 500; }
.doc-table td:first-child { width: 36%; }

.doc-body .doc-foot { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }

/* ---------- archive ---------- */
.shelf { width: var(--wrap); margin: 0 auto; }
.shelf-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.shelf-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 24px; align-items: baseline; padding: 18px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.shelf-row:hover .shelf-title { text-decoration: underline; text-underline-offset: 4px; }
.shelf-num { display: none; }
.shelf-id { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.shelf-title { font-weight: 500; }
.shelf-tag { color: var(--muted); font-size: 0.88rem; }
.shelf-note { grid-column: 1; color: var(--muted); font-size: 0.92rem; }
.shelf-cta { grid-column: 2; grid-row: 1; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.88rem; }
.shelf-cta svg { width: 15px; height: 15px; }

.loose { padding-top: 48px; }
.loose h2 { margin: 0 0 8px; font-size: 1.3rem; font-weight: 600; letter-spacing: -0.015em; }
.loose > p { margin-bottom: 16px; color: var(--muted); }
.loose a { text-underline-offset: 3px; }
.loose code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; }

/* ---------- skip link ---------- */
.skip-link { position: absolute; left: 16px; top: -100px; z-index: 10; padding: 10px 14px; color: var(--bg); background: var(--text); border-radius: 6px; font-size: 0.9rem; text-decoration: none; }
.skip-link:focus { top: 16px; }

/* ---------- responsive ---------- */
@media (max-width: 600px) {
    :root { --wrap: calc(100% - 40px); }
    .header-nav { gap: 16px; }
    .header-nav a:nth-child(n + 3) { display: none; }
    .doc-toc ol { columns: 1; }
    .doc-table, .doc-table tbody, .doc-table tr, .doc-table td, .doc-table th { display: block; width: 100%; }
    .doc-table thead { display: none; }
    .doc-table tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
    .doc-table td { border: 0; padding: 0 0 4px; }
    .doc-table td:first-child { width: 100%; color: var(--muted); font-size: 0.88rem; }
    footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}
