/* ==========================================================================
   signal — a minimal Ghost theme for notes & long-form tech writing
   ========================================================================== */

/* ---- tokens ------------------------------------------------------------- */

:root {
    --font-sans: var(--gh-font-body, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif);
    --font-heading: var(--gh-font-heading, var(--font-sans));
    --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", "Fira Code", Menlo, Consolas, monospace;

    --measure: 42rem;
    --wide: 64rem;
    --gutter: 1.25rem;
    --radius: 6px;

    --accent: var(--ghost-accent-color, #dd0031);

    /* light */
    --bg: #fbfbf8;
    --fg: #1c1c21;
    --fg-soft: #3a3a42;
    --muted: #6e6e78;
    --line: #e6e5df;
    --surface: #f2f1ec;
    --code-bg: #f4f3ee;
    --selection: color-mix(in srgb, var(--accent) 22%, transparent);

    /* syntax (catppuccin latte-ish) */
    --tok-comment: #8c8fa1;
    --tok-keyword: #8839ef;
    --tok-string: #40a02b;
    --tok-function: #1e66f5;
    --tok-number: #fe640b;
    --tok-class: #c27c0e;
    --tok-tag: #d20f39;
    --tok-attr: #179299;
    --tok-punct: #6c6f85;

    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0f1013;
    --fg: #e5e5e7;
    --fg-soft: #c4c4ca;
    --muted: #8a8c96;
    --line: #24262c;
    --surface: #17191d;
    --code-bg: #15171b;

    /* syntax (catppuccin mocha-ish) */
    --tok-comment: #7f849c;
    --tok-keyword: #cba6f7;
    --tok-string: #a6e3a1;
    --tok-function: #89b4fa;
    --tok-number: #fab387;
    --tok-class: #f9e2af;
    --tok-tag: #f38ba8;
    --tok-attr: #94e2d5;
    --tok-punct: #9399b2;

    color-scheme: dark;
}

/* no-JS fallback */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]):not([data-scheme="light"]) {
        --bg: #0f1013; --fg: #e5e5e7; --fg-soft: #c4c4ca; --muted: #8a8c96;
        --line: #24262c; --surface: #17191d; --code-bg: #15171b;
        --tok-comment: #7f849c; --tok-keyword: #cba6f7; --tok-string: #a6e3a1; --tok-function: #89b4fa;
        --tok-number: #fab387; --tok-class: #f9e2af; --tok-tag: #f38ba8; --tok-attr: #94e2d5; --tok-punct: #9399b2;
        color-scheme: dark;
    }
}

/* ---- base --------------------------------------------------------------- */

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: 1.5rem;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

::selection { background: var(--selection); }

a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 0.2em; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }

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

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

h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); line-height: 1.25; letter-spacing: -0.015em; font-weight: 650; }

code, kbd, pre, samp { font-family: var(--font-mono); }

.container { width: 100%; max-width: calc(var(--measure) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }

.site-main { flex: 1; padding-bottom: 4rem; }

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

.skip-link { position: absolute; left: -999px; top: 0.5rem; z-index: 100; background: var(--fg); color: var(--bg); padding: 0.4rem 0.8rem; font: 0.8rem var(--font-mono); }
.skip-link:focus { left: 0.5rem; }

.prompt { color: var(--accent); font-family: var(--font-mono); }
.sep { color: var(--muted); opacity: 0.6; }

.badge {
    display: inline-block; font: 500 0.68rem/1 var(--font-mono); text-transform: lowercase;
    padding: 0.28em 0.5em; border: 1px solid var(--line); border-radius: 4px; color: var(--muted);
}
.badge-pinned { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

/* ---- header ------------------------------------------------------------- */

.site-header { padding: 1.75rem 0 1rem; }

.header-inner { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }

.site-logo { display: inline-flex; align-items: center; text-decoration: none; font: 600 1rem var(--font-mono); letter-spacing: -0.01em; }
.site-logo:hover { color: inherit; }
.site-logo img { max-height: 32px; width: auto; }

.cursor { display: inline-block; width: 0.55em; height: 1.1em; margin-left: 2px; background: var(--accent); transform: translateY(1px); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.site-nav { flex: 1; min-width: 0; }
.site-nav .nav { display: flex; gap: 1rem; list-style: none; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; }
.site-nav .nav a { font: 0.85rem var(--font-mono); color: var(--muted); text-decoration: none; white-space: nowrap; }
.site-nav .nav a::before { content: "./"; opacity: 0.5; }
.site-nav .nav a:hover, .site-nav .nav-current a { color: var(--fg); }
.site-nav .nav-current a::before { color: var(--accent); opacity: 1; }

.header-actions { display: flex; align-items: center; gap: 0.25rem; margin-left: auto; }

.icon-btn {
    display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
    background: none; border: 0; border-radius: var(--radius); color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--fg); background: var(--surface); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.theme-toggle span { display: grid; }

.header-link { font: 0.8rem var(--font-mono); color: var(--muted); text-decoration: none; padding: 0.3rem 0.6rem; border: 1px solid var(--line); border-radius: var(--radius); margin-left: 0.35rem; }
.header-link:hover { color: var(--fg); border-color: var(--muted); }

@media (max-width: 560px) {
    .site-nav { order: 3; flex-basis: 100%; }
}

/* ---- homepage intro ----------------------------------------------------- */

.intro { display: flex; flex-direction: column; font: 0.92rem/1.6 var(--font-mono); margin: 1.5rem 0 2.25rem; }
.intro > span { white-space: pre-wrap; }
.intro-comment > span:nth-child(2) { padding-left: 3ch; text-indent: -3ch; }
.intro-docstring > span:nth-child(2) { padding-left: 4ch; }

.tok-comment { color: var(--tok-comment); }
.tok-keyword { color: var(--tok-keyword); }
.tok-string { color: var(--tok-string); }
.tok-function { color: var(--tok-function); }
.tok-number { color: var(--tok-number); }

/* ---- feed filter -------------------------------------------------------- */

.feed-filter { display: flex; gap: 0.25rem; margin: 0 0 1.5rem; font: 0.8rem var(--font-mono); border-bottom: 1px solid var(--line); }
.feed-filter a { text-decoration: none; color: var(--muted); padding: 0.4rem 0.7rem; margin-bottom: -1px; border-bottom: 2px solid transparent; }
.feed-filter a:hover { color: var(--fg); }
.feed-filter a.is-active { color: var(--fg); border-bottom-color: var(--accent); }

/* ---- feed: a `git log --graph` timeline -------------------------------- */

.feed { position: relative; padding-left: 1.6rem; }
.feed::before { content: ""; position: absolute; left: 5px; top: 0.6rem; bottom: 2.5rem; width: 1px; background: var(--line); }

.card { position: relative; padding: 0 0 2.25rem; min-width: 0; overflow-wrap: break-word; }
.card::before {
    content: ""; position: absolute; left: calc(-1.6rem + 1px); top: 0.5rem;
    width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 1.5px solid var(--muted);
}
.card-article::before { background: var(--accent); border-color: var(--accent); border-radius: 2px; transform: rotate(45deg); }
.card:hover::before { border-color: var(--accent); }

.card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; font: 0.78rem var(--font-mono); color: var(--muted); margin-bottom: 0.4rem; }
.card-permalink { text-decoration: none; color: inherit; }
.card-permalink:hover { color: var(--accent); }

.card-title { font-size: 1.35rem; margin: 0.1rem 0 0.4rem; }
.card-title a { text-decoration: none; }
.card-excerpt { margin: 0; color: var(--fg-soft); font-size: 0.98rem; }

.micro-title { font-size: 1.05rem; margin: 0 0 0.3rem; }
.micro-title a { text-decoration: none; }

.micro-image { display: block; margin-top: 0.75rem; }
.micro-image img { border-radius: var(--radius); border: 1px solid var(--line); max-height: 420px; width: auto; }

.card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.6rem; font: 0.75rem var(--font-mono); color: var(--muted); }
.card-more, .card-comments { text-decoration: none; color: var(--muted); margin-left: auto; }
.card-comments { margin-left: 0; }
@media (max-width: 560px) { .card-more { display: none; } }
.card-comments::before { content: "↳ "; }
.card-more:hover, .card-comments:hover { color: var(--accent); }

.tag-list { display: inline-flex; flex-wrap: wrap; gap: 0.6rem; }
.tag { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); text-decoration: none; }
.tag:hover { color: var(--accent); }

/* ---- sidebar ------------------------------------------------------------ */

:root { --sidebar: 15rem; --sidebar-gap: 3.5rem; }

.layout-main { min-width: 0; }

@media (min-width: 1024px) {
    .with-sidebar,
    body:has(.with-sidebar) .site-header .container,
    body:has(.with-sidebar) .site-footer .container {
        max-width: calc(var(--measure) + var(--sidebar) + var(--sidebar-gap) + var(--gutter) * 2);
    }
    .with-sidebar { display: grid; grid-template-columns: minmax(0, var(--measure)) var(--sidebar); gap: var(--sidebar-gap); align-items: start; }
    .sidebar { position: sticky; top: 1.5rem; max-height: calc(100vh - 3rem); overflow-y: auto; scrollbar-width: none; padding: 1.5rem 0 1rem 1.5rem; border-left: 1px solid var(--line); }
    .sidebar::-webkit-scrollbar { display: none; }
}

@media (max-width: 1023px) {
    .sidebar { margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px dashed var(--line); display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 2rem; }
}

.side-block { margin-bottom: 1.75rem; font-size: 0.88rem; }
.side-cmd { margin: 0 0 0.55rem; font: 0.72rem var(--font-mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.side-author { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 650; text-decoration: none; }
.side-author img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.side-bio { margin: 0.5rem 0 0; color: var(--fg-soft); line-height: 1.55; }
.side-location { margin: 0.4rem 0 0; font: 0.72rem var(--font-mono); color: var(--muted); }

.side-list, .side-tags, .side-links { list-style: none; margin: 0; padding: 0; }
.side-list li { padding: 0.3rem 0; line-height: 1.4; }
.side-list li + li { border-top: 1px dashed var(--line); }
.side-list a { text-decoration: none; }
.side-empty { color: var(--muted); font-family: var(--font-mono); }

.side-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.side-tags a {
    display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.45rem; text-decoration: none;
    font: 0.72rem var(--font-mono); color: var(--fg-soft); border: 1px solid var(--line); border-radius: 4px;
}
.side-tags a:hover, .side-tags a.is-current { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.side-count { color: var(--muted); font-size: 0.65rem; }

.side-stack { margin: 0; font: 0.78rem/1.7 var(--font-mono); color: var(--fg-soft); }
.side-stack .req { display: block; }
.side-stack .req-op { color: var(--muted); }
.side-stack .req-ver { color: var(--tok-number); }

.side-links { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; font: 0.78rem var(--font-mono); }
.side-links a { text-decoration: none; color: var(--fg-soft); }
.side-links a::before { content: "→ "; color: var(--muted); }
.side-links a:hover { color: var(--accent); }

.sidebar .side-subscribe { flex-wrap: nowrap; gap: 0.35rem; }
.sidebar .side-subscribe input { flex: 1 1 auto; padding: 0.4rem 0.55rem; font-size: 0.75rem; }
.sidebar .side-subscribe button { padding: 0.4rem 0.7rem; font-size: 0.8rem; }
.side-subscribe .form-msg { font-size: 0.7rem; }
.sidebar .side-subscribe.success, .sidebar .side-subscribe.error { flex-wrap: wrap; }

/* ---- pagination --------------------------------------------------------- */

.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; padding-top: 1.25rem; border-top: 1px dashed var(--line); font: 0.82rem var(--font-mono); color: var(--muted); }
.pagination a { text-decoration: none; }
.pagination .is-disabled { opacity: 0.35; }

/* ---- post --------------------------------------------------------------- */

.post-header { margin: 2rem auto 2rem; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font: 0.8rem var(--font-mono); color: var(--muted); }
.post-meta a { text-decoration: none; }
.post-meta .tag { font-size: inherit; color: var(--accent); }

.post-title { overflow-wrap: break-word; font-size: clamp(1.9rem, 1.4rem + 2.2vw, 2.6rem); margin: 0.6rem 0 0.75rem; letter-spacing: -0.025em; }
.post-excerpt { font-size: 1.2rem; line-height: 1.55; color: var(--fg-soft); margin: 0 0 1.25rem; }

.post-byline { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; font: 0.8rem var(--font-mono); color: var(--muted); }
.byline-author { display: inline-flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.byline-author img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }

.post-micro .post-header { margin-bottom: 1rem; }
.post-micro .micro-title { font-size: 1.5rem; margin-top: 0.75rem; }

.post-image { margin: 0 auto 2.5rem; }
.post-image-wide { max-width: calc(var(--wide) + var(--gutter) * 2); padding: 0 var(--gutter); }
.post-image img { width: 100%; border-radius: var(--radius); }
.post-image figcaption { margin-top: 0.6rem; text-align: center; font: 0.78rem var(--font-mono); color: var(--muted); }

/* toc */
.toc { margin-bottom: 2rem; }
.toc details { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 1rem; font: 0.85rem/1.6 var(--font-mono); }
.toc summary { cursor: pointer; color: var(--muted); list-style: none; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary::before { content: "▸ "; display: inline-block; transition: transform 0.15s; }
.toc details[open] summary::before { content: "▾ "; }
.toc-list { list-style: none; margin: 0.5rem 0 0.25rem; padding: 0; }
.toc-list li { margin: 0.15rem 0; }
.toc-list li.toc-h3 { padding-left: 1.25rem; }
.toc-list li.toc-h3::before { content: "└─ "; color: var(--muted); opacity: 0.6; }
.toc-list a { text-decoration: none; color: var(--fg-soft); }
.toc-list a:hover, .toc-list a.is-active { color: var(--accent); }

/* ---- content (koenig-compatible grid) ---------------------------------- */

.gh-content {
    display: grid;
    grid-template-columns:
        [full-start] minmax(var(--gutter), 1fr)
        [wide-start] minmax(0, calc((var(--wide) - var(--measure)) / 2))
        [main-start] min(var(--measure), calc(100% - var(--gutter) * 2)) [main-end]
        minmax(0, calc((var(--wide) - var(--measure)) / 2)) [wide-end]
        minmax(var(--gutter), 1fr) [full-end];
    font-size: 1.0625rem;
}
.gh-content > * { grid-column: main; min-width: 0; }
.gh-content > .kg-width-wide { grid-column: wide; }
.gh-content > .kg-width-full { grid-column: full; }
.gh-content > .kg-width-full img { border-radius: 0; }

.gh-content-flush { display: block; margin-bottom: 2rem; }

.gh-content > * + *, .micro-content > * + * { margin-top: 1.35em; margin-bottom: 0; }
.gh-content > :first-child, .micro-content > :first-child { margin-top: 0; }

.micro-content { font-size: 1.0rem; line-height: 1.65; }
.micro-content p { margin: 0; }
.micro-content > * + * { margin-top: 0.85em; }
.micro-body { font-size: 1.15rem; }

.gh-content h2, .gh-content h3, .gh-content h4 { position: relative; }
.gh-content > h2 { font-size: 1.55rem; margin-top: 2em; }
.gh-content > h3 { font-size: 1.22rem; margin-top: 1.9em; }
.gh-content > h4 { font-size: 1.05rem; margin-top: 1.7em; }
.gh-content > h2 + *, .gh-content > h3 + *, .gh-content > h4 + * { margin-top: 0.7em; }

/* markdown-style heading anchors in the left margin */
.heading-anchor {
    font: 500 0.8em var(--font-mono); color: var(--muted); text-decoration: none; opacity: 0;
    position: absolute; right: 100%; padding-right: 0.5rem; top: 0.12em; white-space: nowrap; transition: opacity 0.15s;
}
.gh-content h2:hover .heading-anchor, .gh-content h3:hover .heading-anchor, .heading-anchor:focus { opacity: 1; }
.heading-anchor:hover { color: var(--accent); }
@media (max-width: 860px) {
    .heading-anchor { display: none; }
}

.gh-content a { color: var(--fg); text-decoration-color: var(--accent); text-decoration-thickness: 1.5px; }
.gh-content a:hover { color: var(--accent); }
.micro-content a { text-decoration-color: var(--accent); }

.gh-content ul, .gh-content ol, .micro-content ul, .micro-content ol { padding-left: 1.4rem; }
.gh-content li + li { margin-top: 0.35em; }
.gh-content li::marker { color: var(--muted); }

.gh-content blockquote:not([class]), .micro-content blockquote:not([class]) {
    margin-left: 0; margin-right: 0; padding: 0.1rem 0 0.1rem 1.1rem; border-left: 2px solid var(--accent); color: var(--fg-soft); font-style: italic;
}

.gh-content hr, .micro-content hr { border: 0; height: auto; margin: 2.8em 0; text-align: center; }
.gh-content hr::after { content: "# ---"; font: 0.85rem var(--font-mono); color: var(--muted); letter-spacing: 0.2em; }

.gh-content figcaption { margin-top: 0.6rem; text-align: center; font: 0.78rem/1.5 var(--font-mono); color: var(--muted); }
.gh-content figure img { border-radius: var(--radius); }

.gh-content table { width: 100%; border-collapse: collapse; font-size: 0.92rem; display: block; overflow-x: auto; }
.gh-content th, .gh-content td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); text-align: left; }
.gh-content th { font: 600 0.8rem var(--font-mono); color: var(--muted); }

/* inline code */
:not(pre) > code {
    font-size: 0.86em; padding: 0.12em 0.38em; border-radius: 4px;
    background: var(--surface); border: 1px solid var(--line); color: var(--fg); word-break: break-word;
}
kbd { font-size: 0.8em; padding: 0.1em 0.4em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); }

/* ---- code blocks -------------------------------------------------------- */

.gh-content pre, .micro-content pre {
    margin-left: 0; margin-right: 0; padding: 1rem 1.15rem; overflow-x: auto;
    background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius);
    font-size: 0.84rem; line-height: 1.65; tab-size: 4; -webkit-overflow-scrolling: touch;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; color: var(--fg); white-space: pre; }

.code-block { position: relative; }
.code-block > pre { margin: 0; padding-top: 2.3rem; }
.code-bar {
    position: absolute; inset: 1px 1px auto 1px; height: 1.8rem; display: flex; align-items: center; justify-content: space-between;
    padding: 0 0.75rem; font: 0.7rem var(--font-mono); color: var(--muted); border-bottom: 1px dashed var(--line);
    border-radius: var(--radius) var(--radius) 0 0; pointer-events: none;
}
.code-lang::before { content: "● ● ● "; letter-spacing: -0.1em; margin-right: 0.6em; opacity: 0.35; }
.code-copy { pointer-events: auto; background: none; border: 0; padding: 0.2rem 0.3rem; font: inherit; color: inherit; cursor: pointer; border-radius: 4px; }
.code-copy:hover { color: var(--fg); background: var(--surface); }
.code-copy.is-copied { color: var(--tok-string); }

.gh-content .kg-code-card { position: relative; }
.gh-content .kg-code-card pre { margin: 0; }

/* prism tokens */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: var(--tok-comment); font-style: italic; }
.token.punctuation { color: var(--tok-punct); }
.token.keyword, .token.atrule, .token.important, .token.rule, .token.selector .token.class { color: var(--tok-keyword); }
.token.string, .token.char, .token.attr-value, .token.inserted, .token.template-string, .token.url { color: var(--tok-string); }
.token.function, .token.function-variable, .token.method { color: var(--tok-function); }
.token.number, .token.boolean, .token.constant, .token.symbol, .token.unit { color: var(--tok-number); }
.token.class-name, .token.builtin, .token.maybe-class-name, .token.namespace { color: var(--tok-class); }
.token.tag, .token.deleted, .token.selector { color: var(--tok-tag); }
.token.attr-name, .token.property, .token.variable, .token.regex { color: var(--tok-attr); }
.token.operator, .token.entity { color: var(--tok-punct); }
.token.decorator, .token.annotation { color: var(--tok-tag); }
.token.inserted { background: color-mix(in srgb, var(--tok-string) 12%, transparent); }
.token.deleted { background: color-mix(in srgb, var(--tok-tag) 12%, transparent); }
.token.bold { font-weight: bold; }
.token.italic { font-style: italic; }

/* ---- post footer -------------------------------------------------------- */

.post-footer { margin-top: 3.5rem; }
.post-footer-row { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; padding-top: 1.25rem; border-top: 1px dashed var(--line); }
.text-btn { margin-left: auto; background: none; border: 0; padding: 0; font: 0.78rem var(--font-mono); color: var(--muted); cursor: pointer; }
.text-btn:hover { color: var(--accent); }

.post-comments { margin-top: 3rem; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 3rem; }
.post-nav-link { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; }
.post-nav-link:hover { border-color: var(--accent); color: inherit; }
.post-nav-next { grid-column: 2; text-align: right; }
.post-nav-label { font: 0.72rem var(--font-mono); color: var(--muted); }
.post-nav-title { font-weight: 600; line-height: 1.35; font-size: 0.95rem; }
@media (max-width: 560px) {
    .post-nav { grid-template-columns: 1fr; }
    .post-nav-next { grid-column: 1; }
}

/* ---- subscribe ---------------------------------------------------------- */

.subscribe { margin-top: 2.5rem; padding: 1.25rem 1.25rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.subscribe-cmd { margin: 0; font: 600 0.9rem var(--font-mono); }
.subscribe-text { margin: 0.35rem 0 0.9rem; font-size: 0.92rem; color: var(--fg-soft); }
.subscribe-form { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.subscribe-form input {
    flex: 1 1 14rem; min-width: 0; padding: 0.55rem 0.75rem; font: 0.88rem var(--font-mono);
    color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
}
.subscribe-form input:focus { outline: none; border-color: var(--accent); }
.subscribe-form button {
    padding: 0.55rem 1rem; font: 600 0.85rem var(--font-mono); color: #fff; background: var(--accent);
    border: 0; border-radius: var(--radius); cursor: pointer;
}
.subscribe-form button:hover { filter: brightness(1.08); }
.btn-loading, .form-msg { display: none; }
.form-msg { flex-basis: 100%; margin: 0.25rem 0 0; font: 0.8rem var(--font-mono); }
.subscribe-form.loading .btn-label { display: none; }
.subscribe-form.loading .btn-loading { display: inline; }
.subscribe-form.success .form-success { display: block; color: var(--tok-string); }
.subscribe-form.error .form-error { display: block; color: var(--tok-tag); }

/* ---- archives ----------------------------------------------------------- */

.archive-header { margin: 2rem 0 2.5rem; }
.archive-cmd { margin: 0; font: 0.82rem var(--font-mono); color: var(--muted); }
.archive-title { font-size: 2rem; margin: 0.35rem 0 0.5rem; }
.archive-description { margin: 0 0 0.5rem; color: var(--fg-soft); }
.archive-count, .archive-links { margin: 0; font: 0.78rem var(--font-mono); color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.9rem; }
.archive-links { margin-bottom: 0.35rem; }
.author-row { display: flex; align-items: center; gap: 1rem; }
.author-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }

.archive-list { list-style: none; margin: 0; padding: 0; font-size: 0.98rem; }
.archive-list li { display: flex; gap: 1rem; align-items: baseline; padding: 0.45rem 0; border-bottom: 1px dashed var(--line); }
.archive-list time, .archive-rt { font: 0.78rem var(--font-mono); color: var(--muted); flex-shrink: 0; }
.archive-list a { text-decoration: none; flex: 1; }
.archive-year { list-style: none; font: 600 0.85rem var(--font-mono); color: var(--accent); padding: 1.75rem 0 0.25rem !important; border: 0 !important; }

/* ---- error -------------------------------------------------------------- */

.error-page { padding-top: 3rem; }
.traceback {
    margin: 0; padding: 1.25rem; overflow-x: auto; font-size: 0.85rem; line-height: 1.7;
    background: var(--code-bg); border: 1px solid var(--line); border-left: 3px solid var(--tok-tag); border-radius: var(--radius);
}
.traceback code { white-space: pre; }
.tb-dim { color: var(--muted); }
.tb-caret, .tb-error { color: var(--tok-tag); font-weight: 600; }
.error-actions { font: 0.95rem var(--font-mono); margin: 1.5rem 0 3rem; }
.error-latest .archive-cmd { margin-bottom: 0.5rem; }

/* ---- footer ------------------------------------------------------------- */

.site-footer { padding: 2rem 0 2.5rem; font: 0.75rem var(--font-mono); color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem 1.5rem; border-top: 1px solid var(--line); padding-top: 1.5rem; }
.footer-left, .footer-right { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }
.footer-tagline::before { content: "# "; opacity: 0.6; }
.site-footer a { text-decoration: none; }
.site-footer .nav { display: flex; gap: 1rem; list-style: none; margin: 0; padding: 0; }

/* ---- reading position --------------------------------------------------- */

.statusline {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; align-items: center; gap: 0;
    height: 1.6rem; font: 0.7rem/1.6rem var(--font-mono); color: var(--muted);
    background: color-mix(in srgb, var(--bg) 88%, transparent); border-top: 1px solid var(--line);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    transform: translateY(100%); transition: transform 0.2s ease;
}
.statusline.is-visible { transform: none; }
.statusline > span { padding: 0 0.75rem; white-space: nowrap; }
.sl-mode { background: var(--accent); color: #fff; font-weight: 700; letter-spacing: 0.05em; }
.sl-mode[data-value="VISUAL"] { background: var(--tok-keyword); color: var(--bg); }
.sl-mode[data-value="INSERT"] { background: var(--tok-string); color: var(--bg); }
.sl-file { color: var(--fg-soft); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sl-spacer { flex: 1; }
.sl-pos { min-width: 4.5ch; text-align: right; color: var(--fg-soft); }
@media (max-width: 560px) { .sl-meta { display: none; } }
.post-template .site-footer { padding-bottom: 4rem; }

.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 50; pointer-events: none; }
.progress span { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }

@media (prefers-reduced-motion: reduce) {
    .cursor { animation: none; }
    .statusline { transition: none; }
}

@media print {
    .site-header, .site-footer, .sidebar, .statusline, .progress, .post-footer, .toc, .code-bar { display: none !important; }
}
