/* Chambers: shared tokens and base styles for every page. See DESIGN.md. */

:root {
    --paper: #F7F4EE;
    --sheet: #FFFFFF;
    --sheet-2: #FBF9F5;
    --ink: #172033;
    --muted: #5B6577;
    --hairline: #E3DED3;
    --hairline-strong: #CFC8BA;
    --accent: #1F3A5F;
    --accent-deep: #162B47;
    --on-accent: #FFFFFF;
    --accent-wash: rgb(31 58 95 / 0.07);
    --deletion: #A33A32;
    --deletion-wash: rgb(163 58 50 / 0.08);
    --insertion: #2F6B4F;
    --insertion-wash: rgb(47 107 79 / 0.1);
    --check: #B45309;
    --check-wash: rgb(180 83 9 / 0.07);
    --shadow-card: 0 1px 2px rgb(23 32 51 / 0.04), 0 8px 24px -12px rgb(23 32 51 / 0.12);
    --shadow-bar: 0 -6px 18px -12px rgb(23 32 51 / 0.18);

    --font-serif: "Source Serif 4", "Iowan Old Style", Charter, Georgia, serif;
    --font-ui: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --gutter: 24px;
    --container: 1120px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #11151C;
        --sheet: #181D26;
        --sheet-2: #1D2330;
        --ink: #E9E5DC;
        --muted: #A3ABB9;
        --hairline: #2C333F;
        --hairline-strong: #3B4350;
        --accent: #A9C1E3;
        --accent-deep: #C3D5EE;
        --on-accent: #0E1726;
        --accent-wash: rgb(169 193 227 / 0.1);
        --deletion: #EC9A92;
        --deletion-wash: rgb(236 154 146 / 0.1);
        --insertion: #8FCDA9;
        --insertion-wash: rgb(143 205 169 / 0.12);
        --check: #F2A860;
        --check-wash: rgb(242 168 96 / 0.09);
        --shadow-card: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 28px -14px rgb(0 0 0 / 0.6);
        --shadow-bar: 0 -8px 22px -12px rgb(0 0 0 / 0.6);
        --thumb: var(--paper);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --paper: #11151C;
    --sheet: #181D26;
    --sheet-2: #1D2330;
    --ink: #E9E5DC;
    --muted: #A3ABB9;
    --hairline: #2C333F;
    --hairline-strong: #3B4350;
    --accent: #A9C1E3;
    --accent-deep: #C3D5EE;
    --on-accent: #0E1726;
    --accent-wash: rgb(169 193 227 / 0.1);
    --deletion: #EC9A92;
    --deletion-wash: rgb(236 154 146 / 0.1);
    --insertion: #8FCDA9;
    --insertion-wash: rgb(143 205 169 / 0.12);
    --check: #F2A860;
    --check-wash: rgb(242 168 96 / 0.09);
    --shadow-card: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 28px -14px rgb(0 0 0 / 0.6);
    --shadow-bar: 0 -8px 22px -12px rgb(0 0 0 / 0.6);
    --thumb: var(--paper);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
[hidden] { display: none !important; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: calc(var(--sticky-top, 0px) + 16px);
    scroll-padding-bottom: calc(var(--sticky-bottom, 0px) + 16px);
}

body {
    font-family: var(--font-ui);
    font-size: 1rem;
    line-height: 1.6;
    background: var(--paper);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "cv11", "ss01";
    text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
cite { font-style: italic; }
em { font-style: italic; }

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

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

.skip-link {
    position: absolute; left: 16px; top: -100px; z-index: 50;
    background: var(--sheet); color: var(--ink); padding: 10px 14px;
    border: 1px solid var(--hairline-strong); border-radius: 6px;
}
.skip-link:focus { top: 12px; }

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

/* ---- Site header -------------------------------------------------------- */

.site-header { border-bottom: 1px solid var(--hairline); }
.site-header .container {
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    min-height: 64px;
}
.wordmark {
    font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em;
    color: var(--ink); text-decoration: none; line-height: 1;
    display: inline-flex; align-items: center; min-height: 44px;
}
.wordmark:hover { text-decoration: none; }
.site-nav { display: flex; gap: 4px; }
.site-nav a {
    color: var(--muted); text-decoration: none; font-size: 0.9375rem; font-weight: 500;
    padding: 8px 12px; border-radius: 6px; min-height: 40px; display: inline-flex; align-items: center;
}
.site-nav a:hover { color: var(--ink); background: var(--sheet); }

/* ---- Site footer -------------------------------------------------------- */

.site-footer { border-top: 1px solid var(--hairline); margin-top: 96px; padding: 40px 0 48px; }
.site-footer .container { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 48px; align-items: start; }
.site-footer .wordmark { font-size: 1.0625rem; min-height: 0; }
.site-footer p { color: var(--muted); font-size: 0.875rem; max-width: 52ch; margin-top: 8px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 20px; list-style: none; }
.footer-links a {
    color: var(--ink); font-size: 0.9375rem; text-decoration: none;
    display: inline-flex; align-items: center; min-height: 32px;
}
.footer-links a:hover { text-decoration: underline; }
.footer-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 24px; color: var(--muted); font-size: 0.8125rem; padding-top: 20px; border-top: 1px solid var(--hairline); }

/* ---- Buttons ------------------------------------------------------------ */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 9px 16px; border-radius: 6px;
    font-size: 0.9375rem; font-weight: 600; line-height: 1.25; text-decoration: none;
    border: 1px solid transparent;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); min-height: 44px; padding: 11px 20px; }
.btn-primary:hover:not(:disabled) { background: var(--accent-deep); }
.btn-secondary { background: var(--sheet); color: var(--ink); border-color: var(--hairline-strong); }
.btn-secondary:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { cursor: not-allowed; opacity: 0.55; }
.btn-block { width: 100%; }
.link-button {
    color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
    font-weight: 500; padding: 2px 0; min-height: 24px;
}
.link-button:hover { text-decoration-thickness: 2px; }

/* ---- Guides (/guides): worked examples, index list, call to action ------ */

.prose .crumbs { font-size: 0.875rem; color: var(--muted); margin: 0 0 20px; }
.prose .crumbs a { color: var(--muted); }
.prose cite { font-style: italic; }

.g-example {
    margin-top: 20px; background: var(--sheet); border: 1px solid var(--hairline); border-radius: 8px;
    padding: 6px 20px 8px;
}
.g-example figcaption { padding: 12px 0 4px; font-size: 0.8125rem; font-weight: 500; color: var(--muted); }
.g-row {
    display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 0 16px; align-items: baseline;
    padding: 10px 0; border-top: 1px solid var(--hairline);
}
.g-row:first-of-type { border-top: 0; }
.g-solo { grid-template-columns: minmax(0, 1fr); }
.g-sub { padding-bottom: 0; }
.g-sub + .g-row { border-top: 0; }
figcaption + .g-row { border-top: 0; }
.g-no {
    text-align: right; font-family: var(--font-serif); font-weight: 600; color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.g-label { font-size: 0.8125rem; font-weight: 500; color: var(--muted); }
.g-cite { font-family: var(--font-serif); font-size: 1.0625rem; line-height: 1.6; overflow-wrap: anywhere; margin: 0; }
.prose .g-example .g-cite { margin-top: 0; }
.g-cite em { font-style: italic; }
.g-was { color: var(--muted); }
.g-redline del {
    color: var(--deletion); text-decoration: line-through; text-decoration-thickness: 1px;
    background: var(--deletion-wash); border-radius: 4px;
}
.g-redline ins {
    color: var(--insertion); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
    background: var(--insertion-wash); border-radius: 4px;
}
.g-key {
    padding: 8px 0 6px; border-top: 1px solid var(--hairline); color: var(--muted); font-size: 0.8125rem;
    display: flex; flex-wrap: wrap; gap: 4px 20px;
}
.g-key del { color: var(--deletion); background: var(--deletion-wash); border-radius: 4px; }
.g-key ins {
    color: var(--insertion); text-decoration: underline; text-underline-offset: 3px;
    background: var(--insertion-wash); border-radius: 4px;
}

.prose .g-index { list-style: none; padding: 0; margin-top: 28px; border-top: 1px solid var(--hairline); }
.prose .g-index li { margin: 0; border-bottom: 1px solid var(--hairline); }
.prose .g-index a {
    display: block; padding: 16px 0; text-decoration: none; color: var(--ink);
}
.prose .g-index .g-name {
    display: block; font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600; color: var(--accent);
    letter-spacing: -0.01em;
}
.prose .g-index a:hover .g-name { text-decoration: underline; text-underline-offset: 3px; }
.prose .g-index .g-sum { display: block; margin-top: 2px; color: var(--muted); }

/* The shape of a citation, with each part named: in the citation serif, the names in Muted */
.g-pattern { font-family: var(--font-serif); font-size: 1.0625rem; line-height: 1.6; overflow-wrap: anywhere; margin: 0; }
.g-pattern var { font-style: normal; color: var(--muted); }
.g-pattern var em { font-style: italic; }

/* Common questions: visible questions and answers (the page's FAQPage markup is read from these) */
.prose .g-faq { margin-top: 48px; border-top: 1px solid var(--hairline); }
.prose .g-faq h2 { margin-top: 32px; }
.prose .g-faq h3 { margin-top: 24px; }
.prose .g-faq h3 + p { margin-top: 4px; }

.prose .g-related { list-style: none; padding: 0; }
.prose .g-related li { margin-top: 4px; }

.g-cta {
    margin-top: 48px; padding: 24px; background: var(--sheet); border: 1px solid var(--hairline);
    border-radius: 8px; box-shadow: var(--shadow-card);
}
.prose .g-cta h2 { margin-top: 0; font-size: 1.375rem; }
.prose .g-cta p { color: var(--muted); }
.prose .g-cta .btn { margin-top: 16px; }

/* ---- Prose (static pages, FAQ answers) --------------------------------- */

.prose { max-width: 68ch; }
.prose h1 { font-family: var(--font-serif); font-size: 2.5rem; font-weight: 600; line-height: 1.15; letter-spacing: -0.015em; text-wrap: balance; }
.prose h2 { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 600; line-height: 1.25; margin: 48px 0 12px; letter-spacing: -0.01em; }
.prose h3 { font-size: 1.0625rem; font-weight: 600; margin: 28px 0 8px; }
.prose p, .prose ul, .prose ol { margin-top: 12px; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: 6px; }
.prose .lede { font-size: 1.125rem; color: var(--muted); margin-top: 16px; }
.prose .updated { color: var(--muted); font-size: 0.875rem; margin-top: 12px; }
.todo {
    font-family: var(--font-ui); font-size: 0.875em; font-weight: 600; color: var(--check);
    background: var(--check-wash); border-radius: 4px; padding: 1px 5px;
}

.missing {
    font-family: var(--font-ui); font-size: 0.8125rem; font-weight: 600; color: var(--check);
    background: var(--check-wash); padding: 1px 4px; border-radius: 4px;
}

.page-main { padding: 64px 0 0; }

@media (max-width: 760px) {
    .site-nav { display: none; }
    .site-footer .container { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    :root { --gutter: 16px; }
    .page-main { padding-top: 40px; }
    .prose h1 { font-size: 2rem; }
    .g-example { padding-left: 16px; padding-right: 16px; }
    .g-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .g-no { text-align: left; }
    .g-no::before { content: "Footnote "; font-family: var(--font-ui); font-size: 0.8125rem; font-weight: 500; }
    .site-footer { margin-top: 64px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
