﻿/* ============================================================
   Blog Styles â€“ Index & Post pages
   Optimised for Core Web Vitals (CLS, LCP, readability)
   ============================================================ */

/* ---------- Hero ---------- */
.blog-hero {
    text-align: center;
    padding: 4rem 1rem 2rem;
}

.blog-hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: .5rem;
}

.blog-hero-subtitle {
    font-size: 1.15rem;
    opacity: .75;
}

/* ---------- Category Pills ---------- */
.blog-categories {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.blog-category-pill {
    display: inline-block;
    padding: .4rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--bs-border-color, #dee2e6);
    background: transparent;
    color: inherit;
    text-decoration: none;
    font-size: .875rem;
    transition: all .2s;
}

.blog-category-pill:hover,
.blog-category-pill.active {
    background: var(--bs-primary, #0d6efd);
    color: #fff;
    border-color: var(--bs-primary, #0d6efd);
}

/* ---------- Featured Post ---------- */
.blog-featured {
    margin-bottom: 2.5rem;
}

.blog-featured-card {
    display: grid;
    grid-template-columns: 1fr;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: .75rem;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .25s;
}

.blog-featured-card:hover {
    box-shadow: 0 12px 32px rgba(0,0,0,.1);
}

.blog-featured-img-wrap {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bs-secondary-bg, #e9ecef);
}

.blog-featured-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.blog-featured-body {
    padding: 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.blog-featured-label {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--bs-primary, #0d6efd);
    margin-bottom: .5rem;
}

.blog-featured-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 .75rem;
    line-height: 1.3;
}

.blog-featured-excerpt {
    font-size: .95rem;
    opacity: .8;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.blog-featured-meta {
    font-size: .8rem;
    opacity: .6;
}

@media (min-width: 768px) {
    .blog-featured-card {
        grid-template-columns: 1fr 1fr;
    }

    .blog-featured-img-wrap {
        aspect-ratio: 3 / 2;
    }

    .blog-featured-title {
        font-size: 1.85rem;
    }
}

/* ---------- Post Card ---------- */
.blog-card-link {
    text-decoration: none;
    color: inherit;
}

.blog-card {
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: .75rem;
    overflow: hidden;
    transition: box-shadow .25s, transform .25s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
    transform: translateY(-4px);
}

/* CLS-safe image container: reserves exact space before image loads */
.blog-card-img-wrap {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bs-secondary-bg, #e9ecef);
}

.blog-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.blog-card-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-card-category {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--bs-primary, #0d6efd);
    font-weight: 600;
    margin-bottom: .5rem;
}

.blog-card-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: .5rem;
    line-height: 1.35;
}

.blog-card-excerpt {
    font-size: .9rem;
    opacity: .8;
    flex: 1;
    line-height: 1.55;
}

.blog-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: .8rem;
    opacity: .6;
    margin-top: auto;
    padding-top: .75rem;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
}

/* ---------- Pagination ---------- */
.blog-pagination {
    display: flex;
    justify-content: center;
    gap: .5rem;
    padding-top: 2rem;
}

.blog-pagination .page-link {
    border-radius: .5rem;
    min-width: 2.5rem;
    text-align: center;
}

/* ---------- Single Post Page ---------- */

/* Category pill â€“ above title */
.blog-post-category {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
    font-size: .8rem;
    color: var(--bs-primary, #0d6efd);
    background: color-mix(in srgb, var(--bs-primary, #0d6efd) 8%, transparent);
    padding: .3rem .75rem;
    border-radius: .35rem;
    margin-bottom: .75rem;
}

.blog-post-title {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    line-height: 1.25;
}

/* Author row â€“ avatar + name / read-time / date */
.blog-post-author-row {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin-bottom: 1.5rem;
}

.blog-post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.blog-post-author-info {
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.blog-post-author-name {
    font-weight: 600;
    font-size: .95rem;
}

.blog-post-meta-line {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .85rem;
    color: var(--bs-secondary-color, #6c757d);
}

[data-theme="3d"] .blog-post-meta-line {
    color: rgba(255, 255, 255, .7);
}

.blog-post-meta-sep {
    opacity: .5;
}

.blog-post-readtime {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

.blog-post-readtime-icon {
    flex-shrink: 0;
    opacity: .7;
}

/* Cover image â€“ below meta, centred with max-width */
.blog-post-cover {
    display: flex;
    justify-content: center;
    padding: 0 1rem;
    margin-bottom: 1rem;
}

.blog-post-cover-img {
    width: 100%;
    max-width: 990px;
    height: auto;
    display: block;
    border-radius: .75rem;
}

/* ---------- Breadcrumb ---------- */
.blog-breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: .85rem;
    gap: .15rem;
}

.blog-breadcrumb li + li::before {
    content: "â€º";
    margin-right: .35rem;
    opacity: .5;
}

.blog-breadcrumb a {
    color: var(--bs-primary, #0d6efd);
    text-decoration: none;
}

.blog-breadcrumb a:hover {
    text-decoration: underline;
}

.blog-breadcrumb li[aria-current="page"] {
    opacity: .6;
}

/* ---------- Post Tags ---------- */
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.blog-tag {
    display: inline-block;
    padding: .25rem .75rem;
    border-radius: 999px;
    background: var(--bs-light, #f8f9fa);
    font-size: .8rem;
}

/* Article prose â€“ constrained width for readability */
.blog-post-content {
    max-width: 750px;
    font-size: 1.08rem;
    line-height: 1.85;
    letter-spacing: .01em;
}

.blog-post-content p {
    margin-bottom: 1.35rem;
}

.blog-post-content h2 {
    margin-top: 2.5rem;
    margin-bottom: .85rem;
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.3;
}

.blog-post-content h3 {
    margin-top: 2rem;
    margin-bottom: .6rem;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.35;
}

.blog-post-content h4 {
    margin-top: 1.5rem;
    margin-bottom: .5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.blog-post-content img {
    max-width: 100%;
    height: auto;
    border-radius: .5rem;
    margin: 1.25rem 0;
    display: block;
}

.blog-post-content pre {
    background: var(--bs-light, #f8f9fa);
    padding: 1rem;
    border-radius: .5rem;
    overflow-x: auto;
    font-size: .9rem;
    margin: 1.25rem 0;
}

.blog-post-content blockquote {
    border-left: 4px solid var(--bs-primary, #0d6efd);
    padding: .75rem 1.25rem;
    margin: 1.25rem 0;
    opacity: .85;
}

.blog-post-content ul,
.blog-post-content ol {
    margin-bottom: 1.35rem;
    padding-left: 1.5rem;
}

.blog-post-content li {
    margin-bottom: .35rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .blog-hero {
        padding: 2.5rem 1rem 1.5rem;
    }

    .blog-hero-title {
        font-size: 1.75rem;
    }

    .blog-post-title {
        font-size: 1.5rem;
    }

    .blog-post-cover {
        padding: 0;
    }

    .blog-post-cover-img {
        border-radius: 0;
    }

    .blog-post-content {
        font-size: 1rem;
    }

    .blog-featured-title {
        font-size: 1.3rem;
    }
}

/* ---------- Related Articles ---------- */
.blog-related {
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    padding: 3rem 0 4rem;
}

.blog-related-heading {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.blog-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.blog-related-card {
    display: flex;
    flex-direction: column;
    border-radius: .75rem;
    overflow: hidden;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    text-decoration: none;
    color: inherit;
    transition: box-shadow .2s, transform .2s;
}

.blog-related-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    transform: translateY(-2px);
}

.blog-related-img {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bs-secondary-bg, #e9ecef);
}

.blog-related-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.blog-related-body {
    padding: 1rem 1.15rem 1.25rem;
    flex: 1;
}

.blog-related-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 .4rem;
    line-height: 1.35;
}

.blog-related-excerpt {
    font-size: .875rem;
    opacity: .75;
    margin: 0;
    line-height: 1.5;
}

@media (max-width: 991px) {
    .blog-related-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 575px) {
    .blog-related-grid {
        grid-template-columns: 1fr;
    }
}
