/* ── Post article card ───────────────────────────────────── */

main {
    padding-top: var(--space-lg);
    padding-bottom: var(--space-xl);
}

main > article {
    background: var(--color-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--color-glass-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    margin-bottom: var(--space-xl);
    margin-left: auto;
    margin-right: auto;
    margin-top: var(--space-xl);
    max-width: var(--max-width-article);
    padding: var(--space-xl) var(--space-2xl);
    transition: var(--transition-medium);
}

main > article:first-child { margin-top: 0; }
main > article:last-child  { margin-bottom: 0; }

@media screen and (max-width: 62em) {
    main > article {
        margin-left: var(--space-md);
        margin-right: var(--space-md);
    }
}

@media screen and (max-width: 38em) {
    main > article {
        padding: var(--space-lg) var(--space-md);
    }
}

/* ── Post title card ─────────────────────────────────────── */

.post-title {
    border-bottom: none;
    display: block;
    font-family: var(--font-condensed);
    font-size: 1.75em;
    font-weight: normal;
    line-height: 1.25;
    margin: 0 0 0.4em;
    text-align: center;
}

@media screen and (max-width: 32em) {
    .post-title { font-size: 1.3em; }
}

.post-date {
    color: var(--color-text-muted);
    font-family: var(--font-condensed);
    font-size: 0.9em;
    font-style: italic;
    text-align: center;
    margin: 0 0 0;
}

/* ── Post prose ──────────────────────────────────────────── */

.post-content {
    margin-top: var(--space-xl);
}

.post-content p {
    line-height: 1.7;
    margin: 0 0 0.75em;
    text-align: justify;
}

.post-content p:last-child { margin-bottom: 0; }

.post-content a {
    color: var(--color-accent);
    text-decoration: underline;
    text-decoration-color: var(--color-accent-dim);
    text-underline-offset: 0.2em;
}

.post-content a:hover {
    text-decoration-color: var(--color-accent);
    opacity: 0.85;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
    font-family: var(--font-condensed-bold);
    font-weight: normal;
    line-height: 1.3;
    margin: 1.5em 0 0.5em;
}

.post-content h2 {
    font-size: 1.5em;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.3em;
}

.post-content h3 { font-size: 1.2em; }
.post-content h4 { font-size: 1em; }

.post-content ul,
.post-content ol {
    padding-left: 1.5em;
    margin: 0.5em 0 0.75em;
}

.post-content li { margin-bottom: 0.3em; }

.post-content img {
    display: block;
    height: auto;
    max-width: 100%;
    margin: var(--space-lg) auto;
    border-radius: var(--radius-sm);
}

.post-content figure { margin: 0; }

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

/* ── Code blocks ─────────────────────────────────────────── */

.post-content pre,
.post-content code {
    font-family: 'DejaVu Sans Mono', 'Courier New', Courier, monospace;
    font-size: 0.85em;
}

.post-content code {
    background: var(--color-surface-raised);
    border: 1px solid var(--color-glass-border);
    border-radius: var(--radius-sm);
    padding: 0.1em 0.4em;
}

.post-content pre {
    background: var(--color-surface-raised);
    border: 1px solid var(--color-glass-border);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    padding: 1em 1.25em;
    tab-size: 4;
}

.post-content pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 1em;
}

/* ── Blockquote ──────────────────────────────────────────── */

.post-content blockquote {
    border-left: 3px solid var(--color-accent-dim);
    color: var(--color-text-muted);
    font-style: italic;
    margin: 1em 0;
    padding-left: 1em;
}

/* ── Table ───────────────────────────────────────────────── */

.post-content table {
    border-collapse: collapse;
    margin: 1em 0;
    width: 100%;
    font-size: 0.9em;
}

.post-content th,
.post-content td {
    border: 1px solid var(--color-glass-border);
    padding: 0.5em 0.75em;
    text-align: left;
}

.post-content th {
    background: var(--color-glass);
    font-family: var(--font-condensed-bold);
    font-weight: normal;
}

/* ── Table of contents ───────────────────────────────────── */

#markdown-toc {
    border: 1px solid var(--color-glass-border);
    border-radius: var(--radius-sm);
    background: var(--color-glass);
    display: inline-block;
    font-size: 0.9em;
    list-style: decimal;
    margin: 0 0 var(--space-lg);
    padding: 1em 1em 1em 2.5em;
}

#markdown-toc::before {
    content: "Contents";
    font-family: var(--font-condensed-bold);
    font-weight: normal;
    display: block;
    margin-bottom: 0.5em;
    margin-left: -1.5em;
    font-size: 1.1em;
}

#markdown-toc ul { list-style: decimal; }

/* ── Giscus comments ─────────────────────────────────────── */

.giscus-wrap {
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border);
}

/* ── Focus visible ───────────────────────────────────────── */

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

/* ── Skip link ───────────────────────────────────────────── */

.skip-link {
    background: var(--color-accent);
    border-radius: var(--radius-sm);
    clip-path: inset(50%);
    color: var(--color-on-accent, #000);
    font-family: var(--font-condensed);
    font-size: 1em;
    height: 1px;
    left: 1rem;
    overflow: hidden;
    padding: 0.5em 1em;
    position: absolute;
    top: 1rem;
    white-space: nowrap;
    width: 1px;
    z-index: var(--z-skip);
}

.skip-link:focus-visible {
    clip-path: none;
    height: auto;
    overflow: visible;
    width: auto;
}

/* ── Print ───────────────────────────────────────────────── */

@media print {
    header, nav, .profile, footer, .skip-link, .giscus-wrap { display: none !important; }
    body { background: white; color: black; }
    main > article {
        backdrop-filter: none;
        background: none;
        border: none;
        box-shadow: none;
        max-width: none;
        padding: 0;
    }
    a:not([href^="#"]):not([href^="javascript"])::after { content: ' (' attr(href) ')'; font-size: 0.8em; }
}
