/* ═══════════════════════════════════════════════════════════════
   blog.css — Premium Blog UI/UX  |  Avishkar Studio
   Sidebar-TOC layout + fully responsive (mobile-first)
   ═══════════════════════════════════════════════════════════════ */

/* ─── CSS Variables (local fallbacks) ───────────────────────── */
:root {
    --blog-sidebar-w: 260px;
    --blog-gap: 40px;
    --blog-content-max: 860px;
    --blog-bg: #f4f6fb;
    --blog-white: #ffffff;
    --blog-border: #e2e8f0;
    --blog-text: #1e293b;
    --blog-muted: #64748b;
    --blog-primary: #1E3A8A;
    --blog-accent: #f59e0b;
    --blog-radius: 14px;
    --blog-radius-sm: 8px;
}

/* ════════════════════════════════════════════════════════════════
   BLOG INDEX PAGE
   ════════════════════════════════════════════════════════════════ */

.blog-section {
    padding: 48px 0 80px;
}

/* ─── Blog Index Grid ────────────────────────────────────────── */
.blog-index-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 0;
    margin-top: 32px;
}

/* ─── Blog Card ──────────────────────────────────────────────── */
.blog-card {
    background: var(--blog-white);
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-radius);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
        box-shadow 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
        border-color 0.4s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: rgba(30, 58, 138, 0.3);
}

.blog-card-img-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    flex-shrink: 0;
}

.blog-card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
    display: block;
}

.blog-card:hover .blog-card-img-wrapper img {
    transform: scale(1.05);
}

.blog-card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.blog-card-meta {
    font-size: 0.78rem;
    color: var(--blog-muted);
    font-weight: 500;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.blog-category {
    color: var(--blog-primary);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    line-height: 1;
}

.blog-card-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--blog-text);
    margin: 0 0 14px;
    line-height: 1.4;
    font-family: var(--font-display);
    transition: color 0.3s ease;
}

.blog-card-title a {
    color: inherit;
    text-decoration: none;
}

.blog-card:hover .blog-card-title,
.blog-card:hover .blog-card-title a {
    color: var(--blog-primary);
}

.blog-card-excerpt {
    font-size: 0.97rem;
    color: var(--blog-muted);
    line-height: 1.65;
    margin-bottom: 20px;
    flex-grow: 1;
}

.blog-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--blog-border);
    gap: 12px;
    flex-wrap: wrap;
}

.blog-card-author {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.blog-card-author img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.blog-card-author span {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--blog-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.blog-read-more {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--blog-primary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    white-space: nowrap;
    transition: gap 0.3s ease, color 0.3s ease;
    flex-shrink: 0;
}

.blog-read-more i {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.blog-card:hover .blog-read-more {
    gap: 8px;
}

.blog-card:hover .blog-read-more i {
    transform: translateX(3px);
}

/* ════════════════════════════════════════════════════════════════
   BLOG POST PAGE — TWO-COLUMN SIDEBAR LAYOUT
   ════════════════════════════════════════════════════════════════ */

/* Outer wrapper: light grey page background */
.blog-post-page {
    background: var(--blog-bg);
    padding: 48px 0 100px;
    min-height: 60vh;
}

/* Two-column grid: sidebar + main */
.blog-post-layout {
    display: grid;
    grid-template-columns: var(--blog-sidebar-w) 1fr;
    gap: var(--blog-gap);
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px;
    align-items: start;
}

/* ─── LEFT SIDEBAR ───────────────────────────────────────────── */
.blog-sidebar {
    position: sticky;
    top: 100px;
    /* clears the fixed navbar */
    align-self: start;
}

.blog-sidebar-toc {
    background: var(--blog-white);
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-radius);
    padding: 24px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.blog-sidebar-toc-label {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--blog-muted);
    margin-bottom: 16px;
    display: block;
}

.blog-sidebar-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.blog-sidebar-toc li {
    margin: 0;
    padding: 0;
}

.blog-sidebar-toc a {
    display: block;
    padding: 9px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--blog-muted);
    text-decoration: none;
    border-radius: var(--blog-radius-sm);
    border-left: 3px solid transparent;
    line-height: 1.4;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.blog-sidebar-toc a:hover,
.blog-sidebar-toc a.toc-active {
    color: var(--blog-primary);
    background: rgba(30, 58, 138, 0.06);
    border-left-color: var(--blog-primary);
}

/* ─── RIGHT: MAIN ARTICLE ────────────────────────────────────── */
.blog-post-main {
    min-width: 0;
    /* prevents grid blowout */
}

/* Article card */
.blog-post-content {
    background: var(--blog-white);
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-radius);
    padding: 40px 48px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    margin: 0;
    /* remove old negative-margin pull */
    position: relative;
    z-index: 1;
}

/* Featured image (1200x630) */
.blog-featured-img {
    width: 100%;
    max-width: 1200px;
    aspect-ratio: 1200 / 630;
    object-fit: cover;
    border-radius: var(--blog-radius-sm);
    margin-bottom: 36px;
    box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.08);
    display: block;
}

/* Content Images (800x450) */
.blog-post-content img:not(.blog-featured-img):not(.blog-author-box img) {
    width: 100%;
    max-width: 800px;
    aspect-ratio: 800 / 450;
    object-fit: cover;
    border-radius: var(--blog-radius-sm);
    margin: 24px 0;
    display: block;
}

/* ─── Article typography ─────────────────────────────────────── */
.blog-post-content h2 {
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--blog-text);
    margin-top: 0;
    margin-bottom: 12px;
    line-height: 1.35;
    padding-top: 40px;
    /* scroll-offset for sticky nav */
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Numbered section badge — auto-generated via CSS counter */
.blog-post-content {
    counter-reset: section-counter;
}

.blog-post-content h2.numbered {
    counter-increment: section-counter;
}

.blog-post-content h2.numbered::before {
    content: counter(section-counter);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    background: var(--blog-primary);
    color: #fff;
    border-radius: 50%;
    font-size: 0.95rem;
    font-weight: 800;
    flex-shrink: 0;
}

/* Section divider line under h2 */
.blog-post-content h2+p,
.blog-post-content h2+ul,
.blog-post-content h2+ol {
    border-top: 1px solid var(--blog-border);
    padding-top: 20px;
    margin-top: 0;
}

.blog-post-content p {
    font-size: 1.05rem;
    color: #4b5563;
    line-height: 1.85;
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

.blog-post-content ul,
.blog-post-content ol {
    margin-bottom: 24px;
    padding-left: 0;
    list-style: none;
}

.blog-post-content li {
    font-size: 1.05rem;
    color: #4b5563;
    line-height: 1.75;
    margin-bottom: 10px;
    padding-left: 24px;
    position: relative;
}

/* Orange bullet dots */
.blog-post-content ul li::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 11px;
    width: 8px;
    height: 8px;
    background: var(--blog-accent);
    border-radius: 50%;
}

.blog-post-content ol {
    list-style: none;
    counter-reset: list-counter;
}

.blog-post-content ol li {
    counter-increment: list-counter;
}

.blog-post-content ol li::before {
    content: counter(list-counter) ".";
    position: absolute;
    left: 0;
    top: 0;
    font-weight: 700;
    color: var(--blog-primary);
    font-size: 0.95rem;
}

.blog-post-content strong {
    color: var(--blog-text);
    font-weight: 700;
}

/* Inline article links */
.blog-post-content a {
    color: var(--blog-primary);
    text-decoration: underline;
    text-decoration-color: rgba(30, 58, 138, 0.3);
    text-underline-offset: 3px;
    font-weight: 500;
    transition: text-decoration-color 0.3s ease;
}

.blog-post-content a:hover {
    text-decoration-color: var(--blog-primary);
}

/* ─── CTA Box (website-cost-india style) ─────────────────────── */
.blog-cta-box {
    margin-top: 40px;
    padding: 28px 32px;
    background: rgba(30, 58, 138, 0.05);
    border-radius: var(--blog-radius);
    text-align: center;
    border: 1px solid rgba(30, 58, 138, 0.15);
}

.blog-cta-box h3 {
    margin: 0 0 10px;
    font-size: 1.2rem;
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--blog-primary);
}

.blog-cta-box p {
    margin: 0 !important;
    font-size: 1rem !important;
    color: var(--blog-muted) !important;
}

.blog-cta-box a {
    color: var(--blog-accent) !important;
    font-weight: 700 !important;
}

/* ─── Inline TOC (hidden on desktop, shown on mobile) ───────── */
.blog-toc-inline {
    display: none;
    background: var(--blog-white);
    padding: 20px;
    border-radius: var(--blog-radius);
    margin-bottom: 28px;
    border: 1px solid var(--blog-border);
}

.blog-toc-inline .blog-toc-label {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--blog-muted);
    margin-bottom: 14px;
    display: block;
}

.blog-toc-inline ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.blog-toc-inline li {
    margin-bottom: 8px !important;
    padding: 0 !important;
}

.blog-toc-inline li::before {
    display: none !important;
}

.blog-toc-inline a {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--blog-muted);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    display: block;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.blog-toc-inline a:hover {
    color: var(--blog-primary);
    background: rgba(30, 58, 138, 0.05);
    border-left-color: var(--blog-primary);
}

/* ─── Share Buttons ──────────────────────────────────────────── */
.blog-share {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 40px;
    padding: 18px 24px;
    background: #f8fafc;
    border-radius: var(--blog-radius-sm);
    border: 1px solid var(--blog-border);
}

.blog-share span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--blog-text);
    margin-right: 4px;
    white-space: nowrap;
}

.blog-share a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--blog-white);
    border: 1px solid var(--blog-border);
    color: var(--blog-muted);
    font-size: 1rem;
    text-decoration: none !important;
    transition: background 0.3s, color 0.3s, border-color 0.3s, transform 0.3s;
    flex-shrink: 0;
}

.blog-share a:hover {
    background: var(--blog-primary);
    color: #fff;
    border-color: var(--blog-primary);
    transform: translateY(-3px);
}

/* ─── Author Box ─────────────────────────────────────────────── */
.blog-author-box {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    background: #f8fafc;
    padding: 24px;
    border-radius: var(--blog-radius);
    margin-top: 40px;
    border: 1px solid var(--blog-border);
    flex-wrap: wrap;
}

.blog-author-box img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--blog-white);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.author-info {
    flex: 1;
    min-width: 0;
}

.blog-author-box h4 {
    margin: 0 0 8px;
    font-size: 1.2rem;
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--blog-text);
}

.blog-author-box p {
    margin: 0 !important;
    font-size: 0.97rem !important;
    color: var(--blog-muted) !important;
    line-height: 1.6 !important;
}

/* ─── Related Posts ──────────────────────────────────────────── */
.blog-related-posts {
    margin-top: 32px;
}

.blog-related-posts h3 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--blog-text);
    margin-bottom: 20px;
}

.related-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.related-card {
    display: block;
    padding: 18px 22px;
    background: var(--blog-white);
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-radius-sm);
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.related-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px -4px rgba(0, 0, 0, 0.08);
    border-color: rgba(30, 58, 138, 0.3);
}

.related-card h4 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--blog-text);
    margin: 0 0 8px;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.related-card:hover h4 {
    color: var(--blog-primary);
}

.related-card span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--blog-muted);
    font-weight: 500;
}

.related-card span i {
    font-size: 0.78rem;
    color: var(--blog-primary);
}

/* ─── Hero padding for post pages ───────────────────────────── */
.pg-hero.blog-post-hero {
    padding: 120px 0 60px;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ════════════════════════════════════════════════════════════════ */

/* ── Large desktops (1280px+) ────────────────────────────────── */
@media (min-width: 1280px) {
    .blog-section {
        padding: 60px 0 100px;
    }

    .blog-index-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 32px;
        margin-top: 40px;
    }

    .blog-card-content {
        padding: 24px;
    }

    .blog-card-title {
        font-size: 1.35rem;
    }

    .blog-card-excerpt {
        font-size: 1rem;
    }

    .blog-post-content {
        padding: 40px 52px;
    }

    .blog-post-content h2 {
        font-size: 1.6rem;
    }

    .blog-post-content p,
    .blog-post-content li {
        font-size: 1.1rem;
    }

    .related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

    /* ── Tablets landscape (768px → 1279px) ─────────────────────── */
    @media (min-width: 768px) and (max-width: 1279px) {
        :root {
            --blog-sidebar-w: 220px;
            --blog-gap: 28px;
        }

        .blog-section {
            padding: 48px 0 80px;
        }

        .blog-index-grid {
            grid-template-columns: repeat(2, 1fr);
            gap: 24px;
            margin-top: 32px;
        }

        .blog-card-content {
            padding: 20px;
        }

        .blog-post-content {
            padding: 28px 32px;
        }

        .blog-post-content h2 {
            font-size: 1.4rem;
        }

        .related-grid {
            grid-template-columns: repeat(2, 1fr);
        }
    }

    /* ── Tablets portrait (481px → 767px) ───────────────────────── */
    @media (min-width: 481px) and (max-width: 767px) {
        .blog-section {
            padding: 40px 0 72px;
        }

        .blog-index-grid {
            grid-template-columns: 1fr;
            gap: 20px;
        }

        .blog-post-layout {
            grid-template-columns: 1fr;
            padding: 0 16px;
        }

        .blog-sidebar {
            display: none;
        }

        /* hidden; inline TOC takes over */
        .blog-toc-inline {
            display: block;
        }

        .pg-hero.blog-post-hero {
            padding: 100px 0 48px;
        }

        .blog-post-content {
            padding: 24px 20px;
        }

        .blog-post-content h2 {
            font-size: 1.3rem;
        }

        .blog-related-posts {
            margin-top: 24px;
        }
    }

    /* ── Small phones (≤ 480px) ──────────────────────────────────── */
    @media (max-width: 480px) {
        .blog-section {
            padding: 32px 0 60px;
        }

        .blog-index-grid {
            gap: 16px;
            margin-top: 20px;
        }

        .blog-card-img-wrapper {}

        .blog-card-content {
            padding: 16px;
        }

        .blog-card-title {
            font-size: 1.05rem;
        }

        .blog-card-excerpt {
            font-size: 0.9rem;
        }

        .blog-card-footer {
            flex-direction: column;
            align-items: flex-start;
            gap: 8px;
        }

        .blog-read-more {
            align-self: flex-end;
        }

        /* Sidebar: always hidden; inline TOC shown */
        .blog-post-layout {
            grid-template-columns: 1fr;
            padding: 0 12px;
        }

        .blog-post-page {
            padding: 24px 0 72px;
        }

        .blog-sidebar {
            display: none;
        }

        .blog-toc-inline {
            display: block;
        }

        .pg-hero.blog-post-hero {
            padding: 80px 0 40px;
        }

        .blog-post-content {
            padding: 20px 16px;
        }

        .blog-post-content h2 {
            font-size: 1.2rem;
            padding-top: 28px;
        }

        .blog-post-content p,
        .blog-post-content li {
            font-size: 0.97rem;
        }

        .blog-cta-box {
            padding: 24px 16px;
        }

        .blog-cta-box h3 {
            font-size: 1.15rem;
        }

        .blog-cta-box a {
            display: inline-block;
        }

        .blog-share {
            padding: 14px 16px;
            gap: 8px;
            justify-content: center;
        }

        .blog-share span {
            width: 100%;
            margin-bottom: 4px;
            text-align: center;
        }

        .blog-share a {
            width: 34px;
            height: 34px;
            font-size: 0.9rem;
        }

        .blog-author-box {
            flex-direction: column;
            align-items: center;
            text-align: center;
            padding: 20px 16px;
        }

        .blog-author-box img {
            width: 68px;
            height: 68px;
        }

        .blog-related-posts h3 {
            font-size: 1.2rem;
        }

        .related-card {
            padding: 14px 16px;
        }

        .related-card h4 {
            font-size: 0.95rem;
        }
    }

    /* ── Wide screens (1600px+) ──────────────────────────────────── */
    @media (min-width: 1600px) {
        :root {
            --blog-sidebar-w: 280px;
            --blog-gap: 52px;
        }

        .blog-index-grid {
            grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
            gap: 36px;
        }

        .blog-card-img-wrapper {}

        .blog-post-layout {
            max-width: 1320px;
        }
    }

    /* ─── Reduced Motion ─────────────────────────────────────────── */
    @media (prefers-reduced-motion: reduce) {

        .blog-card,
        .blog-card-img-wrapper img,
        .blog-sidebar-toc a,
        .blog-toc-inline a,
        .blog-read-more,
        .blog-read-more i,
        .blog-share a,
        .related-card {
            transition: none;
        }

        .blog-card:hover,
        .related-card:hover {
            transform: none;
        }

        .blog-card:hover .blog-card-img-wrapper img {
            transform: none;
        }

        .blog-share a:hover {
            transform: none;
        }
    }

    /* ════════════════════════════════════════════════════════════════
   READING PROGRESS BAR
   ════════════════════════════════════════════════════════════════ */

    #reading-progress {
        position: fixed;
        top: 0;
        left: 0;
        width: 0%;
        height: 4px;
        background: linear-gradient(90deg, var(--blog-primary) 0%, #3b82f6 50%, var(--blog-accent) 100%);
        z-index: 9999;
        border-radius: 0 2px 2px 0;
        transition: width 0.1s linear;
        box-shadow: 0 0 10px rgba(30, 58, 138, 0.4);
    }

    /* Glowing tip effect */
    #reading-progress::after {
        content: '';
        position: absolute;
        right: 0;
        top: -2px;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--blog-accent);
        box-shadow: 0 0 8px 2px rgba(245, 158, 11, 0.6);
    }