/* ==========================================================================
   Merenzon — Ghost theme v3
   1 Fonts · 2 Tokens · 3 Base · 4 Header · 5 Dialogue (first screen)
   6 Board: projects + latest · 7 Topic pages: head, stats, masonry
   8 Article · 9 Footer, pagination, errors · 10 Utilities
   ========================================================================== */

/* 1. Fonts — Geist (SIL OFL), self-hosted ---------------------------------- */

@font-face { font-family: "Geist"; font-weight: 100 900; font-style: normal; font-display: swap; src: url("../fonts/geist-sans-variable.woff2") format("woff2-variations"); }
@font-face { font-family: "Geist"; font-weight: 100 900; font-style: italic; font-display: swap; src: url("../fonts/geist-sans-italic-variable.woff2") format("woff2-variations"); }
@font-face { font-family: "Geist Serif"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/geist-serif-regular.woff2") format("woff2"); }

/* 2. Tokens ------------------------------------------------------------------ */

:root {
    /* Ghost's font picker: heading font → interface and titles, body font → reading text */
    --font-body: var(--gh-font-heading, "Geist", "Helvetica Neue", Arial, sans-serif);
    --font-display: var(--gh-font-heading, "Geist", "Helvetica Neue", Arial, sans-serif);
    --font-text: var(--gh-font-body, "Geist Serif", "Iowan Old Style", Georgia, serif);
    --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    --color-link: var(--ghost-accent-color, #1f5aa6);
    --color-hover: #d4322c;
    --color-highlight: #ffe95c;
    --color-bg: #ffffff;
    --color-text: #111111;
    --color-muted: #8a8a8a;
    --color-rule: #e3e3e3;
    --color-tint: #f6f1ee;
    --color-placeholder: #eef1f5;

    --sky-1: #fff6c8; --sky-2: #e9f1ff; --sky-3: #ffeadb; --sky-4: #eefbf3;

    --wrap: 1500px;
    --gutter: clamp(16px, 2.8vw, 40px);
    --pad: max(var(--gutter), calc((100% - var(--wrap)) / 2 + var(--gutter)));
    --measure: 740px;
    --header-height: 92px;
}

/* 3. Base -------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-height) + 16px); }
body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
img, svg, video { max-width: 100%; height: auto; }
img { display: block; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--color-link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em; text-decoration-color: color-mix(in srgb, currentColor 30%, transparent); transition: color 0.12s; }
a:hover { color: var(--color-hover); }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--color-hover); outline-offset: 3px; border-radius: 2px; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--color-bg); padding: 8px 12px; }
.skip-link:focus { top: 8px; }

/* 4. Header: pages row + topics row ------------------------------------------ */

.site-header { position: sticky; top: 0; z-index: 50; background: var(--color-bg); transition: transform 0.25s ease; }
.site-header.is-hidden { transform: translateY(-101%); }
.site-header.is-stuck { box-shadow: 0 1px 0 var(--color-rule); }

.site-header-inner { display: flex; align-items: center; gap: 0 clamp(14px, 2vw, 28px); padding-block: 12px 6px; }
.site-id { flex: none; font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }

.site-menu { flex: 1 1 auto; min-width: 0; }
.nav-list { display: flex; align-items: baseline; gap: clamp(14px, 1.8vw, 26px); list-style: none; white-space: nowrap; }
.nav-item { flex: none; position: relative; }
.nav-pages a { font-size: 0.95em; font-weight: 400; text-decoration: none; color: var(--color-text); }
.nav-pages a:hover { color: var(--color-hover); }
.nav-pages .is-current > a { color: var(--color-hover); }

.site-actions { flex: none; display: flex; align-items: center; gap: 16px; margin-left: auto; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; color: var(--color-link); border-radius: 50%; }
.icon-button:hover { color: var(--color-hover); }
.icon-button svg { width: 17px; height: 17px; }
.site-action-link { font-size: 0.78em; white-space: nowrap; }

.site-tags { position: relative; display: block; border-top: 1px solid var(--color-rule); border-bottom: 1px solid var(--color-rule); }
.site-nav-scroll { display: flex; align-items: baseline; gap: clamp(12px, 1.5vw, 22px); overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; white-space: nowrap; padding-block: 7px; }
.site-nav-scroll::-webkit-scrollbar { display: none; }
.site-nav-scroll .nav-list { gap: clamp(12px, 1.5vw, 22px); }
.site-nav-scroll .nav-list:empty { display: none; }
.site-tags .nav-item a { font-size: 0.8em; color: var(--color-muted); text-decoration: none; }
.site-tags .nav-item a:hover { color: var(--color-hover); }
.site-tags .nav-item.is-current > a, .site-tags .nav-item.is-current > a:hover { color: var(--color-text); cursor: default; }
/* the marker sits exactly on the row's bottom rule */
.site-tags .nav-item.is-current::after { content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 2px; background: var(--color-text); }
.site-tags::before, .site-tags::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40px; pointer-events: none; opacity: 0; transition: opacity 0.15s; z-index: 1; }
.site-tags::before { left: 0; background: linear-gradient(to right, var(--color-bg), transparent); }
.site-tags::after { right: 0; background: linear-gradient(to left, var(--color-bg), transparent); }
.site-tags.can-scroll-left::before, .site-tags.can-scroll-right::after { opacity: 1; }

.read-progress { position: absolute; left: 0; bottom: -2px; height: 2px; width: 100%; background: var(--color-hover); transform: scaleX(0); transform-origin: 0 50%; display: none; }
.post-template .read-progress { display: block; }

@media (max-width: 760px) {
    :root { --header-height: 84px; }
    .site-header-inner { padding-block: 8px 4px; }
    .site-menu { overflow-x: auto; scrollbar-width: none; }
    .site-menu::-webkit-scrollbar { display: none; }
    .site-actions .site-action-link { display: none; }
}

/* 5. Dialogue — first screen -------------------------------------------------- */

.dialog {
    position: relative; isolation: isolate;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto 1fr;
    column-gap: 40px;
    min-height: min(calc(100svh - var(--header-height) - 24px), 640px);
    margin-top: 8px;
    padding: clamp(20px, 3vw, 40px) clamp(20px, 3vw, 44px) clamp(24px, 3.5vw, 44px);
}
.dialog::before {
    content: ""; position: absolute; z-index: -1; inset: 0; border-radius: 12px;
    background:
        radial-gradient(60% 80% at 15% 20%, var(--sky-1) 0%, transparent 70%),
        radial-gradient(55% 70% at 85% 30%, var(--sky-2) 0%, transparent 70%),
        radial-gradient(60% 70% at 70% 95%, var(--sky-3) 0%, transparent 70%),
        radial-gradient(50% 60% at 20% 90%, var(--sky-4) 0%, transparent 70%),
        #fffdf7;
    background-size: 160% 160%;
    animation: drift 22s ease-in-out infinite alternate;
}
@keyframes drift { 0% { background-position: 0% 0%; } 50% { background-position: 70% 40%; } 100% { background-position: 100% 100%; } }

.say {
    grid-column: 1 / -1;
    max-width: 20em;
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(1.5rem, 8px + 2.25vw, 2.5rem);   /* 40px at 1440, 24px on phones */
    line-height: 1.25;
    letter-spacing: -0.01em;
    text-wrap: balance;
    color: var(--color-text);
}
.say-name { white-space: nowrap; }
.say .portrait {
    display: inline-block; vertical-align: -0.18em; position: relative;
    height: 1.05em; width: 1.05em; object-fit: cover; border-radius: 0.22em; margin: 0 0.12em;
    background: var(--color-placeholder);
    transform-origin: 50% 100%;
    transition: transform 0.6s cubic-bezier(.22,.61,.36,1), box-shadow 0.6s ease;
}
.say-name:hover .portrait { transform: scale(2.2); z-index: 2; box-shadow: 0 8px 22px rgba(0,0,0,0.14); }
.say a { color: var(--color-link); text-decoration: none; }
.say a:hover { color: var(--color-hover); }

.reply {
    grid-column: 2; justify-self: end; align-self: end;
    max-width: 15em; text-align: right;
    font-family: var(--font-display); font-weight: 300;
    font-size: clamp(1rem, 6px + 1.2vw, 1.4rem);
    line-height: 1.32; letter-spacing: -0.005em;
}
.reply-lead { display: block; color: var(--color-muted); font-size: 11px; font-family: var(--font-text); text-transform: uppercase; letter-spacing: 0.22em; margin-bottom: 1.1em; }
.reply p { margin: 0; text-wrap: balance; }
.reply p + p { margin-top: 0.55em; }
.reply a { color: inherit; font-weight: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.14em; text-decoration-color: color-mix(in srgb, currentColor 30%, transparent); }
.reply a:hover { color: var(--color-hover); }
.reply .when { display: inline-block; font-family: var(--font-body); font-size: max(0.5em, 12px); color: var(--color-muted); margin-left: 0.6em; vertical-align: 0.3em; letter-spacing: 0; }
.reply mark {
    color: inherit; padding: 0.02em 0.18em; margin: 0 -0.08em; border-radius: 0.2em;
    background: linear-gradient(var(--color-highlight), var(--color-highlight)) no-repeat 0 0 / 0% 100%;
    -webkit-box-decoration-break: clone; box-decoration-break: clone;
    animation: ink 0.7s cubic-bezier(.2,.8,.2,1) 1.9s forwards;
}
@keyframes ink { to { background-size: 100% 100%; } }

.now {
    grid-column: 1; align-self: end; justify-self: start;
    display: flex; align-items: flex-end; gap: 16px; max-width: 22em;
    text-decoration: none; color: var(--color-text);
    opacity: 0; animation: rise 0.7s cubic-bezier(.2,.8,.2,1) 1.6s forwards;
}
/* instant-print frame: wider margin at the bottom, square photo inside */
.now-frame { display: block; flex: none; width: 128px; padding: 8px 8px 26px; background: #fff; border-radius: 4px; box-shadow: 0 8px 22px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.10); transform: rotate(-2.5deg); transition: transform 0.35s cubic-bezier(.2,.8,.2,1); }
.now-img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 2px; }
.now:hover .now-frame { transform: rotate(0) scale(1.05); }
.now-text { display: block; font-size: 0.78rem; line-height: 1.4; }
.now-lead { display: block; font-family: var(--font-text); font-size: 11px; text-transform: uppercase; letter-spacing: 0.22em; color: var(--color-muted); margin-bottom: 0.5em; }
.now-caption { display: block; text-wrap: pretty; }
.now:hover .now-caption { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }

.say, .reply p, .reply-lead { opacity: 0; transform: translateY(10px); animation: rise 0.7s cubic-bezier(.2,.8,.2,1) forwards; }
.say { animation-delay: 0.1s; }
.reply-lead { animation-delay: 0.9s; }
.reply p:nth-of-type(1) { animation-delay: 1.05s; }
.reply p:nth-of-type(2) { animation-delay: 1.3s; }
.reply p:nth-of-type(3) { animation-delay: 1.55s; }
@keyframes rise { to { opacity: 1; transform: none; } }

@media (max-width: 760px) {
    .dialog { min-height: 0; grid-template-columns: 1fr; grid-template-rows: auto auto auto; gap: 28px; }
    .say { max-width: none; }
    .say-break { display: none; }
    .say-name { white-space: normal; }
    .reply { grid-column: 1; order: 2; max-width: 92%; }
    .now { order: 3; max-width: none; }
    .now-frame { width: 96px; padding: 6px 6px 20px; }
}

/* 6. Board: projects + latest -------------------------------------------------- */

.board { padding-top: clamp(24px, 4vw, 56px); }
.board-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-top: 18px; margin-bottom: clamp(18px, 2.5vw, 32px); border-top: 1px solid var(--color-rule); }
.board-head-latest { margin-top: clamp(40px, 5vw, 72px); }
.board-title { font-size: 1.1rem; }
.board-all { font-size: 0.75em; color: var(--color-muted); text-decoration: none; }
.board-all:hover { color: var(--color-hover); }

/* big project = whole row; regular project = half; phones: one per row */
.projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(20px, 2.4vw, 36px) clamp(18px, 2vw, 32px); }
.project { display: block; text-decoration: none; color: var(--color-text); }
.project.full { grid-column: 1 / -1; }
.project-img { display: block; width: 100%; object-fit: cover; border-radius: 4px; background: var(--color-placeholder); }
.project.full .project-img { aspect-ratio: 2 / 1; }
.project.half .project-img { aspect-ratio: 3 / 2; }
.project-img-empty { background: var(--color-tint); }
.project-kind { display: inline-block; font-size: 0.7em; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-link); margin-top: 0.9em; }
.project-kind:empty { display: none; }
.project-title { display: block; margin-top: 0.5em; font-family: var(--font-display); font-weight: 700; line-height: 1.15; letter-spacing: -0.022em; transition: color 0.12s; }
.project.full .project-title { font-size: clamp(1.5rem, 1rem + 1.6vw, 2.4rem); }
.project.half .project-title { font-size: clamp(1.15rem, 1rem + 0.6vw, 1.5rem); }
.project-excerpt { display: block; margin-top: 0.45em; color: var(--color-muted); font-size: 0.92em; line-height: 1.4; max-width: 36em; }
.project-meta { display: block; margin-top: 0.55em; font-size: 0.72em; color: var(--color-muted); }
.project:hover .project-title { color: var(--color-hover); }

.latest { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px clamp(20px, 2.4vw, 36px); font-family: var(--font-text); font-size: 0.82rem; line-height: 1.45; }
.latest li { padding-top: 12px; border-top: 1px solid var(--color-rule); }
.latest a { display: block; text-decoration: none; color: var(--color-text); }
.latest-title { display: block; font-family: var(--font-display); font-weight: 700; font-size: 1rem; line-height: 1.2; letter-spacing: -0.015em; margin-bottom: 0.45em; transition: color 0.12s; }
.latest a:hover .latest-title { color: var(--color-hover); }
.latest-text { display: block; }
.latest-meta { display: block; margin-top: 0.6em; font-family: var(--font-body); font-size: 0.72rem; color: var(--color-muted); }

@media (max-width: 1000px) { .latest { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
    .projects { grid-template-columns: 1fr; }
    .project.full .project-img { aspect-ratio: 3 / 2; }
    .latest { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) { .latest { grid-template-columns: 1fr; } }

/* 7. Topic pages: head, stats, masonry ------------------------------------------ */

.tagpage { padding-top: clamp(20px, 3vw, 44px); }
.tag-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 48px; align-items: end; padding-bottom: clamp(20px, 3vw, 32px); border-bottom: 1px solid var(--color-rule); }
.tag-kicker { font-family: var(--font-text); font-size: 11px; text-transform: uppercase; letter-spacing: 0.22em; color: var(--color-muted); margin-bottom: 0.8em; }
.tag-title { font-size: clamp(2rem, 1rem + 3vw, 3.5rem); line-height: 1.05; letter-spacing: -0.025em; }
.tag-desc { max-width: 34em; margin-top: 0.6em; font-family: var(--font-text); font-size: 1.05rem; line-height: 1.5; }
.tag-stats { display: grid; grid-auto-flow: column; gap: 0 32px; margin: 0; }
.tag-stats div { display: flex; flex-direction: column; }
.tag-stats div[hidden] { display: none; }
.tag-stats dt { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-muted); order: 2; margin-top: 4px; }
.tag-stats dd { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.02em; line-height: 1; white-space: nowrap; }
.tag-related { grid-column: 1 / -1; font-size: 0.8rem; color: var(--color-muted); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.tag-related[hidden] { display: none; }
.tag-related a { color: var(--color-text); text-decoration: none; padding: 2px 10px; border: 1px solid var(--color-rule); border-radius: 999px; }
.tag-related a:hover { border-color: var(--color-hover); color: var(--color-hover); }
.tag-toolbar { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0; font-size: 0.78rem; color: var(--color-muted); }
.tag-feed a { color: var(--color-muted); text-decoration: none; }
.tag-feed a:hover { color: var(--color-hover); }

/* Masonry: the first three image posts open the page level; the rest are dealt into the shortest column by main.js */
.mosaic { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; align-items: start; }
.masonry { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 0 28px; align-items: start; }
.masonry-col { list-style: none; margin: 0; padding: 0; }
.masonry .m-item { margin-bottom: 28px; }
.m-item { list-style: none; }
.m-item a { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: var(--color-text); }
.m-img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 4px; background: var(--color-placeholder); margin-bottom: 12px; }
.m-kind { display: inline-block; font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-link); margin-bottom: 0.45em; }
.m-title { display: block; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; line-height: 1.2; letter-spacing: -0.02em; transition: color 0.12s; }
.has-img .m-title { font-size: 1.3rem; }
.m-text { display: block; margin-top: 0.4em; font-family: var(--font-text); font-size: 0.92rem; line-height: 1.45; }
.m-meta { display: block; margin-top: 0.55em; font-size: 0.7rem; color: var(--color-muted); }
.m-item a:hover .m-title { color: var(--color-hover); }
.no-img a { padding: 18px 20px 16px; background: var(--color-tint); border-radius: 6px; }
.is-lead .m-title, .is-lead .m-text { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.is-lead .m-title { -webkit-line-clamp: 2; }
.is-lead .m-text { -webkit-line-clamp: 2; }
.is-lead .m-body { min-height: 7.6rem; }

@media (max-width: 1000px) {
    .mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tag-head { grid-template-columns: 1fr; align-items: start; }
    .tag-stats { grid-auto-flow: row; grid-template-columns: repeat(4, auto); justify-content: start; }
}
@media (max-width: 640px) {
    .mosaic { grid-template-columns: 1fr; }
    .tag-stats { grid-template-columns: repeat(2, auto); gap: 14px 32px; }
}

/* projects inside a topic hub */
.tag-projects-head { margin-top: clamp(24px, 3vw, 40px); border-top: 0; padding-top: 0; }
.tag-projects { margin-bottom: clamp(24px, 3vw, 40px); }
/* inside a hub every project is a half-width square card; featured status does not change it */
.tag-projects .project { grid-column: auto; }
.tag-projects .project .project-img { aspect-ratio: 1 / 1; }
.tag-projects .project .project-title { font-size: clamp(1.15rem, 1rem + 0.6vw, 1.5rem); }
.tag-projects + .tag-toolbar { border-top: 1px solid var(--color-rule); }

/* 8. Article ----------------------------------------------------------------------- */

.article { padding-top: clamp(16px, 3vw, 40px); }
.article-header { margin-bottom: clamp(20px, 3vw, 40px); }
.article-kicker { font-size: 0.8rem; margin-bottom: 0.6em; }
.article-kicker a { text-decoration: none; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.85em; }
.article-title { max-width: 70%; font-size: clamp(2rem, 1rem + 3vw, 3.5rem); line-height: 1.06; letter-spacing: -0.025em; text-wrap: balance; }
.article-excerpt { max-width: 70%; margin-top: 0.7em; font-family: var(--font-text); font-size: 1.3rem; line-height: 1.4; }
.article-meta { margin-top: 1.1em; font-size: 0.8rem; color: var(--color-muted); }
.article-meta a { color: inherit; }
.article-meta .sep { margin-inline: 0.35em; }
.article-image { margin: 0 auto clamp(24px, 4vw, 48px); }
.article-image img { width: 100%; border-radius: 4px; }
figcaption { margin-top: 0.7em; font-size: 0.8rem; color: var(--color-muted); }

/* reading column: left 70% of the page; images and embeds take the whole column; nothing bleeds */
.gh-content {
    display: grid;
    grid-template-columns: [full-start] var(--pad) [wide-start main-start] minmax(0, 7fr) [main-end] minmax(0, 3fr) [wide-end] var(--pad) [full-end];
    font-family: var(--font-text);
    font-size: 1.1rem;
    line-height: 1.62;
}
.gh-content > * { grid-column: main; min-width: 0; margin-top: 1.15em; }
.gh-content > :first-child { margin-top: 0; }
.gh-content > .kg-image-card, .gh-content > .kg-gallery-card, .gh-content > .kg-video-card, .gh-content > .kg-embed-card, .gh-content > .kg-width-wide, .gh-content > .kg-width-full { grid-column: wide; }
.gh-content > .kg-image-card img { width: 100%; border-radius: 4px; }
.gh-content h2, .gh-content h3, .gh-content h4 { font-family: var(--font-display); }
.gh-content h2 { font-size: 1.6em; margin-top: 1.7em; }
.gh-content h3 { font-size: 1.25em; margin-top: 1.6em; }
.gh-content h4, .gh-content h5, .gh-content h6 { font-size: 1.05em; margin-top: 1.5em; }
.gh-content h2 + *, .gh-content h3 + *, .gh-content h4 + * { margin-top: 0.6em; }
.gh-content ul, .gh-content ol { padding-left: 1.3em; }
.gh-content li + li { margin-top: 0.35em; }
.gh-content blockquote { margin-inline: 0; padding-left: 1em; border-left: 3px solid var(--color-link); font-size: 1.1em; }
.gh-content blockquote.kg-blockquote-alt { border: 0; padding: 0; font-size: 1.5em; line-height: 1.25; color: var(--color-link); }
.gh-content hr { width: 100%; height: 1px; border: 0; background: var(--color-rule); margin-top: 2em; }
.gh-content figure { margin-inline: 0; }
.gh-content .kg-card { margin-top: 1.8em; }
.gh-content figcaption, .gh-content table, .gh-content .kg-card:not(.kg-callout-card):not(.kg-toggle-card) { font-family: var(--font-body); }
.gh-content strong, .gh-content b { font-weight: 700; }
.gh-content code { font-family: var(--font-mono); font-size: 0.82em; padding: 0.1em 0.35em; border-radius: 4px; background: var(--color-tint); }
.gh-content pre { overflow-x: auto; padding: 18px 20px; border-radius: 6px; background: var(--color-tint); font-size: 0.85em; line-height: 1.5; }
.gh-content pre code { padding: 0; background: none; font-size: inherit; }
.gh-content table { display: block; overflow-x: auto; border-collapse: collapse; font-size: 0.85em; }
.gh-content th, .gh-content td { padding: 8px 14px 8px 0; border-bottom: 1px solid var(--color-rule); text-align: left; vertical-align: top; }
.gh-content iframe { max-width: 100%; }
.gh-content .kg-bookmark-container { color: var(--color-text); }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: clamp(48px, 7vw, 96px); padding-top: 24px; position: relative; }
.post-nav:not(:has(a)) { display: none; }
.post-nav::before { content: ""; position: absolute; top: 0; left: var(--gutter); right: var(--gutter); height: 1px; background: var(--color-rule); }
.post-nav-link { display: block; text-decoration: none; color: var(--color-text); font-weight: 700; font-size: 1.05rem; line-height: 1.25; letter-spacing: -0.015em; }
.post-nav-link:hover { color: var(--color-hover); }
.post-nav-older { grid-column: 2; text-align: right; }
.post-nav-label { display: block; font-weight: 400; font-size: 0.72rem; color: var(--color-muted); margin-bottom: 0.3em; }
.related { margin-top: clamp(48px, 7vw, 96px); }
.article-comments { margin-top: clamp(48px, 7vw, 96px); }
.article-comments-inner { max-width: 70%; }

@media (max-width: 900px) {
    .gh-content { grid-template-columns: [full-start] var(--pad) [wide-start main-start] minmax(0, 1fr) [main-end wide-end] var(--pad) [full-end]; }
    .article-title, .article-excerpt, .article-comments-inner { max-width: none; }
}

/* 9. Footer, pagination, errors -------------------------------------------------------- */

.pagination { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin: 32px 0 clamp(40px, 6vw, 80px); }
.pagination a { text-decoration: none; }
.pagination-info { color: var(--color-muted); font-size: 0.85em; margin-inline: auto; }

.site-footer { margin-top: clamp(56px, 8vw, 120px); padding-bottom: 40px; }
.site-footer-inner { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 28px; font-size: 0.8em; color: var(--color-muted); }
.site-footer-inner::before { content: ""; flex: 1 0 100%; height: 1px; background: var(--color-rule); margin-bottom: 14px; }
.site-footer-copy a { color: inherit; }
.site-footer-nav a { color: var(--color-muted); text-decoration: none; }
.site-footer-nav a:hover { color: var(--color-hover); }

.error-page { padding-block: clamp(32px, 6vw, 80px); }
.error-code { font-size: clamp(4rem, 14vw, 10rem); color: var(--color-link); letter-spacing: -0.03em; }
.error-message { font-size: 1.5em; font-weight: 300; margin-bottom: 1em; }
.error-stack { margin-top: 3em; font-size: 0.8em; }
.error-stack ul { list-style: none; }
.error-stack li { padding: 12px 0; border-top: 1px solid var(--color-rule); }

/* 10. Utilities ---------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
    .dialog::before { animation: none; }
    .say, .reply p, .reply-lead, .now { animation: none; opacity: 1; transform: none; }
    .reply mark { animation: none; background-size: 100% 100%; }
    .say-name:hover .portrait, .now:hover .now-frame { transform: none; }
}
@media print {
    .site-header, .site-footer, .post-nav, .related, .article-comments { display: none !important; }
    body { font-size: 11pt; }
    a { color: inherit; }
}
