/* Shared foundation for Cory Land: cream paper, charcoal type, thin rules,
   Georgia headings, and Geist controls. The homepage uses collection.css;
   non-editor tools and reading pages build on collection-pages.css. */

@font-face {
    font-family: "Geist";
    src: url("/fonts/Geist-Variable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Geist Mono";
    src: url("/fonts/GeistMono-Variable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* Paper is the default. Night paper follows the system setting unless the
   reader picks one with the topbar toggle (stored as html[data-theme]).
   Every color on the site is one of these tokens; charts and calendars use
   the --viz-* and --tint-* roles so both themes stay legible. */
:root {
    color-scheme: light;

    --background: #f6f4ed;
    --foreground: #292c2a;
    --secondary: #eeece3;
    --muted-foreground: #686b64;
    --subtle-foreground: #777a72;
    --border: #d6d4cb;
    --border-strong: #b5b4a9;
    --surface: #f1efe7;
    --raised: #fbfaf5;
    --prose: #2d2f2c;
    --shadow-color: 32 22% 18%;

    /* Rust: the one accent. Focus, live markers, the selected thing. */
    --brand: #a84e36;
    --brand-strong: #8c3f2a;
    --brand-soft: #a84e3612;
    --on-brand: #fbfaf5;
    --destructive: hsl(0 66% 47%);
    --destructive-soft: hsl(0 66% 47% / 0.07);
    --success: #556944;
    --success-soft: #55694414;
    --warning: hsl(38 92% 36%);
    --warning-soft: hsl(45 93% 47% / 0.1);

    /* Data colors: rust and sage on paper, sun and dusk for daylight. */
    --viz-a: #ac684b;
    --viz-a-strong: #8c4a30;
    --viz-b: #859078;
    --viz-b-strong: #67735b;
    --viz-sage: #9baf89;
    --viz-sage-text: #556944;
    --viz-day: #dbc07d;
    --viz-twilight: #eac5a6;
    --viz-night: #d5d6d2;
    --viz-area: #e9d5c6;
    --viz-grid: #d6d4cb;
    --viz-shade: #e9e7de;
    --tint-brand: #ecdcd2;
    --tint-brand-text: #793c2d;
    --art-placeholder: #d0cabb;

    --radius: 3px;
    --radius-sm: 2px;

    --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
    /* The one serif: mastheads and reading prose. Chrome stays Geist. */
    --font-serif: Georgia, "Times New Roman", serif;

    /* Motion spec: two durations, one curve. */
    --motion-fast: 140ms;
    --motion-settle: 240ms;
    --ease-standard: cubic-bezier(0.2, 0, 0, 1);

    /* Page widths: prose reads at reading width, tools at tool width, and
       only surfaces that earn it (dashboards, charts, split panes) go wide. */
    --w-reading: 760px;
    --w-tool: 920px;
    --w-wide: 1140px;
}

/* Night paper: warm charcoal, not black; the same rust, lifted for contrast. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --background: #1c1d1a;
        --foreground: #e9e5d9;
        --secondary: #282925;
        --muted-foreground: #a6a397;
        --subtle-foreground: #8f8d82;
        --border: #393a35;
        --border-strong: #56574f;
        --surface: #222320;
        --raised: #262723;
        --prose: #dcd8cc;
        --shadow-color: 40 12% 3%;
        --brand: #d97c5d;
        --brand-strong: #e8957a;
        --brand-soft: #d97c5d1a;
        --on-brand: #1c1d1a;
        --destructive: hsl(4 72% 64%);
        --destructive-soft: hsl(4 72% 64% / 0.1);
        --success: #a3ba8e;
        --success-soft: #a3ba8e1a;
        --warning: hsl(40 85% 62%);
        --warning-soft: hsl(40 85% 62% / 0.1);
        --viz-a: #c27a5c;
        --viz-a-strong: #d9927a;
        --viz-b: #8f9d81;
        --viz-b-strong: #a9b79b;
        --viz-sage: #6f8360;
        --viz-sage-text: #a3ba8e;
        --viz-day: #c9a75c;
        --viz-twilight: #9a6a55;
        --viz-night: #33352f;
        --viz-area: #4a3328;
        --viz-grid: #393a35;
        --viz-shade: #252622;
        --tint-brand: #4a2f25;
        --tint-brand-text: #f0b9a3;
        --art-placeholder: #34332e;
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --background: #1c1d1a;
    --foreground: #e9e5d9;
    --secondary: #282925;
    --muted-foreground: #a6a397;
    --subtle-foreground: #8f8d82;
    --border: #393a35;
    --border-strong: #56574f;
    --surface: #222320;
    --raised: #262723;
    --prose: #dcd8cc;
    --shadow-color: 40 12% 3%;
    --brand: #d97c5d;
    --brand-strong: #e8957a;
    --brand-soft: #d97c5d1a;
    --on-brand: #1c1d1a;
    --destructive: hsl(4 72% 64%);
    --destructive-soft: hsl(4 72% 64% / 0.1);
    --success: #a3ba8e;
    --success-soft: #a3ba8e1a;
    --warning: hsl(40 85% 62%);
    --warning-soft: hsl(40 85% 62% / 0.1);
    --viz-a: #c27a5c;
    --viz-a-strong: #d9927a;
    --viz-b: #8f9d81;
    --viz-b-strong: #a9b79b;
    --viz-sage: #6f8360;
    --viz-sage-text: #a3ba8e;
    --viz-day: #c9a75c;
    --viz-twilight: #9a6a55;
    --viz-night: #33352f;
    --viz-area: #4a3328;
    --viz-grid: #393a35;
    --viz-shade: #252622;
    --tint-brand: #4a2f25;
    --tint-brand-text: #f0b9a3;
    --art-placeholder: #34332e;
}

/* ---------------------------------------------------------------- base */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    height: 100%;
    background: var(--background);
}

body {
    min-height: 100%;
    margin: 0;
    background: var(--background);
    color: var(--foreground);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    font-feature-settings: "rlig" 1, "calt" 1, "ss01" 1, "cv11" 1;
    /* Numbers hold their width as they update (counts, times, scores). */
    font-variant-numeric: tabular-nums;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: color-mix(in srgb, var(--brand) 22%, transparent);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border: 2px solid var(--background);
    border-radius: 999px;
}

a {
    color: var(--foreground);
    text-decoration-color: var(--border-strong);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

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

:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

h1, h2, h3, h4 {
    margin: 0;
    text-wrap: balance;
}

p {
    margin: 0;
}

/* ------------------------------------------------------------ topbar
   Injected by site-shell.js on every page. */

.site-topbar {
    position: relative;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 0 18px;
    border-bottom: 1px solid var(--border);
    background: var(--background);
    backdrop-filter: blur(16px);
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--foreground);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

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

.site-mark {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--secondary);
}

.site-mark svg {
    width: 16px;
    height: 16px;
    color: var(--foreground);
}

.site-context {
    min-width: 0;
    overflow: hidden;
    padding-left: 12px;
    border-left: 1px solid var(--border);
    color: var(--muted-foreground);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
}

.site-nav a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 32px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    color: var(--muted-foreground);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color var(--motion-fast) var(--ease-standard),
                color var(--motion-fast) var(--ease-standard);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
    background: var(--secondary);
    color: var(--foreground);
}

.site-nav svg {
    width: 14px;
    height: 14px;
}

/* ------------------------------------------------------- page scaffold */

.page {
    width: min(100% - 48px, var(--w-tool));
    margin-inline: auto;
    padding: 44px 0 96px;
}

.page--reading {
    width: min(100% - 48px, var(--w-reading));
}

.page--wide {
    width: min(100% - 48px, var(--w-wide));
}

/* Masthead: eyebrow, serif title, quiet subtitle. Every page is a paper. */
.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-family: var(--font-serif);
    font-size: clamp(28px, 4.5vw, 38px);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.page-header .eyebrow {
    display: block;
    margin-bottom: 10px;
}

.page-subtitle {
    max-width: 64ch;
    margin-top: 8px;
    color: var(--muted-foreground);
    font-size: 13px;
    line-height: 1.55;
}

.section {
    margin-top: 40px;
}

.section-label {
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* ----------------------------------------------------------- type roles
   Semantic sizes; below 768px each reading role steps up one notch. */

.eyebrow {
    color: var(--muted-foreground);
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.text-ui { font-size: 13px; }
.text-preview { font-size: 12px; }
.text-body { font-size: 15px; line-height: 1.625; }
.text-stamp { font-size: 10px; }

.editorial {
    font-family: var(--font-serif);
    letter-spacing: -0.01em;
}

.mono {
    font-family: var(--font-mono);
}

.muted { color: var(--muted-foreground); }
.subtle { color: var(--subtle-foreground); }

/* -------------------------------------------------------------- surfaces */

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
}

.card-body {
    padding: 20px;
}

.card-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.hairline-t { border-top: 1px solid var(--border); }
.hairline-b { border-bottom: 1px solid var(--border); }

/* A quiet inset panel inside a card (results, code-ish displays). */
.well {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.callout {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-left: 2px solid var(--brand);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 13px;
    line-height: 1.6;
}

.callout .eyebrow {
    display: block;
    margin-bottom: 6px;
    color: var(--brand);
}

/* ----------------------------------------------------------------- lists */

.list {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.list-row {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: inherit;
    text-decoration: none;
    transition: background-color var(--motion-fast) var(--ease-standard);
}

.list-row:last-child {
    border-bottom: 0;
}

a.list-row:hover,
.list-row.interactive:hover {
    background: var(--secondary);
    color: inherit;
}

/* ---------------------------------------------------------------- tables */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--muted-foreground);
    font-size: 10px;
    font-weight: 550;
    letter-spacing: 0.1em;
    text-align: left;
    text-transform: uppercase;
}

.table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.table tr:last-child td {
    border-bottom: 0;
}

/* ---------------------------------------------------------------- controls */

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--background);
    color: var(--foreground);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 550;
    letter-spacing: -0.01em;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: background-color var(--motion-fast) var(--ease-standard),
                border-color var(--motion-fast) var(--ease-standard),
                transform var(--motion-fast) var(--ease-standard);
}

button:hover,
.btn:hover {
    border-color: var(--border-strong);
    background: var(--secondary);
    color: var(--foreground);
}

button:active,
.btn:active {
    transform: scale(0.98);
}

button:disabled,
.btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    border-color: var(--foreground);
    background: var(--foreground);
    color: var(--background);
}

.btn-primary:hover {
    border-color: color-mix(in srgb, var(--foreground) 86%, var(--background));
    background: color-mix(in srgb, var(--foreground) 86%, var(--background));
    color: var(--background);
}

.btn-danger {
    color: var(--destructive);
}

/* Ghost: no chrome until hovered (icon buttons, dismissals). */
.btn-ghost {
    min-height: 0;
    padding: 4px;
    border: 0;
    background: transparent;
    color: var(--subtle-foreground);
}

.btn-ghost:hover {
    border: 0;
    background: color-mix(in srgb, var(--foreground) 7%, transparent);
    color: var(--foreground);
}

input,
select,
textarea {
    font: inherit;
    color: var(--foreground);
}

input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--background);
    font-family: var(--font-sans);
    font-size: var(--type-control, 13px);
}

textarea {
    padding: 12px;
    line-height: 1.55;
}

input::placeholder,
textarea::placeholder {
    color: var(--subtle-foreground);
}

.field-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted-foreground);
    font-size: 10px;
    font-weight: 550;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* The control vocabulary, shared by every tool:
   - .segmented: one choice from a few (buttons with aria-pressed, or radio
     labels). An inset track; the chosen option is pressed into it.
   - .switch / .switch-track: on or off.
   - .text-action: a quiet one-shot action (presets, Sample, Clear).
   - .btn-primary: the one main action on a page.
   Pills are kept for stamps and indicators, never for things you press. */
.segmented {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 2px;
    max-width: 100%;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
}

.segmented > button,
.segmented > label > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted-foreground);
    font: 500 13px/1.2 var(--font-sans);
    white-space: nowrap;
    cursor: pointer;
    transition: background-color var(--motion-fast) var(--ease-standard),
                color var(--motion-fast) var(--ease-standard),
                box-shadow var(--motion-fast) var(--ease-standard);
}

.segmented > label { position: relative; display: inline-flex; }
.segmented > label > input { position: absolute; width: 1px; height: 1px; min-height: 0; margin: 0; opacity: 0; pointer-events: none; }

.segmented > button:hover,
.segmented > label:hover > span { background: transparent; color: var(--foreground); }
.segmented > button:active { transform: none; }

.segmented > button[aria-pressed="true"],
.segmented > button.active,
.segmented > label > input:checked + span {
    background: var(--secondary);
    color: var(--foreground);
    box-shadow: inset 0 0 0 1px var(--border);
}

.segmented > label > input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.segmented > button:disabled { opacity: .4; }

/* Numbers and short codes (12h/24h, 2/4/Tab, 5/10/20/30). */
.segmented--mono > button,
.segmented--mono > label > span { min-width: 40px; padding-inline: 10px; font-family: var(--font-mono); letter-spacing: .01em; }

/* Switch: a checkbox inside a label, or a button with aria-pressed. */
.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
    border: 0;
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    user-select: none;
}
.switch:hover { background: transparent; color: var(--foreground); }
.switch:active { transform: none; }
.switch > input { position: absolute; width: 1px; height: 1px; min-height: 0; margin: 0; opacity: 0; }
.switch-track {
    position: relative;
    flex: none;
    width: 28px;
    height: 16px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--secondary);
    transition: background-color var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard);
}
.switch-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--muted-foreground);
    transition: transform var(--motion-settle) var(--ease-standard), background-color var(--motion-fast) var(--ease-standard);
}
.switch > input:checked + .switch-track,
.switch[aria-pressed="true"] > .switch-track { border-color: var(--brand); background: var(--brand); }
.switch > input:checked + .switch-track::after,
.switch[aria-pressed="true"] > .switch-track::after { background: var(--on-brand); transform: translateX(12px); }
.switch > input:focus-visible + .switch-track { outline: 2px solid var(--brand); outline-offset: 3px; }
.switch:has(input:checked),
.switch[aria-pressed="true"] { color: var(--foreground); }

/* Text action: no chrome, an underline arrives on hover. */
.text-action {
    min-height: 32px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--muted-foreground);
    font-weight: 450;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-decoration-thickness: 1px;
    text-underline-offset: 5px;
    transition: color var(--motion-fast) var(--ease-standard), text-decoration-color var(--motion-fast) var(--ease-standard);
}
.text-action:hover { border: 0; background: none; color: var(--foreground); text-decoration-color: var(--brand); }
.text-action:active { transform: none; color: var(--brand); }

/* range inputs: hairline track, brand thumb */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border: 0;
    border-radius: 999px;
    background: var(--secondary);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--background);
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 1px var(--brand);
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 2px solid var(--background);
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 1px var(--brand);
    cursor: pointer;
}

/* ------------------------------------------------------------------ chips */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--background);
    color: var(--muted-foreground);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge--fill {
    border-color: var(--foreground);
    background: var(--foreground);
    color: var(--background);
}

kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--secondary);
    color: var(--muted-foreground);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 550;
}

code {
    padding: 1px 5px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--secondary);
    font-family: var(--font-mono);
    font-size: 0.88em;
}

pre {
    overflow-x: auto;
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.6;
}

pre code {
    padding: 0;
    border: 0;
    background: transparent;
    font-size: inherit;
}

/* ------------------------------------------------------------------ stats */

.stat-value {
    font-family: var(--font-mono);
    font-size: 30px;
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1.1;
}

/* The stat strip: the site's signature for headline numbers. Figures sit in
   one hairline-bounded band with column rules, like a newspaper data row —
   never in individual boxes. */
.stat-strip {
    display: flex;
    border-block: 1px solid var(--border);
}

.stat-strip > * {
    flex: 1 1 0;
    min-width: 0;
    padding: 18px 22px;
    border-left: 1px solid var(--border);
}

.stat-strip > :first-child {
    padding-left: 0;
    border-left: 0;
}

.stat-strip .eyebrow {
    display: block;
    margin-top: 7px;
}

@media (max-width: 640px) {
    .stat-strip {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .stat-strip > * {
        padding: 14px 0 14px 0;
        border-left: 0;
        border-top: 1px solid var(--border);
    }

    .stat-strip > :nth-child(-n+2) {
        border-top: 0;
    }

    .stat-strip > :nth-child(even) {
        padding-left: 18px;
        border-left: 1px solid var(--border);
    }
}

/* ------------------------------------------------------------------ prose
   Reading surfaces: serif body, sans headings, hairline section breaks. */

.prose {
    font-family: var(--font-serif);
    font-size: 15.5px;
    letter-spacing: -0.008em;
    line-height: 1.68;
    color: var(--prose);
}

.prose p {
    margin: 0 0 1em;
}

.prose h2 {
    margin: 34px 0 14px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-sans);
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--foreground);
}

.prose h3 {
    margin: 26px 0 10px;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 650;
    color: var(--foreground);
}

.prose ul,
.prose ol {
    margin: 0 0 1em;
    padding-left: 1.4em;
}

.prose li {
    margin-bottom: 0.35em;
}

.prose pre {
    margin: 0 0 1.2em;
}

.prose blockquote {
    margin: 0 0 1em;
    padding: 2px 0 2px 16px;
    border-left: 2px solid var(--border-strong);
    color: var(--muted-foreground);
}

/* Memo front-matter: label/value rows under a masthead. */
.memo-meta {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px 16px;
    margin-top: 14px;
    font-size: 12px;
    color: var(--muted-foreground);
}

.memo-meta dt {
    color: var(--subtle-foreground);
    font-size: 10px;
    font-weight: 550;
    letter-spacing: 0.08em;
    line-height: 1.8;
    text-transform: uppercase;
}

.memo-meta dd {
    margin: 0;
}

.redacted {
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--foreground);
    color: var(--background);
    font-family: var(--font-sans);
    font-size: 0.78em;
    letter-spacing: 0.04em;
}

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

/* ---------------------------------------------------------------- motion */

/* Arrival: the one orchestrated moment. Blocks settle onto the page like
   papers landing in an inbox — set --arrive-i per block to stagger. */
@media (prefers-reduced-motion: no-preference) {
    @keyframes arrive {
        from {
            opacity: 0;
            transform: translateY(-4px);
        }
        to {
            opacity: 1;
            transform: none;
        }
    }

    .arrive {
        animation: arrive var(--motion-settle) var(--ease-standard) both;
        animation-delay: calc(var(--arrive-i, 0) * 40ms);
    }
}

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

/* ---------------------------------------------------------------- mobile
   Reading roles step up one notch at phone distance; controls hold. */

@media (max-width: 767px) {
    .page,
    .page--reading,
    .page--wide {
        width: min(100% - 32px, var(--w-wide));
        padding-top: 28px;
    }

    .eyebrow { font-size: 11px; }
    .text-ui { font-size: 15px; }
    .text-preview { font-size: 13px; }
    .text-body { font-size: 16px; line-height: 1.6; }
    .text-stamp { font-size: 11px; }

    .prose {
        font-size: 17px;
        line-height: 1.6;
    }

    /* iOS Safari auto-zooms when a focused control is under 16px. */
    input,
    textarea,
    select {
        font-size: 16px !important;
    }

}

/* ------------------------------------------------------- collection layer
   The same quiet masthead and reading rhythm as the project collection: the
   topbar lines up with the homepage masthead (1320px sleeve, 44px gutters). */

.site-topbar {
    width: min(100% - 88px, 1232px);
    max-width: none;
    min-height: 74px;
    margin: 0 auto;
    padding-inline: 0;
    gap: 20px;
    background: transparent;
    backdrop-filter: none;
}
.site-brand { font-family: var(--font-serif); font-size: 24px; font-weight: 400; letter-spacing: -.6px; }
.site-brand:hover { color: var(--brand); }
.site-mark, .site-context { display: none; }
.site-nav { gap: 18px; }
.site-nav a { min-height: 36px; padding: 0; border-radius: 0; background: none; font-size: 13px; }
.site-nav a:hover { background: none; color: var(--brand); }
.site-crumb { color: var(--subtle-foreground); font-family: var(--font-mono); font-size: 10px; letter-spacing: .03em; white-space: nowrap; }

/* Theme toggle: a quiet circle that matches the cover flow's arrows. */
.theme-toggle {
    position: relative;
    width: 34px;
    min-height: 34px;
    height: 34px;
    padding: 0;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: transparent;
    color: var(--muted-foreground);
}
.theme-toggle:hover { border-color: var(--border-strong); background: transparent; color: var(--foreground); }
.theme-toggle svg { position: absolute; inset: 0; margin: auto; width: 15px; height: 15px; transition: opacity var(--motion-settle) var(--ease-standard), transform var(--motion-settle) var(--ease-standard); }
.theme-toggle .theme-icon-sun { opacity: 0; transform: rotate(-40deg) scale(.7); }
:root[data-theme="dark"] .theme-toggle .theme-icon-sun { opacity: 1; transform: none; }
:root[data-theme="dark"] .theme-toggle .theme-icon-moon { opacity: 0; transform: rotate(40deg) scale(.7); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .theme-icon-sun { opacity: 1; transform: none; }
    :root:not([data-theme="light"]) .theme-toggle .theme-icon-moon { opacity: 0; transform: rotate(40deg) scale(.7); }
}

.page-title { font-weight: 400; font-size: clamp(30px, 4vw, 38px); letter-spacing: -.035em; }
.page-header > .eyebrow { display: none; }
.page-subtitle { line-height: 1.7; }
.card { box-shadow: none; background: transparent; }
button, .btn { box-shadow: none; font-weight: 400; }
button.btn-primary, .btn-primary { background: var(--foreground); border-color: var(--foreground); color: var(--background); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }
input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),
select,
textarea { transition: border-color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard); }
input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):hover,
select:hover,
textarea:hover { border-color: var(--border-strong); }
/* Fields focus with a soft rust halo instead of a hard outline. */
input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):focus-visible,
select:focus-visible,
textarea:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
/* Every dropdown gets the site's quiet chevron, not the platform's. */
select:not([multiple]):not([size]) {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 36px;
    background: var(--background) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%238f8d82' stroke-width='1.5'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 12px center;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
/* color-scheme: dark already draws these icons light; no filter needed. */
.prose { line-height: 1.75; }
.editor-container { height: calc(100dvh - 75px); }
.site-skip { position: absolute; left: 16px; top: -80px; z-index: 200; padding: 10px; background: var(--background); }
.site-skip:focus { top: 10px; }
.app-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; padding: 18px 0; border-block: 1px solid var(--border); }
.app-toolbar label { display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: var(--muted-foreground); }
.app-toolbar .toolbar-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.app-status { min-height: 24px; color: var(--muted-foreground); font-size: 12px; padding-top: 7px; }
.app-status[data-error='true'] { color: var(--destructive); }
.app-footnote { color: var(--muted-foreground); font-size: 11px; line-height: 1.7; margin-top: 25px; }

/* Project covers stay small; the work on the page stays in the foreground. */
.page-art { display: block; width: 68px; height: 68px; background-size: 300% 300%; background-color: var(--art-placeholder); border-radius: 2px; flex-shrink: 0; box-shadow: 0 10px 18px -14px hsl(var(--shadow-color) / .7); }
.illustrated-header { display: grid; grid-template-columns: 68px minmax(0, 1fr); column-gap: 20px; align-items: start; }
.illustrated-header > .page-art { grid-column: 1; grid-row: 1 / span 4; }
.illustrated-header > :not(.page-art) { grid-column: 2; }
.illustrated-header .page-title { align-self: end; }
.illustrated-note-title { display: flex; align-items: center; gap: 12px; font: 400 23px var(--font-serif); }
.illustrated-note-title .page-art { width: 44px; height: 44px; }
.site-brand .masthead-art { width: 32px; height: 32px; margin-right: 10px; }
.page-edit .site-topbar,
.page-edit-hotwire .site-topbar { width: 100%; max-width: none; margin-inline: 0; padding-inline: 16px; min-height: 64px; }
.page-edit .editor-container,
.page-edit-hotwire .editor-container { height: calc(100dvh - 65px); }

/* Pager: the neighbors in the collection, closing every page. */
.collection-pager {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 24px;
    margin-top: 72px;
    padding-top: 26px;
    border-top: 1px solid var(--border);
}
.pager-link { display: flex; align-items: center; gap: 16px; min-width: 0; color: var(--foreground); text-decoration: none; }
.pager-next { flex-direction: row-reverse; text-align: right; }
.pager-art {
    width: 56px; height: 56px; flex: 0 0 auto;
    border-radius: 2px;
    background-color: var(--art-placeholder);
    background-size: 300% 300%;
    box-shadow: 0 10px 18px -14px hsl(var(--shadow-color) / .7);
    transition: transform var(--motion-settle) var(--ease-standard);
}
.pager-copy { display: grid; gap: 3px; min-width: 0; }
.pager-label, .pager-count { color: var(--subtle-foreground); font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.pager-title { font: 400 20px/1.25 var(--font-serif); letter-spacing: -.02em; text-wrap: balance; transition: color var(--motion-fast) var(--ease-standard); }
.pager-link:hover { color: var(--foreground); }
.pager-link:hover .pager-title { color: var(--brand); }
.pager-prev:hover .pager-art { transform: translateX(-3px); }
.pager-next:hover .pager-art { transform: translateX(3px); }
.pager-home { display: grid; justify-items: center; gap: 4px; color: var(--muted-foreground); font-size: 13px; text-decoration: none; }
.pager-home:hover { color: var(--brand); }

@media (max-width: 767px) {
    .site-topbar { width: calc(100% - 40px); min-height: 60px; padding-inline: 0; }
    .site-brand { font-size: 21px; }
    .site-nav { gap: 14px; }
    .site-nav a { width: auto; padding: 0; }
    .site-crumb { display: none; }
    .page-edit .editor-container, .page-edit-hotwire .editor-container, .editor-container { height: calc(100dvh - 61px); }
    .app-toolbar .toolbar-actions { margin-left: 0; }
    .collection-pager { grid-template-columns: 1fr 1fr; gap: 22px 16px; margin-top: 56px; }
    .pager-home { grid-column: 1 / -1; grid-row: 2; padding-top: 16px; border-top: 1px solid var(--border); }
    .pager-link { align-items: flex-start; flex-direction: column; gap: 10px; }
    .pager-next { align-items: flex-end; }
    .pager-art { width: 48px; height: 48px; }
    .pager-title { font-size: 17px; white-space: normal; }
}
@media (max-width: 600px) {
    .page-art { width: 52px; height: 52px; }
    .illustrated-header { grid-template-columns: 52px minmax(0, 1fr); column-gap: 14px; }
    .illustrated-header .page-title { font-size: 29px; }
}
@media print {
    .site-topbar, .collection-pager, .site-skip { display: none !important; }
}
