/* Blog article page. Loaded only on article pages. */

.blog-page {
    --blog-text: #374151;
    --blog-heading: #111827;
    --blog-muted: #6b7280;
    --blog-border: #e5e7eb;
    --blog-soft: #f6f2ff;
    --blog-accent: #9146ff;
    --blog-accent-dark: #772ce8;
    color: var(--blog-text);
}

/* Breadcrumbs */
.blog-breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem .5rem;
    margin: 0 0 1.75rem;
    padding: 0;
    list-style: none;
    font-size: .875rem;
    color: var(--blog-muted);
}
.blog-breadcrumbs li { display: flex; align-items: center; min-width: 0; }
.blog-breadcrumbs li + li::before { content: "/"; margin-right: .5rem; color: #d1d5db; }
.blog-breadcrumbs a { color: var(--blog-muted); text-decoration: none; }
.blog-breadcrumbs a:hover { color: var(--blog-accent); }
.blog-breadcrumbs [aria-current] {
    color: var(--blog-heading);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 32ch;
}

/* Header */
.blog-header { max-width: 48rem; margin-bottom: 2.5rem; }
.blog-category {
    display: inline-block;
    margin-bottom: 1rem;
    padding: .25rem .75rem;
    border-radius: 999px;
    background: var(--blog-soft);
    color: var(--blog-accent-dark);
    font-size: .8125rem;
    font-weight: 600;
    text-decoration: none;
}
.blog-title {
    margin: 0 0 1rem;
    color: var(--blog-heading);
    font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -.025em;
    text-wrap: balance;
}
.blog-lead {
    margin: 0 0 1.75rem;
    font-size: 1.25rem;
    line-height: 1.6;
    color: #4b5563;
    text-wrap: pretty;
}
.blog-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 2rem;
    padding: 1.25rem 0;
    border-top: 1px solid var(--blog-border);
    border-bottom: 1px solid var(--blog-border);
}
.blog-meta-author { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.blog-meta-author img { width: 44px; height: 44px; border-radius: 999px; object-fit: cover; }
.blog-meta-author > span { display: flex; flex-direction: column; line-height: 1.3; }
.blog-meta-label { font-size: .75rem; color: var(--blog-muted); }
.blog-meta-name { font-weight: 600; color: var(--blog-heading); }
.blog-meta-author:hover .blog-meta-name { color: var(--blog-accent); }
.blog-meta-facts {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: .875rem;
    color: var(--blog-muted);
}
.blog-meta-facts li { display: flex; align-items: center; gap: .375rem; }
.blog-meta-facts svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Layout */
.blog-layout { display: block; }
.blog-main { min-width: 0; max-width: 46rem; }
.blog-aside { display: none; }

@media (min-width: 1024px) {
    .blog-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 16rem;
        gap: 4rem;
        align-items: start;
    }
    .blog-aside {
        display: block;
        position: sticky;
        top: 6rem;
        max-height: calc(100vh - 7rem);
        overflow-y: auto;
    }
    .blog-toc-inline { display: none; }
}

/* Table of contents */
.blog-toc ol { margin: 0; padding: 0; list-style: none; }
.blog-toc li { margin: 0; }
.blog-toc li.level-3 { padding-left: .875rem; }
.blog-toc a {
    display: block;
    padding: .375rem 0 .375rem .875rem;
    border-left: 2px solid var(--blog-border);
    color: var(--blog-muted);
    font-size: .875rem;
    line-height: 1.4;
    text-decoration: none;
}
.blog-toc a:hover { color: var(--blog-heading); }
.blog-toc a.is-active { color: var(--blog-accent-dark); border-left-color: var(--blog-accent); font-weight: 600; }
.blog-toc-title {
    margin: 0 0 .75rem;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--blog-heading);
}
.blog-toc-inline {
    margin: 0 0 2.5rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--blog-border);
    border-radius: .75rem;
    background: #fafafa;
}
.blog-toc-inline summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--blog-heading);
}
.blog-toc-inline ol { margin-top: .75rem; }

/* Article body */
.article-content {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--blog-text);
    overflow-wrap: break-word;
}
.article-content > :first-child { margin-top: 0; }
.article-content p { margin: 0 0 1.375em; }
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    color: var(--blog-heading);
    text-align: left !important;
    scroll-margin-top: 6.5rem;
    text-wrap: balance;
}
.article-content h2 { margin: 2.25em 0 .75em; font-size: 1.75rem; font-weight: 800; line-height: 1.25; letter-spacing: -.02em; }
.article-content h3 { margin: 1.9em 0 .6em; font-size: 1.375rem; font-weight: 700; line-height: 1.35; }
.article-content h4,
.article-content h5,
.article-content h6 { margin: 1.6em 0 .5em; font-size: 1.125rem; font-weight: 700; line-height: 1.4; }
.article-content a {
    color: var(--blog-accent-dark);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
.article-content a:hover { color: var(--blog-accent); }
.article-content strong, .article-content b { color: var(--blog-heading); font-weight: 600; }
.article-content ul,
.article-content ol { margin: 0 0 1.375em; padding-left: 1.5em; }
.article-content ul { list-style: disc; }
.article-content ol { list-style: decimal; }
.article-content li { margin: .4em 0; padding-left: .25em; }
.article-content li::marker { color: var(--blog-accent); }
.article-content li > ul,
.article-content li > ol { margin: .4em 0 0; }
.article-content blockquote {
    margin: 2em 0;
    padding: .5em 0 .5em 1.25em;
    border-left: 2px solid #ddd0f7;
    color: var(--blog-heading);
    font-size: 1.1875rem;
    font-style: italic;
}
.article-content img,
.article-content picture img {
    display: block;
    max-width: 100% !important;
    height: auto !important;
    margin: 2em auto;
    border-radius: .75rem;
}
.article-content figure { margin: 2em 0; }
.article-content figure img { margin: 0 auto; }
.article-content figcaption { margin-top: .75em; font-size: .875rem; color: var(--blog-muted); text-align: center; }
.article-content iframe {
    display: block;
    width: 100% !important;
    max-width: 100%;
    height: auto !important;
    aspect-ratio: 16 / 9;
    margin: 2em 0;
    border: 0;
    border-radius: .75rem;
}
.article-content hr { margin: 2.5em 0; border: 0; border-top: 1px solid var(--blog-border); }
.article-content code { padding: .15em .35em; border-radius: .25rem; background: #f3f4f6; font-size: .9em; }
.article-table { margin: 2em 0; overflow-x: auto; }
.article-content table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.article-content th,
.article-content td { padding: .625em .75em; border-bottom: 1px solid var(--blog-border); text-align: left; vertical-align: top; }
.article-content th { color: var(--blog-heading); font-weight: 600; background: #fafafa; }

/* Share */
.blog-share { display: flex; flex-direction: column; gap: .75rem; margin-top: 2rem; }
.blog-share-end {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem 1rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--blog-border);
}
.blog-share-label { font-size: .875rem; font-weight: 600; color: var(--blog-heading); }
.blog-share-list { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.blog-share-list a,
.blog-share-list button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--blog-border);
    border-radius: 999px;
    background: #fff;
    color: #4b5563;
    cursor: pointer;
    transition: color .15s, border-color .15s, background-color .15s;
}
.blog-share-list a:hover,
.blog-share-list button:hover { color: var(--blog-accent-dark); border-color: var(--blog-accent); background: var(--blog-soft); }
.blog-share-list svg { width: 16px; height: 16px; }
.blog-share-list .icon-check { display: none; }
.blog-share-list .is-copied { color: #059669; border-color: #059669; }
.blog-share-list .is-copied .icon-link { display: none; }
.blog-share-list .is-copied .icon-check { display: block; }

/* Author box */
.blog-author {
    display: flex;
    gap: 1.25rem;
    margin-top: 2.5rem;
    padding: 1.5rem;
    border-radius: 1rem;
    background: var(--blog-soft);
}
.blog-author img { width: 72px; height: 72px; border-radius: 999px; object-fit: cover; flex-shrink: 0; }
.blog-author p { margin: 0; }
.blog-author-label { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--blog-accent-dark); }
.blog-author-name { margin-top: .25rem !important; font-size: 1.125rem; font-weight: 700; }
.blog-author-name a { color: var(--blog-heading); text-decoration: none; }
.blog-author-bio { margin-top: .5rem !important; font-size: .9375rem; line-height: 1.6; }
.blog-author-more { display: inline-block; margin-top: .75rem; font-size: .875rem; font-weight: 600; color: var(--blog-accent-dark); text-decoration: none; }
.blog-author-more:hover { text-decoration: underline; }

/* Related articles */
.blog-related { margin-top: 4.5rem; padding-top: 3rem; border-top: 1px solid var(--blog-border); }
.blog-related h2 { margin: 0 0 1.5rem; font-size: 1.75rem; font-weight: 800; color: var(--blog-heading); letter-spacing: -.02em; }
.blog-related-grid { display: grid; gap: 1.25rem; }
@media (min-width: 768px) { .blog-related-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.blog-related-card {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: 1.5rem;
    border: 1px solid var(--blog-border);
    border-radius: 1rem;
    background: #fff;
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.blog-related-card:hover { border-color: var(--blog-accent); box-shadow: 0 10px 25px -10px rgba(145, 70, 255, .25); transform: translateY(-2px); }
.blog-related-title { font-weight: 700; line-height: 1.35; color: var(--blog-heading); }
.blog-related-text { font-size: .9375rem; line-height: 1.55; color: var(--blog-muted); }
.blog-related-meta { margin-top: auto; padding-top: .5rem; font-size: .8125rem; color: var(--blog-muted); }

@media (max-width: 639px) {
    .article-content { font-size: 1.0625rem; }
    .blog-lead { font-size: 1.125rem; }
    .blog-author { flex-direction: column; }
    .blog-meta { gap: .875rem 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    .blog-related-card { transition: none; }
    .blog-related-card:hover { transform: none; }
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
