/* ==========================================================================
   Blog styles — extends style.css (same tokens, same visual language)
   ========================================================================== */

.nav-links a.is-active {
    color: var(--primary);
    font-weight: 600;
}

/* Breadcrumbs -------------------------------------------------------------- */
.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

.breadcrumbs a {
    color: var(--text-light);
}

.breadcrumbs a:hover {
    color: var(--primary);
}

.breadcrumbs span[aria-hidden] {
    opacity: 0.4;
}

.breadcrumbs-current {
    color: var(--dark);
    font-weight: 500;
}

.breadcrumbs-center {
    justify-content: center;
    margin-bottom: 1.5rem;
}

/* Blog index header -------------------------------------------------------- */
.blog-head {
    background: linear-gradient(to bottom, #ffffff 0%, var(--surface) 100%);
    border-bottom: 1px solid var(--border);
    padding: 3.5rem 0 3rem;
    text-align: center;
}

.blog-head h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--dark) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.blog-head p {
    font-size: 1.125rem;
    max-width: 640px;
    margin: 0 auto;
}

.blog-shell {
    padding: 4rem 0 5rem;
}

/* Post cards --------------------------------------------------------------- */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 2rem;
}

.post-grid-sm {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.post-grid-sm .post-card-body {
    padding: 1.25rem;
}

.post-grid-sm .post-card-title {
    font-size: 1.0625rem;
}

@media (max-width: 900px) {
    .post-grid-sm {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.post-card {
    display: flex;
    flex-direction: column;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.post-card-media {
    display: block;
    aspect-ratio: 3 / 2;
    background: var(--surface);
    overflow: hidden;
}

.post-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.post-card:hover .post-card-media img {
    transform: scale(1.04);
}

.post-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.5rem;
}

.post-card-title {
    font-size: 1.1875rem;
    font-weight: 700;
    line-height: 1.35;
    text-align: left;
    margin: 0.875rem 0 0.625rem;
}

.post-card-title a:hover {
    color: var(--primary);
}

.post-card-body p {
    font-size: 0.9375rem;
    margin-bottom: 1.25rem;
}

.post-tag {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: rgba(47, 49, 144, 0.08);
    color: var(--primary);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.post-card-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.post-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    color: var(--text-light);
}

.post-meta span[aria-hidden] {
    opacity: 0.5;
}

.post-card-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
}

.post-card-link:hover {
    color: var(--primary-dark);
}

/* Article ------------------------------------------------------------------ */
.article {
    padding: 2.5rem 0 4.5rem;
}

.article > .container {
    max-width: 840px;
}

/* `header` is styled globally in style.css — reset it for the in-article header */
.article-head {
    display: block;
    height: auto;
    background: none;
    position: static;
    z-index: auto;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2.5rem;
}

.article-title {
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin: 1rem 0 1rem;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    color: var(--text-light);
    margin: 0;
}

.article-meta span[aria-hidden] {
    opacity: 0.5;
}

/* Table of contents -------------------------------------------------------- */
.toc {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem 1.75rem;
    margin-bottom: 2.5rem;
}

.toc h2 {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    text-align: left;
    color: var(--text-light);
    margin: 0 0 1rem;
}

.toc ol {
    counter-reset: toc;
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc li {
    counter-increment: toc;
    position: relative;
    padding-left: 2rem;
    margin-bottom: 0.6rem;
    font-size: 0.9375rem;
}

.toc li:last-child {
    margin-bottom: 0;
}

.toc li::before {
    content: counter(toc);
    position: absolute;
    left: 0;
    top: 0.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 50%;
    background: rgba(47, 49, 144, 0.1);
    color: var(--primary);
    font-size: 0.6875rem;
    font-weight: 700;
}

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

.toc a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Article body ------------------------------------------------------------- */
.article-body {
    font-size: 1.0625rem;
    line-height: 1.75;
}

.article-body p {
    color: var(--text);
    margin-bottom: 1.35rem;
}

.article-body h2 {
    text-align: left;
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 3rem 0 1rem;
    scroll-margin-top: 110px;
}

.article-body h3 {
    font-size: 1.3125rem;
    font-weight: 700;
    margin: 2.25rem 0 0.75rem;
    scroll-margin-top: 110px;
}

.article-body ul,
.article-body ol {
    margin: 0 0 1.5rem;
    padding-left: 1.5rem;
    list-style: disc;
}

.article-body ol {
    list-style: decimal;
}

.article-body li {
    color: var(--text);
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

.article-body li::marker {
    color: var(--primary);
}

.article-body a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.article-body a:hover {
    color: var(--primary-dark);
}

.article-body strong {
    color: var(--dark);
    font-weight: 700;
}

.post-figure {
    margin: 2.25rem 0;
}

.post-figure img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.article-body code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    color: var(--primary-dark);
    overflow-wrap: anywhere;
}

.code-block {
    background: var(--dark);
    color: #e8eaf2;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 0 0 1.5rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.code-block code {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* Inline "Read next" card -------------------------------------------------- */
.read-next {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.875rem;
    margin: 2.75rem 0;
    padding: 1.125rem 1.375rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: 8px;
}

.read-next-label {
    flex-shrink: 0;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--primary);
}

.article-body .read-next a {
    color: var(--dark);
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.4;
    text-decoration: none;
}

.article-body .read-next a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Tables ------------------------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
    margin: 0 0 2rem;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.post-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.post-table th {
    background: var(--surface);
    text-align: left;
    padding: 0.9rem 1.1rem;
    font-weight: 700;
    color: var(--dark);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.post-table td {
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-light);
    vertical-align: top;
}

.post-table tbody tr:last-child td {
    border-bottom: none;
}

.post-table tbody tr:hover {
    background: rgba(47, 49, 144, 0.03);
}

/* Download CTA ------------------------------------------------------------- */
.post-cta {
    background: var(--dark);
    border-radius: 16px;
    padding: 2.75rem 2rem;
    margin: 3.5rem 0 0;
    text-align: center;
}

.post-cta h2 {
    color: var(--white);
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.post-cta p {
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 1.75rem;
}

.post-cta .download-main-btn {
    margin: 0;
}

.post-cta small {
    display: block;
    margin-top: 1.25rem;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.45);
}

/* Related ------------------------------------------------------------------ */
.related {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border);
}

.related h2 {
    text-align: left;
    font-size: 1.5rem;
    margin-bottom: 1.75rem;
}

/* Responsive --------------------------------------------------------------- */
@media (max-width: 768px) {
    .blog-head {
        padding: 2.5rem 0 2rem;
    }

    .blog-head h1 {
        font-size: 2.125rem;
    }

    .blog-shell {
        padding: 3rem 0 4rem;
    }

    .post-grid,
    .post-grid-sm {
        grid-template-columns: 1fr;
    }

    .article-title {
        font-size: 2rem;
    }

    .article-body {
        font-size: 1rem;
    }

    .article-body h2 {
        font-size: 1.5rem;
        margin-top: 2.5rem;
    }

    .article-body h3 {
        font-size: 1.1875rem;
    }

    .toc {
        padding: 1.25rem 1.25rem;
    }

    .post-cta {
        padding: 2rem 1.25rem;
    }

    .post-cta .download-main-btn {
        padding: 0.9rem 1.5rem;
        font-size: 1.05rem;
    }
}
