/* ==============================
   blog-detail.css — préfixe .bd-
   ============================== */

/* ── Page ── */
.bd-page {
    padding: 60px 0 100px;
    min-height: 100vh;
}

/* ── Animations ── */
.bd-lazy {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity .6s ease, transform .6s ease;
}
.bd-lazy.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Hero ── */
.bd-hero {
    position: relative;
    border-radius: 1.5rem;
    overflow: clip;
    height: clamp(380px, 52vw, 560px);
    border: 1px solid rgba(99,102,241,.18);
    margin-bottom: 3rem;
}
.bd-hero-img-wrap {
    position: absolute;
    inset: 0;
    z-index: 0;
}
.bd-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}
.bd-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(8,5,20,.96) 0%,
        rgba(8,5,20,.55) 45%,
        rgba(8,5,20,.1) 100%
    );
}
.bd-hero-body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2.75rem 3rem;
    z-index: 2;
}

/* ── Badge catégorie ── */
.bd-cat-badge {
    display: inline-flex;
    align-self: flex-start;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #a78bfa;
    background: rgba(167,139,250,.18);
    border: 1px solid rgba(167,139,250,.3);
    border-radius: 50px;
    padding: .22rem .75rem;
    margin-bottom: 1rem;
}

/* ── H1 dans le hero ── */
.bd-hero-title {
    font-size: clamp(1.6rem, 3.5vw, 2.6rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
    margin-bottom: 1.1rem;
    max-width: 820px;
    text-shadow: 0 2px 16px rgba(0,0,0,.5);
}

/* ── Méta date / temps / modif ── */
.bd-hero-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.25rem;
}
.bd-meta-item {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .82rem;
    color: rgba(255,255,255,.55);
    font-weight: 500;
}
.bd-meta-item i { color: #6366f1; }
.bd-meta-sep {
    width: 1px;
    height: 14px;
    background: rgba(255,255,255,.18);
}

/* ── Partage + like ── */
.bd-hero-actions {
    display: flex;
    align-items: center;
    gap: .65rem;
    flex-wrap: wrap;
}
.bd-share-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(99,102,241,.3);
    background: rgba(99,102,241,.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a78bfa;
    font-size: .95rem;
    text-decoration: none;
    transition: background .25s, border-color .25s;
}
.bd-share-btn:hover {
    background: rgba(99,102,241,.25);
    border-color: rgba(99,102,241,.5);
    color: #fff;
}
.bd-like-btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .82rem;
    font-weight: 700;
    color: #6366f1;
    border: 1px solid rgba(99,102,241,.3);
    background: rgba(99,102,241,.1);
    border-radius: 50px;
    padding: .4rem 1.1rem;
    cursor: pointer;
    transition: background .25s, border-color .25s;
    margin-left: .5rem;
}
.bd-like-btn:hover {
    background: rgba(99,102,241,.22);
    border-color: rgba(99,102,241,.5);
    color: #818cf8;
}

/* ── Layout corps : contenu + sidebar ── */
.bd-body {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
    align-items: start;
    margin-bottom: 4rem;
}

/* ── Contenu article ── */
.bd-preview {
    font-size: 1.05rem;
    line-height: 1.85;
    font-weight: 600;
    color: whitesmoke;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(99,102,241,.1);
    white-space: pre-wrap;
}
.bd-paragraphs {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.bd-paragraph {
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(99,102,241,.07);
}
.bd-paragraph:last-child {
    border-bottom: none;
}
.bd-h2 {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: .85rem;
    color: #a78bfa;
}
.bd-h2-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    border-radius: .5rem;
    background: rgba(99,102,241,.12);
    border: 1px solid rgba(99,102,241,.22);
    color: #6366f1;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .04em;
    flex-shrink: 0;
}
.bd-p {
    font-size: .97rem;
    line-height: 1.85;
    opacity: .78;
}
[data-bs-theme="dark"] .bd-p { color: whitesmoke; }
[data-bs-theme="light"] .bd-p { color: rgba(0,0,0,.75); }

/* ── Tags ── */
.bd-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(99,102,241,.1);
}
.bd-tags-label {
    font-size: .78rem;
    font-weight: 700;
    opacity: .45;
    margin-right: .25rem;
}
.bd-tag {
    font-size: .72rem;
    font-weight: 600;
    padding: .22rem .75rem;
    border-radius: 50px;
    background: rgba(99,102,241,.1);
    color: #818cf8;
    border: 1px solid rgba(99,102,241,.2);
    text-decoration: none;
    transition: background .2s, border-color .2s;
}
.bd-tag:hover {
    background: rgba(99,102,241,.2);
    border-color: rgba(99,102,241,.4);
    color: #a78bfa;
}
.bd-tags-empty { font-size: .82rem; opacity: .4; }

/* ── Sidebar ── */
.bd-sidebar {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.bd-sb-block {
    border-radius: 1rem;
    padding: 1.25rem;
    border: 1px solid rgba(99,102,241,.12);
}
[data-bs-theme="dark"] .bd-sb-block { background: rgba(255,255,255,.03); }
[data-bs-theme="light"] .bd-sb-block { background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.05); }
.bd-sb-title {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    opacity: .45;
    margin-bottom: .85rem;
}

/* ── Sommaire ── */
.bd-toc {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}
.bd-toc-item {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    font-size: .82rem;
    line-height: 1.45;
    color: inherit;
    opacity: .55;
    text-decoration: none;
    padding: .4rem .6rem;
    border-radius: .5rem;
    border-left: 2px solid transparent;
    transition: opacity .2s, border-color .2s, background .2s;
}
.bd-toc-item:hover {
    opacity: .9;
    background: rgba(99,102,241,.05);
}
.bd-toc-item.active {
    opacity: 1;
    border-left-color: #6366f1;
    color: #a78bfa;
    background: rgba(99,102,241,.06);
}
.bd-toc-num {
    font-size: .68rem;
    font-weight: 800;
    color: #6366f1;
    flex-shrink: 0;
    margin-top: .1rem;
}

/* ── CTA sidebar ── */
.bd-sb-cta {
    border-radius: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(99,102,241,.12) 0%, rgba(99,102,241,.04) 100%);
    border: 1px solid rgba(99,102,241,.22);
}
.bd-sb-cta-title {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: .6rem;
}
[data-bs-theme="dark"] .bd-sb-cta-title { color: #fff; }
[data-bs-theme="light"] .bd-sb-cta-title { color: #0a0819; }
.bd-sb-cta-sub {
    font-size: .85rem;
    opacity: .65;
    line-height: 1.6;
    margin-bottom: 1.1rem;
}
.bd-sb-cta-btn {
    display: block;
    text-align: center;
    font-size: .88rem;
    font-weight: 700;
    color: #fff;
    background: #6366f1;
    border-radius: .6rem;
    padding: .65rem 1rem;
    text-decoration: none;
    transition: background .25s;
}
.bd-sb-cta-btn:hover {
    background: #4f46e5;
    color: #fff;
}

/* ── Articles liés ── */
.bd-related {
    padding-top: 3rem;
    border-top: 1px solid rgba(99,102,241,.1);
}
.bd-related-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
}
.bd-related-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0;
}
[data-bs-theme="dark"] .bd-related-title { color: #fff; }
[data-bs-theme="light"] .bd-related-title { color: #0a0819; }
.bd-related-all {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .88rem;
    font-weight: 700;
    color: #6366f1;
    text-decoration: none;
    transition: gap .2s;
}
.bd-related-all:hover { gap: .7rem; color: #6366f1; }
.bd-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}
.bd-related-card {
    display: flex;
    flex-direction: column;
    border-radius: 1rem;
    overflow: clip;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(99,102,241,.12);
    transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
}
.bd-related-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 50px rgba(99,102,241,.15);
    border-color: rgba(99,102,241,.3);
    color: inherit;
}
[data-bs-theme="dark"] .bd-related-card { background: rgba(255,255,255,.03); }
[data-bs-theme="light"] .bd-related-card { background: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.bd-related-img-wrap {
    width: 100%;
    height: 230px;
    overflow: hidden;
    flex-shrink: 0;
}
.bd-related-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform .4s ease;
}
.bd-related-card:hover .bd-related-img { transform: scale(1.05); }
.bd-related-body { padding: 1.1rem; }
.bd-related-cat {
    display: inline-block;
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: #a78bfa;
    background: rgba(167,139,250,.12);
    border: 1px solid rgba(167,139,250,.25);
    border-radius: 50px;
    padding: .18rem .6rem;
    margin-bottom: .55rem;
}
.bd-related-card-title {
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: .5rem;
}
[data-bs-theme="dark"] .bd-related-card-title { color: #fff; }
[data-bs-theme="light"] .bd-related-card-title { color: #0a0819; }
.bd-related-meta {
    font-size: .78rem;
    opacity: .45;
    font-weight: 500;
}

/* ── Light mode ── */
[data-bs-theme="light"] .bd-page { background-color: #f5f5ff; }
[data-bs-theme="light"] .bd-hero { border-color: rgba(99,102,241,.2); }
[data-bs-theme="light"] .bd-preview { color: #0a0819; }
[data-bs-theme="light"] .bd-h2 { color: #5b21b6; }
[data-bs-theme="light"] .bd-h2-num { background: rgba(99,102,241,.08); color: #6366f1; }
[data-bs-theme="light"] .bd-paragraph { border-bottom-color: rgba(99,102,241,.1); }
[data-bs-theme="light"] .bd-tags { border-top-color: rgba(99,102,241,.12); }
[data-bs-theme="light"] .bd-sb-block { border-color: rgba(99,102,241,.12); }
[data-bs-theme="light"] .bd-sb-cta { background: linear-gradient(135deg, rgba(99,102,241,.08) 0%, rgba(99,102,241,.02) 100%); border-color: rgba(99,102,241,.18); }
[data-bs-theme="light"] .bd-related { border-top-color: rgba(99,102,241,.12); }
[data-bs-theme="light"] .bd-toc-item { color: rgba(0,0,0,.65); }
[data-bs-theme="light"] .bd-toc-item.active { color: #6366f1; }

/* ── Responsive ── */
@media (max-width: 991px) {
    .bd-body {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .bd-sidebar {
        position: relative;
        top: 0;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .bd-sb-block { flex: 1; min-width: 260px; }
    .bd-sb-cta { flex: 1; min-width: 260px; }
    .bd-related-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 767px) {
    .bd-page { padding: 50px 0 80px; }
    .bd-hero { height: clamp(300px, 70vw, 420px); border-radius: 1rem; }
    .bd-hero-body { padding: 1.5rem; }
    .bd-hero-title { font-size: clamp(1.3rem, 5vw, 1.8rem); }
    .bd-meta-sep { display: none; }
    .bd-hero-meta { gap: .5rem; }
    .bd-sidebar { flex-direction: column; }
    .bd-related-grid { grid-template-columns: 1fr; }
    .bd-related-img-wrap { height: 200px; }
    .bd-preview {
    font-size: .88rem;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
   }
    .bd-body {
        overflow: hidden;
    }
    .bd-content {
        min-width: 0;
        max-width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bd-lazy { opacity: 1; transform: none; transition: none; }
    .bd-related-card:hover { transform: none; }
    .bd-related-card:hover .bd-related-img { transform: none; }
}