/* === Design Tokens === */

:root {
    /* Tune the paper and ink colors with these six values. */
    --paper-lightness: 82%;
    --paper-chroma: 0.035;
    --paper-hue: 75;
    --ink-lightness: 25%;
    --ink-chroma: 0.035;
    --ink-hue: 150;

    /* Palette primitives derived from the controls above. */
    --palette-paper: oklch(var(--paper-lightness) var(--paper-chroma) var(--paper-hue));
    --palette-paper-translucent: oklch(
        var(--paper-lightness) var(--paper-chroma) var(--paper-hue) /
        94%
    );
    --palette-paper-surface: oklch(
        calc(var(--paper-lightness) - 2.5%) var(--paper-chroma) var(--paper-hue)
    );
    --palette-paper-surface-alt: oklch(
        calc(var(--paper-lightness) - 5.5%) var(--paper-chroma) var(--paper-hue)
    );
    --palette-paper-border: oklch(
        calc(var(--paper-lightness) - 14%) calc(var(--paper-chroma) - 0.01) var(--paper-hue)
    );
    --palette-paper-border-accent: oklch(
        calc(var(--paper-lightness) - 20%) calc(var(--paper-chroma) - 0.005) var(--paper-hue)
    );
    --palette-ink: oklch(var(--ink-lightness) var(--ink-chroma) var(--ink-hue));
    --palette-ink-secondary: oklch(
        calc(var(--ink-lightness) + 7%) calc(var(--ink-chroma) - 0.005) var(--ink-hue)
    );
    --palette-ink-muted: oklch(
        calc(var(--ink-lightness) + 12%) calc(var(--ink-chroma) - 0.008) var(--ink-hue)
    );
    --palette-ink-tertiary: oklch(
        calc(var(--ink-lightness) + 17%) calc(var(--ink-chroma) - 0.011) var(--ink-hue)
    );
    --palette-forest: oklch(
        calc(var(--ink-lightness) + 6%) calc(var(--ink-chroma) + 0.025) calc(var(--ink-hue) - 5)
    );
    --palette-forest-hover: oklch(
        calc(var(--ink-lightness) + 13%) calc(var(--ink-chroma) + 0.02) calc(var(--ink-hue) - 5)
    );

    /* Semantic colors consumed by components. */
    --color-bg: var(--palette-paper);
    --color-bg-translucent: var(--palette-paper-translucent);
    --color-text: var(--palette-ink);
    --color-secondary: var(--palette-ink-secondary);
    --color-tertiary: var(--palette-ink-tertiary);
    --color-muted: var(--palette-ink-muted);
    --color-border: var(--palette-paper-border);
    --color-border-accent: var(--palette-paper-border-accent);
    --color-surface: var(--palette-paper-surface);
    --color-surface-alt: var(--palette-paper-surface-alt);
    --color-control-background: var(--color-surface);
    --color-link: var(--palette-forest);
    --color-link-hover: var(--palette-forest-hover);

    /* Root-relative spacing primitives */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-7: 2rem;
    --space-8: 3rem;
    --space-9: 4rem;

    /* Semantic spacing */
    --flow-space: var(--space-3);
    --heading-gap: var(--space-2);
    --section-space: var(--space-7);
    --control-gap: var(--space-2);
    --page-gutter-min: var(--space-4);
    --page-gutter-max: var(--space-9);
    --page-gutter: clamp(var(--page-gutter-min), 4vw, var(--page-gutter-max));

    /* Readable line lengths */
    --measure-compact: 55ch;
    --measure-reading: 100ch;

    /* Typography */
    --font-body:
        et-book, Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
    --font-mono: Consolas, "Liberation Mono", Menlo, Courier, monospace;
    --font-size-base: 130%;
    --font-size-sm: 0.85rem;
    --font-size-md: 0.9rem;
    --font-size-lg: 0.95rem;

    /* Document heading scale */
    --font-size-h1: 3.157rem;
    --font-size-h2: 2.369rem;
    --font-size-h3: 1.777rem;
    --font-size-h4: 1.333rem;
    --font-size-h5: 1.1rem;
    --font-size-h6: 1rem;
}

/* === Reset & Base === */

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

html {
    font-size: var(--font-size-base);
    -webkit-text-size-adjust: 100%;
}

@media (min-width: 601px) {
    html {
        scrollbar-gutter: stable;
    }
}

body {
    --page-measure: var(--measure-reading);

    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    padding-inline: var(--page-gutter);
}

select {
    padding: 0.3em 1.8em 0.3em 0.5em;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background-color: var(--color-control-background);
    color: var(--color-secondary);
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
}

select option {
    background-color: var(--color-control-background);
    color: var(--color-secondary);
}

select:focus-visible {
    outline: 2px solid var(--color-link);
    outline-offset: 2px;
}

select:disabled {
    color: var(--color-tertiary);
    cursor: not-allowed;
}

/* === Layout === */

article,
.content,
#content {
    width: 100%;
    padding: 0;
    text-align: left;
}

#content {
    --outline-indent-step: var(--space-2);

    max-inline-size: var(--page-measure);
    margin-inline: auto;
}

/* === Typography === */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 400;
    line-height: 1.2;
    margin-bottom: var(--heading-gap);
    text-align: left;
    text-wrap: balance;
}

p,
li {
    text-wrap: pretty;
}

h1 {
    margin-top: var(--space-7);
}
h2 {
    margin-top: var(--space-6);
}
h3 {
    margin-top: var(--space-5);
}
h4 {
    margin-top: var(--space-4);
}
h5 {
    margin-top: var(--space-3);
}
h6 {
    margin-top: var(--space-2);
}

h1 a,
h2 a,
h3 a,
h4 a,
h5 a,
h6 a {
    text-decoration: none;
    color: inherit;
}

h1 {
    font-size: var(--font-size-h1);
}
h2 {
    font-size: var(--font-size-h2);
    font-style: italic;
}
h3 {
    font-size: var(--font-size-h3);
}
h4 {
    font-size: var(--font-size-h4);
}
h5 {
    font-size: var(--font-size-h5);
}
h6 {
    font-size: var(--font-size-h6);
}

p,
div.list-intro {
    margin-top: var(--flow-space);
    margin-bottom: var(--flow-space);
}

div.list-intro > ul,
div.list-intro > ol {
    margin-top: 0;
    margin-bottom: 0;
}

div.list-intro > p {
    margin-top: 0;
}

dl,
table,
blockquote,
pre {
    margin-bottom: var(--flow-space);
}

ol,
ul {
    padding-left: 1.5em;
    margin-top: 0;
    margin-bottom: var(--flow-space);
    line-height: 1.4;
}

ol ol,
ol ul,
ul ol,
ul ul {
    padding-left: 1.5em;
    margin-bottom: 0;
}

a {
    color: var(--color-link);
}
a:hover {
    color: var(--color-link-hover);
}

.external-link__icon {
    display: inline-block;
    width: 0.72em;
    height: 0.72em;
    margin-inline-start: 0.18em;
    overflow: visible;
    fill: none;
    stroke: currentcolor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.5;
    vertical-align: 0.08em;
}

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

blockquote {
    border-left: 3px solid var(--color-border-accent);
    padding-left: 1.2em;
    margin-left: 0;
    font-style: italic;
}

/* === Footnotes === */

.footref {
    font-size: 0.75rem;
    vertical-align: super;
    line-height: 0;
    text-decoration: none;
}

.inline-footnote-control {
    position: relative;
    display: inline;
    margin-left: 0.25rem;
    padding-left: 6.5rem;
    color: var(--color-link);
    font-size: 0;
    line-height: 0;
    vertical-align: baseline;
}

.inline-footnote-toggle {
    position: absolute;
    z-index: 1;
    bottom: -0.22rem;
    left: 0;
    display: inline-flex;
    min-width: 6.25rem;
    height: 1rem;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    margin: 0;
    padding: 0 0.25rem;
    border: 0;
    border-radius: 999px;
    background: color-mix(in oklch, var(--color-link) 6%, transparent);
    color: var(--color-link);
    cursor: pointer;
    font: inherit;
    font-size: 1rem;
    line-height: 1;
    vertical-align: baseline;
    white-space: nowrap;
}

.inline-footnote-number {
    min-width: 0;
    font-size: 0.8rem;
    text-align: center;
}

.inline-footnote-caret {
    display: block;
    flex: 0 0 auto;
    width: 0.32rem;
    height: 0.32rem;
    border-right: 1.5px solid currentcolor;
    border-bottom: 1.5px solid currentcolor;
    transform: translateY(-0.08rem) rotate(45deg);
    transform-origin: center;
    transition: transform 120ms ease;
}

.inline-footnote-toggle::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: calc(100% + 0.5rem);
    height: 1.4rem;
    content: "";
    transform: translate(-50%, -50%);
}

.inline-footnote-toggle[aria-expanded="true"] .inline-footnote-caret {
    transform: translateY(0.08rem) rotate(225deg);
}

.inline-footnote-toggle:is(:hover, :focus-visible) {
    background: color-mix(in oklch, var(--color-link) 12%, transparent);
    color: var(--color-link-hover);
}

.inline-footnote-toggle:active {
    background: color-mix(in oklch, var(--color-link) 18%, transparent);
}

.inline-footnote-toggle:focus-visible {
    outline: 1px solid currentcolor;
    outline-offset: 2px;
}

.inline-footnote {
    display: block;
    position: fixed;
    z-index: 1000;
    width: min(28rem, calc(100vw - 1.5rem));
    max-height: min(72vh, 42rem);
    overflow: auto;
    margin: 0;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border-accent);
    border-radius: 4px;
    background: var(--color-surface);
    box-shadow: 0 0.5rem 1.5rem color-mix(in oklch, var(--color-text) 18%, transparent);
    font-size: var(--font-size-md);
    line-height: 1.5;
    text-align: left;
}

.inline-footnote[hidden] {
    display: none;
}

.inline-footnote--expanded {
    position: static;
    width: auto;
    max-height: none;
    overflow: visible;
    margin: var(--space-2) 0;
    border-width: 0 0 0 2px;
    border-radius: 0;
    box-shadow: none;
}

.inline-footnote__paragraph {
    display: inline;
}

.inline-footnote__paragraph + .inline-footnote__paragraph {
    display: block;
    margin-top: var(--space-2);
}

.inline-footnote .figure {
    margin: var(--space-3) 0 0;
}

.inline-footnote img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: min(48vh, 28rem);
    margin-inline: 0;
    border-radius: 3px;
}

.footnote-backlink {
    margin-inline-start: 0.25em;
    text-decoration: none;
    white-space: nowrap;
}

.footdef .figure {
    max-width: 32rem;
}

#footnotes {
    margin-top: var(--space-8);
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-4);
    font-size: var(--font-size-md);
}

#footnotes > .footnotes,
.footnotes-heading {
    margin: 0;
    font-size: 1.2rem;
    font-style: normal;
}

#footnotes > .footnotes {
    margin-bottom: var(--space-2);
}

.footnotes-summary {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0.25rem 0 0.25rem 1.25rem;
    cursor: pointer;
    list-style: none;
}

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

.footnotes-summary::before {
    position: absolute;
    left: 0.25rem;
    width: 0.4rem;
    height: 0.4rem;
    border-right: 1.5px solid currentcolor;
    border-bottom: 1.5px solid currentcolor;
    content: "";
    transform: translateY(-0.1rem) rotate(45deg);
    transform-origin: center;
}

.footnotes-disclosure[open] > .footnotes-summary::before {
    transform: translateY(0.1rem) rotate(225deg);
}

.footnotes-summary:focus-visible {
    outline: 1px solid var(--color-link);
    outline-offset: 3px;
}

.footnotes-count {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    font-weight: normal;
}

@media print {
    .footnotes-disclosure > #text-footnotes {
        display: block;
    }
}

/* === Code === */

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--color-surface-alt);
    padding: 0.15em 0.3em;
    border-radius: 3px;
}

pre {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: var(--space-4);
    overflow-x: auto;
    font-size: var(--font-size-sm);
    line-height: 1.5;
    text-align: left;
}

pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

/* === Tables === */

table {
    border-collapse: collapse;
    width: auto;
    margin-bottom: var(--space-4);
}

th,
td {
    border-bottom: 1px solid var(--color-border);
    padding: 0.4em 0.8em;
    text-align: left;
}

th {
    font-weight: 600;
}

/* === Citations / References === */

.csl-bib-body {
    font-size: var(--font-size-md);
    line-height: 1.5;
}

.csl-entry {
    margin-bottom: var(--flow-space);
    overflow: hidden;
}

.csl-left-margin {
    float: left;
    min-width: 2.5em;
    padding-right: 0.5em !important;
}

.csl-right-inline {
    margin-left: 3em !important;
}

/* === Header & Nav === */

#preamble header {
    max-inline-size: var(--page-measure);
    padding: var(--space-2) 0 var(--space-3);
    border-bottom: 1px solid var(--color-border);
    margin: 0 auto var(--space-2);
}

#preamble header .site-title {
    font-size: 1.6rem;
    font-weight: 400;
    line-height: 1.1;
    text-decoration: none;
    color: var(--color-text);
}

.site-identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(var(--space-1) / 4);
    text-align: center;
}

.site-subtitle {
    color: var(--color-muted);
    font-size: var(--font-size-sm);
    font-style: italic;
    line-height: 1.2;
    text-decoration: none;
}

.site-subtitle:hover,
.site-subtitle:focus-visible {
    color: var(--color-link-hover);
}

#content > header {
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 0;
}

#content > header h1 {
    margin-top: 0;
    margin-bottom: 0;
}

#content > header + .org-ul {
    margin-top: var(--section-space);
}

.site-nav {
    margin-top: var(--space-3);
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 1.2em;
}

.site-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    text-decoration: none;
    color: var(--color-muted);
    font-size: var(--font-size-lg);
}

.site-nav a:hover {
    color: var(--color-text);
}

.nav-icon {
    display: none;
}

/* The thumb navigation is part of the page shell, not the article flow. */
.bottom-nav {
    display: none;
}

/* === Resume === */

.resume {
    text-align: left;
}

.resume__header,
.resume-role__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-4);
}

.resume__header h1 {
    margin-bottom: 0;
}

.resume__contact {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    margin-top: var(--space-2);
    font-size: var(--font-size-md);
    font-style: normal;
}

.resume__contact-link {
    text-decoration: none;
}

.resume-filters {
    margin-top: var(--space-6);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-border);
}

.resume > .resume-filters:first-child {
    margin-top: 0;
}

.resume-filters__heading {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.resume-filters__heading h2 {
    margin: 0;
    font-size: 1.1rem;
    font-style: normal;
}

.resume-filters__body {
    margin-top: var(--space-3);
}

.panel-toggle {
    margin-left: auto;
    padding: 0.1em 0.5em;
    border: 0;
    background: transparent;
    color: var(--color-muted);
    cursor: pointer;
    font: inherit;
    font-size: var(--font-size-sm);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 0.2em;
}

.panel-toggle:hover {
    color: var(--color-text);
}

.panel-toggle:focus-visible {
    outline: 2px solid var(--color-link);
    outline-offset: 2px;
}

.resume-filters__pickers {
    display: grid;
    gap: var(--control-gap);
}

.resume-filters__group {
    display: grid;
    grid-template-columns: 2.5rem minmax(5.5rem, auto) minmax(9rem, 14rem) minmax(0, 1fr);
    align-items: center;
    gap: var(--control-gap);
}

.resume-filters__active-chips {
    grid-column: 4;
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
}

.resume-filter-operator {
    color: var(--color-tertiary);
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
}

.resume-filter-operator--toggle {
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 0.2em;
}

.resume-filter-operator--toggle:hover {
    color: var(--color-text);
}

.resume-filter-operator--toggle:focus-visible {
    outline: 2px solid var(--color-link);
    outline-offset: 2px;
}

.resume-filter-operator--row {
    grid-column: 1;
    justify-self: end;
}

.resume-filters__group label {
    grid-column: 2;
    color: var(--color-secondary);
    font-size: var(--font-size-sm);
    font-weight: bold;
}

.resume-filters__group select {
    grid-column: 3;
    min-width: 9rem;
}

.resume-filter-chip,
.resume-filters__clear,
.toc-collapse-all {
    border: 1px solid var(--color-border-accent);
    background-color: var(--color-control-background);
    color: var(--color-muted);
    cursor: pointer;
    font: inherit;
    font-size: var(--font-size-sm);
}

.resume-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.2em 0.55em 0.2em 0.7em;
    border-radius: 999px;
    font-family: var(--font-mono);
}

.resume-filter-chip:hover,
.resume-filters__clear:hover,
.toc-collapse-all:hover {
    border-color: var(--color-text);
    color: var(--color-text);
}

.resume-filter-chip__remove {
    font-family: sans-serif;
    font-size: 1.15em;
    line-height: 0.8;
}

.resume-filter-chip:focus-visible,
.resume-filters__clear:focus-visible,
.toc-collapse-all:focus-visible {
    outline: 2px solid var(--color-link);
    outline-offset: 2px;
}

.resume-filters__footer {
    display: flex;
    min-height: 1.8em;
    align-items: center;
    gap: var(--control-gap);
    margin-top: var(--control-gap);
}

.resume-filters__summary,
.resume-filters__status {
    color: var(--color-secondary);
    font-size: var(--font-size-sm);
}

.resume-filters__summary {
    margin: 0;
}

.resume-filters__sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.resume-filters__clear,
.toc-collapse-all {
    padding: 0.1em 0.6em;
    border-radius: 3px;
}

.toc-collapse-all {
    margin-top: var(--space-2);
}

#text-table-of-contents ul ul {
    margin: var(--space-1) 0 var(--space-1) var(--space-4);
    padding-left: var(--space-2);
    border-left: 1px solid var(--color-border);
}

.resume-fold__heading {
    --resume-fold-accent: var(--color-link);
    --resume-fold-symbol-x: 0.44em;
    --resume-fold-line-drop: -0.2em;
    --resume-fold-line-reach: 0.08;
    --resume-fold-line-gap: 0.1;
    --resume-fold-tree-depth-gap: 0.9;
    --resume-fold-tree-leaf-gap: 0.27;
    --resume-fold-tree-height-budget: 1;
    --resume-fold-tree-dot-size: 0.04;
    --resume-fold-tree-leaf-dot-size: 0.1;
    --resume-fold-tree-leaf-symbol-size: 0.759;
    --resume-fold-tree-link-stroke: 0.72px;
    --resume-fold-tree-empty-dot-stroke: 0.8px;
    --resume-fold-leaf-fill: oklch(
        calc(var(--ink-lightness) + 38%) calc(var(--ink-chroma) + 0.02) calc(var(--ink-hue) - 5)
    );
    position: relative;
    display: block;
    padding-inline-end: calc(
        var(--resume-fold-tree-width, 1.2em) +
        max(0em, var(--resume-fold-symbol-x))
    );
    overflow-wrap: anywhere;
    cursor: pointer;
}

.resume-fold__title {
    position: relative;
    z-index: 1;
}

.toc-toggle,
.resume-fold__toggle {
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    font: inherit;
}

.toc-toggle:focus-visible {
    background: var(--color-border);
    outline: 2px solid var(--color-link);
    outline-offset: 2px;
}

/* Native Org resume: Org owns the outline and its section containers. */
.resume-org > .outline-2 {
    margin-top: var(--section-space);
    padding-bottom: var(--space-6);
}

.resume-org {
    --outline-content-indent: var(--space-3);
}

.resume-org [class^="outline-"] {
    scroll-margin-top: var(--section-space);
}

.outline-tree-rails-root {
    position: relative;
    --resume-fold-line-stroke: 1.1px;
}

#content :is(.outline-2, .outline-3, .outline-4, .outline-5, .outline-6, .outline-7, .outline-8) {
    margin-inline-start: var(--outline-indent-step);
}

.outline-tree-rails {
    position: absolute;
    z-index: 0;
    top: 0;
    left: 0;
    display: block;
    overflow: visible;
    color: var(--color-link);
    pointer-events: none;
}

.outline-tree-rail {
    fill: none;
    stroke-linecap: butt;
    stroke-linejoin: round;
    stroke-width: var(--resume-fold-line-stroke);
    vector-effect: non-scaling-stroke;
}

.outline-tree-rail--steady {
    stroke: currentcolor;
}

.resume-org :is(h2, h3, h4, h5, h6) {
    margin-bottom: 0;
}

.resume-org > .outline-2 > h2 {
    padding-bottom: var(--space-1);
}

.resume-org .outline-3 {
    margin-top: var(--space-6);
}

.resume-org .outline-4 {
    margin-top: var(--space-4);
}

.resume-org :is(h3, h4) {
    margin-top: 0;
}

.resume-org :is(h5, h6) {
    margin-top: var(--space-4);
    margin-bottom: var(--space-1);
    line-height: 1.3;
}

.resume-org [data-kind="education"] .outline-5 > .outline-text-5,
.resume-org [data-kind="education"] .outline-5 > .resume-fold__body > .outline-text-5 {
    margin-inline-start: var(--outline-content-indent);
}

.resume-org #table-of-contents {
    margin-top: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    text-align: left;
}

.resume-org #text-table-of-contents a {
    margin-right: 0;
    font-size: inherit;
    color: inherit;
}

.resume-org #text-table-of-contents a[aria-current] {
    color: var(--color-link);
    font-weight: bold;
}

.resume-org__metadata {
    margin-top: var(--space-1);
    color: var(--color-secondary);
}

.resume-org [class^="outline-"] > .resume-org__metadata,
.resume-org [class^="outline-"] > .resume-fold__body > .resume-org__metadata {
    margin-inline-start: var(--outline-indent-step);
}

.resume-org__metadata .resume-date {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
}

.resume-org .resume-role__header .resume-org__metadata {
    flex: 0 0 auto;
}

.resume-org
    :is(.outline-text-2, .outline-text-3, .outline-text-4, .outline-text-5, .outline-text-6)
    > ul {
    margin-top: var(--space-2);
}

.resume-project__note {
    color: var(--color-secondary);
}

.resume-date-separator {
    color: var(--color-tertiary);
}

/* === Footer === */

#postamble {
    max-inline-size: var(--page-measure);
    margin-inline: auto;
}

footer {
    margin-top: var(--space-8);
    padding: var(--space-6) 0;
    border-top: 1px solid var(--color-border);
    font-size: var(--font-size-sm);
    color: var(--color-tertiary);
}

#content:has(.resume) + #postamble footer {
    border-top: 0;
}

/* === Dated sitemap entries === */

.sitemap-date {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    color: var(--color-tertiary);
    margin-right: var(--space-2);
}

/* === Time index === */

pre.time-tree {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    line-height: 1.6;
    background: none;
    border: none;
    padding: 0;
    margin-bottom: var(--space-6);
}

pre.time-tree a {
    color: var(--color-link);
}

pre.time-tree a:hover {
    color: var(--color-link-hover);
}

.time-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
}

.time-chip {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    color: var(--color-muted);
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    padding: 0.2em 0.6em;
    cursor: pointer;
}

.time-chip:hover {
    border-color: var(--color-border-accent);
    color: var(--color-text);
}

.time-chip.active {
    color: var(--color-text);
    border-color: var(--color-text);
}

.time-list {
    list-style: none;
    padding-left: 0;
}

.time-entry {
    margin-bottom: var(--space-2);
}

/* === Post metadata === */

.post-date {
    color: var(--color-tertiary);
    font-size: var(--font-size-md);
    margin-bottom: var(--space-6);
}

.subtitle {
    font-style: italic;
    font-size: 1.1rem;
    color: var(--color-muted);
    margin-top: -0.5em;
    margin-bottom: var(--space-6);
}

.post-description {
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-2) 0;
    margin-bottom: var(--section-space);
}

.post-description:has(+ .resume) {
    margin-bottom: 0;
}

.post-description p {
    font-size: 1.1rem;
    color: var(--color-muted);
    margin: 0;
}

/* === Table of Contents === */

#table-of-contents {
    --toc-control-size: 36px;

    font-size: 1rem;
    margin-bottom: var(--section-space);
}

#table-of-contents h2 {
    font-size: 1.1rem;
    font-style: normal;
    margin-bottom: var(--space-2);
}

.toc-select,
.toc-collapse-all,
#text-table-of-contents a {
    min-height: var(--toc-control-size);
}

.toc-select {
    display: block;
    margin-bottom: var(--control-gap);
}

.toc-toggle {
    position: relative;
    display: inline-flex;
    width: var(--toc-control-size);
    height: var(--toc-control-size);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-secondary);
    font-size: 0;
    vertical-align: middle;
    border-radius: 3px;
    background: var(--color-surface-alt);
    margin-right: var(--control-gap);
}

.toc-toggle::before,
.toc-toggle::after {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: 26%;
    border-top: calc(var(--toc-control-size) * 0.04) solid currentColor;
    content: "";
    transform: translate(-50%, -50%);
}

.toc-toggle::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.toc-toggle[data-icon="minus"]::after {
    content: none;
}

.toc-toggle__rings {
    position: absolute;
    inset: 0;
    z-index: 1;
    color: oklch(
        calc(var(--ink-lightness) + 18%) calc(var(--paper-chroma) + 0.035)
            calc(var(--paper-hue) - 10)
    );
    pointer-events: none;
}

.toc-toggle__rings[hidden] {
    display: none;
}

.toc-toggle__ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--toc-ring-size);
    aspect-ratio: 1;
    border: 1px solid currentColor;
    border-radius: 47% 53% 49% 51% / 52% 48% 54% 46%;
    opacity: 0.11;
    transform: translate(-50%, -50%) rotate(-2deg);
}

.toc-toggle__ring:nth-child(even) {
    border-radius: 53% 47% 52% 48% / 46% 54% 48% 52%;
    transform: translate(-50%, -50%) rotate(3deg);
}

.toc-toggle__ring--revealed {
    opacity: 0.28;
}

.toc-toggle__ring--current {
    opacity: 0.5;
}

@media (forced-colors: active) {
    .toc-toggle__rings {
        display: none;
    }
}

@media (hover: hover) and (pointer: fine) {
    .toc-toggle:hover {
        background: var(--color-border);
    }
}

@media (hover: none) and (pointer: coarse) {
    .toc-toggle:active {
        color: var(--color-text);
        box-shadow: inset 0 0 0 1px var(--color-border-accent);
    }
}

.resume-fold__toggle {
    position: absolute;
    left: calc(var(--resume-fold-end-x, 0px) + var(--resume-fold-symbol-x));
    top: calc(
        var(--resume-fold-end-y, 0px) +
        var(--resume-fold-line-drop) -
        var(--resume-fold-tree-half-height, 0.25em) -
        0.14em
    );
    width: var(--resume-fold-tree-width, 1.2em);
    height: calc(var(--resume-fold-tree-height, 0.4em) + 0.28em);
    border-radius: 0;
    background: transparent;
    color: var(--resume-fold-accent);
    font-size: inherit;
    font-style: normal;
    line-height: 0;
    margin-right: 0;
    user-select: none;
    cursor: pointer;
    z-index: 2;
}

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

.resume-fold__line {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    color: var(--resume-fold-accent);
    pointer-events: none;
}

.resume-fold__line path {
    stroke-linecap: round;
    stroke-linejoin: round;
}

.resume-fold__root {
    stroke-width: var(--resume-fold-line-stroke);
}

.resume-fold__line .resume-fold__root--leaf {
    stroke-linecap: butt;
}

.resume-fold__tree-link {
    fill: none;
    stroke: currentcolor;
    stroke-width: var(--resume-fold-tree-link-stroke);
    opacity: 0.1;
}

.resume-fold__tree-link--revealed {
    opacity: 0.44;
}

.resume-fold__tree-link--current {
    opacity: 0.68;
}

.resume-fold__tree-dot {
    fill: currentcolor;
    opacity: 0.16;
}

.resume-fold__tree-dot--leaf {
    opacity: 0.26;
}

.resume-fold__tree-dot--revealed {
    opacity: 0.68;
}

.resume-fold__tree-dot--current {
    opacity: 1;
}

.resume-fold__tree-dot--empty {
    fill: var(--color-bg);
    stroke: currentcolor;
}

.resume-fold__tree-leaf-symbol {
    stroke: currentcolor;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.resume-fold__tree-leaf-symbol--terminal {
    opacity: 0.26;
}

.resume-fold__tree-leaf-symbol--terminal.resume-fold__tree-leaf-symbol--hidden {
    opacity: 0.16;
}

.resume-fold__tree-leaf-symbol--terminal:is(
    .resume-fold__tree-leaf-symbol--revealed,
    .resume-fold__tree-leaf-symbol--current
) {
    opacity: 1;
}

.resume-fold__tree-leaf-body {
    fill: var(--color-bg);
    stroke-width: 0.9px;
}

.resume-fold__tree-leaf-symbol--expanded .resume-fold__tree-leaf-body {
    fill: var(--resume-fold-leaf-fill);
}

.resume-fold__tree-leaf-vein {
    fill: none;
    stroke-width: 0.7px;
}

@media (prefers-contrast: more) {
    .resume-fold__tree-link {
        stroke-width: 0.6px !important;
        opacity: 0.15;
    }

    .resume-fold__tree-link--revealed,
    .resume-fold__tree-link--current {
        stroke-width: 1px !important;
    }

    .resume-fold__tree-link--revealed {
        opacity: 0.8;
    }

    .resume-fold__tree-dot {
        opacity: 0.22;
    }

    .resume-fold__tree-dot--leaf {
        opacity: 0.36;
    }

    .resume-fold__tree-dot--revealed {
        opacity: 0.9;
    }

    .resume-fold__tree-link--current,
    .resume-fold__tree-dot--current {
        opacity: 1;
    }

    .resume-fold__tree-dot--empty {
        stroke-width: 0.5px !important;
    }

    .resume-fold__tree-dot--empty:is(
        .resume-fold__tree-dot--revealed,
        .resume-fold__tree-dot--current
    ) {
        stroke-width: 1px !important;
    }
}

@media (forced-colors: active) {
    .resume-fold__line {
        color: CanvasText;
    }

    .resume-fold__root {
        stroke: CanvasText;
    }

    .resume-fold__tree-link {
        stroke-width: 1px !important;
        opacity: 1;
    }

    .resume-fold__tree-dot {
        opacity: 1;
    }

    .resume-fold__tree-dot--empty {
        fill: Canvas;
        stroke: CanvasText;
        stroke-width: 1px !important;
    }

    .resume-fold__tree-leaf-symbol {
        stroke: CanvasText;
    }

    .resume-fold__tree-leaf-body {
        fill: Canvas;
    }
}

.toc-help-heading {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-bottom: var(--space-2);
}

#table-of-contents .toc-help-heading > h2 {
    margin: 0;
}

.toc-help {
    position: relative;
    display: inline-block;
}

.toc-help__button {
    width: 1.8em;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: var(--color-surface-alt);
    color: var(--color-tertiary);
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
    line-height: 1.4;
}

.toc-help__button:focus-visible {
    outline: 2px solid var(--color-link);
    outline-offset: 2px;
}

.toc-help__tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1;
    padding: 0.3em 0.5em;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: var(--color-surface);
    color: var(--color-secondary);
    font-size: var(--font-size-sm);
    white-space: nowrap;
}

.toc-help:not(.toc-help--dismissed):is(:hover, :focus-within) .toc-help__tooltip {
    display: block;
}

.toc-keyboard-dialog {
    width: min(38rem, 90vw);
    max-height: 85vh;
    box-sizing: border-box;
    overflow: auto;
    padding: var(--space-6);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: var(--color-bg);
    color: var(--color-text);
    font: inherit;
    font-size: 1rem;
}

.toc-keyboard-dialog::backdrop {
    background: rgb(0 0 0 / 35%);
}

.toc-keyboard-dialog > h2 {
    margin-top: 0;
    font-size: 1.4rem;
    font-style: normal;
}

.toc-keyboard-dialog th {
    text-align: left;
}

.toc-keyboard-dialog__close {
    padding: 0.3em 0.7em;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: var(--color-surface-alt);
    color: inherit;
    cursor: pointer;
    font: inherit;
}

.toc-toggle-placeholder {
    display: inline-block;
    width: var(--toc-control-size);
    margin-right: var(--control-gap);
}

#text-table-of-contents ul {
    list-style: none;
    padding-left: var(--space-4);
    margin-bottom: 0;
}

#text-table-of-contents a {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

#text-table-of-contents li + li {
    margin-top: var(--space-1);
}

.org-ul > li > a:only-child {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
}

#text-table-of-contents > ul {
    padding-left: 0;
}

/* === Images === */

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

figure {
    margin: var(--space-6) 0;
}

figcaption {
    font-size: var(--font-size-sm);
    color: var(--color-secondary);
    margin-top: var(--space-1);
}

@media (pointer: coarse) {
    #table-of-contents {
        --toc-control-size: 44px;
    }

    #text-table-of-contents li + li {
        margin-top: var(--space-2);
    }
}

/* === Mobile === */

@media (max-width: 600px) {
    :root {
        --bottom-nav-height: 4.6rem;
        --font-size-h1: 1.8rem;
        --font-size-h2: 1.4rem;
        --font-size-h3: 1.2rem;
        --font-size-h4: 1.05rem;
        --font-size-h5: 1rem;
        --font-size-h6: 0.95rem;
    }

    html {
        font-size: 90%;
    }

    #preamble header {
        padding-block: var(--space-1) var(--space-2);
        margin-bottom: 0;
    }

    #content {
        --outline-indent-step: var(--space-1);
    }

    .resume-org {
        --outline-content-indent: var(--space-2);
    }

    body {
        padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    }

    .resume-filters__group {
        grid-template-columns: 2.5rem minmax(5.5rem, auto) minmax(0, 1fr);
    }

    .resume-filter-operator--row,
    .resume-filters__group label,
    .resume-filters__group select {
        grid-row: 1;
    }

    .resume-filters__group select {
        width: 100%;
        min-width: 0;
    }

    .resume-filters__active-chips {
        grid-row: 2;
        grid-column: 2 / -1;
    }

    .toc-select {
        width: 100%;
        max-width: 100%;
    }

    .site-nav {
        display: none;
    }

    .bottom-nav {
        position: fixed;
        z-index: 20;
        right: 0;
        bottom: 0;
        left: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
        margin: 0;
        padding: 0.35rem max(0.35rem, env(safe-area-inset-right))
            calc(0.35rem + env(safe-area-inset-bottom)) max(0.35rem, env(safe-area-inset-left));
        border-top: 1px solid var(--color-border);
        background: var(--color-bg-translucent);
        box-shadow: 0 -0.2rem 1rem rgb(17 17 17 / 8%);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    .bottom-nav__link {
        display: flex;
        min-width: 4.5rem;
        min-height: 3.5rem;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 0.1rem;
        margin: 0;
        padding: 0.25rem;
        border-radius: 0.4rem;
        color: var(--color-tertiary);
        font-family: var(--font-body);
        font-size: 0.72rem;
        line-height: 1;
        text-decoration: none;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .bottom-nav__link:is(:hover, :focus-visible),
    .bottom-nav a[aria-current="page"],
    .bottom-nav__more--current > summary {
        color: var(--color-text);
        background: var(--color-surface-alt);
    }

    .bottom-nav__link:focus-visible,
    .bottom-nav__menu a:focus-visible {
        outline: 2px solid var(--color-link);
        outline-offset: -2px;
    }

    .bottom-nav__icon,
    .bottom-nav__menu img {
        display: block;
        width: 1.65rem;
        height: 1.65rem;
    }

    .bottom-nav__more {
        min-width: 0;
    }

    .bottom-nav__more > summary {
        list-style: none;
        cursor: pointer;
    }

    .bottom-nav__more > summary::-webkit-details-marker {
        display: none;
    }

    .bottom-nav__more-icon {
        display: flex;
        width: 1.65rem;
        height: 1.65rem;
        align-items: center;
        justify-content: center;
        font-family: var(--font-mono);
        font-size: 0.9rem;
        letter-spacing: 0.08rem;
    }

    .bottom-nav__menu {
        position: fixed;
        right: max(0.75rem, env(safe-area-inset-right));
        bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + 0.5rem);
        display: grid;
        min-width: 10rem;
        padding: 0.35rem;
        border: 1px solid var(--color-border);
        border-radius: 0.55rem;
        background: var(--color-bg);
        box-shadow: 0 0.5rem 1.75rem rgb(17 17 17 / 16%);
    }

    .bottom-nav__menu a {
        display: flex;
        min-height: 3rem;
        align-items: center;
        gap: 0.65rem;
        margin: 0;
        padding: 0.45rem 0.65rem;
        border-radius: 0.35rem;
        color: var(--color-muted);
        font-size: 0.9rem;
        text-decoration: none;
    }

    .bottom-nav__menu a:is(:hover, [aria-current="page"]) {
        color: var(--color-text);
        background: var(--color-surface-alt);
    }
    header {
        text-align: center;
    }
    .resume__header,
    .resume-role__header {
        display: block;
        text-align: left;
    }
    .resume__contact {
        justify-content: flex-start;
    }
}

/* === Debug mode (toggle by clicking year in footer) === */

body.debug * {
    outline: 1px solid #00cc44;
}

body.debug *:hover {
    outline: 2px solid #ff4400;
    background: rgba(0, 204, 68, 0.04);
}

#debug-toggle {
    cursor: pointer;
    user-select: none;
}

/* === Bib header (garden pages) === */

.bib-meta {
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-2) 0;
    margin-bottom: var(--space-6);
    color: var(--color-secondary);
    font-size: var(--font-size-md);
}

.bib-author {
    font-weight: bold;
    margin-bottom: 0.2em;
}

.bib-journal {
    margin-bottom: 0.2em;
}

.bib-doi {
    color: var(--color-tertiary);
    font-size: var(--font-size-sm);
}

.bib-abstract {
    font-size: var(--font-size-sm);
    margin-top: var(--space-2);
}

.bib-abstract-label {
    display: block;
    font-variant: small-caps;
    color: var(--color-tertiary);
}

.bib-annote {
    font-size: var(--font-size-sm);
    margin-top: var(--space-2);
}

.bib-annote-label {
    display: block;
    font-variant: small-caps;
    color: var(--color-tertiary);
}

.bib-keywords {
    font-size: var(--font-size-sm);
    margin-top: var(--space-2);
}

.bib-keywords-label {
    display: block;
    font-variant: small-caps;
    color: var(--color-tertiary);
}

a.org-gls {
    text-decoration: none;
}

/* === Inline citation quotes (transclusion) === */

.cite-group {
    display: inline;
}

.cite-group-body {
    display: none;
}

.cite-group.open .cite-group-body {
    display: block;
    background: var(--color-surface);
    border-left: 3px solid var(--color-border);
    padding: 0.5em 1em 0.4em 1em;
    margin: 0.4em 0 0.4em 0;
}

.cite-group-body ol {
    padding-left: 1.5em;
    margin: 0;
}

.cite-group-body li {
    margin-bottom: 0.5em;
}

.cite-group-body li:last-child {
    margin-bottom: 0;
}

.cite-quote-text {
    display: none;
    font-style: italic;
    margin-bottom: 0.2em;
}

li.quote-open .cite-quote-text {
    display: block;
}

.cite-heading {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--color-tertiary);
    font-weight: bold;
}

.cite-heading-arrow {
    display: inline-block;
    margin-left: 0.4em;
    transition: transform 0.15s ease;
}

li.quote-open .cite-heading-arrow {
    transform: rotate(90deg);
}

.cite-attribution {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--color-tertiary);
    opacity: 0.6;
    margin-top: 0.2em;
    text-decoration: underline;
}
