/* Shared foundation for every variant: palette, reset, prose, pagination. */

:root {
    /* Palette drawn from theme001 references */
    --forest-950: #0a1c15;
    --forest-900: #0f261d;
    --forest-800: #163628;
    --forest-700: #1f4a37;
    --brass: #c9a24d;
    --brass-light: #e2c27a;
    --brass-dark: #8a6a2a;
    --cream: #efe6d2;
    --cream-muted: #b8b09b;
    --signal: #d6452a;
    --mustard: #e2a628;
    --teal: #2d6a78;
    --oxblood: #6e1f2c;
    --graphite: #1a1915;
    --panel: #2a2820;

    /* Roles; variants remap these */
    --bg: var(--forest-900);
    --text: var(--cream);
    --text-muted: var(--cream-muted);
    --accent: var(--brass);
    --rule: color-mix(in srgb, var(--brass) 35%, transparent);

    --font-display: Georgia, serif;
    --font-body: Georgia, serif;
    --font-ui: system-ui, sans-serif;

    --measure: 40rem;
    --gutter: 1rem;
}

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

html { color-scheme: dark; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 1.125rem/1.7 var(--font-body);
    text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { color: var(--text); }

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; text-wrap: balance; }

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

.post-list { margin: 0; padding: 0; list-style: none; }
.post-index, .post-glyph { display: none; }
.post-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: 0; }
.post-tags { display: inline-flex; gap: .5rem; }
.post-tags a { color: inherit; }
.brand { text-decoration: none; color: inherit; }
.brand-mark { display: none; }
.nav-led { display: none; }
.site-nav ul { margin: 0; padding: 0; list-style: none; }
.site-nav a { text-decoration: none; }

/* Prose */
.prose p, .prose ul, .prose ol { margin-block: 0; }
/* Book-style paragraphs: consecutive paragraphs are indented, not spaced.
   Every other block gets space above, so the first paragraph after a
   heading, quote, image or list stays flush. */
.prose > * + :not(p + p),
.prose blockquote > * + :not(p + p) { margin-top: 1.1em; }
.prose p + p { text-indent: 1.5em; }
.prose h2 { font-size: 1.6rem; margin-top: 2.2em; }
.prose h3 { font-size: 1.3rem; margin-top: 1.8em; }
.prose blockquote {
    margin-inline: 0;
    padding-left: 1.25rem;
    border-left: 2px solid var(--accent);
    color: var(--text-muted);
}
.prose img { margin-inline: auto; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin-block: 2.5em; }
.prose code { font-size: .9em; }
.prose sup { line-height: 0; }

/* Highlights: write <mark>…</mark> in a post. Dark text on mustard is about
   8:1 contrast. Without this stylesheet (Reader View, feed readers) <mark>
   falls back to the browser's own highlight. Screen readers mostly skip
   <mark>, so hidden ::before/::after text announces where it starts and ends.
   <mark class="red"> and <mark class="blue"> pick the other two palette colors:
   black on signal is about 4.7:1 (forest-950 would only reach 4:1), cream on
   teal about 4.9:1. */
mark {
    background: var(--mustard);
    color: var(--forest-950);
    padding: .05em .2em;
    border-radius: .1em;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}
mark.red { background: var(--signal); color: #000; }
mark.blue { background: var(--teal); color: var(--cream); }
mark a, mark a:hover { color: inherit; text-decoration-thickness: 1px; }
mark::before, mark::after {
    clip-path: inset(100%);
    clip: rect(1px, 1px, 1px, 1px);
    height: 1px; width: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
}
mark::before { content: " [highlight start] "; }
mark::after { content: " [highlight end] "; }
@media (forced-colors: active) {
    mark, mark.red, mark.blue { background: Mark; color: MarkText; }
}

/* Pagination */
.pagination {
    display: flex; flex-wrap: wrap; gap: .5rem;
    margin: 3rem 0 0; padding: 0; list-style: none;
    font-family: var(--font-ui);
}
.pagination a, .pagination span {
    display: grid; place-items: center;
    min-width: 2.5rem; height: 2.5rem; padding-inline: .5rem;
    text-decoration: none;
}
.pagination span:not(.active) { opacity: .35; }

/* Development-only variant switcher */
.variant-switcher {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 99;
    display: flex; gap: 2px; padding: 3px;
    background: #000c; border-radius: 999px;
    font: 500 .75rem/1 system-ui, sans-serif;
    backdrop-filter: blur(6px);
}
.variant-switcher a { padding: .55rem .8rem; border-radius: 999px; color: #ddd; text-decoration: none; }
.variant-switcher a[aria-current] { background: #fff; color: #000; }

@media (max-width: 40rem) {
    body { font-size: 1.0625rem; }
    .variant-switcher { left: 1rem; right: 1rem; justify-content: center; }
}
