/* ==========================================================================
   Main CSS - Consolidated
   ========================================================================== */

/* ==========================================================================
   Variables
   ========================================================================== */

:root {
    /* Palette */
    --color-bg-paper: #F5F3EE;
    --color-text-ink: #2C2D30;
    --color-text-light: #595A5D;
    --color-accent: #B3202A;   /* cinnabar, from the seal paste */
    --color-line: rgba(44, 45, 48, 0.15);

    /* Typography */
    --font-heading: 'Cormorant Garamond', serif;
    --font-body: 'Newsreader', serif;

    /* Spacing */
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;
}

/* ==========================================================================
   Reset & Base Body Styles
   ========================================================================== */

body {
    background-color: var(--color-bg-paper);
    color: var(--color-text-ink);
    font-family: var(--font-body);
    font-weight: 400;
    font-variant-numeric: oldstyle-nums;
    line-height: 1.7;
    margin: 0;
    padding: 0;

    /* Paper: the fine bumps of the sheet's surface, lit from the upper left. The bumps are grey and soft-light
       blended, so they lighten and darken the paper colour without tinting it */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeDiffuseLighting surfaceScale='2' lighting-color='%23fff'%3E%3CfeDistantLight azimuth='225' elevation='35'/%3E%3C/feDiffuseLighting%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)' opacity='.35'/%3E%3C/svg%3E");
    background-size: 300px;
    background-blend-mode: soft-light;
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3 {
    font-family: var(--font-heading);
    color: var(--color-text-ink);
    margin-top: 0;
}

a {
    color: var(--color-text-ink);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

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

a:hover {
    color: var(--color-accent);
    border-bottom: 1px solid var(--color-accent);
}

/* ==========================================================================
   Layout - Container & Grid
   ========================================================================== */

.l-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem var(--space-md);
}

/* The top margin clears the painting's bamboo, which hangs to 300px below the page top, so a long first
   post title can run under it. Narrow screens give the bird its own row (see the 960px query) */
.l-grid-sidebar {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: var(--space-lg);
    margin-top: 6rem;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .l-grid-sidebar {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
}

/* ==========================================================================
   Header Component
   ========================================================================== */

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0;
    border-bottom: none !important;
    padding-bottom: 0;
    position: relative;
}

.site-header__branding {
    max-width: 60%;
}

.site-header__branding h1 {
    font-size: 3rem;
    margin-bottom: 0.2rem;
    font-weight: 700;
}

.site-header__title-link {
    border-bottom: none;
}

.site-header__title-link:hover {
    border-bottom: none;
}

.site-header__tagline {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.2rem;
    color: var(--color-text-light);
    margin: 0;
}

.site-header__logo {
    width: 300px;
    height: auto;
    display: block;
    border-radius: 2px;
    position: absolute;
    top: -50px;
    right: -20px;
    z-index: 10;
    pointer-events: none;
}

/* Kea: the painting, replaced by a bird-free plate plus a live 3D head (static/js/kea3d.js) and body of
   feathers (static/js/kea-body.js), each on a canvas */
.c-kea__painting {
    display: block;
    width: 100%;
    height: auto;
}

/* Narrow screens: every page opens with one row, short text on the left (the name, or a post's date and
   author) and the bird on the right. The row is as tall as the bird, so the bird holds still between pages
   and page titles start below it */
@media (max-width: 960px) {
    .l-container {
        padding-top: 1rem;
    }

    .site-header {
        min-height: 120px;
        align-items: flex-end;
        padding-right: 130px;
    }

    .site-header__logo {
        top: 0;
        right: 0;
        width: 120px;
    }

    .site-header__branding {
        max-width: none;
    }

    .site-header__branding h1 {
        font-size: 2.25rem;
        margin-bottom: 0;
    }

    .l-grid-sidebar,
    .l-page {
        margin-top: var(--space-md);
    }
}

/* ==========================================================================
   Footer Component
   ========================================================================== */

.site-footer {
    margin-top: 5rem;
    padding-bottom: var(--space-md);
    font-size: 0.85rem;
    color: var(--color-text-light);
}

/* ==========================================================================
   Post List & Post Preview Components
   ========================================================================== */

/* Section Title (reusable) */
.c-section-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--color-text-light);
    margin: 0 0 1.5rem;
}

/* Bio Component */
.c-bio p {
    margin-bottom: 1.5rem;
    font-family: var(--font-body);
    font-size: 1.2rem;
}

/* Post List */
.c-post-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Post Preview */
.c-post-preview {
    display: block;
    margin-bottom: var(--space-md);
}

.c-post-preview__title a {
    border-bottom: none;
}

.c-post-preview__title a:hover {
    border-bottom: none;
    color: var(--color-accent);
    text-decoration: underline 1px;
    text-underline-offset: 0.2em;
}

.c-post-preview__date {
    font-size: 0.8rem;
    color: var(--color-text-light);
    display: block;
    margin-bottom: 0.3rem;
}

.c-post-preview__title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
    display: block;
}

.c-post-preview__excerpt {
    font-size: 0.95rem;
    color: var(--color-text-light);
    margin-top: 0.5rem;
    display: block;
}

/* Home page sections below "Selected writings": quieter titles, date beside the title */
.c-section-title--spaced {
    margin-top: 3.5rem;
}

.c-post-preview--compact {
    margin-bottom: 1.4rem;
}

.c-post-preview--compact .c-post-preview__title {
    font-weight: 400;
    font-size: 1.25rem;
}

.c-post-preview--compact .c-post-preview__date {
    display: inline;
    margin: 0 0 0 0.4em;
    white-space: nowrap;
    font-family: var(--font-body);
}

/* "New" tag beside the newest post */
.c-new-tag {
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-accent);
    border: 1px solid currentColor;
    border-radius: 3px;
    padding: 0.05em 0.4em;
    margin-left: 0.4em;
    vertical-align: 0.3em;
    white-space: nowrap;
}

/* ==========================================================================
   Single Column Layout
   ========================================================================== */

.l-single-column {
    max-width: 65ch;
}

/* Posts fill the room the window gives them, up to 1.5x the usual width. The text starts at 50vw - 450px
   (the centered 900px container), and its 260px sidenote margin plus a 16px gutter must fit to the right,
   which leaves 50vw + 174px. */
.is-post .l-single-column {
    max-width: min(97.5ch, calc(50vw + 174px));
}

/* Single-column pages under the full header (post list, 404) */
.l-page {
    margin-top: var(--space-lg);
}

/* ==========================================================================
   Article Component (Single Posts)
   ========================================================================== */

/* Date and author sit above the title, sized to stay legible in a zoomed-out screenshot */
.c-article__date {
    font-size: 0.85rem;
    color: var(--color-text-light);
    display: block;
}

.c-article__byline {
    font-size: 1.15rem;
    border-bottom: none;
}

.c-article__byline:hover {
    border-bottom: none;
}

.c-article__title {
    font-size: 2.5rem;
    margin: 0.75rem 0 1.5rem;
    line-height: 1.2;
}

/* Wide screens: the painting hangs over the right of the header, about 280px in from the column's edge, so a
   long title wraps before it. Narrow screens give the bird its own row (see the 960px query) */
@media (min-width: 961px) {
    .c-article__title {
        max-width: calc(100% - 290px);
    }
}

.c-article__excerpt {
    font-size: 1.05rem;
    color: var(--color-text-light);
    margin: -1rem 0 1.5rem;
}

/* Bracketed links under the subtitle (`links` front matter), in cinnabar */
.c-article__links {
    font-size: 0.9rem;
    margin: -1rem 0 0.75rem;
}

/* The first paragraph's own top margin would otherwise collapse with the links' and reopen the gap. On narrow
   screens the folded contents sit in between and keep their own spacing */
.c-article__links ~ .c-article__content > :first-child {
    margin-top: 0;
}

.c-article__links a {
    color: var(--color-accent);
    text-decoration: none;
    border-bottom: none;
    background: none;
    margin-right: 0.75em;
}

.c-article__links a:hover {
    color: var(--color-accent);
    border-bottom: none;
    text-decoration: underline 1px;
    text-underline-offset: 0.2em;
}

.c-article__content {
    font-family: var(--font-body);
    font-size: 1.25rem;
    line-height: 1.65;
}

.c-article__content a {
    border-bottom: 1px solid color-mix(in srgb, var(--color-accent) 50%, transparent);
}

/* Alex's seal, stamped in cinnabar: the end mark after a post's last word, and after the name in the
   homepage footer. It links home */
.c-seal,
.c-seal:hover,
.c-article__content .c-seal {
    border-bottom: none;
}

.c-seal img {
    display: inline-block;
    width: 1.05em;
    height: 1.05em;
    margin-left: 0.45em;
    vertical-align: -0.18em;
    mix-blend-mode: multiply;
    transition: opacity 0.2s ease;
}

.c-seal:hover img {
    opacity: 0.7;
}

.c-article__content p {
    margin-bottom: 1.5rem;
}

/* Images and figures in an essay span its full width and keep their own shape. The seal sits inside a
   link, so it stays the size of the text */
.c-article__content > p > img,
.c-article__content figure {
    display: block;
    width: 100%;
    height: auto;
}

/* The odds figure (layouts/partials/figure-odds.html, static/js/odds.js): dots in the painting's ink, and
   cinnabar for the outcomes that pay */
.c-odds,
.c-company,
.c-gradient,
.c-recall,
.c-keepsum {
    margin: 0 0 var(--space-md);
}

.c-odds svg,
.c-company svg,
.c-gradient svg,
.c-recall svg,
.c-keepsum svg {
    display: block;
    width: 100%;
    height: auto;
}

.c-odds__dot {
    fill: #373229;
    transform-box: fill-box;
    transform-origin: center;
    transition: fill .6s ease, opacity .6s ease, transform .6s ease;
}

.c-odds__hit {
    fill: var(--color-accent);
}

/* The red spreads out from the one dot until it fills its square; going back, the square clears all at once */
.is-priced .c-odds__col {
    fill: var(--color-accent);
    opacity: 1;
    transform: scale(var(--s));
    transition-delay: var(--d);
}

@media (prefers-reduced-motion: reduce) {
    .c-odds * {
        transition: none;
    }
}

/* The company figure (layouts/partials/figure-company.html, static/js/company.js): people and outcomes in
   the painting's ink, faint lines for the ties between people, and the model in cinnabar */
.c-company__ink {
    fill: #373229;
}

.c-company__ties {
    stroke: #373229;
    stroke-width: .6;
    opacity: .28;
}

.c-company__model {
    fill: var(--color-accent);
}

/* The gradient figure (layouts/partials/figure-gradient.html, static/js/gradient.js): entries in the painting's
   ink and faint bowed lines for the terms of the rote chain-rule sum. The script turns what survives the untangling,
   and the gradient itself, cinnabar */
.c-gradient__ink {
    fill: #373229;
}

.c-gradient__ties {
    fill: none;
    stroke: #373229;
    stroke-width: .5;
    stroke-opacity: .13;
}

/* The recall figure (layouts/partials/figure-recall.html, static/js/recall.js): each store's recalled picture in
   dots, cinnabar while its recall works and the painting's ink once interference outweighs the signal */
.c-recall__pic {
    fill: #373229;
    fill-opacity: .8;
    transition: fill .8s ease;
}

.c-recall__pic.is-recalled {
    fill: var(--color-accent);
}

.c-recall__label {
    font-family: var(--font-body);
    font-size: 11px;
    fill: #373229;
    text-anchor: middle;
}

/* The keep-or-sum figure (layouts/partials/figure-keepsum.html, static/js/keepsum.js): the layer that sums its
   memories in the painting's ink, the layer that keeps them in cinnabar */
.c-keepsum__pic {
    fill: #373229;
    fill-opacity: .8;
}

.c-keepsum__pic--kept {
    fill: var(--color-accent);
}

.c-keepsum__label,
.c-keepsum__count {
    font-family: var(--font-body);
    font-size: 11px;
    fill: #373229;
    text-anchor: middle;
}

.c-keepsum__count {
    font-variant-numeric: tabular-nums;
    fill-opacity: .7;
}

.c-keepsum__caption {
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-top: .5rem;
}

.c-recall__caption {
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-top: .5rem;
}

/* Other posts to read next, between the end of the essay and the citation */
.c-more {
    margin-top: var(--space-lg);
}

.c-article__content h2 {
    margin-top: var(--space-md);
    margin-bottom: 1rem;
}

/* ==========================================================================
   Footnotes / Sidenotes (sidenotes on wide screens, bottom list otherwise)
   ========================================================================== */

.footnotes {
    font-size: 0.85rem;
    color: var(--color-text-light);
}

/* Plain muted numbers instead of the default underlined-link look */
.c-article__content sup {
    line-height: 0;
}

.footnote-ref,
.footnote-backref,
.sidenote sup {
    color: var(--color-text-light);
    border-bottom: none;
    font-size: 0.75em;
}

.footnote-ref:hover,
.footnote-backref:hover {
    border-bottom: none;
    opacity: 0.7;
}

.sidenote {
    display: none;
}

@media (min-width: 1000px) {
    .sidenote {
        display: block;
        float: right;
        clear: right;
        width: 220px;
        margin: 0.3rem -260px 1rem 0;
        font-size: 0.8rem;
        line-height: 1.5;
        color: var(--color-text-light);
    }

    .footnotes {
        display: none;
    }
}

/* ==========================================================================
   Citation
   ========================================================================== */

.c-citation {
    margin-top: var(--space-md);
    padding-top: 1rem;
    border-top: 1px solid var(--color-line);
    font-size: 0.85rem;
    color: var(--color-text-light);
}

.c-citation summary {
    cursor: pointer;
}

.c-citation pre {
    overflow-x: auto;
    padding: 1rem;
    background: rgba(44, 45, 48, 0.04);
    border-radius: 2px;
}

.c-citation__box {
    position: relative;
}

.c-citation__copy {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.15rem 0.55rem;
    font: inherit;
    font-size: 0.75rem;
    color: var(--color-text-light);
    background: var(--color-bg-paper);
    border: 1px solid var(--color-line);
    border-radius: 2px;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.c-citation__copy:hover,
.c-citation__copy:focus-visible {
    color: var(--color-accent);
    border-color: var(--color-accent);
}

/* ==========================================================================
   Page transitions: an ink flick
   Clicking a link on the site flicks a brush stroke of ink across it, then the page follows
   (layouts/partials/ink-splash.html). Where the browser supports cross-document view transitions, the
   old page, ink and all, fades into the new one. The painting never moves.
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
    @view-transition {
        navigation: auto;
    }
}

.c-kea {
    view-transition-name: kea;
}

::view-transition {
    background: var(--color-bg-paper);
}

::view-transition-group(kea),
::view-transition-new(kea),
::view-transition-new(root) {
    animation: none;
}

::view-transition-old(kea) {
    display: none;
}

::view-transition-old(root) {
    animation: ink-lift 180ms ease-in both;
}

@keyframes ink-lift {
    to {
        opacity: 0;
        filter: blur(.6px);
    }
}

.c-ink-splash {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

/* Wide display math scrolls on its own instead of widening the page */
mjx-container[display="true"] {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
}

/* Obsidian-style callouts (render-blockquote.html): a rule down the left; folded ones open on click */
.c-callout {
    margin: 0 0 1.5rem;
    padding-left: 1rem;
    border-left: 2px solid var(--color-line);
}

.c-callout__title {
    margin-bottom: 0.75rem;
    font-weight: 600;
}

summary.c-callout__title {
    cursor: pointer;
}

details.c-callout:not([open]) > .c-callout__title {
    margin-bottom: 0;
}

/* Inline code: a smaller monospace set in a thin box */
.c-article__content :not(pre) > code {
    font-size: 0.82em;
    padding: 0.1em 0.35em;
    border: 1px solid var(--color-line);
    border-radius: 3px;
    background: rgba(44, 45, 48, 0.04);
}

/* Tables: rules between rows; a table wider than the column scrolls inside itself */
.c-article__content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    margin: var(--space-sm) 0;
    border-collapse: collapse;
    font-size: 0.9em;
}
.c-article__content th,
.c-article__content td {
    padding: 0.4em 0.75em;
    border-bottom: 1px solid var(--color-line);
    text-align: left;
    vertical-align: top;
}
.c-article__content th { font-weight: 600; border-bottom-color: var(--color-text-light); }

/* Code blocks: Hugo's highlighter sets the dark background; long lines scroll inside it */
.c-article__content pre {
    font-size: 0.8rem;
    line-height: 1.5;
    padding: 1rem 1.25rem;
    border-radius: 4px;
    overflow-x: auto;
}

/* Table of contents (toc: true): folded like the citation box, above the post's text */
.c-toc {
    margin-bottom: var(--space-md);
    font-size: 0.9rem;
    color: var(--color-text-light);
}

.c-toc summary {
    cursor: pointer;
}

.c-toc ul {
    margin: 0.5rem 0 0;
    padding-left: 1.1rem;
    list-style: none;
}

.c-toc ul ul {
    margin-top: 0;
    padding-left: 1rem;
}

.c-toc li {
    margin: 0.2rem 0;
}

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

.c-toc a:hover {
    color: var(--color-accent);
}

/* Wide screens: the contents sit open in the left margin, beside the 900px container (1360px is the narrowest window with room), and stay put while
   the post scrolls. The script in posts/single.html opens it and marks the section being read. */
.c-toc a.is-active {
    color: var(--color-accent);
}

@media (min-width: 1360px) {
    .c-toc {
        position: fixed;
        top: 8rem;
        left: calc(50vw - 450px - 210px);
        width: 180px;
        max-height: calc(100vh - 10rem);
        overflow-y: auto;
        margin: 0;
        font-size: 0.8rem;
        line-height: 1.4;
    }

    .c-toc summary {
        pointer-events: none;
        list-style: none;
        font-family: var(--font-heading);
        font-size: 1rem;
        color: var(--color-text-ink);
    }

    .c-toc summary::-webkit-details-marker {
        display: none;
    }

    .c-toc ul {
        padding-left: 0;
    }

    .c-toc ul ul {
        padding-left: 0.8rem;
    }
}

/* Section links (render-heading.html): a # after each heading, shown on hover or focus */
.c-article__content :is(h2, h3, h4) {
    scroll-margin-top: 1.5rem;
}

.c-article__content .c-heading-anchor {
    margin-left: 0.35em;
    border-bottom: none;
    color: var(--color-text-light);
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.c-article__content :is(h2, h3, h4):hover .c-heading-anchor,
.c-article__content .c-heading-anchor:focus-visible {
    opacity: 1;
}

.c-article__content .c-heading-anchor:hover {
    color: var(--color-accent);
}

/* No hover on touch screens, so keep the # faintly visible there */
@media (hover: none) {
    .c-article__content .c-heading-anchor {
        opacity: 0.4;
    }
}

/* Crosstalk chart (layouts/shortcodes/crosstalk-chart.html): like the site's other figures, the painting's ink,
   lighter for weaker suppression, and the strongest series in cinnabar. Text in the body font, italic variables */
.c-crosstalk { margin: var(--space-md) 0; }
.c-crosstalk svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font-body); }
.c-crosstalk__grid { stroke: #373229; stroke-opacity: .1; stroke-width: 1; }
.c-crosstalk__one { stroke-opacity: .45; stroke-dasharray: 4 4; }
.c-crosstalk__axis { stroke: #373229; stroke-opacity: .45; stroke-width: 1; }
.c-crosstalk__tick { font-size: 13px; fill: var(--color-text-light); }
.c-crosstalk__label { font-size: 14px; fill: var(--color-text-light); }
.c-crosstalk__series { font-size: 15px; fill: var(--color-text-ink); }
.c-crosstalk__var { font-style: italic; }
.c-crosstalk__sup, .c-crosstalk__sub { font-size: 11px; }
.c-crosstalk__line polyline { fill: none; stroke: #373229; stroke-opacity: var(--op); stroke-width: 1.6; }
.c-crosstalk__line circle { fill: #373229; fill-opacity: var(--op); stroke: var(--color-bg-paper); stroke-width: 1.5; }
.c-crosstalk__line--accent polyline { stroke: var(--color-accent); stroke-opacity: 1; stroke-width: 2; }
.c-crosstalk__line--accent circle { fill: var(--color-accent); fill-opacity: 1; }
.c-crosstalk__line circle:hover { r: 5.5; }
.c-crosstalk__drowned { fill: #373229; opacity: .07; }
.c-crosstalk__drowned-label { font-size: 13px; font-style: italic; fill: var(--color-text-light); }
.c-crosstalk__note { font-size: 13px; fill: var(--color-text-light); }
.c-crosstalk__drop { stroke: #373229; stroke-width: 1.5; stroke-dasharray: 2 3; }

/* Endpoints figure (layouts/shortcodes/endpoints-figure.html): faint ink paths, the most likely one in cinnabar */
.c-endpoints { margin: var(--space-md) 0; }
.c-endpoints svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font-body); }
.c-endpoints__path { fill: none; stroke: #373229; stroke-opacity: .28; stroke-width: 1.3; stroke-linejoin: round; }
.c-endpoints__path--miss { stroke-dasharray: 3 3; }
.c-endpoints__best { fill: none; stroke: var(--color-accent); stroke-width: 2.2; }
.c-endpoints__dot { fill: #373229; }
.c-endpoints__best-end { fill: var(--color-accent); }
.c-endpoints__end { fill: var(--color-bg-paper); stroke: #373229; stroke-width: 1.3; }
.c-endpoints__region { fill: #373229; fill-opacity: .07; stroke: #373229; stroke-opacity: .45; stroke-dasharray: 4 4; }
.c-endpoints__title { font-size: 15px; fill: var(--color-text-ink); }
.c-endpoints__label { font-size: 14px; fill: var(--color-text-light); }
.c-endpoints__best-label { font-size: 14px; font-style: italic; fill: var(--color-accent); }

/* The least-action figure (layouts/shortcodes/least-action.html), styled like the memory-bars figure */
.c-leastaction { margin: var(--space-md) 0; --ink: #373229; --red: #B3202A; font-family: var(--font-body); }
.c-leastaction__canvas { display: block; width: 100%; height: 300px; }
.c-leastaction__legend { display: flex; gap: 1.5em; flex-wrap: wrap; font-size: 0.85rem; color: var(--color-text-light); margin-top: .35rem; }
.c-leastaction__swatch { display: inline-block; width: 1.2em; height: 2px; background: var(--red); margin-right: .4em; vertical-align: .3em; }
.c-leastaction__slider { display: flex; align-items: center; gap: .6em; flex-wrap: wrap; font-size: 0.9rem; color: var(--color-text-light); margin-top: .5rem; font-variant-numeric: tabular-nums; }
.c-leastaction input[type=range] { flex: 1 1 160px; max-width: 260px; accent-color: #373229; }
.c-leastaction__readout { font-size: 0.9rem; color: var(--color-text-ink); margin-top: .35rem; font-variant-numeric: tabular-nums; }

/* The reasoning-as-path-finding figures (layouts/shortcodes/rl-walks.html) */
.c-rlwalks { margin: var(--space-md) 0; --ink: #373229; --red: #B3202A; font-family: var(--font-body); }
.c-rlwalks__canvas { display: block; width: 100%; height: 280px; }
.c-rlwalks__canvas--amortize { height: 360px; }
/* The walks variant opens the post (`figure: rlwalks`), so it takes the other opening figures' frame: the full column
   at 564:150 like the memory posts' strips, flush to the top, with a small caption */
.c-rlwalks[data-variant="walks"] { margin: 0 0 var(--space-md); }
.c-rlwalks__canvas--walks { height: auto; aspect-ratio: 564 / 150; }
.c-rlwalks__caption { font-size: 0.85rem; color: var(--color-text-light); margin-top: .5rem; }
.c-rlwalks__controls { display: flex; gap: 1.5em; flex-wrap: wrap; align-items: center; margin-top: .5rem; font-size: 0.9rem; color: var(--color-text-light); font-variant-numeric: tabular-nums; }
.c-rlwalks__check input { accent-color: #B3202A; }
.c-rlwalks__stages { display: inline-flex; border: 1px solid rgba(55, 50, 41, .35); border-radius: 4px; overflow: hidden; }
.c-rlwalks__stages button { font: inherit; color: inherit; background: none; border: 0; padding: .2em .7em; cursor: pointer; }
.c-rlwalks__stages button + button { border-left: 1px solid rgba(55, 50, 41, .35); }
.c-rlwalks__stages button[aria-pressed="true"] { background: #373229; color: #F5F3EE; }

/* The training figure (layouts/shortcodes/training-paths.html): three panels in a row, stacked on phones */
.c-training { margin: var(--space-md) 0; --ink: #373229; --red: #B3202A; font-family: var(--font-body); }
.c-training__panels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; }
@media (max-width: 600px) { .c-training__panels { grid-template-columns: 1fr; } }
.c-training__title { font-size: 0.9rem; color: var(--color-text-ink); }
.c-training__canvas { display: block; width: 100%; aspect-ratio: 1.6; }
.c-training__stat { font-size: 0.85rem; color: var(--color-text-ink); margin: .2rem 0 .3rem; font-variant-numeric: tabular-nums; }
.c-training__route { display: grid; grid-template-columns: 6.5em 1fr 3em; align-items: center; gap: .5em; font-size: 0.8rem; color: var(--color-text-light); font-variant-numeric: tabular-nums; }
.c-training__track { position: relative; height: 8px; background: rgba(55, 50, 41, .06); }
.c-training__track::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; border-left: 1px solid rgba(55, 50, 41, .45); }
.c-training__bar { position: absolute; top: 0; bottom: 0; background: var(--ink); opacity: .55; }
.c-training__route--red .c-training__bar { background: var(--red); opacity: .85; }
.c-training__value { text-align: right; color: var(--color-text-ink); }
.c-training__legend { display: flex; gap: 1.5em; flex-wrap: wrap; font-size: 0.85rem; color: var(--color-text-light); margin-top: .6rem; }

/* The memory-bars figure (layouts/shortcodes/memory-bars.html) */
.c-membars__slider { display: flex; align-items: center; gap: .6em; flex-wrap: wrap; font-size: 0.9rem; color: var(--color-text-light); margin: .25rem 0 0 52px; }
.c-membars input[type=range] { flex: 1 1 160px; max-width: 260px; accent-color: #373229; }
.c-membars { margin: var(--space-md) 0; --ink: #373229; --red: #B3202A; }
.c-membars__controls { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .5rem; }
.c-membars__slider { margin-left: 0; }
.c-membars__modes { border: none; padding: 0; margin: 0; display: flex; gap: 1em; flex-wrap: wrap; font-size: 0.9rem; color: var(--color-text-ink); }
.c-membars__modes legend { float: left; margin-right: .5em; color: var(--color-text-light); }
.c-membars__modes input { accent-color: #373229; }
.c-membars__bars { display: block; width: 100%; height: 220px; border-bottom: 1px solid rgba(55, 50, 41, .2); }
.c-membars__legend { display: flex; gap: 1.5em; flex-wrap: wrap; font-size: 0.85rem; color: var(--color-text-light); margin-top: .35rem; }
.c-membars__swatch { display: inline-block; width: .8em; height: .8em; background: var(--red); margin-right: .4em; vertical-align: -0.05em; }
.c-membars__meter { display: flex; align-items: center; gap: .8em; flex-wrap: wrap; font-size: 0.9rem; color: var(--color-text-ink); margin-top: .5rem; font-variant-numeric: tabular-nums; }
.c-membars__meter-track { position: relative; flex: 1 1 160px; max-width: 320px; height: 8px; background: rgba(55, 50, 41, .08); }
.c-membars__meter-track::after { content: ""; position: absolute; left: 50%; right: 0; top: 0; bottom: 0; background: rgba(55, 50, 41, .1); }
.c-membars__meter-fill { position: absolute; left: 0; top: 0; bottom: 0; background: #373229; opacity: .7; }
.c-membars__meter-one { position: absolute; left: 50%; top: -3px; bottom: -3px; border-left: 1px dashed rgba(55, 50, 41, .6); }
.c-membars__fail { font-size: 0.85rem; font-style: italic; color: var(--color-text-light); visibility: hidden; }
.c-membars.is-failing .c-membars__fail { visibility: visible; }
.c-membars__beta-row[hidden] { display: none; }

/* The three-memories figure (layouts/shortcodes/three-memories.html), styled like the memory-bars figure */
.c-three { margin: var(--space-md) 0; --ink: #373229; --red: #B3202A; }
.c-three__controls { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .5rem; }
.c-three__modes { border: none; padding: 0; margin: 0; display: flex; gap: 1em; flex-wrap: wrap; font-size: 0.9rem; color: var(--color-text-ink); }
.c-three__modes legend { float: left; margin-right: .5em; color: var(--color-text-light); }
.c-three__modes input { accent-color: #373229; }
.c-three__slider { display: flex; align-items: center; gap: .6em; flex-wrap: wrap; font-size: 0.9rem; color: var(--color-text-light); }
.c-three input[type=range] { flex: 1 1 160px; max-width: 260px; accent-color: #373229; }
.c-three__beta-row[hidden] { display: none; }
.c-three__panels { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
@media (max-width: 600px) { .c-three__panels { grid-template-columns: 1fr; } }
.c-three__circle { display: block; width: 100%; height: 240px; cursor: grab; touch-action: none; }
.c-three__circle:active { cursor: grabbing; }
.c-three__bars { display: block; width: 100%; height: 240px; }
.c-three__legend { display: flex; gap: 1.5em; flex-wrap: wrap; font-size: 0.85rem; color: var(--color-text-light); margin-top: .35rem; }
.c-three__swatch { display: inline-block; width: .8em; height: .8em; background: var(--red); margin-right: .4em; vertical-align: -0.05em; }
.c-three__meter { display: flex; align-items: center; gap: .8em; flex-wrap: wrap; font-size: 0.9rem; color: var(--color-text-ink); margin-top: .5rem; font-variant-numeric: tabular-nums; }
.c-three__meter-track { position: relative; flex: 1 1 160px; max-width: 320px; height: 8px; background: rgba(55, 50, 41, .08); }
.c-three__meter-track::after { content: ""; position: absolute; left: 50%; right: 0; top: 0; bottom: 0; background: rgba(55, 50, 41, .1); }
.c-three__meter-fill { position: absolute; left: 0; top: 0; bottom: 0; background: #373229; opacity: .7; }
.c-three__meter-one { position: absolute; left: 50%; top: -3px; bottom: -3px; border-left: 1px dashed rgba(55, 50, 41, .6); }
.c-three__fail { font-size: 0.85rem; font-style: italic; color: var(--color-text-light); visibility: hidden; }
.c-three.is-failing .c-three__fail { visibility: visible; }

/* The memory-grid figure (layouts/shortcodes/memory-grid.html): a two by two grid, the growing layer in cinnabar */
.c-memgrid { margin: var(--space-md) 0; }
.c-memgrid__grid { display: grid; grid-template-columns: minmax(5em, .8fr) minmax(0, 1fr) minmax(0, 1fr); gap: .5rem; }
.c-memgrid__head { font-size: 0.85rem; color: var(--color-text-light); text-align: center; align-self: end; }
.c-memgrid__side { font-size: 0.85rem; color: var(--color-text-light); align-self: center; text-align: right; }
.c-memgrid__cell { border: 1px solid rgba(55, 50, 41, .3); padding: .8rem .6rem; text-align: center; display: flex; flex-direction: column; gap: .35rem; justify-content: center; min-height: 6.5em; }
.c-memgrid__cell b { font-weight: 500; color: var(--color-text-ink); }
.c-memgrid__cell span { font-size: 0.85rem; color: var(--color-text-light); }
.c-memgrid__cell--new { border-color: var(--color-accent); background: rgba(179, 32, 42, .06); }
.c-memgrid__cell--new b { color: var(--color-accent); }

/* ==========================================================================
   CV (layouts/cv/single.html, content/cv/index.md)
   ========================================================================== */

/* Static fonts for the CV. Google Fonts serves variable fonts, which Chrome writes into the PDF as Type 3
   fonts that some ATS parsers can't read; static ones go in as plain TrueType */
@font-face { font-family: 'CV Newsreader'; src: url('/fonts/cv/newsreader-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'CV Newsreader'; src: url('/fonts/cv/newsreader-latin-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; }
@font-face { font-family: 'CV Newsreader'; src: url('/fonts/cv/newsreader-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; }
@font-face { font-family: 'CV Cormorant'; src: url('/fonts/cv/cormorant-garamond-latin-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; }
@font-face { font-family: 'CV Cormorant'; src: url('/fonts/cv/cormorant-garamond-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; }
@font-face { font-family: 'CV Cormorant'; src: url('/fonts/cv/cormorant-garamond-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-style: normal; }

/* The sheet is a US Letter page, 8.5in wide with the PDF's margins, and the type is sized in em off
   --cv-size (front matter `size`, 10pt by default). So the screen copy breaks lines where the PDF does */
.l-cv { margin-top: var(--space-sm); }

.c-cv-nav {
    display: flex;
    justify-content: space-between;
    max-width: 8.5in;
    margin: 0 auto var(--space-sm);
    font-size: 0.95rem;
}

.c-cv-nav a { color: var(--color-text-light); }

.c-cv {
    --font-heading: 'CV Cormorant', serif;
    --font-body: 'CV Newsreader', serif;
    font-family: var(--font-body);
    font-size: var(--cv-size, 10pt);
    line-height: 1.3;
    width: 8.5in;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 0.5in 0.6in;
    background: #FCFBF8;
    box-shadow: 0 1px 2px rgba(44, 45, 48, 0.08), 0 10px 40px rgba(44, 45, 48, 0.08);
    /* Parsers read "fi" and "ffi" ligatures as one odd character, and a word hyphenated across lines as
       two, so both stay off: every keyword survives text extraction intact */
    font-variant-ligatures: no-common-ligatures;
    hyphens: manual;
    page: cv;
}

.c-cv a { color: inherit; border-bottom: none; }
.c-cv a:hover { color: var(--color-accent); border-bottom: none; }
.c-cv p { margin: 0.3em 0; }

.c-cv__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2em;
    margin-bottom: 0.3em;
}

.c-cv__name {
    font-size: 3em;
    font-weight: 700;
    line-height: 1;
    margin: 0 0 0.08em;
}

.c-cv__headline {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.4em;
    line-height: 1.25;
    margin: 0 0 0.25em !important;
}

.c-cv__contact { color: var(--color-text-light); }
/* Items wrap whole, after a separator */
.c-cv__contact span { white-space: nowrap; }
.c-cv__contact span:not(:last-child)::after { content: "\00b7"; margin: 0 0.3em 0 0.55em; }
.c-cv__head > div { min-width: 0; }

/* ## Section: a cinnabar title with a hairline running out to the margin */
.c-cv h2 {
    display: flex;
    align-items: center;
    gap: 0.6em;
    font-size: 1.5em;
    font-weight: 600;
    line-height: 1.2;
    color: var(--color-accent);
    margin: 0.7em 0 0.2em;
}

.c-cv h2::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--color-line);
}

/* ### Entry | Dates */
.c-cv h3 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1.5em;
    font-family: var(--font-body);
    font-size: 1.05em;
    font-weight: 600;
    line-height: 1.3;
    margin: 0.55em 0 0;
}

.c-cv h2 + h3 { margin-top: 0; }

.c-cv__when {
    flex-shrink: 0;
    font-weight: 400;
    color: var(--color-text-light);
    font-variant-numeric: lining-nums tabular-nums;
}

/* The line under an entry: company, place */
.c-cv h3 + p {
    margin: 0;
    font-style: italic;
    color: var(--color-text-light);
}

.c-cv ul { margin: 0.1em 0 0; padding-left: 1.1em; }
.c-cv li { margin: 0.05em 0; padding-left: 0.15em; }
.c-cv li::marker { color: var(--color-accent); }

/* A list straight under a section title (Skills) has no bullets */
.c-cv h2 + ul { list-style: none; padding-left: 0; }
.c-cv h2 + ul li { padding-left: 0; }

/* Where text on page 1 of the PDF must stop: 11in less the 0.5in bottom margin. The sheet matches the
   PDF's page size and type, so anything below this line spills onto a second page */
.c-cv { position: relative; min-height: 11in; }
.c-cv::after {
    content: "p. 2";
    position: absolute;
    top: 10.5in;
    left: 0;
    right: 0;
    border-top: 1px dashed color-mix(in srgb, var(--color-accent) 60%, transparent);
    padding: 0.15em 0.15in;
    font-size: 0.8em;
    color: var(--color-accent);
    pointer-events: none;
}

@media (max-width: 860px) {
    .c-cv { min-height: 0; }
    .c-cv::after { display: none; }
}

@media (max-width: 700px) {
    .c-cv { padding: 1.6em 1.3em; }
    .c-cv h3 { flex-wrap: wrap; gap: 0 1em; }
}

@page cv {
    size: letter;
    margin: 0.5in 0.6in;
}

@media print {
    body.is-cv { background: #fff; }
    .is-cv .l-container { max-width: none; padding: 0; }
    .is-cv .site-footer,
    .c-cv-nav { display: none; }

    .l-cv { margin: 0; }
    .c-cv { width: auto; min-height: 0; padding: 0; background: none; box-shadow: none; }
    .c-cv::after { display: none; }
    .c-cv h2, .c-cv h3, .c-cv h3 + p { break-after: avoid; }
    .c-cv li { break-inside: avoid; }
}
