/* ===========================================================================
   pixel de prosa · tema ghost · v1
   identidade: hermes (teal-preto / creme / amarelo-lime)
   fontes: Archivo Black (display), Fraunces (prose), Courier Prime (UI/meta)
   =========================================================================== */

:root {
    /* surfaces */
    --bg: #041c1c;
    --bg-raised: #052525;
    --bg-elevated: #072b2b;

    /* text */
    --fg: #ffe6cb;
    --fg-dim: rgba(255, 230, 203, 0.62);
    --fg-mute: rgba(255, 230, 203, 0.34);

    /* action */
    --accent: #ffff89;
    --accent-dim: rgba(255, 255, 137, 0.55);
    --accent-bg: rgba(255, 255, 137, 0.07);
    --glow: rgba(255, 189, 56, 0.32);
    --red: #fb2c36;

    /* structure */
    --border: rgba(255, 230, 203, 0.34);
    --border-soft: rgba(255, 230, 203, 0.18);
    --border-strong: rgba(255, 230, 203, 0.5);

    /* type · aceitam override pelo admin (custom fonts) */
    --font-display: var(--gh-font-heading, "Archivo Black"), "Syne", system-ui, sans-serif;
    --font-prose: var(--gh-font-body, "Fraunces"), Georgia, "Times New Roman", serif;
    --font-ui: "Courier Prime", "Courier New", ui-monospace, monospace;

    /* scale */
    --container: 1180px;
    --measure: 68ch;

    /* layout frame */
    --frame-inset: 18px;

    /* space */
    --s-1: 0.25rem;
    --s-2: 0.5rem;
    --s-3: 0.75rem;
    --s-4: 1rem;
    --s-6: 1.5rem;
    --s-8: 2rem;
    --s-10: 2.5rem;
    --s-12: 3rem;
    --s-16: 4rem;
    --s-24: 6rem;
}

/* Give long-form posts a bit more horizontal room on desktop. */
@media (min-width: 900px) {
    body.post-template,
    body.page-template {
        --measure: 78ch;
    }
}

/* ───────── reset ───────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-size-adjust: 100%; font-size: 16px; }

body {
    font-family: var(--font-ui);
    background: var(--bg);
    color: var(--fg);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding: var(--frame-inset);
    background-image:
        radial-gradient(ellipse 900px 600px at 0% 0%, var(--glow) 0%, transparent 60%),
        repeating-linear-gradient(0deg, rgba(255, 230, 203, 0.015) 0 1px, transparent 1px 3px);
    background-attachment: fixed, fixed;
}

/* Closed frame like hermes (scrolls with page content) */
.site-frame {
    border: 1px solid var(--border);
    min-height: calc(100vh - (2 * var(--frame-inset)));
}

img, video, svg { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration: none; }

button, input, textarea {
    font: inherit;
    color: inherit;
    background: transparent;
    border: 0;
}

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

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

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

.skip-link {
    position: absolute;
    top: -40px; left: 0;
    padding: var(--s-2) var(--s-4);
    background: var(--accent);
    color: var(--bg);
    z-index: 100;
}

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

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--s-6);
}

/* ───────── site header · grid hermes-style ───────── */
.site-header {
    display: grid;
    grid-template-columns: 240px 1fr auto;
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 10;
    min-height: 88px;
}

.site-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--s-3) var(--s-6);
    font-family: var(--font-display);
    font-size: 1.5rem;
    line-height: 0.9;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--fg);
    border-right: 1px solid var(--border);
}

.site-brand-line { display: block; }
.site-brand-dot { color: var(--accent); }

.site-brand-pixel {
    display: inline-block;
    width: 0.65em;
    height: 0.65em;
    border: 2px solid currentColor;
    vertical-align: 0.06em;
    margin: 0 0.08em;
}

.site-nav {
    display: flex;
    align-items: stretch;
}

.site-nav ul {
    list-style: none;
    display: flex;
    width: 100%;
    margin: 0;
    padding: 0;
}

.site-nav li {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--border);
}

.site-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: var(--s-4) var(--s-6);
    font-family: var(--font-ui);
    font-size: 0.78rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--fg-dim);
    transition: color 0.12s, background 0.12s;
}

.site-nav a:hover { color: var(--accent); background: rgba(255, 255, 137, 0.04); }

.site-auth {
    display: flex;
    align-items: stretch;
}

.auth-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    padding: var(--s-4) var(--s-6);
    font-family: var(--font-ui);
    font-size: 0.78rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--fg-dim);
    cursor: pointer;
    transition: color 0.12s, background 0.12s;
    border-left: 1px solid var(--border);
}

.auth-link:hover { color: var(--accent); background: rgba(255, 255, 137, 0.04); }

.auth-cta {
    background: var(--accent);
    color: var(--bg);
    font-weight: 700;
}

.auth-cta:hover {
    background: transparent;
    color: var(--accent);
}

/* ── menu toggle (hamburger) - desktop: hidden ── */
.menu-toggle-input { display: none; }

.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    padding: var(--s-4);
    cursor: pointer;
    color: var(--fg);
    font-family: var(--font-ui);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    user-select: none;
    border-left: 1px solid var(--border);
}

.menu-toggle-bars {
    width: 20px;
    height: 14px;
    position: relative;
}

.menu-toggle-bars::before,
.menu-toggle-bars::after,
.menu-toggle-bars {
    background: currentColor;
}

.menu-toggle-bars {
    background: transparent;
}

.menu-toggle-bars::before,
.menu-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: currentColor;
    transition: transform 0.2s;
}

.menu-toggle-bars::before { top: 0; box-shadow: 0 6px 0 currentColor; }
.menu-toggle-bars::after { bottom: 0; }

.menu-toggle-close { display: none; }

/* ── header responsive ── */
@media (max-width: 1100px) {
    .site-header { grid-template-columns: 180px 1fr auto; }
    .site-brand { font-size: 1.15rem; padding: var(--s-3) var(--s-4); }
    .site-nav a, .auth-link { padding: var(--s-3) var(--s-4); font-size: 0.7rem; letter-spacing: 0.2em; }
    .auth-link { min-width: 110px; }
}

@media (max-width: 860px) {
    .site-header {
        display: flex;
        flex-wrap: wrap;
        min-height: 0;
    }

    .site-brand {
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: baseline;
        gap: var(--s-2);
        border-right: 0;
        font-size: 1.2rem;
        padding: var(--s-4);
        flex: 1;
    }

    .menu-toggle { display: flex; order: 2; }

    /* nav e auth colapsam num dropdown abaixo do header */
    .site-nav,
    .site-auth {
        flex: 0 0 100%;
        width: 100%;
        overflow: hidden;
        max-height: 0;
        transition: max-height 0.25s ease;
        border-top: 0;
    }

    .site-nav { order: 3; }
    .site-auth { order: 4; }

    .site-nav ul {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .site-nav li {
        flex: initial;
        width: 100%;
        border-right: 0;
        border-top: 1px solid var(--border);
    }

    .site-nav a {
        width: 100%;
        justify-content: flex-start;
        padding: var(--s-4);
        font-size: 0.78rem;
        letter-spacing: 0.22em;
    }

    .site-auth {
        display: flex;
        flex-direction: column;
    }

    .auth-link {
        flex: initial;
        width: 100%;
        justify-content: flex-start;
        padding: var(--s-4);
        border-left: 0;
        border-top: 1px solid var(--border);
        font-size: 0.78rem;
        letter-spacing: 0.22em;
        min-width: 0;
    }

    /* estado aberto */
    .menu-toggle-input:checked ~ .site-nav,
    .menu-toggle-input:checked ~ .site-auth {
        max-height: 500px;
    }

    .menu-toggle-input:checked ~ .menu-toggle .menu-toggle-open { display: none; }
    .menu-toggle-input:checked ~ .menu-toggle .menu-toggle-close { display: inline; }
    .menu-toggle-input:checked ~ .menu-toggle .menu-toggle-bars::before {
        transform: translateY(6px) rotate(45deg);
        box-shadow: none;
    }
    .menu-toggle-input:checked ~ .menu-toggle .menu-toggle-bars::after {
        transform: translateY(-6px) rotate(-45deg);
    }
}

/* ───────── main ───────── */
.site-main { padding: var(--s-12) 0 var(--s-16); }

/* ───────── hero ───────── */
.hero {
    padding: var(--s-8) 0 var(--s-12);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--s-12);
}

.hero-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: var(--font-ui);
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--fg-mute);
    margin-bottom: var(--s-8);
    padding-bottom: var(--s-3);
    border-bottom: 1px solid var(--border-soft);
    gap: var(--s-4);
    flex-wrap: wrap;
}

.hero-meta .accent { color: var(--accent); }

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 7vw, 5.5rem);
    line-height: 0.95;
    letter-spacing: -0.03em;
    color: var(--fg);
    text-transform: uppercase;
    word-break: break-word;
}

.hero-title .accent { color: var(--accent); }

.hero-lede {
    font-family: var(--font-prose);
    font-weight: 400;
    font-size: 1.25rem;
    line-height: 1.55;
    color: var(--fg-dim);
    margin-top: var(--s-6);
    max-width: 50ch;
}

.hero-nav {
    margin-top: var(--s-6);
}

.hero-nav-link {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--fg-mute);
    transition: color 0.12s;
}

.hero-nav-link:hover { color: var(--accent); }

/* ───────── archive search ───────── */
.archive-search {
    margin-top: var(--s-8);
    max-width: 620px;
}

.search-input-wrap {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-3) var(--s-4);
    border: 1px solid var(--border-strong);
    background: var(--bg);
}

.search-input-wrap:focus-within { border-color: var(--accent); }

.search-prompt {
    color: var(--accent);
    font-weight: 700;
}

.search-input {
    flex: 1;
    min-width: 0;
    outline: 0;
}

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

.search-kbd {
    display: inline-block;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 0.72rem;
    color: var(--fg-mute);
    border: 1px solid var(--border-strong);
    padding: 0.1rem 0.45rem;
    letter-spacing: 0.12em;
}

.search-clear {
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fg-mute);
    border: 1px solid var(--border-strong);
    padding: 0.1rem 0.5rem;
    cursor: pointer;
}

.search-clear:hover { color: var(--accent); border-color: var(--accent); }

.search-meta {
    margin-top: var(--s-2);
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--fg-mute);
}

/* ───────── home sections ───────── */
.home-section {
    margin-bottom: var(--s-16);
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

.home-section > *,
.section-head {
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.section-link { margin-left: auto !important; }

.section-head {
    display: flex;
    align-items: baseline;
    gap: var(--s-3);
    padding-bottom: var(--s-3);
    border-bottom: 1px solid var(--border-strong);
    margin-bottom: var(--s-6) !important;
    flex-wrap: wrap;
    width: 100%;
}

.section-head .section-num {
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 0.72rem;
    color: var(--accent);
    letter-spacing: 0.2em;
}

.section-head .section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.28em;
    color: var(--fg);
}

.section-link {
    margin-left: auto;
    font-family: var(--font-ui);
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--fg-mute);
    transition: color 0.12s;
}

.section-link:hover { color: var(--accent); }

/* ── featured card (home) ── */
.featured-card {
    border: 1px solid var(--border);
    background: var(--bg-raised);
    transition: border-color 0.15s;
    position: relative;
}

.featured-card::before {
    content: "";
    position: absolute;
    top: -1px; left: -1px; right: -1px;
    height: 3px;
    background: var(--accent);
}

.featured-card:hover { border-color: var(--border-strong); }

.featured-card-link {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    align-items: stretch;
}

.featured-card-image {
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: var(--bg);
    border-right: 1px solid var(--border);
}

.featured-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.featured-card:hover .featured-card-image img { transform: scale(1.03); }

.featured-card-body {
    padding: var(--s-8);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.featured-card-title {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 3.2vw, 2.75rem);
    line-height: 1.05;
    letter-spacing: -0.025em;
    color: var(--fg);
    text-transform: uppercase;
    margin-bottom: var(--s-4);
    transition: color 0.15s;
}

.featured-card:hover .featured-card-title { color: var(--fg); }

.featured-card-excerpt {
    font-family: var(--font-prose);
    font-style: italic;
    font-size: 1.15rem;
    line-height: 1.55;
    color: var(--fg-dim);
    margin-bottom: var(--s-6);
    max-width: 55ch;
}

@media (max-width: 800px) {
    .featured-card-link { grid-template-columns: 1fr; }
    .featured-card-image { aspect-ratio: 16 / 9; }
    .featured-card-body { padding: var(--s-6); }
}

/* ───────── post feed (index) ───────── */
.post-feed {
    display: flex;
    flex-direction: column;
}

/* override do cards.min.css do Ghost que aplica max-width em article.post */
article.post.post-card,
article.post-card.post {
    max-width: none;
    margin: 0;
}

.post-card {
    border-bottom: 1px solid var(--border-strong);
    border-left: 1px solid var(--border-strong);
    border-right: 1px solid var(--border-strong);
    transition: background 0.15s;
    max-width: none;
    margin: 0;
    width: 100%;
}

.post-card:first-child { border-top: 1px solid var(--border-strong); }
.post-card:hover { background: rgba(255, 230, 203, 0.025); }

.post-card-link {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr) 260px;
    gap: 0;
    padding: 0;
    align-items: stretch;
}

.post-card-date {
    padding: var(--s-4);
}

.post-card-body {
    border-left: 1px solid var(--border-strong);
    border-right: 1px solid var(--border-strong);
    padding: var(--s-4) var(--s-6);
}

.post-card-image {
    margin: var(--s-3);
    align-self: center;
}

/* ── date column ── */
.post-card-date {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    color: var(--fg);
    transition: color 0.15s;
}

.post-card:hover .post-card-day { color: var(--accent); }

.post-card-day {
    font-family: var(--font-display);
    font-size: clamp(2.75rem, 3.5vw, 3.5rem);
    line-height: 0.9;
    letter-spacing: -0.03em;
    color: var(--fg);
    transition: color 0.15s;
}

.post-card-month-year {
    margin-top: var(--s-2);
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.post-card-month {
    font-weight: 700;
    color: var(--fg-dim);
}

.post-card-year { color: var(--fg-mute); }

.post-card-body { min-width: 0; }

.post-card-image {
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: var(--bg-raised);
    border: 1px solid var(--border-soft);
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(1.1) contrast(1.05);
    transition: transform 0.5s ease;
}

.post-card:hover .post-card-image img {
    transform: scale(1.03);
}

.post-card-meta {
    display: flex;
    gap: var(--s-2);
    align-items: center;
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--fg-mute);
    margin-bottom: var(--s-3);
    flex-wrap: wrap;
}

.post-card-meta .sep { color: var(--border-strong); }
.post-card-tag { color: var(--accent); }

.post-card-title {
    font-family: var(--font-prose);
    font-weight: 500;
    font-size: clamp(1.4rem, 2.2vw, 1.7rem);
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: var(--fg);
    margin-bottom: var(--s-3);
    transition: color 0.15s;
    max-width: 36ch;
}

.post-card:hover .post-card-title { color: var(--fg); }

.post-card-excerpt {
    font-family: var(--font-prose);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--fg-dim);
    max-width: 65ch;
    margin-bottom: var(--s-3);
}

.post-card-more {
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--fg-mute);
    transition: color 0.15s;
}

.post-card:hover .post-card-more { color: var(--accent); }

/* ── responsive ── */
@media (max-width: 1100px) {
    .post-card-link { grid-template-columns: 100px minmax(0, 1fr) 220px; }
    .post-card-day { font-size: 2.75rem; }
    .post-card-date { padding: var(--s-3); }
    .post-card-body { padding: var(--s-4) var(--s-5, 1.25rem); }
}

@media (max-width: 720px) {
    .post-card-link {
        grid-template-columns: 1fr;
        grid-template-areas: "date" "body" "image";
    }
    .post-card-date {
        grid-area: date;
        flex-direction: row;
        align-items: baseline;
        gap: var(--s-3);
        padding: var(--s-4);
        border-bottom: 1px solid var(--border-strong);
    }
    .post-card-day { font-size: 2rem; line-height: 1; }
    .post-card-month-year { flex-direction: row; gap: var(--s-2); margin-top: 0; align-items: baseline; }
    .post-card-body {
        grid-area: body;
        border: 0;
        border-bottom: 1px solid var(--border-strong);
        padding: var(--s-4);
    }
    .post-card-image {
        grid-area: image;
        aspect-ratio: 16 / 9;
        margin: 0;
        border: 0;
    }
    .post-card-title { font-size: 1.35rem; max-width: none; }
    .post-card-excerpt { font-size: 0.95rem; }
}

@media (max-width: 480px) {
    :root { --frame-inset: 6px; }

    /* só no feed (home/tag/autor/paged) removemos o padding pra cards estourarem */
    body.home-template .site-main,
    body.tag-template .site-main,
    body.author-template .site-main,
    body.paged .site-main { padding: 0 !important; }

    body.home-template .container,
    body.tag-template .container,
    body.author-template .container,
    body.paged .container { padding-left: 0; padding-right: 0; }

    .section-head { padding: var(--s-4) !important; }
    .post-card-body, .post-card-date { padding: var(--s-3) var(--s-4); }
}

/* post-template e page-template mantêm padding confortável pra leitura */
@media (max-width: 720px) {
    body.post-template .site-main,
    body.page-template .site-main { padding: var(--s-6) var(--s-4) var(--s-12); }

    body.post-template .post-content,
    body.post-template .post-header,
    body.post-template .post-footer,
    body.page-template .post-content,
    body.page-template .post-header,
    body.page-template .post-footer,
    body.post-template .post-comments,
    body.post-template .newsletter-cta { padding-left: var(--s-2); padding-right: var(--s-2); }
}

/* ───────── pagination ───────── */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--s-8) 0;
    margin-top: var(--s-8);
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.pagination a {
    padding: var(--s-2) var(--s-4);
    border: 1px solid var(--border-strong);
    color: var(--fg);
    transition: all 0.12s;
}

.pagination a:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }

.pagination .page-number { color: var(--fg-mute); }

/* ───────── post (single) ───────── */
.post {
    max-width: var(--measure);
    margin: 0 auto;
}

.post.page { max-width: var(--measure); }

.post-header { margin-bottom: var(--s-8); }

.post-meta {
    display: flex;
    gap: var(--s-2);
    align-items: center;
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--fg-mute);
    margin-bottom: var(--s-4);
    flex-wrap: wrap;
}

.post-meta .sep { color: var(--border-strong); }
.post-meta-tag { color: var(--accent); }
.post-meta-tag:hover { text-decoration: underline; text-underline-offset: 3px; }

.post-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.75rem);
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--fg);
    text-transform: uppercase;
    margin-bottom: var(--s-4);
    word-break: break-word;
}

.post-lede {
    font-family: var(--font-prose);
    font-style: italic;
    font-weight: 400;
    font-size: 1.3rem;
    line-height: 1.5;
    color: var(--fg-dim);
    max-width: 55ch;
}

body.post-template .post-lede,
body.page-template .post-lede {
    max-width: 62ch;
}

.post-image {
    max-width: var(--container);
    width: 100%;
    margin: 0 auto var(--s-8);
}

.post-image img {
    width: 100%;
    border: 1px solid var(--border);
}

.post-image figcaption {
    margin-top: var(--s-3);
    padding-left: var(--s-3);
    border-left: 2px solid var(--accent);
    font-size: 0.85rem;
    color: var(--fg-mute);
    max-width: var(--measure);
    margin-left: auto;
    margin-right: auto;
}

/* ───────── prose (post content) ───────── */
.prose {
    font-family: var(--font-prose);
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--fg);
    font-weight: 400;
    text-align: left;
    word-spacing: normal;
    hyphens: auto;
    -webkit-hyphens: auto;
    text-wrap: pretty;
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

.prose > * + * { margin-top: var(--s-6); }

.prose p {
    max-width: var(--measure);
    text-align: left;
    text-wrap: pretty;
}

.prose h2, .prose h3, .prose h4 {
    font-family: var(--font-prose);
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--fg);
    line-height: 1.2;
    margin-top: var(--s-12);
    margin-bottom: var(--s-3);
}

.prose h2 { font-size: 1.85rem; }
.prose h3 { font-size: 1.45rem; }
.prose h4 { font-size: 1.15rem; }

.prose a {
    color: var(--fg);
    border-bottom: 1px solid var(--accent-dim);
    transition: background 0.1s;
}

.prose a:hover { background: var(--accent-bg); border-bottom-color: var(--accent); }

.prose strong { font-weight: 700; color: var(--fg); }
.prose em { font-style: italic; }

.prose blockquote {
    border-left: 3px solid var(--accent);
    padding: var(--s-2) var(--s-6);
    margin-left: 0;
    font-style: italic;
    font-size: 1.2rem;
    color: var(--fg-dim);
    max-width: var(--measure);
}

.prose blockquote cite {
    display: block;
    margin-top: var(--s-3);
    font-size: 0.85rem;
    font-style: normal;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--fg-mute);
    font-family: var(--font-ui);
}

.prose ul, .prose ol {
    max-width: var(--measure);
    padding-left: var(--s-6);
}

.prose li + li { margin-top: var(--s-2); }

.prose ul > li::marker { content: "— "; color: var(--accent); }
.prose ol > li::marker { color: var(--accent); font-weight: 700; }

.prose hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: var(--s-12) auto;
    max-width: var(--measure);
}

.prose code {
    font-family: var(--font-ui);
    font-size: 0.92em;
    background: var(--bg-raised);
    padding: 0.1em 0.4em;
    border: 1px solid var(--border);
    color: var(--accent);
}

.prose pre {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    padding: var(--s-4);
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: var(--container);
}

.prose pre code {
    background: transparent;
    border: 0;
    padding: 0;
    color: var(--fg);
}

.prose figure { max-width: var(--container); margin-left: auto; margin-right: auto; }

.prose figure img,
.prose > img { border: 1px solid var(--border); width: 100%; }

.prose figcaption {
    margin-top: var(--s-3);
    padding-left: var(--s-3);
    border-left: 2px solid var(--accent);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--fg-mute);
    max-width: var(--measure);
    margin-left: auto;
    margin-right: auto;
}

.prose .kg-callout-card {
    border: 1px solid var(--border);
    padding: var(--s-4) var(--s-6);
    background: var(--bg-raised);
    max-width: var(--measure);
}

.prose .kg-bookmark-card {
    max-width: var(--measure);
    border: 1px solid var(--border);
    background: var(--bg-raised);
    display: block;
    padding: var(--s-4);
    color: var(--fg);
    transition: border-color 0.15s;
}

.prose .kg-bookmark-card:hover { border-color: var(--accent); }

.prose .kg-bookmark-title { font-weight: 700; color: var(--fg); margin-bottom: var(--s-2); }
.prose .kg-bookmark-description { color: var(--fg-dim); font-size: 0.95rem; }
.prose .kg-bookmark-metadata { font-family: var(--font-ui); font-size: 0.75rem; color: var(--fg-mute); margin-top: var(--s-3); text-transform: uppercase; letter-spacing: 0.15em; }

/* Koenig breakouts: keep inside the frame for consistent layout control */
.prose .kg-width-wide,
.prose .kg-width-full {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* Required Koenig gallery styles (minimal, theme-consistent) */
.prose .kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    max-width: var(--container);
    margin-left: auto;
    margin-right: auto;
}

.prose .kg-gallery-row {
    display: flex;
    gap: var(--s-4);
}

.prose .kg-gallery-image {
    flex: 1;
    min-width: 0;
}

.prose .kg-gallery-image img {
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
}

/* Required Koenig bookmark styles (use existing bookmark card look) */
.prose .kg-bookmark-container {
    display: flex;
    gap: var(--s-4);
    align-items: stretch;
}

.prose .kg-bookmark-content {
    flex: 1;
    min-width: 0;
}

.prose .kg-bookmark-thumbnail {
    flex: 0 0 160px;
    border: 1px solid var(--border);
    background: var(--bg);
    overflow: hidden;
}

.prose .kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.prose .kg-bookmark-icon {
    width: 16px;
    height: 16px;
    opacity: 0.75;
}

.prose .kg-bookmark-author,
.prose .kg-bookmark-publisher {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--fg-mute);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

@media (max-width: 680px) {
    .prose .kg-gallery-row { flex-direction: column; }

    .prose .kg-bookmark-container {
        flex-direction: column;
    }

    .prose .kg-bookmark-thumbnail {
        flex-basis: auto;
        width: 100%;
        aspect-ratio: 16 / 9;
    }
}

/* ───────── post footer ───────── */
.post-footer {
    max-width: var(--measure);
    margin: var(--s-16) auto 0;
    padding-top: var(--s-8);
    border-top: 1px solid var(--border);
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
    margin-bottom: var(--s-8);
}

.tag-pill {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border-strong);
    color: var(--fg-dim);
    transition: all 0.12s;
}

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

.post-author {
    display: flex;
    gap: var(--s-4);
    align-items: flex-start;
    padding: var(--s-6);
    border: 1px solid var(--border);
    background: var(--bg-raised);
}

.author-avatar {
    width: 56px;
    height: 56px;
    border: 1px solid var(--border-strong);
    flex-shrink: 0;
    object-fit: cover;
}

.author-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--accent);
    text-transform: uppercase;
}

.author-info { min-width: 0; }

.author-name {
    font-family: var(--font-display);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    color: var(--fg);
    margin-bottom: var(--s-2);
}

.author-bio {
    font-family: var(--font-prose);
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--fg-dim);
}

/* ───────── newsletter CTA ───────── */
.newsletter-cta {
    max-width: var(--measure);
    margin: var(--s-16) auto 0;
    padding: var(--s-8);
    border: 1px solid var(--border-strong);
    background: var(--bg-raised);
    position: relative;
}

.newsletter-cta::before {
    content: "";
    position: absolute;
    top: -1px; left: -1px; right: -1px;
    height: 3px;
    background: var(--accent);
}

.newsletter-tag {
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--fg-mute);
    margin-bottom: var(--s-3);
}

.newsletter-title {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--fg);
    text-transform: uppercase;
    margin-bottom: var(--s-3);
}

.newsletter-title .accent { color: var(--accent); }

.newsletter-lede {
    font-family: var(--font-prose);
    font-size: 1.1rem;
    color: var(--fg-dim);
    margin-bottom: var(--s-6);
    max-width: 45ch;
}

.newsletter-form {
    display: flex;
    gap: var(--s-2);
    flex-wrap: wrap;
    align-items: stretch;
}

.newsletter-input {
    flex: 1;
    min-width: 220px;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-strong);
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    caret-color: var(--accent);
}

.newsletter-input::placeholder { color: var(--fg-mute); }
.newsletter-input:focus { outline: 0; border-color: var(--accent); }

.newsletter-error {
    flex-basis: 100%;
    color: var(--red);
    font-size: 0.85rem;
    font-family: var(--font-ui);
    min-height: 1em;
}

.newsletter-note {
    margin-top: var(--s-3);
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--fg-mute);
}

.newsletter-member {
    font-family: var(--font-prose);
    color: var(--fg-dim);
    font-size: 1rem;
}

.newsletter-member a { color: var(--accent); cursor: pointer; }

/* ───────── btn ───────── */
.btn {
    display: inline-block;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    padding: 0.8rem 1.6rem;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--fg);
    cursor: pointer;
    transition: all 0.12s;
}

.btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }

.btn-primary {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.btn-primary:hover { background: transparent; color: var(--accent); }

/* ───────── section head (comments / related) ───────── */
.section-head {
    display: flex;
    gap: var(--s-3);
    align-items: baseline;
    max-width: var(--measure);
    margin: var(--s-16) auto var(--s-6);
    padding-bottom: var(--s-3);
    border-bottom: 1px solid var(--border);
}

.section-num {
    font-family: var(--font-ui);
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.1em;
    font-size: 0.85rem;
}

.section-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.28em;
    color: var(--fg);
}

/* ───────── comments ───────── */
.post-comments {
    max-width: var(--measure);
    margin: 0 auto;
}

/* ───────── related ───────── */
.related {
    max-width: var(--container);
    margin: var(--s-16) auto 0;
    padding: 0 var(--s-6);
}

.related .section-head { max-width: none; }

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
}

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

@media (max-width: 720px) {
    .related-grid { grid-template-columns: 1fr; }
}

/* ───────── post nav (prev/next) ───────── */
.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    max-width: var(--measure);
    margin: var(--s-16) auto 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.post-nav > a {
    padding: var(--s-4);
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    transition: background 0.12s;
}

.post-nav > a:hover { background: var(--accent-bg); }

.post-nav-next { border-left: 1px solid var(--border); text-align: right; }

.post-nav .label {
    font-size: 0.7rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--fg-mute);
}

.post-nav .title {
    font-family: var(--font-display);
    font-size: 1rem;
    text-transform: uppercase;
    color: var(--fg);
}

/* ───────── error page ───────── */
.error-page .hero-title { font-size: clamp(4rem, 16vw, 10rem); }
.error-actions { margin-top: var(--s-8); }

/* ───────── footer ───────── */
.site-footer {
    padding: var(--s-8) 0 var(--s-8);
    margin-top: var(--s-16);
}

.statusbar {
    display: flex;
    align-items: stretch;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    flex-wrap: wrap;
}

.statusbar-seg {
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border);
    border-right: 0;
    color: var(--fg-mute);
}

.statusbar-seg:last-child { border-right: 1px solid var(--border); }

.statusbar-seg a { color: inherit; }
.statusbar-seg a:hover { color: var(--accent); }

.statusbar-seg.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    font-weight: 700;
}

/* Footer: the brand "pixel"/square should read as black */
.site-footer .statusbar-seg.active {
    color: #000;
}

.site-footer .statusbar-seg.active .site-brand-pixel {
    border-color: currentColor;
    background: currentColor;
}

.site-footer .footer-brand {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
}

.site-footer .footer-brand-num {
    font-weight: 700;
}

.statusbar-fill {
    flex: 1;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    min-width: 1rem;
}

/* ───────── responsive ───────── */
@media (max-width: 680px) {
    :root { --frame-inset: 10px; }

    .container { padding: 0 var(--s-4); }

    .site-header-inner { gap: var(--s-3); }
    .site-nav { order: 3; flex-basis: 100%; justify-content: flex-start; }
    .site-auth { margin-left: auto; }

    .site-main { padding: var(--s-6) 0 var(--s-12); }
    .hero { padding: var(--s-4) 0 var(--s-8); margin-bottom: var(--s-8); }

    .prose { font-size: 1.05rem; line-height: 1.7; }
    .prose h2 { font-size: 1.6rem; }
    .prose h3 { font-size: 1.3rem; }

    .newsletter-cta { padding: var(--s-6); }
    .newsletter-form { flex-direction: column; }
    .newsletter-input, .newsletter-form .btn { width: 100%; }

    /* footer statusbar: avoid wrap artifacts */
    .site-footer .statusbar {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "brand rss"
            "by by"
            "year year";
        gap: 1px;
        background: var(--border);
        padding: 1px;
    }

    .site-footer .statusbar-fill { display: none; }

    .site-footer .statusbar-seg {
        border: 0;
        margin: 0;
        background: var(--bg);
        white-space: nowrap;
    }

    .site-footer .statusbar-seg.active { grid-area: brand; }
    .site-footer .statusbar-seg:nth-child(3) { grid-area: rss; }
    .site-footer .statusbar-seg:nth-child(4) { grid-area: by; }
    .site-footer .statusbar-seg:nth-child(5) { grid-area: year; }
}

/* ───────── reduced motion ───────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* ───────── legibility (post/page prose) ─────────
   The global `-webkit-font-smoothing: antialiased` makes Fraunces look too thin
   on some displays (notably macOS). Restore default smoothing + slightly bump
   weight/size for long-form reading.
*/
body.post-template .prose,
body.page-template .prose,
body.post-template .post-lede,
body.page-template .post-lede {
    -webkit-font-smoothing: auto;
    text-rendering: optimizeLegibility;
}

body.post-template .prose,
body.page-template .prose {
    font-weight: 500;
    font-size: 1.18rem;
    line-height: 1.8;
    font-optical-sizing: auto;
    /* Keep Fraunces from using a display optical size at body text. */
    font-variation-settings: "opsz" 42;
}

@media (max-width: 680px) {
    body.post-template .prose,
    body.page-template .prose {
        font-size: 1.08rem;
        line-height: 1.75;
        font-variation-settings: "opsz" 36;
    }
}
