/* ═══════════════════════════════════
   PROSTABLES BLOG SINGLE
   Typographie du corps d'article + médias.

   ⚠️ Cette feuille ne contient PAS la mise en page de la page article :
   la grille, les méta, l'encadré auteur, le bloc partage et les articles
   liés sont définis dans blog.css, déclarée en dépendance de ce fichier
   (cf. prostables.php → wp_register_style('prostables-blog-single')).
   Elle s'occupe uniquement d'habiller ce que l'éditeur WordPress produit
   dans .article-body (titres, listes, images, tableaux, citations…), que
   le reset global de base.css laisse sinon complètement nu.
   ═══════════════════════════════════ */

/* Barre de progression de lecture (remplie par blog-single.js) */
.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: var(--color-accent);
    z-index: 10001;
    transition: width 0.1s ease-out;
}

/* base.css impose min-height: 73vh à .entry-content (utile pour les pages
   de thème, néfaste ici : ça creuse un trou sous les articles courts). */
.article-body.entry-content {
    min-height: 0;
}

/* ═══ CORPS D'ARTICLE : TITRES ═══ */
.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
    color: var(--color-primary);
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
    /* Un lien d'ancre ne doit pas amener le titre sous la navbar fixe. */
    scroll-margin-top: 160px;
}

.article-body h2 {
    font-size: clamp(1.6rem, 2.4vw, 2.1rem);
    margin: 60px 0 22px;
}

.article-body h3 {
    font-size: clamp(1.3rem, 1.8vw, 1.6rem);
    margin: 45px 0 18px;
}

.article-body h4 {
    font-size: 1.2rem;
    margin: 35px 0 14px;
}

.article-body h5,
.article-body h6 {
    font-size: 1.05rem;
    margin: 30px 0 12px;
}

/* Premier élément du corps d'article : pas de marge haute superflue sous le titre. */
.article-body> *:first-child {
    margin-top: 0;
}

/* ═══ CORPS D'ARTICLE : TEXTE ═══ */
.article-body p {
    margin-bottom: 28px;
}

.article-body p:last-child {
    margin-bottom: 0;
}

.article-body strong,
.article-body b {
    color: var(--color-primary);
    font-weight: 700;
}

.article-body a {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--color-accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    transition: color 0.3s ease, background 0.3s ease;
}

.article-body a:hover {
    color: var(--color-accent);
}

/* ═══ CORPS D'ARTICLE : LISTES ═══
   `* { padding: 0 }` de base.css supprime le retrait ET les puces des
   listes du contenu : on les rétablit ici. */
.article-body ul,
.article-body ol {
    margin: 0 0 28px;
    padding-left: 1.4em;
}

.article-body ul {
    list-style: disc;
}

.article-body ol {
    list-style: decimal;
}

.article-body ul ul,
.article-body ol ol,
.article-body ul ol,
.article-body ol ul {
    margin: 12px 0 0;
}

.article-body ul ul {
    list-style: circle;
}

.article-body li {
    margin-bottom: 12px;
    padding-left: 4px;
}

.article-body li::marker {
    color: var(--color-accent);
    font-weight: 700;
}

.article-body li>p {
    margin-bottom: 12px;
}

/* ═══ CORPS D'ARTICLE : IMAGES & MÉDIAS ═══
   Couvre les images insérées via l'éditeur (bloc Image, bloc Galerie,
   ancien éditeur classique) et les vidéos / embeds. */
.article-body img,
.article-body video,
.article-body iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

.article-body img,
.article-body video {
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(14, 3, 56, 0.12);
}

.article-body figure,
.article-body .wp-block-image,
.article-body .wp-block-video,
.article-body .wp-block-embed {
    margin: 45px 0;
}

.article-body figure img {
    margin: 0 auto;
}

.article-body figcaption,
.article-body .wp-caption-text {
    margin-top: 14px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: rgba(14, 3, 56, 0.55);
    text-align: center;
    font-style: italic;
}

/* Images en pleine largeur de colonne, légèrement débordantes (effet premium) */
.article-body .alignwide,
.article-body .alignfull {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.article-body .aligncenter {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.article-body .alignleft {
    float: left;
    margin: 10px 35px 25px 0;
    max-width: 45%;
}

.article-body .alignright {
    float: right;
    margin: 10px 0 25px 35px;
    max-width: 45%;
}

/* Galeries */
.article-body .wp-block-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.article-body .wp-block-gallery figure {
    margin: 0;
}

.article-body .wp-block-gallery img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    border-radius: 18px;
}

/* Embeds responsives (YouTube, Vimeo…) */
.article-body .wp-block-embed__wrapper {
    position: relative;
}

.article-body .wp-block-embed iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border: 0;
    border-radius: 24px;
}

/* ═══ CORPS D'ARTICLE : DIVERS ═══ */
.article-body hr,
.article-body .wp-block-separator {
    border: none;
    height: 1px;
    background: rgba(14, 3, 56, 0.12);
    margin: 55px 0;
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 40px 0;
    font-size: 1rem;
    background: white;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(14, 3, 56, 0.06);
}

.article-body th,
.article-body td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid rgba(14, 3, 56, 0.08);
}

.article-body th {
    background: var(--color-primary);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Un tableau large ne doit jamais élargir la page : il défile seul. */
.article-body .wp-block-table {
    overflow-x: auto;
    margin: 40px 0;
}

.article-body .wp-block-table table {
    margin: 0;
}

.article-body code {
    background: rgba(14, 3, 56, 0.06);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.9em;
}

.article-body pre {
    background: var(--color-primary);
    color: white;
    padding: 25px 30px;
    border-radius: 18px;
    overflow-x: auto;
    margin: 35px 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.article-body pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Boutons Gutenberg alignés sur le design system */
.article-body .wp-block-button__link {
    display: inline-flex;
    align-items: center;
    padding: 16px 40px;
    border-radius: 100px;
    background: var(--color-primary);
    color: white;
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--btn-shadow);
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.article-body .wp-block-button__link:hover {
    background: var(--color-accent);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px var(--color-accent-glow);
}

/* ═══ COLONNE MÉDIA : ARTICLE SANS IMAGE À LA UNE ═══
   Sans photo, la colonne de droite ne contiendrait que le bloc partage et
   laisserait un grand vide à côté du texte : on repasse alors en 1 colonne. */
.content-intro-grid.no-featured {
    grid-template-columns: 1fr;
    gap: 40px;
}

.content-intro-grid.no-featured .article-featured-column {
    position: static;
}

.content-intro-grid.no-featured .share-block {
    max-width: 480px;
    margin-top: 0;
}

/* Légende de l'image à la une.
   Marge haute négative : elle se fond dans les 30px de marge basse de l'image
   (marges adjacentes fusionnées → ~12px d'écart réel). */
.article-featured-caption {
    display: block;
    margin: -18px 0 40px;
    font-size: 0.85rem;
    line-height: 1.5;
    font-style: italic;
    color: rgba(14, 3, 56, 0.55);
    text-align: center;
}

/* ═══ ARTICLES LIÉS ═══
   blog.css ne donne à cette section qu'une marge basse : sur une page article,
   son titre se collait donc au bord supérieur du bloc sombre. */
.blog-related-section {
    padding-top: 100px;
}

/* ═══ APPARITIONS AU DÉFILEMENT ═══
   Le masquage n'est appliqué QUE si le JS a pris la main (classe posée sur
   <html> par blog-single.js) : si le script échoue, le contenu reste visible. */
html.ps-reveal-ready .blog-single-content-section [data-reveal],
html.ps-reveal-ready .blog-related-section [data-reveal] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.9s cubic-bezier(0.23, 1, 0.32, 1),
        transform 0.9s cubic-bezier(0.23, 1, 0.32, 1);
}

html.ps-reveal-ready .blog-single-content-section [data-reveal].visible,
html.ps-reveal-ready .blog-related-section [data-reveal].visible {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {

    html.ps-reveal-ready .blog-single-content-section [data-reveal],
    html.ps-reveal-ready .blog-related-section [data-reveal] {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1100px) {

    /* La colonne média cesse d'être collante dès que la grille passe en 1 colonne
       (bascule définie dans blog.css). */
    .article-featured-column {
        position: static;
    }
}

@media (max-width: 768px) {

    .blog-single-content-container,
    .blog-related-container {
        padding: 0 20px;
    }

    .blog-single-content-section {
        padding-bottom: 70px;
    }

    .blog-related-section {
        padding: 60px 0 60px;
    }

    /* Le filigrane décoratif « PREMIUM » déborde et brouille le texte sur mobile. */
    .blog-single-content-section::before {
        display: none;
    }

    .article-body {
        font-size: 1.05rem;
        line-height: 1.8;
    }

    .article-body h2 {
        margin: 45px 0 18px;
    }

    .article-body img,
    .article-body video {
        border-radius: 18px;
        box-shadow: 0 20px 40px rgba(14, 3, 56, 0.12);
    }

    /* Les flottants sont ingérables sur petit écran : on repasse en pleine largeur. */
    .article-body .alignleft,
    .article-body .alignright {
        float: none;
        max-width: 100%;
        margin: 30px auto;
    }

    .article-featured-image {
        border-radius: 24px;
    }

    .share-block {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .related-title {
        font-size: 2rem;
    }
}
