/* Leaf KDE–inspired palette (https://github.com/qewer33/leaf-kde) */

:root {
    --leaf-accent: #729b79;
    --leaf-accent-hover: #628a69;
    --leaf-accent-muted: #80af88;
    --leaf-link: #0095b3;
    --leaf-link-hover: #008099;
    --leaf-highlight: #88c0d0;
    --leaf-positive: #729b79;
    --leaf-negative: #da4453;
    --leaf-neutral: #4ac6ff;

    /* Theme default: Newsreader for content; Ghost Brand → heading/body overrides via {{ghost_head}}. */
    --gh-font-heading: "Newsreader", Georgia, "Times New Roman", serif;
    --gh-font-body: "Newsreader", Georgia, "Times New Roman", serif;
    --leaf-font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;

    --leaf-radius: 6px;
    --leaf-radius-lg: 14px;
    --leaf-max-width: 42rem;
    --leaf-wide-width: 64rem;
    --leaf-space: 1.5rem;
    --leaf-header-height: 4rem;

    --leaf-font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --leaf-line-body: 1.7;
    --leaf-line-display: 1.15;
    --leaf-heading-weight: 500;
}

@media (prefers-color-scheme: light) {
    :root {
        --leaf-bg: #e1e4dc;
        --leaf-bg-alt: #d3d6ce;
        --leaf-bg-elevated: #f5f6f2;
        --leaf-text: #2e2c2f;
        --leaf-text-muted: #565258;
        --leaf-border: #c5c8c0;
        --leaf-code-bg: #d3d6ce;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --leaf-bg: #2e2c2f;
        --leaf-bg-alt: #29282a;
        --leaf-bg-elevated: #363438;
        --leaf-text: #e1e4dc;
        --leaf-text-muted: #a6acb6;
        --leaf-border: #3d3b3e;
        --leaf-code-bg: #29282a;
    }
}

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

html {
    font-size: 106.25%;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--gh-font-body);
    font-weight: 400;
    line-height: var(--leaf-line-body);
    color: var(--leaf-text);
    background-color: var(--leaf-bg);
    font-optical-sizing: auto;
}

:is(h1, h2, h3, h4, h5, h6) {
    font-family: var(--gh-font-heading);
    font-weight: var(--leaf-heading-weight);
    letter-spacing: 0;
    line-height: var(--leaf-line-display);
    text-wrap: balance;
}

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

a {
    color: var(--leaf-link);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
}

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

.site-wrapper {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
    overflow-x: clip;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid transparent;
    background: color-mix(in srgb, var(--leaf-bg) 90%, transparent);
    -webkit-backdrop-filter: saturate(1.2) blur(10px);
    backdrop-filter: saturate(1.2) blur(10px);
    transition: border-color 0.2s ease;
}

.site-header.is-scrolled {
    border-bottom-color: var(--leaf-border);
}

.site-header__inner {
    max-width: var(--leaf-wide-width);
    margin: 0 auto;
    padding: 0 var(--leaf-space);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: var(--leaf-header-height);
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-right: auto;
    color: var(--leaf-text);
    font-family: var(--gh-font-body);
    font-size: 1.0625rem;
    font-weight: var(--leaf-heading-weight);
    line-height: 1.1;
    text-decoration: none;
}

.site-brand:hover {
    color: var(--leaf-text);
}

.site-brand__logo {
    width: auto;
    max-height: 2.25rem;
}

.site-brand__icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    object-fit: cover;
}

.site-brand--icon-only .site-brand__icon {
    width: 32px;
    height: 32px;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    font-family: var(--leaf-font-ui);
    font-size: 0.875rem;
}

.site-nav .nav {
    display: flex;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav .nav a,
.site-nav__link {
    color: color-mix(in srgb, var(--leaf-text) 62%, var(--leaf-text-muted));
    text-decoration: none;
    transition: color 0.15s ease;
}

.site-nav .nav a:hover,
.site-nav .nav-current a,
.site-nav__link:hover {
    color: var(--leaf-text);
}

.site-nav__members {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.site-header__actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.site-icon-button {
    display: inline-grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 0;
    border-radius: var(--leaf-radius);
    background: none;
    color: color-mix(in srgb, var(--leaf-text) 55%, var(--leaf-text-muted));
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.site-icon-button:hover {
    background: color-mix(in srgb, var(--leaf-text) 6%, transparent);
    color: var(--leaf-text);
}

.site-burger {
    display: none;
}

.site-burger__close {
    display: none;
}

@media (max-width: 860px) {
    .site-burger {
        display: inline-grid;
    }

    .site-nav {
        position: fixed;
        top: var(--leaf-header-height);
        right: 0;
        left: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
        max-height: calc(100vh - var(--leaf-header-height));
        padding: 1.5rem var(--leaf-space) 2rem;
        overflow-y: auto;
        border-bottom: 1px solid var(--leaf-border);
        background: var(--leaf-bg);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-0.5rem);
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    }

    .is-menu-open .site-nav {
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .is-menu-open .site-burger__open {
        display: none;
    }

    .is-menu-open .site-burger__close {
        display: block;
    }

    .site-nav .nav {
        flex-direction: column;
        gap: 0;
    }

    .site-nav .nav a {
        display: block;
        padding: 0.65rem 0;
        border-bottom: 1px solid var(--leaf-border);
        color: var(--leaf-text);
        font-family: var(--leaf-font-ui);
        font-size: 1.0625rem;
        font-weight: 600;
    }

    .site-nav__members {
        justify-content: space-between;
    }
}

.site-main {
    flex: 1;
    max-width: var(--leaf-wide-width);
    width: 100%;
    margin: 0 auto;
    padding: calc(var(--leaf-space) * 1.5) var(--leaf-space);
}

/* Footer newsletter */

.newsletter-signup {
    width: 100%;
    max-width: none;
    margin: calc(var(--leaf-space) * 2) 0 0;
    padding: calc(var(--leaf-space) * 2) var(--leaf-space);
    box-sizing: border-box;
    border-top: 1px dashed var(--leaf-border);
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--leaf-accent) 6%, transparent) 0,
        transparent 12rem
    );
}

.newsletter-signup__inner {
    max-width: 32rem;
    margin: 0 auto;
    text-align: center;
}

.newsletter-signup__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    margin: 0 auto 1.25rem;
    border: 2px dashed color-mix(in srgb, var(--leaf-accent) 55%, var(--leaf-border));
    border-radius: 50%;
    color: var(--leaf-accent);
    background: color-mix(in srgb, var(--leaf-accent) 8%, var(--leaf-bg));
}

.newsletter-signup__icon-svg {
    width: 1.375rem;
    height: 1.375rem;
}

.newsletter-signup__title {
    margin: 0 0 0.75rem;
    font-family: var(--gh-font-heading);
    font-size: clamp(1.5rem, 4vw, 1.875rem);
    font-weight: var(--leaf-heading-weight);
    line-height: var(--leaf-line-display);
    letter-spacing: 0;
}

.newsletter-signup__text {
    margin: 0 0 1.5rem;
    font-family: var(--gh-font-body);
    font-size: 1.0625rem;
    line-height: 1.55;
    color: var(--leaf-text-muted);
}

.newsletter-signup__action {
    text-align: left;
}

.newsletter-signup__action .subscribe-form {
    max-width: none;
    width: 100%;
}

.newsletter-signup .subscribe-form__row {
    padding: 0.35rem 0;
    border: 0;
    border-bottom: 1px dashed color-mix(in srgb, var(--leaf-accent) 35%, var(--leaf-border));
    border-radius: 0;
    background: transparent;
    transition: border-color 0.15s ease;
}

.newsletter-signup .subscribe-form__row:focus-within {
    border-bottom-color: color-mix(in srgb, var(--leaf-accent) 55%, var(--leaf-border));
}

.newsletter-signup__subscribed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin: 0;
    font-size: 0.9375rem;
    color: var(--leaf-text-muted);
    text-align: center;
}

.newsletter-signup__subscribed .leaf-icon {
    color: var(--leaf-accent);
    flex-shrink: 0;
}

.newsletter-signup__subscribed a {
    color: var(--leaf-text);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--leaf-accent) 45%, transparent);
    text-underline-offset: 0.15em;
}

.newsletter-signup__subscribed a:hover {
    color: var(--leaf-accent-hover);
    text-decoration-color: var(--leaf-accent);
}

.newsletter-signup__note {
    margin: 0.9rem 0 0;
    font-family: var(--leaf-font-ui);
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--leaf-text-muted);
}

.site-footer {
    border-top: 1px solid var(--leaf-border);
    background: color-mix(in srgb, var(--leaf-bg) 90%, transparent);
    -webkit-backdrop-filter: saturate(1.2) blur(10px);
    backdrop-filter: saturate(1.2) blur(10px);
    font-family: var(--leaf-font-ui);
    font-size: 0.8125rem;
    color: var(--leaf-text-muted);
}

.site-footer__inner {
    max-width: var(--leaf-wide-width);
    margin: 0 auto;
    padding: 0 var(--leaf-space);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    min-height: var(--leaf-header-height);
}

.site-footer__end {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
}

.site-footer__nav .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-footer__nav .nav a {
    color: var(--leaf-text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
}

.site-footer__nav .nav a:hover,
.site-footer__nav .nav-current a {
    color: var(--leaf-accent);
}

.site-footer__rss {
    color: var(--leaf-text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
}

.site-footer__rss:hover {
    color: var(--leaf-accent);
}

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

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

/* Buttons (header, hero subscribe, errors, editor cards) */

.leaf-btn,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0.65rem 1.25rem;
    border: 0;
    border-radius: 0;
    background: var(--leaf-accent);
    color: #fff;
    box-shadow: none;
    font-family: var(--leaf-font-ui);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.leaf-btn:hover,
.button:hover {
    background: var(--leaf-accent-hover);
    color: #fff;
}

.leaf-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

.leaf-btn--compact {
    height: 2.35rem;
    padding: 0 1.1rem;
    line-height: 1;
}

.leaf-btn--large {
    font-size: 0.875rem;
    padding: 0.75rem 1.35rem;
}

.leaf-btn--ghost {
    border: 1px solid var(--leaf-border);
    background: transparent;
    color: var(--leaf-text);
}

.leaf-btn--ghost:hover {
    border-color: color-mix(in srgb, var(--leaf-text) 35%, var(--leaf-border));
    background: transparent;
    color: var(--leaf-text);
}

/* Home hero */

.home-hero {
    /* Pull up only; keep horizontal inset aligned with header + .site-main padding */
    margin: calc(var(--leaf-space) * -1.5) 0 var(--leaf-space);
    padding: calc(var(--leaf-space) * 1.25) 0 calc(var(--leaf-space) * 1.25);
    background: var(--leaf-bg);
}

.home-hero__inner {
    width: 100%;
    max-width: var(--leaf-max-width);
    margin: 0;
    text-align: left;
}

.home-hero__byline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 1.25rem;
    font-family: var(--leaf-font-ui);
    font-size: 0.8125rem;
    color: var(--leaf-text-muted);
}

.home-hero__byline-text {
    line-height: 1.4;
}

.home-hero__byline a {
    color: var(--leaf-text);
    font-weight: 600;
    text-decoration: none;
}

.home-hero__byline a:hover {
    color: var(--leaf-accent);
}

.home-hero__avatars {
    display: flex;
    flex-shrink: 0;
}

.home-hero__avatar {
    width: 2.25rem;
    height: 2.25rem;
    border: 2px solid var(--leaf-bg);
    border-radius: 50%;
    background: var(--leaf-bg-alt);
    object-fit: cover;
}

.home-hero__avatars .home-hero__avatar + .home-hero__avatar {
    margin-left: -0.65rem;
}

.home-hero__avatar--blank {
    display: inline-block;
}

.home-hero__title {
    margin: 0 0 1rem;
    max-width: 20ch;
    font-size: clamp(2.125rem, 6.5vw, 3.25rem);
    font-weight: var(--leaf-heading-weight);
    letter-spacing: 0;
    line-height: var(--leaf-line-display);
}

.home-hero__description {
    margin: 0 0 1.75rem;
    max-width: 38ch;
    font-family: var(--gh-font-body);
    font-size: 1.125rem;
    font-weight: 400;
    line-height: 1.55;
    color: var(--leaf-text-muted);
}

.home-hero__note {
    margin: 0.9rem 0 0;
    font-family: var(--leaf-font-ui);
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--leaf-text-muted);
}

.home-hero__subscribed {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
    font-size: 0.9375rem;
    color: var(--leaf-text-muted);
}

.home-hero__subscribed .leaf-icon {
    color: var(--leaf-accent);
    flex-shrink: 0;
}

.home-hero__subscribed a {
    color: var(--leaf-text);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--leaf-accent) 45%, transparent);
    text-underline-offset: 0.15em;
}

.home-hero__subscribed a:hover {
    color: var(--leaf-accent-hover);
    text-decoration-color: var(--leaf-accent);
}

.home-hero__subscribe {
    max-width: 30rem;
}

.home-hero__subscribe .subscribe-form__row {
    padding: 0.35rem 0;
    border: 0;
    border-bottom: 1px dashed color-mix(in srgb, var(--leaf-accent) 35%, var(--leaf-border));
    border-radius: 0;
    background: transparent;
}

.home-hero__subscribe .subscribe-form__row:focus-within {
    border-bottom-color: color-mix(in srgb, var(--leaf-accent) 55%, var(--leaf-border));
}

.home-hero__subscribe .home-hero__subscribed {
    margin: 0;
}

.leaf-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
}

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

.subscribe-form {
    width: 100%;
    max-width: 30rem;
}

.subscribe-form__row {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.35rem 0.35rem 0.35rem 0.9rem;
    border: 1px solid var(--leaf-border);
    border-radius: var(--leaf-radius);
    background: var(--leaf-bg-elevated);
    transition: border-color 0.15s ease;
}

.subscribe-form__row:focus-within {
    border-color: color-mix(in srgb, var(--leaf-accent) 45%, var(--leaf-border));
}

.subscribe-form__input {
    flex: 1;
    min-width: 0;
    align-self: center;
    padding: 0.5rem 0.25rem 0.5rem 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--leaf-text);
    font-family: var(--leaf-font-ui);
    font-size: 0.9375rem;
}

.subscribe-form__input::placeholder {
    color: var(--leaf-text-muted);
}

.subscribe-form__button {
    flex-shrink: 0;
}

.subscribe-form--large .subscribe-form__row {
    padding: 0.4rem 0.4rem 0.4rem 1rem;
}

.subscribe-form--large .subscribe-form__input {
    font-size: 1rem;
}

.subscribe-form__message {
    display: none;
    margin: 0.85rem 0 0;
    font-family: var(--leaf-font-ui);
    font-size: 0.8125rem;
    line-height: 1.45;
}

.subscribe-form__message--success {
    display: none;
    align-items: center;
    gap: 0.5rem;
    color: var(--leaf-text-muted);
}

.subscribe-form__message--success .leaf-icon {
    color: var(--leaf-accent);
}

.subscribe-form__message--error {
    color: var(--leaf-negative);
}

.subscribe-form.success .subscribe-form__row {
    display: none;
}

.subscribe-form.success .subscribe-form__message--success {
    display: flex;
    margin-top: 0;
}

.subscribe-form.error .subscribe-form__message--error {
    display: block;
}

@media (max-width: 480px) {
    .subscribe-form__row {
        flex-direction: column;
        align-items: stretch;
        padding: 0.65rem;
    }

    .subscribe-form__input {
        width: 100%;
        padding: 0.25rem 0;
    }

    .subscribe-form__button {
        width: 100%;
    }
}

/* Homepage latest post — full width of main column */

.home-featured {
    margin: 0 calc(var(--leaf-space) * -1) calc(var(--leaf-space) * 2);
    padding: 0 var(--leaf-space);
}

.letter-card {
    --letter-card-gap: var(--leaf-space);
    --letter-card-rule: 2px solid color-mix(in srgb, var(--leaf-accent) 35%, var(--leaf-border));
    --home-featured-gap: var(--letter-card-gap);
    --home-featured-rule: var(--letter-card-rule);

    display: flex;
    flex-direction: column;
    gap: var(--letter-card-gap);
    padding: calc(var(--letter-card-gap) * 1.35) var(--letter-card-gap);
    border-top: 1px dashed var(--leaf-border);
    border-bottom: 1px dashed var(--leaf-border);
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--leaf-accent) 7%, transparent) 0,
        transparent 14rem
    );
}

.letter-card__masthead,
.home-featured__masthead {
    display: flex;
    align-items: center;
    gap: var(--letter-card-gap);
}

.letter-card__kicker {
    margin: 0;
}

.letter-stamp {
    flex-shrink: 0;
}

.letter-stamp__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    width: 5.75rem;
    height: 5.75rem;
    padding: 0.35rem;
    border: 2px dashed color-mix(in srgb, var(--leaf-accent) 55%, var(--leaf-border));
    border-radius: 50%;
    color: var(--leaf-accent);
    font-family: var(--leaf-font-mono);
    font-size: 0.625rem;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: uppercase;
    transform: rotate(-8deg);
}

.letter-stamp__no {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1;
}

.letter-stamp__no:empty,
.letter-stamp__no [data-issue-no]:empty {
    min-height: 1.125rem;
}

.home-featured__letter {
    max-width: var(--leaf-max-width);
}

.home-featured__meta {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-family: var(--leaf-font-ui);
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--leaf-text-muted);
}

.home-featured__meta a {
    color: var(--leaf-text-muted);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--leaf-text-muted) 45%, transparent);
    text-underline-offset: 0.14em;
}

.home-featured__meta a:hover {
    color: var(--leaf-accent);
    text-decoration-color: var(--leaf-accent);
}

.home-featured__meta-sep {
    opacity: 0.65;
}

.home-featured__title {
    margin: 0 0 var(--home-featured-gap);
    font-size: clamp(1.75rem, 4.5vw, 2.25rem);
    font-weight: var(--leaf-heading-weight);
    line-height: var(--leaf-line-display);
}

.home-featured__title a {
    color: var(--leaf-text);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--leaf-accent) 45%, var(--leaf-border));
    text-decoration-thickness: 2px;
    text-underline-offset: 0.12em;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.home-featured__title a:hover {
    color: var(--leaf-accent-hover);
    text-decoration-color: var(--leaf-accent);
}

.home-featured__excerpt {
    margin: 0;
    max-width: 36rem;
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--leaf-text-muted);
}

.home-featured__read {
    margin: var(--home-featured-gap) 0 0;
    font-family: var(--leaf-font-ui);
    font-size: 0.875rem;
    font-weight: 600;
}

.home-featured__read a {
    color: var(--leaf-accent);
    text-decoration: none;
}

.home-featured__read a:hover {
    color: var(--leaf-accent-hover);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

@media (max-width: 520px) {
    .letter-card {
        padding: calc(var(--letter-card-gap) * 1.25) var(--letter-card-gap);
    }

    .letter-stamp__inner {
        width: 2.85rem;
        height: 2.85rem;
        gap: 0.05rem;
        padding: 0.2rem;
        border-width: 1.5px;
        font-size: 0.4375rem;
        letter-spacing: 0.02em;
        transform: rotate(-6deg);
    }

    .letter-stamp__word {
        max-width: 2.4rem;
        line-height: 1.05;
    }

    .letter-stamp__no {
        font-size: 0.625rem;
    }

    .letter-stamp__no:empty,
    .letter-stamp__no [data-issue-no]:empty {
        min-height: 0.625rem;
    }

    .article-header__masthead .letter-stamp__inner {
        width: 3.1rem;
        height: 3.1rem;
        font-size: 0.40625rem;
    }

    .article-header__masthead .letter-stamp__word {
        max-width: 2.65rem;
    }

    .article-header__masthead .letter-stamp__no {
        font-size: 0.5625rem;
    }

    .article-header__masthead .letter-stamp__no:empty,
    .article-header__masthead .letter-stamp__no [data-issue-no]:empty {
        min-height: 0.5625rem;
    }
}

@media (min-width: 521px) {
    .letter-card {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-rows: auto auto;
        column-gap: var(--letter-card-gap);
        row-gap: var(--letter-card-gap);
    }

    .letter-card__masthead,
    .home-featured__masthead {
        display: contents;
    }

    .letter-stamp {
        grid-column: 1;
        grid-row: 1 / span 2;
        align-self: start;
    }

    .home-featured__meta,
    .letter-card__kicker {
        grid-column: 2;
        grid-row: 1;
        padding-left: var(--letter-card-gap);
        border-left: var(--letter-card-rule);
    }

    .letter-card__body,
    .home-featured__letter {
        grid-column: 2;
        grid-row: 2;
        padding-left: var(--letter-card-gap);
        border-left: var(--letter-card-rule);
    }
}

.home-posts {
    margin: 0 calc(var(--leaf-space) * -1);
    padding: 0 var(--leaf-space);
}

.home-posts__title {
    margin: 0 0 calc(var(--leaf-space) * 1.25);
    font-family: var(--leaf-font-ui);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--leaf-text-muted);
}

.button--ghost {
    border: 1px solid var(--leaf-border);
    background: transparent;
    color: var(--leaf-text);
    box-shadow: none;
}

.button--ghost:hover {
    border-color: color-mix(in srgb, var(--leaf-text) 35%, var(--leaf-border));
    background: transparent;
    color: var(--leaf-text);
}

/* Index */

.page-head {
    max-width: var(--leaf-max-width);
    margin-bottom: calc(var(--leaf-space) * 2);
}

.page-head__title {
    margin: 0 0 0.5rem;
    font-size: clamp(1.625rem, 4vw, 2.125rem);
    font-weight: var(--leaf-heading-weight);
    letter-spacing: 0;
    line-height: var(--leaf-line-display);
}

.page-head__description {
    margin: 0;
    color: var(--leaf-text-muted);
    font-size: 1.0625rem;
    line-height: 1.55;
}

.post-feed {
    display: flex;
    flex-direction: column;
    gap: calc(var(--leaf-space) * 1.25);
}

.home-issues .post-feed {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--leaf-space);
}

@media (min-width: 36rem) {
    .home-issues .post-feed {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 52rem) {
    .home-issues .post-feed {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.post-card {
    position: relative;
    padding-bottom: calc(var(--leaf-space) * 1.25);
    border-bottom: 1px dashed var(--leaf-border);
    cursor: pointer;
}

.post-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.home-issues .post-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: calc(var(--leaf-space) * 1.1);
    border: 1px dashed var(--leaf-border);
    background: linear-gradient(
        145deg,
        color-mix(in srgb, var(--leaf-accent) 6%, transparent) 0,
        transparent 55%
    );
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.home-issues .post-card:last-child {
    padding-bottom: calc(var(--leaf-space) * 1.1);
    border-bottom: 1px dashed var(--leaf-border);
}

.home-issues .post-card:hover {
    border-color: color-mix(in srgb, var(--leaf-accent) 40%, var(--leaf-border));
    background: linear-gradient(
        145deg,
        color-mix(in srgb, var(--leaf-accent) 10%, transparent) 0,
        transparent 55%
    );
}

.home-issues .post-card__title {
    font-size: 1.125rem;
}

.home-issues .post-card__excerpt {
    margin-top: auto;
    padding-top: 0.65rem;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
}

.post-card__meta {
    margin: 0 0 0.5rem;
    font-family: var(--leaf-font-ui);
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--leaf-text-muted);
}

.post-card__meta a {
    position: relative;
    z-index: 2;
    color: var(--leaf-text-muted);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--leaf-text-muted) 45%, transparent);
    text-underline-offset: 0.14em;
}

.post-card__meta a:hover {
    color: var(--leaf-accent);
    text-decoration-color: var(--leaf-accent);
}

.post-card__meta-sep,
.article-meta__sep {
    opacity: 0.65;
}

.article-meta__sep {
    margin-inline: 0.45em;
}

.issue-number {
    font-family: var(--leaf-font-mono);
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--leaf-accent);
}

.post-card__title {
    margin: 0 0 0.5rem;
    font-size: 1.375rem;
    font-weight: var(--leaf-heading-weight);
    letter-spacing: 0;
    line-height: var(--leaf-line-display);
}

.post-card__title a {
    color: var(--leaf-text);
    text-decoration: none;
    transition: color 0.15s ease;
}

.post-card__title a::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.post-card:hover .post-card__title a {
    color: var(--leaf-accent-hover);
}

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

/* Single post / page */

.article {
    width: 100%;
    max-width: var(--leaf-max-width);
    margin-inline: auto;
}

.article-header {
    margin-bottom: calc(var(--leaf-space) * 1.25);
}

.article-header__masthead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--leaf-space);
    margin-bottom: calc(var(--leaf-space) * 0.85);
}

.article-header__masthead .letter-stamp {
    flex-shrink: 0;
}

.article-header__masthead .letter-stamp__inner {
    width: 4.5rem;
    height: 4.5rem;
    gap: 0.2rem;
    padding: 0.28rem;
    font-size: 0.5625rem;
}

.article-header__masthead .letter-stamp__no {
    font-size: 0.9375rem;
}

.article-header__masthead .letter-stamp__no:empty,
.article-header__masthead .letter-stamp__no [data-issue-no]:empty {
    min-height: 0.9375rem;
}

.article-meta--masthead {
    flex: 0 1 auto;
    min-width: 0;
    margin: 0;
    margin-left: auto;
    text-align: right;
}

.article-meta__lines {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
}

.article-meta--masthead .article-meta__line {
    display: block;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.article-header__title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}

.article-header__title-row .article-share {
    flex-shrink: 0;
    margin: 0;
}

.article-title {
    flex: 1;
    min-width: min(100%, 16rem);
    margin: 0;
    font-size: clamp(1.75rem, 4.5vw, 2.375rem);
    font-weight: var(--leaf-heading-weight);
    letter-spacing: 0;
    line-height: var(--leaf-line-display);
    /* Global h1–h6 use text-wrap: balance; avoid short balanced lines on long post titles */
    text-wrap: wrap;
}

.article-meta {
    font-family: var(--leaf-font-ui);
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--leaf-text-muted);
}

.article-meta a {
    color: var(--leaf-text-muted);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--leaf-text-muted) 45%, transparent);
    text-underline-offset: 0.14em;
}

.article-meta a:hover {
    color: var(--leaf-accent);
    text-decoration-color: var(--leaf-accent);
}

.article-excerpt {
    margin: calc(var(--leaf-space) * 1.25) 0 calc(var(--leaf-space) * 1.5);
    padding-bottom: calc(var(--leaf-space) * 1.35);
    border-bottom: 1px dashed color-mix(in srgb, var(--leaf-accent) 35%, var(--leaf-border));
    font-family: var(--gh-font-body);
    font-size: 1.25rem;
    font-style: italic;
    font-weight: 400;
    line-height: 1.5;
    color: var(--leaf-text-muted);
}

.article-header:has(.article-excerpt) + .gh-content {
    margin-top: calc(var(--leaf-space) * 0.35);
}

.article-header:has(.article-excerpt) + .feature-image {
    margin-top: calc(var(--leaf-space) * 0.35);
}

.feature-image {
    margin: 0 0 calc(var(--leaf-space) * 1.5);
    border-radius: var(--leaf-radius);
    overflow: hidden;
}

.feature-image img {
    display: block;
    width: 100%;
}

.article-footer {
    margin-top: calc(var(--leaf-space) * 2);
    padding-top: calc(var(--leaf-space) * 1.25);
    border-top: 1px dashed var(--leaf-border);
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.65rem;
    margin: 0 0 calc(var(--leaf-space) * 1.25);
    padding: 0;
    list-style: none;
    font-family: var(--leaf-font-ui);
    font-size: 0.8125rem;
}

.article-tags__link {
    color: var(--leaf-text-muted);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--leaf-text-muted) 45%, transparent);
    text-underline-offset: 0.14em;
}

.article-tags__link:hover {
    color: var(--leaf-accent);
    text-decoration-color: var(--leaf-accent);
}

.article-footer .article-share {
    margin-bottom: calc(var(--leaf-space) * 1.25);
}

.article-share__status:not(.visually-hidden) {
    display: inline-block;
    margin-left: 0.75rem;
    font-family: var(--leaf-font-ui);
    font-size: 0.8125rem;
    color: var(--leaf-accent);
}

.article-adjacent {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--leaf-space);
}

.article-adjacent__link {
    display: block;
    padding: calc(var(--leaf-space) * 0.85);
    border: 1px dashed var(--leaf-border);
    color: var(--leaf-text);
    text-decoration: none;
    background: linear-gradient(
        145deg,
        color-mix(in srgb, var(--leaf-accent) 5%, transparent) 0,
        transparent 55%
    );
    transition: border-color 0.15s ease, color 0.15s ease;
}

.article-adjacent__link:hover {
    border-color: color-mix(in srgb, var(--leaf-accent) 40%, var(--leaf-border));
    color: var(--leaf-accent-hover);
}

.article-adjacent__link--prev:only-child {
    grid-column: 1;
}

.article-adjacent__link--next:only-child {
    grid-column: 2;
    text-align: right;
}

.article-adjacent__link--next {
    text-align: right;
}

.article-adjacent__label {
    display: block;
    margin-bottom: 0.35rem;
    font-family: var(--leaf-font-ui);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--leaf-text-muted);
}

.article-adjacent__title {
    display: block;
    font-family: var(--gh-font-heading);
    font-size: 1.0625rem;
    font-weight: var(--leaf-heading-weight);
    line-height: var(--leaf-line-display);
}

.article-comments {
    max-width: var(--leaf-max-width);
    margin-inline: auto;
    margin-top: calc(var(--leaf-space) * 2);
    padding-top: calc(var(--leaf-space) * 1.25);
    border-top: 1px dashed var(--leaf-border);
}

@media (max-width: 36rem) {
    .article-adjacent {
        grid-template-columns: minmax(0, 1fr);
    }

    .article-adjacent__link--next:only-child,
    .article-adjacent__link--next {
        grid-column: 1;
        text-align: left;
    }
}

/* Ghost Koenig / prose */

.gh-content {
    font-size: 1.0625rem;
    line-height: var(--leaf-line-body);
}

.gh-content > * + * {
    margin-top: 1.25em;
}

.gh-content h1,
.gh-content h2,
.gh-content h3,
.gh-content h4 {
    line-height: var(--leaf-line-display);
    letter-spacing: 0;
    font-weight: var(--leaf-heading-weight);
}

.gh-content h2 {
    font-size: 1.4375rem;
    margin-top: 2em;
}

.gh-content h3 {
    font-size: 1.1875rem;
    margin-top: 1.75em;
}

.gh-content blockquote {
    margin: 1.5em 0;
    padding: 0.75em 1.25em;
    border-left: 3px solid var(--leaf-accent);
    background: var(--leaf-bg-alt);
    color: var(--leaf-text-muted);
}

.gh-content pre {
    overflow-x: auto;
    padding: 1em 1.25em;
    border-radius: var(--leaf-radius);
    background: var(--leaf-code-bg);
    font-family: var(--leaf-font-mono);
    font-size: 0.85em;
    line-height: 1.5;
}

.gh-content code {
    font-family: var(--leaf-font-mono);
    font-size: 0.9em;
    padding: 0.15em 0.35em;
    border-radius: 4px;
    background: var(--leaf-code-bg);
}

.gh-content pre code {
    padding: 0;
    background: none;
    font-size: inherit;
}

.gh-content hr {
    border: none;
    border-top: 1px solid var(--leaf-border);
    margin: 2.5em 0;
}

.gh-content figcaption {
    font-size: 0.875rem;
    color: var(--leaf-text-muted);
    text-align: center;
    margin-top: 0.5em;
}

.gh-content .kg-card {
    margin: 2em 0;
}

.gh-content .kg-width-wide {
    position: relative;
    width: min(90vw, calc(var(--leaf-max-width) + 12rem));
    max-width: none;
    margin-left: 50%;
    transform: translateX(-50%);
}

.gh-content .kg-width-full {
    position: relative;
    width: 100%;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    box-sizing: border-box;
}

.gh-content .kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.gh-content .kg-gallery-row {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
}

.gh-content .kg-gallery-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--leaf-radius);
}

.gh-content .kg-bookmark-card {
    width: 100%;
}

.gh-content .kg-bookmark-container {
    display: flex;
    overflow: hidden;
    border: 1px solid var(--leaf-border);
    border-radius: var(--leaf-radius);
    background: var(--leaf-bg-elevated);
    color: inherit;
    text-decoration: none;
    min-height: 148px;
}

.gh-content .kg-bookmark-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 1rem 1.25rem;
    gap: 0.5rem;
}

.gh-content .kg-bookmark-title {
    font-family: var(--gh-font-body);
    font-weight: var(--leaf-heading-weight);
    font-size: 1rem;
    line-height: 1.25;
    letter-spacing: 0;
    color: var(--leaf-text);
}

.gh-content .kg-bookmark-description {
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--leaf-text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gh-content .kg-bookmark-metadata {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--leaf-text-muted);
    margin-top: auto;
}

.gh-content .kg-bookmark-icon {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 2px;
}

.gh-content .kg-bookmark-author,
.gh-content .kg-bookmark-publisher {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gh-content .kg-bookmark-thumbnail {
    flex-shrink: 0;
    width: 180px;
    min-height: 100%;
}

.gh-content .kg-bookmark-thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gh-content .kg-button-card .kg-btn {
    background: var(--leaf-accent);
    color: var(--leaf-bg);
    border-radius: 0;
}

.gh-content .kg-button-card .kg-btn:hover {
    background: var(--leaf-accent-hover);
}

@media (max-width: 600px) {
    .gh-content .kg-bookmark-container {
        flex-direction: column;
    }

    .gh-content .kg-bookmark-thumbnail {
        width: 100%;
        height: 160px;
    }
}

/* Tag / author archive */

.archive-head {
    max-width: var(--leaf-max-width);
    margin-bottom: calc(var(--leaf-space) * 2);
}

.archive-head__identity {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.archive-head__avatar {
    flex-shrink: 0;
    width: 4.5rem;
    height: 4.5rem;
    border: 2px solid var(--leaf-border);
    border-radius: 50%;
    background: var(--leaf-bg-alt);
    object-fit: cover;
}

.archive-head__avatar--blank {
    display: block;
}

.archive-head__intro {
    flex: 1;
    min-width: 0;
}

.archive-head__title {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
    font-weight: var(--leaf-heading-weight);
}

.archive-head--author .archive-head__title {
    margin: 0 0 0.35rem;
    line-height: var(--leaf-line-display);
}

.archive-head__description {
    margin: 0;
    color: var(--leaf-text-muted);
    font-size: 1.0625rem;
    line-height: 1.55;
}

/* Pagination */

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem 1rem;
    margin: calc(var(--leaf-space) * 2) calc(var(--leaf-space) * -1) 0;
    padding: var(--leaf-space) var(--leaf-space) 0;
    border-top: 1px dashed var(--leaf-border);
    font-family: var(--leaf-font-ui);
    font-size: 0.875rem;
}

.pagination a {
    color: var(--leaf-accent);
    text-decoration: none;
    font-weight: 600;
}

.pagination a:hover {
    color: var(--leaf-accent-hover);
}

.pagination .page-number {
    color: var(--leaf-text-muted);
}

/* Error page */

.error-page {
    max-width: var(--leaf-max-width);
    text-align: center;
    padding: calc(var(--leaf-space) * 3) 0;
}

.error-page__code {
    margin: 0;
    font-size: 4rem;
    font-weight: 600;
    color: var(--leaf-accent);
    line-height: 1;
}

.error-page__message {
    margin: 1rem 0 1.5rem;
    color: var(--leaf-text-muted);
}

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