/* DampSnag theme - "Ink & Lichen". Hand-written for DampSnag. MIT. */

/* ------------------------------------------------------------------ */
/* 1. Fonts                                                            */
/* ------------------------------------------------------------------ */
/* @font-face rules are inline in default.hbs (versioned {{asset}} URLs match the preload). */

/* ------------------------------------------------------------------ */
/* 2. Tokens                                                           */
/* ------------------------------------------------------------------ */
:root {
    color-scheme: dark;

    --bg: #0C1015;          /* oklch(17% .012 255)  */
    --surface: #151A21;     /* oklch(21.5% .016 255) */
    --raised: #1E252D;      /* oklch(26% .018 255)  */
    --border: #2D333C;      /* oklch(32% .018 255)  */
    --text: #EAE8DF;        /* oklch(93% .012 95)   */
    --muted: #A2ACB7;       /* oklch(74% .02 250)   */
    --accent: #9FE079;      /* oklch(84% .15 135)   */
    --accent-hi: #B8F299;   /* oklch(90% .13 135)   */
    --accent-tint: rgb(159 224 121 / 0.1);
    --accent-soft: rgb(159 224 121 / 0.45);

    /* Syntax colours (all >= 4.5:1 on --surface) */
    --syn-comment: #8A949F;
    --syn-keyword: #9FE079;
    --syn-string: #E8C77E;
    --syn-number: #F0A07A;
    --syn-func: #8CC8F0;
    --syn-punct: #A2ACB7;

    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    /* Ghost's Design > Brand fonts override these if ever set; default is all JetBrains Mono */
    --font: var(--gh-font-body, var(--font-mono));
    --font-heading: var(--gh-font-heading, var(--font-mono));
    --step--1: 0.875rem;
    --step-0: 1.0625rem;              /* 17px */
    --step-1: 1.25rem;
    --step-2: clamp(1.4rem, 1.2rem + 0.8vw, 1.75rem);
    --step-3: clamp(1.9rem, 1.3rem + 2.6vw, 3.1rem);
    --measure: 66ch;
    --gutter: clamp(1rem, 4vw, 2rem);
    --radius: 8px;

    /* Motion: our own spring (damping ~0.62) and a soft ease-out */
    --spring: linear(0, 0.037 2.5%, 0.129 5%, 0.253 7.5%, 0.392 10%, 0.531 12.5%, 0.661 15%, 0.775 17.5%, 0.871 20%, 1.003 25%, 1.068 30%, 1.084 35%, 1.072 40%, 1.05 45%, 1.028 50%, 1.01 55%, 0.999 60%, 0.994 65%, 0.993 70%, 0.996 80%, 0.999 90%, 1);
    --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
    --dur-fast: 0.18s;
    --dur: 0.35s;
    --dur-slow: 0.6s;
}

/* ------------------------------------------------------------------ */
/* 3. Base                                                             */
/* ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html {
    background: var(--bg);
    scrollbar-gutter: stable;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100svh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--step-0);
    font-weight: 400;
    line-height: 1.7;
    letter-spacing: -0.02em;
    font-variant-ligatures: contextual;
    accent-color: var(--accent);
    -webkit-font-smoothing: antialiased;
}
@media (max-width: 600px) { body { font-size: 1rem; } }

img, video, svg, iframe { max-width: 100%; }
img, video { height: auto; }
button, input { font: inherit; color: inherit; }

::selection { background: var(--accent); color: var(--bg); }

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

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.035em;
    text-wrap: balance;
    margin: 0;
}

p { text-wrap: pretty; }

.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 10;
    padding: 0.5rem 0.75rem;
    background: var(--accent);
    color: var(--bg);
    text-decoration: none;
    border-radius: var(--radius);
}
.skip-link:focus { top: 1rem; }

/* ------------------------------------------------------------------ */
/* 4. Links: straight underline that drops and thickens on hover/focus */
/* ------------------------------------------------------------------ */
:root {
    --ul-thick: 1.5px;        /* at rest */
    --ul-offset: 4px;
    --ul-thick-hover: 3px;    /* hover / focus-visible */
    --ul-offset-hover: 7px;
    --ul-thick-current: 3px;  /* current nav item (static) */
    --ul-offset-current: 6px;
}
a {
    color: inherit;
    text-decoration-line: underline;
    text-decoration-style: solid;
    text-decoration-color: var(--accent-soft);
    text-decoration-thickness: var(--ul-thick);
    text-underline-offset: var(--ul-offset);
    text-decoration-skip-ink: auto;
    transition:
        color var(--dur-fast) ease,
        text-decoration-color var(--dur-fast) ease,
        text-decoration-thickness var(--dur) var(--spring),
        text-underline-offset var(--dur) var(--spring);
}
a:is(:hover, :focus-visible) {
    text-decoration-color: var(--accent-hi);
    text-decoration-thickness: var(--ul-thick-hover);
    text-underline-offset: var(--ul-offset-hover);
}

/* ------------------------------------------------------------------ */
/* 5. Layout grid (named lines, symmetric breakout)                    */
/* ------------------------------------------------------------------ */
.grid,
.prose {
    display: grid;
    grid-template-columns:
        [full-start] minmax(var(--gutter), 1fr)
        [wide-start] minmax(0, 7rem)
        [content-start] min(var(--measure), 100% - 2 * var(--gutter))
        [content-end] minmax(0, 7rem)
        [wide-end] minmax(var(--gutter), 1fr)
        [full-end];
}
.grid > *,
.prose > * { grid-column: content; min-width: 0; }
.article .prose,
.home-content { grid-column: full; }
.wide { grid-column: wide !important; }

/* ------------------------------------------------------------------ */
/* 6. Header / nav / wordmark                                          */
/* ------------------------------------------------------------------ */
.site-header-inner,
.site-footer-inner {
    width: min(100% - 2 * var(--gutter), var(--measure) + 14rem);
    margin-inline: auto;
}
.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    flex-wrap: wrap;
    padding-block: 1.5rem;
}

.brand {
    text-decoration: none;
    font-size: 1.15rem;
    line-height: 1;
}
.brand:hover { text-decoration: none; }
.brand .wm-b { transition: color var(--dur-fast) ease; }
.brand:hover .wm-b { color: var(--accent-hi); }

.wordmark {
    display: inline-block;
    font-weight: 800;
    letter-spacing: -0.045em;
    white-space: nowrap;
    view-transition-name: wordmark;
}
.wm-a { color: var(--text); }
.wm-b { color: var(--accent); }

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-left: auto;
}
.nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.nav-list a {
    text-decoration-color: transparent;
    color: var(--muted);
}
.nav-list a:is(:hover, :focus-visible) { color: var(--text); text-decoration-color: var(--accent-hi); }
/* Current page: static, thicker straight underline (no hover motion) */
.nav-list a[aria-current="page"],
.post-template .nav-blog a,
.nav-list a[aria-current="page"]:is(:hover, :focus-visible),
.post-template .nav-blog a:is(:hover, :focus-visible) {
    color: var(--text);
    font-weight: 700;
    text-decoration-color: var(--accent);
    text-decoration-thickness: var(--ul-thick-current);
    text-underline-offset: var(--ul-offset-current);
    transition: none;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.icon-button:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-tint); }

.brand-slot { display: block; width: 1px; height: 1px; }

/* ------------------------------------------------------------------ */
/* 7. Homepage                                                         */
/* ------------------------------------------------------------------ */
.hero { padding-block: clamp(2.5rem, 9vw, 6rem) 1rem; }
.hero-title {
    font-size: clamp(2.9rem, 1rem + 10vw, 7rem);
    line-height: 0.95;
}
.hero-title .wordmark { letter-spacing: -0.06em; }
.hero-sub {
    margin: 1.25rem 0 0;
    color: var(--muted);
    font-size: var(--step-1);
}

.home-content > h2 { /* the "Links" heading inside the home page */
    margin-top: 2.5rem;
}
.home-content > h2,
.section-label {
    font-size: var(--step--1);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
}
.home-content > h2::before,
.section-label::before { content: "// "; color: var(--accent); }

/* Link list on the homepage rendered as plain rows */
.home-content > ul {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
    border-top: 1px solid var(--border);
}
.home-content > ul > li {
    position: relative;
    margin: 0;
    padding: 0.85rem 2.5rem 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    transition: background-color var(--dur-fast) ease;
}
.home-content > ul > li > a:first-child {
    color: var(--text);
    font-weight: 700;
    text-decoration-color: transparent;
}
.home-content > ul > li > a:first-child::after { /* stretch the click target over the row */
    content: "";
    position: absolute;
    inset: 0;
}
.home-content > ul > li::before,
.row::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.6rem;
    bottom: 0.6rem;
    width: 2px;
    border-radius: 2px;
    background: var(--accent);
    transform: scaleY(0);
    transition: transform var(--dur) var(--spring);
}
.home-content > ul > li::after,
.row-arrow {
    position: absolute;
    right: 1rem;
    top: 50%;
    translate: 0 -50%;
    color: var(--muted);
    transition: translate var(--dur) var(--spring), color var(--dur-fast) ease;
}
.home-content > ul > li::after { content: "→"; }
.home-content > ul > li:is(:hover, :focus-within),
.row:is(:hover, :focus-within) { background: var(--surface); }
.home-content > ul > li:is(:hover, :focus-within)::before,
.row:is(:hover, :focus-within)::before { transform: scaleY(1); }
.home-content > ul > li:is(:hover, :focus-within)::after,
.row:is(:hover, :focus-within) .row-arrow { translate: 6px -50%; color: var(--accent); }
.home-content > ul > li:is(:hover, :focus-within) > a:first-child {
    text-decoration-color: var(--accent-hi);
    text-decoration-thickness: var(--ul-thick-hover);
    text-underline-offset: var(--ul-offset-hover);
}

.latest { margin-top: 3.5rem; }
.latest .section-label { margin-bottom: 0.75rem; }
.more-link { margin: 1.25rem 0 0; }

/* ------------------------------------------------------------------ */
/* 8. Listing rows (/blog/, tags, authors, homepage latest)            */
/* ------------------------------------------------------------------ */
.listing { padding-block: clamp(2rem, 6vw, 4rem) 0; }
.listing-header { margin-bottom: 1.75rem; }
.listing-kicker { margin: 0 0 0.25rem; color: var(--accent); font-size: var(--step--1); }
.listing-title { font-size: var(--step-3); }
.listing-sub { margin: 0.5rem 0 0; color: var(--muted); }

.rows {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--border);
}
.row {
    position: relative;
    padding: 1rem 2.75rem 1rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: background-color var(--dur-fast) ease;
}
.row-title {
    font-size: var(--step-1);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.3;
}
.row-link {
    text-decoration-color: transparent;
    display: inline-block; /* lets the view transition size the title box to its text */
}
.row-link::after { content: ""; position: absolute; inset: 0; }
/* Row titles: same drop-and-thicken underline as other links, triggered by the whole row */
.row:is(:hover, :focus-within) .row-link {
    text-decoration-color: var(--accent-hi);
    text-decoration-thickness: var(--ul-thick-hover);
    text-underline-offset: var(--ul-offset-hover);
}
.row-excerpt { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.95rem; }
.row .meta { position: relative; z-index: 1; } /* tag links stay clickable above the stretched link */

/* Meta line and tags */
.meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.15rem 0.6rem;
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: var(--step--1);
}
.tags { display: inline-flex; flex-wrap: wrap; gap: 0 0.6rem; }
.tag {
    color: var(--muted);
    text-decoration-color: rgb(162 172 183 / 0.4);
}
.tag:hover { color: var(--text); }

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    color: var(--muted);
    font-size: var(--step--1);
}

/* ------------------------------------------------------------------ */
/* 9. Article                                                          */
/* ------------------------------------------------------------------ */
.article { padding-top: clamp(2rem, 6vw, 4.5rem); }
.article-header { margin-bottom: 2.25rem; }
.article-title {
    font-size: var(--step-3);
    line-height: 1.08;
    width: fit-content;
    max-width: 100%;
}
.article-header .meta { margin-top: 1rem; }
.article-dek { margin: 1rem 0 0; color: var(--muted); font-size: var(--step-1); line-height: 1.5; }
.article-image { margin: 0 0 2.5rem; }
.article-image img { display: block; width: 100%; border-radius: var(--radius); }
.article-image figcaption { margin-top: 0.6rem; color: var(--muted); font-size: var(--step--1); text-align: center; }

.post-nav { margin-top: 4rem; }
.post-nav-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}
.post-nav-link {
    display: grid;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    text-decoration: none;
    transition: background-color var(--dur-fast) ease;
}
.post-nav-link:hover { background: var(--surface); text-decoration: none; }
.post-nav-link.next { text-align: right; }
.post-nav-label { color: var(--muted); font-size: var(--step--1); }
.post-nav-title { font-weight: 700; }
.post-nav-link:hover .post-nav-title { color: var(--accent-hi); }

/* ------------------------------------------------------------------ */
/* 10. Prose (Ghost content)                                           */
/* ------------------------------------------------------------------ */
.prose > * { margin-block: 0 1.4em; }
.prose > :last-child { margin-bottom: 0; }
.prose h2 { font-size: var(--step-2); margin-top: 2.2em; margin-bottom: 0.6em; }
.prose h3 { font-size: var(--step-1); margin-top: 1.8em; margin-bottom: 0.5em; }
.prose h4, .prose h5, .prose h6 { font-size: 1rem; margin-top: 1.6em; margin-bottom: 0.4em; }
.prose :is(h2, h3, h4) { position: relative; scroll-margin-top: 1.5rem; }
.prose .anchor {
    margin-left: 0.5ch;
    color: var(--accent);
    text-decoration: none;
    opacity: 0;
    transition: opacity var(--dur-fast) ease;
}
.prose :is(h2, h3, h4):hover .anchor,
.prose .anchor:focus-visible { opacity: 1; }

.prose strong { font-weight: 750; color: #F6F4EC; }
.prose em { font-style: italic; }
.prose ul, .prose ol { padding-left: 2ch; }
.prose li { margin-block: 0.3em; padding-left: 0.5ch; }
.prose li::marker { color: var(--accent); }
.prose hr {
    border: 0;
    height: 1px;
    background: var(--border);
    margin-block: 2.5em;
}
.prose del { color: rgb(234 232 223 / 0.6); }
.prose mark { background: var(--accent-tint); color: var(--accent-hi); padding: 0 0.2ch; }

.prose blockquote:not([class]),
.prose blockquote.kg-blockquote-alt {
    margin-inline: 0;
    padding: 0.2em 0 0.2em 1.5ch;
    border-left: 3px solid var(--accent);
    color: var(--muted);
}
.prose blockquote.kg-blockquote-alt {
    border-left: 0;
    padding: 0;
    text-align: center;
    font-size: var(--step-1);
    color: var(--text);
}

/* Inline code: accent tint plus backticks drawn by CSS */
:not(pre) > code {
    font-family: var(--font-mono);
    font-size: 0.92em;
    padding: 0.1em 0.3ch;
    border-radius: 4px;
    background: var(--accent-tint);
    color: var(--text);
}
:not(pre) > code::before,
:not(pre) > code::after {
    content: "`";
    color: rgb(159 224 121 / 0.65);
}

/* Code blocks (Markdown, HTML and Ghost code cards) */
.prose pre {
    grid-column: wide;
    margin-inline: 0;
    padding: 1.1rem 1.25rem;
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    line-height: 1.6;
    tab-size: 2;
    color: var(--text);
}
.prose pre code { font-family: var(--font-mono); background: none; padding: 0; }
.prose pre code::before, .prose pre code::after { content: none; }
.prose figure.kg-code-card { grid-column: wide; margin-inline: 0; }
.prose figure.kg-code-card pre { margin: 0; }

/* Tiny highlighter (assets/js/site.js) uses the CSS Custom Highlight API */
::highlight(ds-comment) { color: var(--syn-comment); }
::highlight(ds-keyword) { color: var(--syn-keyword); }
::highlight(ds-string) { color: var(--syn-string); }
::highlight(ds-number) { color: var(--syn-number); }
::highlight(ds-func) { color: var(--syn-func); }
::highlight(ds-punct) { color: var(--syn-punct); }

/* Tables */
.table-wrap { grid-column: wide; overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.prose :is(th, td) { padding: 0.6em 0.9em; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose th { background: var(--surface); font-weight: 700; }

/* Footnotes (Markdown / HTML cards) */
.prose .footnotes,
.prose section.footnotes {
    margin-top: 3em;
    padding-top: 1.25em;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: var(--step--1);
}
.prose sup a,
.prose .footnote-ref a,
.prose a.footnote-backref { color: var(--accent); text-decoration: none; }
.prose sup { line-height: 0; }

/* ------------------------------------------------------------------ */
/* 11. Ghost cards                                                     */
/* ------------------------------------------------------------------ */
.prose .kg-width-wide,
.prose .kg-embed-card,
.prose .kg-gallery-card,
.prose .kg-bookmark-card { grid-column: wide; }
.prose .kg-width-full { grid-column: full; }
.prose .kg-width-full img { border-radius: 0; }

.prose figure { margin-inline: 0; }
.prose figcaption,
.prose .kg-card figcaption {
    margin-top: 0.6rem;
    color: var(--muted);
    font-size: var(--step--1);
    text-align: center;
}
.prose .kg-image-card img,
.prose .kg-gallery-image img { border-radius: var(--radius); }
.prose .kg-image { display: block; margin-inline: auto; }
.prose .kg-gallery-container { gap: 0.75rem; }
.prose .kg-gallery-row { gap: 0.75rem; }
.prose .kg-gallery-row:not(:first-of-type) { margin-top: 0; }
.prose .kg-gallery-image:not(:first-of-type) { margin-left: 0; }

.prose .kg-embed-card { display: flex; flex-direction: column; align-items: center; }
.prose .kg-embed-card iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border-radius: var(--radius); }

.prose .kg-callout-card,
.prose .kg-callout-card[class*="kg-callout-card-"] {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    color: var(--text);
    padding: 1rem 1.25rem;
}
.prose .kg-callout-card-accent {
    background: var(--accent-tint) !important;
    border-color: var(--accent);
}
.prose .kg-callout-card-accent .kg-callout-text,
.prose .kg-callout-card-accent a { color: var(--text) !important; }
.prose .kg-callout-text { font-size: 1rem; line-height: 1.65; }

.prose .kg-toggle-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: none;
    padding: 1rem 1.25rem;
}
.prose .kg-toggle-heading-text { font-family: var(--font); font-size: 1rem; font-weight: 700; color: var(--text); }
.prose .kg-toggle-card-icon svg { color: var(--accent); }
.prose .kg-toggle-content { color: var(--muted); }
.prose .kg-toggle-content p { font-size: 0.95rem; }

.prose .kg-bookmark-card a.kg-bookmark-container {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    box-shadow: none;
    overflow: hidden;
    transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.prose .kg-bookmark-card a.kg-bookmark-container:hover { border-color: var(--accent); background: var(--raised); }
.prose .kg-bookmark-title { color: var(--text); font-weight: 700; font-size: 0.95rem; }
.prose .kg-bookmark-description { color: var(--muted); font-size: 0.85rem; }
.prose .kg-bookmark-metadata { color: var(--muted); font-size: 0.8rem; }
.prose .kg-bookmark-publisher,
.prose .kg-bookmark-author { color: var(--muted); }
.prose .kg-bookmark-thumbnail img { border-radius: 0; }

.prose .kg-button-card { display: flex; }
.button,
.prose .kg-btn,
.prose .kg-button-card a.kg-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5ch;
    height: auto;
    padding: 0.65rem 1.1rem;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--bg) !important;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    transition: background-color var(--dur-fast) ease, translate var(--dur) var(--spring);
}
.button:hover,
.prose .kg-btn:hover { background: var(--accent-hi); text-decoration: none; translate: 0 -2px; }
.button-quiet {
    background: transparent;
    color: var(--accent) !important;
    border-color: var(--border);
}
.button-quiet:hover { background: var(--accent-tint); border-color: var(--accent); }

.prose .kg-header-card,
.prose .kg-cta-card,
.prose .kg-product-card-container,
.prose .kg-file-card-container,
.prose .kg-audio-card {
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.prose .kg-file-card-title,
.prose .kg-audio-title { color: var(--text); }
.prose .kg-file-card-caption,
.prose .kg-file-card-metadata,
.prose .kg-audio-player-container { color: var(--muted); }

/* ------------------------------------------------------------------ */
/* 12. Error pages                                                     */
/* ------------------------------------------------------------------ */
.error { padding-block: clamp(3rem, 10vw, 7rem); }
.error-code {
    margin: 0;
    font-size: clamp(4.5rem, 2rem + 14vw, 9rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.06em;
    color: var(--accent);
}
.error-title { margin-top: 1rem; font-size: var(--step-2); }
.error-text { color: var(--muted); }
.error-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }

/* ------------------------------------------------------------------ */
/* 13. Footer                                                          */
/* ------------------------------------------------------------------ */
.site-footer { margin-top: clamp(4rem, 10vw, 7rem); border-top: 1px solid var(--border); }
.site-footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    padding-block: 1.75rem 2.25rem;
    color: var(--muted);
    font-size: var(--step--1);
}
.footer-brand { color: var(--text); font-weight: 800; letter-spacing: -0.04em; }
.site-footer .nav-list a { color: var(--muted); }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--text); }

/* ------------------------------------------------------------------ */
/* 14. Motion                                                          */
/* ------------------------------------------------------------------ */

/* Cross-document view transitions (Chromium 126+, Safari 18.2+) */
@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) { animation-duration: 0.28s; animation-timing-function: ease; }

/* Wordmark: big on the homepage, small in the nav elsewhere */
::view-transition-group(wordmark) {
    animation-duration: 0.6s;
    animation-timing-function: var(--spring);
}

/* Post titles: list row title morphs into the article heading */
.row-link,
.article-title { view-transition-class: title; }
::view-transition-group(*.title) {
    animation-duration: 0.5s;
    animation-timing-function: var(--ease-out);
}
::view-transition-old(*.title),
::view-transition-new(*.title) {
    height: 100%;
    object-fit: contain;
    object-position: left top;
}
/* The titles re-wrap between sizes, so hand over quickly instead of a long double-exposure */
::view-transition-old(*.title) { animation-duration: 0.16s; }
::view-transition-new(*.title) { animation-duration: 0.3s; animation-delay: 0.06s; animation-fill-mode: both; }

/* Entrance: CSS-only stagger on first paint */
.enter {
    transition:
        opacity var(--dur-slow) var(--ease-out),
        translate var(--dur-slow) var(--ease-out);
    transition-delay: calc(min(var(--i, 0), 8) * 55ms);
}
@starting-style {
    .enter { opacity: 0; translate: 0 12px; }
}

/* Homepage wordmark settles in: tracking tightens with a spring */
.hero-title .wordmark {
    transition: letter-spacing 0.9s var(--spring), opacity 0.5s ease;
}
@starting-style {
    .hero-title .wordmark { letter-spacing: 0.08em; opacity: 0; }
}

/* ------------------------------------------------------------------ */
/* 15. Reduced motion: no transitions, no animations, no view morphs   */
/* ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
        scroll-behavior: auto !important;
    }
    .wordmark, .row-link, .article-title { view-transition-name: none !important; }
    .enter { translate: none; }
    a, .row-link, .nav-list a { transition: none !important; } /* underline changes instantly */
    .button:hover, .prose .kg-btn:hover { translate: none; }
}

/* ------------------------------------------------------------------ */
/* 16. Small screens                                                   */
/* ------------------------------------------------------------------ */
@media (max-width: 600px) {
    .site-header-inner { padding-block: 1rem; }
    .site-nav { gap: 0.9rem; }
    .row { padding: 0.9rem 2.25rem 0.9rem 0.75rem; }
    .home-content > ul > li { padding: 0.8rem 2.25rem 0.8rem 0.75rem; }
    .row-arrow, .home-content > ul > li::after { right: 0.6rem; }
    .prose pre { border-radius: 0; border-inline: 0; grid-column: full; }
    .post-nav-link.next { text-align: left; }
}

/* Print */
@media print {
    .site-header, .site-footer, .post-nav, .icon-button { display: none; }
    body { background: #fff; color: #000; }
}
