/*
 * blog.calvinbrown.dev
 *
 * Plain CSS, like the tools family's shared stylesheet — no utility layer and
 * no build step for the styles. tools.css is loaded first and owns the nav and
 * the toast; this file owns everything below them.
 *
 * Dark mode keys off `.dark` on <html>, which is what tools.js sets. Every
 * color goes through a custom property so the two themes differ in exactly one
 * block and nothing downstream has to know which one is active.
 */

/* ------------------------------------------------------------------ *
 * Tokens
 * ------------------------------------------------------------------ */

:root {
    /* Surfaces. Light is very slightly warm rather than pure white — long-form
       reading on #ffffff is harsher than it needs to be. */
    --bg: #fdfdfc;
    --surface: #ffffff;
    --surface-sunk: #f5f5f3;

    --text: #14161a;
    --text-soft: #414750;
    --muted: #6b7280;
    --border: #e6e6e1;
    --border-strong: #d3d3cc;

    /* Same blue as the rest of the family, so a link here and a link on the
       tools hub are the same color. */
    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.09);

    --code-bg: #f6f7f9;
    --code-bar: #eceef1;
    --code-border: #e2e5ea;
    --code-inline-bg: rgba(17, 24, 39, 0.055);

    --shadow-sm: 0 1px 2px rgba(16, 18, 22, 0.05);
    --shadow-md: 0 10px 30px -12px rgba(16, 18, 22, 0.22);

    --font-ui: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
    --font-prose: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    /* The reading column. Around 68 characters at the prose size, which is the
       range where the eye finds the next line without effort. */
    --measure: 40rem;
    --gutter: 1.5rem;
}

html.dark {
    --bg: #0f1419;
    --surface: #161b22;
    --surface-sunk: #1c222b;

    --text: #e8eaed;
    --text-soft: #b6bcc6;
    --muted: #8b939f;
    --border: #262c36;
    --border-strong: #333b47;

    --accent: #6ea8fe;
    --accent-soft: rgba(110, 168, 254, 0.13);

    --code-bg: #12171e;
    --code-bar: #1a212a;
    --code-border: #262c36;
    --code-inline-bg: rgba(233, 237, 243, 0.08);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 30px -12px rgba(0, 0, 0, 0.7);
}

/* The nav is styled by tools.css against its own variables. Nudge them to
   match this page rather than the tools' gray, so the seam doesn't show. */
:root {
    --tools-bg: var(--surface);
    --tools-border: var(--border);
    --tools-text: var(--text);
    --tools-muted: var(--muted);
    --tools-hover: var(--surface-sunk);
    --tools-accent: var(--accent);
}

/* ------------------------------------------------------------------ *
 * Base
 * ------------------------------------------------------------------ */

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

html {
    scroll-behavior: smooth;
    /* Anchor jumps otherwise land under the sticky nav. */
    scroll-padding-top: 5rem;
    -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

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

.hidden {
    display: none !important;
}

.wrap {
    width: 100%;
    /* Close to the reading measure, so the rules between index entries end
       near where the text does rather than running off to the right. */
    max-width: 46rem;
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.wrap--post {
    max-width: calc(var(--measure) + var(--gutter) * 2);
}

main {
    flex: 1;
    padding-top: 3.5rem;
    padding-bottom: 5rem;
}

/* A visual separator between two pieces of metadata. */
.dot {
    display: inline-block;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.45;
    vertical-align: middle;
    margin: 0 0.15rem;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 200;
    padding: 0.6rem 1rem;
    background: var(--accent);
    color: #fff;
    border-radius: 0 0 0.4rem 0;
    font-size: 0.875rem;
    font-weight: 600;
}

.skip-link:focus {
    left: 0;
}

/* ------------------------------------------------------------------ *
 * Reading progress
 * ------------------------------------------------------------------ */

/*
 * Sits above the sticky nav from tools.css (z-index 50). Width is driven by
 * blog.js writing a --progress custom property, so the scroll handler touches
 * one property and never triggers layout.
 */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 60;
    pointer-events: none;
}

.reading-progress > span {
    display: block;
    height: 100%;
    width: var(--progress, 0%);
    background: var(--accent);
    transition: width 90ms linear;
}

/* Only a post is long enough for progress to mean anything. */
body:not(.page-post) .reading-progress {
    display: none;
}

/* ------------------------------------------------------------------ *
 * Index — masthead and controls
 * ------------------------------------------------------------------ */

.masthead {
    margin-bottom: 2.5rem;
}

.masthead__title {
    font-family: var(--font-prose);
    font-size: clamp(2.25rem, 6vw, 3rem);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 0.6rem;
}

.masthead__tagline {
    margin: 0;
    max-width: 34rem;
    color: var(--muted);
    font-size: 1.0625rem;
    line-height: 1.6;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 2.5rem;
}

.search {
    position: relative;
    max-width: 22rem;
}

.search__icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.search input {
    width: 100%;
    padding: 0.6rem 2.5rem 0.6rem 2.4rem;
    font: inherit;
    font-size: 0.9375rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.search input::placeholder {
    color: var(--muted);
}

.search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* The browser's own clear button would sit on top of the "/" hint. */
.search input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.search kbd {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.1rem 0.35rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--muted);
    border: 1px solid var(--border-strong);
    border-radius: 0.25rem;
    pointer-events: none;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* ------------------------------------------------------------------ *
 * Tags
 * ------------------------------------------------------------------ */

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.85rem;
}

.tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-soft);
    background: var(--surface-sunk);
    border: 1px solid var(--border);
    border-radius: 999px;
}

button.tag {
    cursor: pointer;
    transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

button.tag:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.tag--filter.is-active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

html.dark .tag--filter.is-active {
    color: #0f1419;
}

/* ------------------------------------------------------------------ *
 * Index — post list
 * ------------------------------------------------------------------ */

.post-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.post-card {
    padding: 1.6rem 0;
    border-top: 1px solid var(--border);
}

.post-card:last-child {
    border-bottom: 1px solid var(--border);
}

.post-card__link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.post-card__link:hover {
    text-decoration: none;
}

.post-card__meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.post-card__title {
    font-family: var(--font-prose);
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin: 0.35rem 0 0.4rem;
    /* Underline only on hover, and only the title — the whole card is the
       click target but a fully underlined card is visual noise. */
    background-image: linear-gradient(var(--accent), var(--accent));
    background-size: 0% 1.5px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size 220ms ease, color 120ms ease;
}

.post-card__link:hover .post-card__title,
.post-card__link:focus-visible .post-card__title {
    color: var(--accent);
    background-size: 100% 1.5px;
}

.post-card__excerpt {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.9375rem;
    line-height: 1.65;
}

.draft-badge {
    margin-left: 0.35rem;
    padding: 0.05rem 0.4rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #b45309;
    background: rgba(180, 83, 9, 0.12);
    border-radius: 0.25rem;
}

html.dark .draft-badge {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.15);
}

.empty-state {
    padding: 3.5rem 0;
    text-align: center;
    color: var(--muted);
}

.empty-state code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    padding: 0.15rem 0.35rem;
    background: var(--code-inline-bg);
    border-radius: 0.25rem;
}

/* ------------------------------------------------------------------ *
 * Post — header
 * ------------------------------------------------------------------ */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted);
}

.back-link:hover {
    color: var(--accent);
    text-decoration: none;
}

.back-link svg {
    transition: transform 150ms ease;
}

.back-link:hover svg {
    transform: translateX(-2px);
}

.draft-banner {
    margin: 0 0 2rem;
    padding: 0.7rem 1rem;
    font-size: 0.875rem;
    color: #92400e;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 0.5rem;
}

html.dark .draft-banner {
    color: #fcd34d;
}

.draft-banner code {
    font-family: var(--font-mono);
    font-size: 0.85em;
}

.post__header {
    margin-bottom: 2.5rem;
}

.post__meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.post__title {
    font-family: var(--font-prose);
    font-size: clamp(2rem, 5.5vw, 2.75rem);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.022em;
    margin: 0.5rem 0 0.75rem;
    text-wrap: balance;
}

.post__lede {
    margin: 0;
    font-family: var(--font-prose);
    font-size: 1.1875rem;
    line-height: 1.6;
    color: var(--muted);
    text-wrap: pretty;
}

/* ------------------------------------------------------------------ *
 * Post — table of contents
 * ------------------------------------------------------------------ */

/*
 * Inline above the article on narrow screens. On a wide viewport there is room
 * beside the reading column, so it floats into the left margin and follows the
 * scroll — without ever narrowing the measure.
 */
.toc {
    margin: 0 0 2.5rem;
    padding: 1rem 1.1rem;
    background: var(--surface-sunk);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
}

.toc__label {
    margin: 0 0 0.5rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.875rem;
}

.toc__item {
    margin: 0.3rem 0;
    line-height: 1.4;
}

.toc__item--h3 {
    padding-left: 0.9rem;
    font-size: 0.8125rem;
}

.toc__item a {
    color: var(--text-soft);
}

.toc__item a:hover {
    color: var(--accent);
    text-decoration: none;
}

.toc__item.is-current > a {
    color: var(--accent);
    font-weight: 600;
}

@media (min-width: 1180px) {
    .toc {
        position: fixed;
        top: 7rem;
        /* Half the viewport, back off half the reading column, then the TOC's
           own width and a gap — i.e. flush to the left of the measure. */
        left: calc(50% - var(--measure) / 2 - 15rem);
        width: 13rem;
        max-height: calc(100vh - 10rem);
        overflow-y: auto;
        margin: 0;
        padding: 0 0 0 0.9rem;
        background: none;
        border: 0;
        border-left: 1px solid var(--border);
        border-radius: 0;
    }
}

/* ------------------------------------------------------------------ *
 * Post — prose
 * ------------------------------------------------------------------ */

.prose {
    font-family: var(--font-prose);
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--text);
    /* Source Serif 4 is a variable font with an optical size axis; tying it to
       the rendered size thins the strokes appropriately as text gets larger. */
    font-optical-sizing: auto;
}

/*
 * One rule owns the vertical rhythm: clear the browser's own margins, then put
 * space only *between* siblings. Anything wanting more (headings, code, rules)
 * overrides margin-top with a type selector, which outranks this on
 * specificity. Nothing should reintroduce a plain `margin: 0` on a child here
 * — it would outrank the owl below and collapse the gap between paragraphs.
 */
.prose > * {
    margin-top: 0;
    margin-bottom: 0;
}

.prose > * + * {
    margin-top: 1.4em;
}

/* A post opening on a heading shouldn't start with the heading's big lead-in. */
.prose > :first-child {
    margin-top: 0;
}

.prose p {
    text-wrap: pretty;
}

/* Loose list items wrap their content in <p>, which would otherwise keep the
   browser's 1em margins inside the bullet. */
.prose li > p {
    margin: 0;
}

.prose li > p + p {
    margin-top: 0.8em;
}

.prose h2,
.prose h3,
.prose h4 {
    font-family: var(--font-prose);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.015em;
    color: var(--text);
    scroll-margin-top: 5rem;
    text-wrap: balance;
}

.prose h2 {
    font-size: 1.625rem;
    margin-top: 2.6em;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border);
}

.prose h3 {
    font-size: 1.3125rem;
    margin-top: 2.2em;
}

.prose h4 {
    font-size: 1.125rem;
    margin-top: 2em;
}

/* Needs to outrank the three rules above, which set margin-top by type. */
.prose > h2:first-child,
.prose > h3:first-child,
.prose > h4:first-child {
    margin-top: 0;
}

/* A quiet "#" that appears on hover, for linking to a section. */
.heading-anchor {
    margin-left: 0.4rem;
    color: var(--muted);
    font-family: var(--font-ui);
    font-weight: 400;
    text-decoration: none;
    opacity: 0;
    transition: opacity 120ms ease;
}

.prose h2:hover .heading-anchor,
.prose h3:hover .heading-anchor,
.prose h4:hover .heading-anchor,
.heading-anchor:focus-visible {
    opacity: 1;
}

.prose a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.16em;
    text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
    transition: text-decoration-color 120ms ease;
}

.prose a:hover {
    text-decoration-color: var(--accent);
}

.prose strong {
    font-weight: 600;
}

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

.prose li + li {
    margin-top: 0.45em;
}

.prose li::marker {
    color: var(--muted);
}

.prose blockquote {
    margin: 1.8em 0;
    padding: 0.2em 0 0.2em 1.3em;
    border-left: 2px solid var(--accent);
    color: var(--text-soft);
    font-style: italic;
}

.prose blockquote p {
    margin: 0;
}

.prose blockquote > * + * {
    margin-top: 0.9em;
}

.prose hr {
    margin: 3em 0;
    border: 0;
    border-top: 1px solid var(--border);
}

.prose img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

.post-figure {
    margin: 2em 0;
}

.post-figure figcaption {
    margin-top: 0.6rem;
    font-family: var(--font-ui);
    font-size: 0.8125rem;
    color: var(--muted);
    text-align: center;
}

/* --- Inline code --- */

.prose :not(pre) > code {
    font-family: var(--font-mono);
    font-size: 0.855em;
    /* Kept tight horizontally: wider padding reads as a space before the next
       character, which looks like a typo when code is followed by a comma. */
    padding: 0.12em 0.28em;
    background: var(--code-inline-bg);
    border-radius: 0.3rem;
    /*
     * `overflow-wrap`, not `word-break: break-word`. The latter lowers the
     * element's min-content width, which lets an auto-layout table squeeze a
     * column narrower than the code in it — `canonical` then breaks after
     * "canonica". This breaks only when a token genuinely cannot fit.
     */
    overflow-wrap: break-word;
}

/* --- Tables --- */

.table-scroll {
    margin: 2em 0;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-ui);
    font-size: 0.875rem;
}

.prose th,
.prose td {
    padding: 0.6rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.prose thead th {
    background: var(--surface-sunk);
    font-weight: 600;
    white-space: nowrap;
}

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

/* --- Footnotes --- */

.prose sup a {
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 0.7em;
    font-weight: 600;
    padding: 0 0.15em;
}

.footnotes {
    margin-top: 3.5em;
    padding-top: 1.5em;
    border-top: 1px solid var(--border);
    font-size: 0.9375rem;
    color: var(--text-soft);
}

.footnotes h2 {
    /* marked-footnote emits a heading for the section; the rule above it is
       already the visual separator. */
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.footnotes ol {
    margin: 0;
    padding-left: 1.2em;
}

.footnotes li {
    margin: 0.5em 0;
}

.footnotes p {
    margin: 0;
    display: inline;
}

/* ------------------------------------------------------------------ *
 * Code blocks
 * ------------------------------------------------------------------ */

.code-block {
    margin: 1.9em 0;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 0.6rem;
    overflow: hidden;
}

.code-block__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 2.1rem;
    padding: 0.25rem 0.35rem 0.25rem 0.85rem;
    background: var(--code-bar);
    border-bottom: 1px solid var(--code-border);
}

.code-lang {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.code-copy {
    margin-left: auto;
    padding: 0.25rem 0.6rem;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.3rem;
    cursor: pointer;
    transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.code-copy:hover {
    color: var(--accent);
    background: var(--surface);
    border-color: var(--border-strong);
}

/*
 * Shiki emits both themes at once: every span carries --shiki-light and
 * --shiki-dark, and the page picks a side. That is why switching theme
 * recolors code with no second stylesheet and no client-side highlighting.
 * The background is deliberately ours rather than Shiki's --shiki-*-bg, which
 * would drop a GitHub-colored slab into a page that is not GitHub-colored.
 */
.code-block .shiki {
    margin: 0;
    padding: 0.95rem 1rem;
    overflow-x: auto;
    background: transparent !important;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.65;
    tab-size: 4;
}

.code-block .shiki code {
    font-family: inherit;
    display: block;
    width: fit-content;
    min-width: 100%;
}

.code-block .shiki,
.code-block .shiki span {
    color: var(--shiki-light);
}

html.dark .code-block .shiki,
html.dark .code-block .shiki span {
    color: var(--shiki-dark);
}

/*
 * Shiki separates its .line spans with real newlines, and inside a <pre> those
 * are preserved. Making .line a block would add a second break and double-space
 * every listing, so the spans stay inline and the newline does the work.
 */

/* ------------------------------------------------------------------ *
 * Post — footer navigation
 * ------------------------------------------------------------------ */

.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.post-nav__link {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.9rem 1.1rem;
    color: inherit;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.post-nav__link:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    transform: translateY(-1px);
}

.post-nav__link--next {
    text-align: right;
}

.post-nav__dir {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
}

.post-nav__title {
    font-family: var(--font-prose);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

.post-nav__link:hover .post-nav__title {
    color: var(--accent);
}

/* ------------------------------------------------------------------ *
 * 404
 * ------------------------------------------------------------------ */

.notfound {
    text-align: center;
    padding-top: 5rem;
}

.notfound__code {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 4rem;
    font-weight: 500;
    line-height: 1;
    color: var(--border-strong);
}

.notfound__title {
    font-family: var(--font-prose);
    font-size: 2rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem;
}

.notfound__body {
    max-width: 26rem;
    margin: 0 auto 2rem;
    color: var(--muted);
}

.button {
    display: inline-block;
    padding: 0.55rem 1.1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border-radius: 0.5rem;
}

html.dark .button {
    color: #0f1419;
}

.button:hover {
    text-decoration: none;
    filter: brightness(1.08);
}

/* ------------------------------------------------------------------ *
 * Footer
 * ------------------------------------------------------------------ */

.site-footer {
    padding: 2rem 0 2.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--muted);
    text-align: center;
}

.site-footer p {
    margin: 0;
}

.site-footer a {
    color: var(--text-soft);
}

.site-footer a:hover {
    color: var(--accent);
}

.site-footer .dot {
    margin: 0 0.5rem;
}

.site-footer__fine {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    opacity: 0.75;
}

/* ------------------------------------------------------------------ *
 * Narrow screens
 * ------------------------------------------------------------------ */

@media (max-width: 640px) {
    :root {
        --gutter: 1.15rem;
    }

    main {
        padding-top: 2.5rem;
    }

    .prose {
        font-size: 1.0625rem;
    }

    .post-nav {
        grid-template-columns: 1fr;
    }

    .post-nav__link--next {
        text-align: left;
    }
}

/* ------------------------------------------------------------------ *
 * Print
 * ------------------------------------------------------------------ */

@media print {
    .tools-nav,
    .reading-progress,
    .toc,
    .post-nav,
    .back-link,
    .code-copy,
    .site-footer {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }

    .prose a::after {
        content: ' (' attr(href) ')';
        font-size: 0.8em;
        color: #555;
    }
}
