/* ─────────────────────────────────────────────────────────────────────────────
   1. VARIABLES LOCALES
   ───────────────────────────────────────────────────────────────────────────── */

:root {
    --article-width: 68ch;
    /* Largeur colonne texte — optimale pour la lecture */
    --article-sidebar: 18rem;
    /* Largeur de la table des matières */
    --article-gap: 4rem;
    /* Espace entre contenu et sidebar */
    --article-margin-v: 5rem;
    /* Marge verticale article */
}

body {
    overflow: visible !important;
}


/* ─────────────────────────────────────────────────────────────────────────────
   2. HEADER ARTICLE
   ───────────────────────────────────────────────────────────────────────────── */

header {
    padding: 2.5rem 0 0;
    position: relative;
}

.header--content {
    margin: 10rem auto 0;
    width: calc(var(--article-width) + var(--article-sidebar) + var(--article-gap));
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding-bottom: 3rem;
}

.hero-eyebrow {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.meta-info {
    color: var(--color-text-disabled);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

.meta-info svg {
    width: 1rem;
    height: 1rem;
    opacity: .6;
}

.author {text-decoration: underline; border: 1px solid var(--color-border); padding: .2rem .8rem .2rem .2rem; border-radius: 200rem;}
.author:hover {color: var(--color-text-default);}
.author img {width: 2cap; border-radius: 50%; margin-right: .2rem;}


/* ─────────────────────────────────────────────────────────────────────────────
   3. IMAGE HERO
   ───────────────────────────────────────────────────────────────────────────── */

.article-hero-img {
    display: block;
    width: calc(var(--article-width) + var(--article-sidebar) + var(--article-gap));
    margin: 0 auto 0;
    aspect-ratio: 16 / 9;
    height: auto;
    object-fit: cover;
    border-radius: 1.25rem;
}


/* ─────────────────────────────────────────────────────────────────────────────
   4. LAYOUT PRINCIPAL
   ───────────────────────────────────────────────────────────────────────────── */

main {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Wrapper qui contient à la fois l'article et la sidebar */
.article-layout {
    display: flex;
    align-items: flex-start;
    gap: var(--article-gap);
    width: calc(var(--article-width) + var(--article-sidebar) + var(--article-gap));
    margin: var(--article-margin-v) auto calc(var(--article-margin-v) * 1.6);
}

/* Colonne principale — le texte */
.article--content {
    flex: 0 0 var(--article-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Colonne latérale — table des matières */
.article-sidebar {
    flex: 0 0 var(--article-sidebar);
    position: sticky;
    top: 12rem;
    align-self: flex-start;

    max-height: calc(100vh - 9rem);
    overflow-y: auto;
    scrollbar-width: none;
}

.article-sidebar::-webkit-scrollbar {
    display: none;
}


/* ─────────────────────────────────────────────────────────────────────────────
   5. TYPOGRAPHIE ARTICLE
   ───────────────────────────────────────────────────────────────────────────── */

/* Lead / intro */
.article--content .lead {
    font-size: var(--text-lg);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
    margin-bottom: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--color-border);
}

/* H2 — titre de section principale */
.article--content h2 {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-text-default);
    line-height: var(--leading-tight);
    letter-spacing: -.02em;
    margin-top: 4rem;
    margin-bottom: 1rem;
}

/* H3 — sous-section */
.article--content h3 {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text-default);
    line-height: var(--leading-normal);
    margin-top: 3rem;
    margin-bottom: .75rem;
}

/* H4 — point précis */
.article--content h4 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--color-text-default);
    line-height: var(--leading-normal);
    margin-top: 2rem;
    margin-bottom: .5rem;
}

.article--content p {
    font-size: var(--text-md);
    font-weight: 400;
    color: var(--color-text-default);
    line-height: var(--leading-relaxed);
    margin-top: 1rem;
}

/* Lien dans l'article */
.article--content a {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: opacity .2s ease;
}

.article--content a:hover {
    opacity: .65;
}

.article--content b,
.article--content strong {
    font-weight: 700;
}

.article--content em {
    font-style: italic;
}

/* Listes */
.article--content ul,
.article--content ol {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin: 1.25rem 0 1.25rem 1.5rem;
}

.article--content ul {
    list-style: disc outside;
}

.article--content ol {
    list-style: decimal outside;
}

.article--content li {
    font-size: var(--text-md);
    font-weight: 400;
    color: var(--color-text-default);
    line-height: var(--leading-relaxed);
    padding-left: .25rem;
}

/* Séparateur de section */
.article--content hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 3.5rem 0;
}

/* Images dans l'article */
.article--content img {
    width: 100%;
    height: auto;
    border-radius: 1rem;
    margin-top: 2rem;
    display: block;
}

.article--content figure {
    margin: 2rem 0 0;
}

.article--content figcaption {
    font-size: var(--text-sm);
    color: var(--color-text-disabled);
    margin-top: .5rem;
    text-align: center;
    line-height: var(--leading-relaxed);
}


/* ─────────────────────────────────────────────────────────────────────────────
   6. BLOCS SPÉCIAUX
   ───────────────────────────────────────────────────────────────────────────── */

/* — Astuce / Note ——————————————————————————————————————————————————————————— */
.article--content .astuce {
    font-size: var(--text-sm);
    padding: 1.25rem 1.5rem;
    border-radius: 0 1rem 1rem 0;
    background-color: var(--color-accent-light);
    color: var(--color-text-default);
    margin-top: 1.75rem;
    line-height: var(--leading-relaxed);
    border-left: 3px solid var(--color-accent);
}

/* — Blockquote ———————————————————————————————————————————————————————————— */
.article--content blockquote {
    margin: 2.5rem 0;
    padding: 1.5rem 2rem;
    border-left: 3px solid var(--color-text-default);
    background-color: var(--color-bg-subtle);
    border-radius: 0 1rem 1rem 0;
}

.article--content blockquote p {
    font-size: var(--text-lg);
    font-weight: 500;
    font-style: italic;
    color: var(--color-text-default);
    line-height: var(--leading-relaxed);
    margin: 0;
}

.article--content blockquote cite {
    display: block;
    margin-top: .75rem;
    font-size: var(--text-sm);
    color: var(--color-text-disabled);
    font-style: normal;
}

/* — Pull quote (grande citation mise en valeur) ——————————————————————————— */
.article--content .pull-quote {
    margin: 3rem 0;
    padding: 2rem 3rem;
    background-color: var(--color-success-light);
    border-left: 2px solid var(--color-success);
    text-align: center;
    border-radius: 0 1rem 1rem 0;
}

.article--content .pull-quote p {
    font-size: var(--text-xl);
    font-weight: 700;
    line-height: var(--leading-tight);
    letter-spacing: -.02em;
    color: var(--color-text-default);
    margin: 0;
}

/* — Embed vidéo (responsive 16:9) ———————————————————————————————————————— */
.article--content .video-embed {
    margin-top: 2.5rem;
    border-radius: 1rem;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background-color: var(--color-bg-subtle);
}

.article--content .video-embed iframe,
.article--content .video-embed video {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}


/* ─────────────────────────────────────────────────────────────────────────────
   7. TABLE DES MATIÈRES (sidebar)
   ───────────────────────────────────────────────────────────────────────────── */

.toc {
    all: unset;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.toc-label {
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--color-text-disabled);
    margin-bottom: 1rem;
}

.toc ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-left: 1px solid var(--color-border);
}

.toc li a {
    display: block;
    padding: .4rem 0 .4rem 1rem;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    text-decoration: none;
    line-height: var(--leading-normal);
    border-left: 2px solid transparent;
    margin-left: -1px;
    transition: color .2s ease, border-color .2s ease;
}

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

/* Lien actif (scroll spy via JS) */
.toc li a.active {
    color: var(--color-accent);
    border-left-color: var(--color-accent);
    font-weight: 500;
}

/* Sous-entrées h3 dans la TOC */
.toc li.toc-h3 a {
    padding-left: 1.75rem;
    font-size: var(--text-sm);
    opacity: .8;
}

/* Partage (sous la TOC) */
.toc-share {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.toc-share-label {
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--color-text-disabled);
}

.toc-share-btns {
    display: flex;
    gap: .5rem;
}

.share-btn {
    all: unset;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: .625rem;
    border: 1px solid var(--color-border);
    background-color: var(--color-bg-subtle);
    color: var(--color-text-secondary);
    transition: background-color .18s ease, color .18s ease;
}

.share-btn:hover {
    background-color: var(--color-accent);
    color: var(--color-bg-page, #fff);
    box-shadow: none;
    border: 1px solid var(--color-border);
    transform: none;
    scale: 1;
    rotate: 0;
}

.share-btn svg {
    width: 1.2rem;
    height: 1.2rem;
}

.share-btn:hover svg {
    scale: 1;
    translate: 0;
}


/* ─────────────────────────────────────────────────────────────────────────────
   8. BARRE DE PROGRESSION LECTURE
   ───────────────────────────────────────────────────────────────────────────── */

.reading-progress {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 6px;
    background-color: var(--color-accent);
    z-index: 9999;
    transition: width .1s linear;
}


/* ─────────────────────────────────────────────────────────────────────────────
   9. CTA INTERMÉDIAIRE INLINE
   ───────────────────────────────────────────────────────────────────────────── */

/* À placer dans le corps de l'article pour interrompre la lecture au bon moment */
.article--content .cta-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    margin: 3rem 0;
    padding: 1.75rem 2rem;
    border-radius: 1.25rem;
    background-color: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
}

.cta-inline-text p {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--color-text-default);
    margin: 0;
    line-height: var(--leading-normal);
}

.cta-inline-text span {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    font-family: var(--font-sans);
    font-weight: 400;
    display: block;
    margin-top: .2rem;
}

.cta-inline .btn--primary {
    white-space: nowrap;
    flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────────────────
   11. CTA DE FIN D'ARTICLE
   ───────────────────────────────────────────────────────────────────────────── */

.article-cta-end {
    width: calc(var(--article-width) + var(--article-sidebar) + var(--article-gap));
    margin: 0 auto 8rem;
    padding: 3rem;
    border-radius: 1.5rem;
    background-color: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.article-cta-end h3 {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text-default);
    line-height: var(--leading-tight);
    letter-spacing: -.02em;
    margin: 0;
}

.article-cta-end p {
    font-size: var(--text-md);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
    margin: 0;
}

.article-cta-end-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}


/* ─────────────────────────────────────────────────────────────────────────────
   12. RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────── */

/* Tablette — sidebar disparaît, contenu pleine largeur */
@media (max-width: 1100px) {
    :root {
        --article-width: 100%;
        --article-sidebar: 0rem;
        --article-gap: 0rem;
    }

    .article-layout {
        width: var(--article-width);
    }

    .article-sidebar {
        display: none;
    }
}

/* Mobile large */
@media (max-width: 900px) {
    .header--content {
        width: calc(100% - 4rem);
        margin-left: 2rem;
        margin-right: 2rem;
    }

    .header--content h1 {
        font-size: var(--text-2xl);
    }

    .article-layout {
        width: calc(100% - 4rem);
    }

    .article-hero-img {
        width: calc(100% - 4rem);
        border-radius: 1rem;
    }

    .article--content .pull-quote {
        margin: 2.5rem 0;
    }

    .related-articles {
        width: calc(100% - 4rem);
    }

    .article-cta-end {
        width: calc(100% - 4rem);
        padding: 2rem;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .header--content {
        width: 100%;
    }

    .header--content h1 {
        font-size: var(--text-xl);
    }

    .hero-eyebrow {
    flex-direction: column;
    align-items: start;
    }

    .article-layout {
        width: 100%;
        margin-top: 3rem;
    }

    .article-hero-img {
        width: 100%;
        border-radius: 0;
    }

    .related-articles {
        width: calc(100% - 3rem);
    }

    .related-grid {
        grid-template-columns: 1fr;
    }

    .article-cta-end {
        width: calc(100% - 3rem);
        margin-bottom: 5rem;
        padding: 1.5rem;
    }

    .article--content .cta-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
    }
}