.blog-detail-hero {
    position: relative;
    color: #ffffff;
    padding: clamp(4rem, 10vw, 7rem) 0 clamp(3rem, 6vw, 5rem);
    /* Semi‑dark gray background */
    background: linear-gradient(135deg, #0f172a 0%, #111827 100%);
    overflow: hidden;
}

.blog-detail-hero--no-image {
    /* Neutral dark when no hero image */
    background: linear-gradient(135deg, #0f172a 0%, #111827 100%);
}

.blog-detail-hero-media {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.blog-detail-hero-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.78);
}

.blog-detail-hero-overlay {
    position: absolute;
    inset: 0;
    /* Neutral dark overlay */
    background: linear-gradient(
        180deg,
        rgba(15, 23, 42, 0.60) 0%,
        rgba(15, 23, 42, 0.78) 60%,
        rgba(2, 6, 23, 0.92) 100%
    );
    z-index: 1;
}

.blog-detail-hero--no-image .blog-detail-hero-overlay {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.14) 0%, rgba(15, 23, 42, 0.24) 100%);
}

.blog-detail-hero-inner {
    position: relative;
    z-index: 2;
    max-width: 780px;
}

.blog-detail-hero .blog-breadcrumbs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.25rem;
}

.blog-detail-hero .blog-breadcrumbs a {
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
}

.blog-detail-meta {
    display: flex;
    gap: 1.25rem;
    font-size: 0.88rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}

.blog-detail-title {
    margin: 1.75rem 0 0;
    font-size: clamp(2.6rem, 5vw, 3.6rem);
    line-height: 1.15;
}

.blog-detail-container {
    padding: clamp(3rem, 9vw, 6rem) 0;
}

.blog-detail-main {
    width: min(100%, 900px);
    margin: 0 auto;
}

.blog-detail-body {
    background: var(--blog-surface, #ffffff);
    padding: clamp(2rem, 4vw, 3rem);
    border-radius: 26px;
    box-shadow: 0 30px 60px rgba(30, 42, 82, 0.1);
    font-size: 1.05rem;
    line-height: 1.75;
    color: #2f2f3f;
}

/* Ensure media never overflows the content area */
.blog-detail-body img,
.blog-detail-body video,
.blog-detail-body iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

.blog-detail-body figure {
    margin: 2rem 0;
}

.blog-detail-body figure img {
    width: 100%;
    height: auto;
    border-radius: 16px;
}

.blog-detail-body figure figcaption {
    margin-top: .5rem;
    color: var(--blog-text-muted, #5c677d);
    font-size: .95rem;
}

/* In-article Table of Contents */
.article-toc {
    margin: 1.5rem 0 2rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(180deg, rgba(20,118,255,0.06) 0%, rgba(20,118,255,0.04) 100%);
    border: 1px solid rgba(20,118,255,0.18);
    border-radius: 14px;
}

.article-toc strong {
    display: block;
    margin-bottom: .5rem;
    color: var(--primary, #1476ff);
    font-size: .9rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.article-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem .75rem;
}

.article-toc li { position: relative; padding-left: 12px; }
.article-toc li::before {
    content: '';
    position: absolute;
    left: 0; top: 0.95em;
    width: 6px; height: 6px; border-radius: 999px; background: var(--primary, #1476ff);
}

.article-toc a {
    display: inline-block;
    color: var(--blog-text, #1b2559);
    text-decoration: none;
    border-radius: 6px;
    transition: color .2s ease, background-color .2s ease;
}

.article-toc a:hover { color: var(--primary, #1476ff); text-decoration: underline; }

@media (max-width: 640px) {
    .article-toc ul { grid-template-columns: 1fr; }
}

/* smooth anchor offset below sticky header */
.blog-detail-body h2[id],
.blog-detail-body h3[id] { scroll-margin-top: 84px; }

/* Responsive tables */
.blog-detail-body table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.blog-detail-body th,
.blog-detail-body td {
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    text-align: left;
}

.blog-detail-body th {
    background: #f8fafc;
    color: var(--blog-text, #1b2559);
    font-weight: 600;
}

@media (max-width: 640px) {
    .blog-detail-body table {
        display: block;              /* enable horizontal scroll */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .blog-detail-body thead,
    .blog-detail-body tbody,
    .blog-detail-body tr,
    .blog-detail-body th,
    .blog-detail-body td {
        white-space: nowrap;
    }
}

.blog-detail-body > *:first-child {
    margin-top: 0;
}

.blog-detail-body h2 {
    font-size: 2rem;
    margin: 3rem 0 1.25rem;
    color: var(--blog-text, #1b2559);
}

.blog-detail-body h3 {
    font-size: 1.5rem;
    margin: 2.5rem 0 1rem;
    color: var(--blog-text, #1b2559);
}

.blog-detail-body p {
    margin-bottom: 1.35rem;
}

.blog-detail-body ul,
.blog-detail-body ol {
    margin: 1.5rem 0 1.5rem 1.5rem;
}

.blog-detail-body blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    border-left: 4px solid var(--blog-accent, #3b5bdb);
    border-radius: 12px;
    background: rgba(59, 91, 219, 0.08);
    font-style: italic;
}

.blog-detail-body pre,
.blog-detail-body code {
    font-family: "Fira Code", "Source Code Pro", Menlo, Consolas, monospace;
    background: rgba(27, 37, 89, 0.06);
    border-radius: 8px;
}

.blog-detail-body pre {
    padding: 1.5rem;
    overflow-x: auto;
}

.blog-detail-footer {
    margin-top: clamp(2rem, 5vw, 3.5rem);
    display: flex;
    justify-content: flex-start;
}

.blog-detail-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 999px;
    background: rgba(59, 91, 219, 0.12);
    color: var(--blog-accent, #3b5bdb);
    font-weight: 600;
    text-decoration: none;
    transition: background 0.3s ease, color 0.3s ease;
}

.blog-detail-back:hover {
    background: rgba(59, 91, 219, 0.18);
    color: #1a33b8;
}

@media (max-width: 768px) {
    .blog-detail-title {
        font-size: 2.2rem;
    }

    .blog-detail-meta {
        flex-direction: column;
        gap: 0.75rem;
    }

    .blog-detail-body {
        padding: 1.75rem;
    }
}
