.article-close-btn {
    position: fixed;
    top: calc(var(--nav-height, 64px) + 1rem);
    right: 1.5rem;
    z-index: 100;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-elev, #f1f5ff);
    border: 1px solid var(--color-border, #d5dceb);
    color: var(--color-primary, #175ce1);
    border-radius: 50%;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .1);
    transition: all 0.2s ease;
}

.article-close-btn:hover {
    transform: scale(1.1);
    color: var(--cta-text, #fff);
    border-color: var(--color-primary);
    background: var(--color-primary);
    text-decoration: none;
    box-shadow: 0 10px 25px rgba(23, 92, 225, .2);
}

@media (max-width: 1023px) {
    .article-close-btn {
        top: calc(var(--nav-height, 64px) + 0.75rem);
        right: 0.75rem;
        width: 40px;
        height: 40px;
    }
}

body.blog-article-page {
    background: var(--surface, #fff);
}

.article-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(1rem, 4vw, 2rem);
    padding: 2rem 1rem 4rem;
}

@media (min-width: 1024px) {
    .article-layout {
        grid-template-columns: 260px 1fr 280px;
    }
}

.article-nav-left {
    display: none;
}

@media (min-width: 1024px) {
    .article-nav-left {
        display: block;
        position: sticky;
        top: calc(var(--nav-height, 32px) + 2rem);
        align-self: start;
        max-height: calc(100vh - var(--nav-height, 32px) - 4rem);
        overflow-y: auto;
    }
}

.cluster-tree-nav {
    padding: 0;
    margin: 0;
    list-style: none;
}

.cluster-tree-nav h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0 0 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.cluster-tree-nav ul {
    list-style: none;
    padding-left: 0.75rem;
    margin: 0.5rem 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.cluster-tree-nav a {
    display: block;
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-muted);
    border-radius: 6px;
    transition: background 0.2s ease;
}

.cluster-tree-nav a:hover {
    background: var(--surface-elev);
    text-decoration: none;
    color: var(--color-text);
}

.cluster-tree-nav a.is-active-article {
    background: var(--surface-elev);
    color: var(--color-primary);
    font-weight: 700;
}

.article-content-main {
    min-width: 0;
}

.article-content-main .prose {
    max-width: 70ch;
    margin: 0 auto;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 18px;
    line-height: 1.6;
    color: var(--color-text);
}

.prose h1 {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 1.5rem;
}

.article-hero {
    margin: 1.5rem auto;
    max-width: 100%;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-card, 0 18px 40px rgba(12, 30, 80, .12));
}

.article-hero img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.prose h2 {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.3;
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--color-border);
    scroll-margin-top: calc(var(--nav-height, 64px) + 1rem);
}

.prose h3 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.4;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    scroll-margin-top: calc(var(--nav-height, 64px) + 1rem);
}

.prose p {
    margin-top: 1.2rem;
    margin-bottom: 1.2rem;
}

.prose a {
    color: var(--color-primary);
    text-decoration: underline;
    font-weight: 500;
}

.prose code:not(pre > code) {
    font-family: "JetBrains Mono", "SF Mono", "Consolas", monospace;
    font-size: 0.9rem;
    background: var(--surface-elev);
    padding: 0.2em 0.4em;
    border-radius: 6px;
    color: var(--color-primary-dark);
    border: 1px solid var(--color-border);
}

.prose pre {
    font-family: "JetBrains Mono", "SF Mono", "Consolas", monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 1.2rem 0;
    padding: 1rem;
    border-radius: 12px;
    background: #0d1117;
    color: #c9d1d9;
    overflow-x: auto;
}

.prose pre code {
    background: none;
    padding: 0;
    border: none;
    color: inherit;
}

.prose .footnote-ref a {
    text-decoration: none;
    font-weight: 600;
    color: var(--color-primary);
}

.prose .footnote-backref {
    display: none;
}

.prose .footnotes {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.85rem;
    color: var(--color-muted);
}

.author-box-card {
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
    background: var(--surface-elev, #f1f5ff);
    margin-top: 2.5rem;
    max-width: 70ch;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.author-box-card h4 {
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
}

.author-box-profile {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
}

.author-box-profile img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.author-box-info {
    line-height: 1.3;
}

.author-box-info .name {
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.95rem;
}

.author-box-info__title {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-primary);
    margin-top: 2px;
}

.author-box-info .bio {
    font-size: 0.85rem;
    color: var(--color-muted);
    margin: 0;
}

@media (min-width: 1024px) {
    .author-box-card {
        text-align: left;
    }

    .author-box-card .author-box-profile {
        display: flex;
    }
}

.article-nav-right {
    display: none;
}

@media (min-width: 1024px) {
    .article-nav-right {
        display: block;
        position: relative;
    }
}

.sticky-toc {
    position: sticky;
    top: calc(var(--nav-height, 32px) + 2rem);
    align-self: start;
    max-height: calc(100vh - var(--nav-height, 32px) - 10rem);
    overflow-y: auto;
}

.sticky-toc h4 {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
    margin: 0 0 0.5rem;
}

.sticky-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-left: 2px solid var(--color-border);
}

.sticky-toc-list .toc-level-3 {
    padding-left: 1.5rem;
}

.sticky-toc-list a {
    display: block;
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-muted);
    text-decoration: none;
    border-left: 2px solid transparent;
    margin-left: -2px;
    transition: all 0.2s ease;
}

.sticky-toc-list a:hover {
    color: var(--color-text);
}

.sticky-toc-list a.is-active-toc {
    color: var(--color-primary);
    font-weight: 700;
    border-left-color: var(--color-primary);
}
