/* ==========================================================================
   WEBIWEB — Feuille de style dédiée aux articles de blog
   ==========================================================================
   À enqueuer uniquement sur les pages single-post via functions.php :

   function webi_enqueue_blog_css() {
       if ( is_single() && get_post_type() === 'post' ) {
           wp_enqueue_style(
               'webi-blog',
               get_stylesheet_directory_uri() . '/webi-blog.css',
               array('webi-main'),
               filemtime( get_stylesheet_directory() . '/webi-blog.css' )
           );
       }
   }
   add_action( 'wp_enqueue_scripts', 'webi_enqueue_blog_css' );

   Toutes les couleurs viennent des variables --bb-* définies dans le brand book.
   Aucune valeur en dur, tout est RGB triplet pour permettre l'alpha via rgba().
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Conteneur principal : .article
   Ajouter cette classe au Groupe qui enveloppe TOUT l'article
   -------------------------------------------------------------------------- */

.article {
    max-width: 720px;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
    color: rgb(var(--bb-text));
    font-family: var(--font-body, "Inter", system-ui, sans-serif);
    line-height: 1.7;
}

/* --------------------------------------------------------------------------
   2. Hiérarchie des titres — écarts volontairement marqués
   -------------------------------------------------------------------------- */

.article h1,
.article .article__titre {
    font-family: var(--font-heading, "Inter", system-ui, sans-serif);
    font-size: clamp(2rem, 4.5vw, 3rem);
    font-weight: 800;
    line-height: 1.15;
    color: rgb(var(--bb-bleu-nuit));
    margin: 0 0 1.25rem;
    letter-spacing: -0.02em;
}

.article h2 {
    font-family: var(--font-heading, "Inter", system-ui, sans-serif);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    line-height: 1.25;
    color: rgb(var(--bb-bleu-nuit));
    margin: 3.5rem 0 1.25rem;
    letter-spacing: -0.015em;
}

/* Accent jaune signal en amorce des H2 pour rythmer visuellement */
.article h2::before {
    content: "";
    display: block;
    width: 48px;
    height: 4px;
    background: rgb(var(--bb-jaune-signal));
    margin-bottom: 1rem;
    border-radius: 2px;
}

.article h3 {
    font-family: var(--font-heading, "Inter", system-ui, sans-serif);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.35;
    color: rgb(var(--bb-bleu-nuit));
    margin: 2.5rem 0 1rem;
}

.article h4 {
    font-size: 1.05rem;
    font-weight: 600;
    color: rgb(var(--bb-bleu-nuit));
    margin: 2rem 0 0.75rem;
}

/* --------------------------------------------------------------------------
   3. Meta info sous le titre : auteur, date, temps de lecture
   Classe à appliquer sur un bloc Paragraphe : article__meta
   NB : préfixé par .article pour gagner en spécificité contre .article p
   -------------------------------------------------------------------------- */

.article .article__meta,
.article__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    color: rgba(var(--bb-text), 0.6);
    font-size: 0.95rem;
    margin: 0 0 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(var(--bb-bleu-nuit), 0.12);
}

.article__meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* --------------------------------------------------------------------------
   4. Chapô : premier paragraphe d'intro, différencié visuellement
   Classe à appliquer sur le paragraphe d'intro : article__chapo
   Contraste avec les paragraphes : +5px de taille, weight 500, line-height
   plus tendu, letter-spacing serré. Aucun changement de couleur ou de fond.
   -------------------------------------------------------------------------- */

.article .article__chapo,
p.article__chapo {
    font-size: 1.375rem;
    line-height: 1.5;
    color: rgb(var(--bb-bleu-nuit));
    font-weight: 500;
    letter-spacing: -0.01em;
    margin: 0 0 2.5rem;
}

@media (max-width: 640px) {
    .article .article__chapo,
    p.article__chapo {
        font-size: 1.2rem;
        line-height: 1.55;
    }
}

/* --------------------------------------------------------------------------
   5. Paragraphes et listes standards
   -------------------------------------------------------------------------- */

.article p {
    margin: 0 0 1.25rem;
    font-size: 1.0625rem;
    line-height: 1.75;
}

.article ul,
.article ol {
    margin: 0 0 1.5rem;
    padding-left: 1.5rem;
}

.article li {
    margin-bottom: 0.5rem;
    line-height: 1.65;
}

.article strong {
    color: rgb(var(--bb-bleu-nuit));
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   6. Liens dans le corps — surlignage jaune signal en sous-ligne
   -------------------------------------------------------------------------- */

.article a:not(.btn):not(.article__cta a) {
    color: rgb(var(--bb-bleu-nuit));
    text-decoration: underline;
    text-decoration-color: rgb(var(--bb-jaune-signal));
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    transition: text-decoration-color 0.15s ease;
}

.article a:not(.btn):hover {
    text-decoration-color: rgb(var(--bb-bleu-nuit));
}

/* --------------------------------------------------------------------------
   7. Encart callout (mise en valeur d'une phrase clé)
   Classe à appliquer sur un bloc Groupe : article__callout
   -------------------------------------------------------------------------- */

.article__callout {
    background: rgba(var(--bb-jaune-signal), 0.12);
    border-left: 4px solid rgb(var(--bb-jaune-signal));
    padding: 1.5rem 1.75rem;
    margin: 2.5rem 0;
    border-radius: 4px;
}

.article__callout p {
    margin-bottom: 0.75rem;
    font-size: 1.05rem;
}

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

.article__callout strong {
    display: block;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    color: rgb(var(--bb-bleu-nuit));
}

/* --------------------------------------------------------------------------
   8. Blockquote — citation ou témoignage
   Bloc Citation natif de Gutenberg, styling automatique
   -------------------------------------------------------------------------- */

.article blockquote,
.article .wp-block-quote {
    border-left: 4px solid rgb(var(--bb-bleu-nuit));
    padding: 0.5rem 0 0.5rem 1.5rem;
    margin: 2.5rem 0;
    font-size: 1.15rem;
    font-style: italic;
    color: rgba(var(--bb-text), 0.85);
    background: transparent;
}

.article blockquote cite,
.article .wp-block-quote cite {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    font-style: normal;
    color: rgba(var(--bb-text), 0.6);
}

.article blockquote cite::before {
    content: "— ";
}

/* --------------------------------------------------------------------------
   9. Tableau — utile pour comparatifs
   -------------------------------------------------------------------------- */

.article table,
.article .wp-block-table table {
    width: 100%;
    border-collapse: collapse;
    margin: 2.5rem 0;
    font-size: 0.95rem;
    background: rgb(var(--bb-creme));
    border-radius: 6px;
    overflow: hidden;
}

.article th {
    background: rgb(var(--bb-bleu-nuit));
    color: rgb(var(--bb-creme));
    text-align: left;
    padding: 0.85rem 1rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.article td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(var(--bb-bleu-nuit), 0.08);
}

.article tr:nth-child(even) td {
    background: rgba(var(--bb-bleu-nuit), 0.03);
}

.article tr:last-child td {
    border-bottom: none;
}

/* --------------------------------------------------------------------------
   10. Images et figures
   -------------------------------------------------------------------------- */

.article img,
.article .wp-block-image img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 2rem 0;
}

.article figcaption,
.article .wp-block-image figcaption {
    font-size: 0.9rem;
    color: rgba(var(--bb-text), 0.6);
    text-align: center;
    margin-top: 0.75rem;
    font-style: italic;
}

/* --------------------------------------------------------------------------
   11. CTA final — bloc bleu nuit avec bouton jaune
   Classe à appliquer sur un bloc Groupe : article__cta
   -------------------------------------------------------------------------- */

.article__cta {
    background: rgb(var(--bb-bleu-nuit));
    color: rgb(var(--bb-creme));
    padding: 2.5rem 2rem;
    margin: 3rem 0;
    border-radius: 8px;
    text-align: center;
}

.article__cta h3,
.article__cta h2 {
    color: rgb(var(--bb-creme));
    margin: 0 0 1rem;
    font-size: 1.5rem;
}

.article__cta h2::before,
.article__cta h3::before {
    display: none;
}

.article__cta p {
    color: rgba(var(--bb-creme), 0.9);
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

.article__cta a,
.article__cta .wp-block-button__link {
    background: rgb(var(--bb-jaune-signal));
    color: rgb(var(--bb-bleu-nuit));
    padding: 0.85rem 2rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 700;
    display: inline-block;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.article__cta a:hover,
.article__cta .wp-block-button__link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

/* --------------------------------------------------------------------------
   12. Encadré auteur (fin d'article)
   Classe à appliquer sur un bloc Groupe : article__auteur
   -------------------------------------------------------------------------- */

.article__auteur {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    padding: 1.5rem;
    background: rgba(var(--bb-creme-soft, var(--bb-creme)), 0.6);
    border-radius: 8px;
    margin: 3rem 0 2rem;
}

.article__auteur img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0;
    flex-shrink: 0;
    object-fit: cover;
}

.article__auteur .nom,
.article__auteur strong {
    font-weight: 600;
    color: rgb(var(--bb-bleu-nuit));
    margin-bottom: 0.25rem;
    display: block;
}

.article__auteur p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   13. Maillage interne (fin d'article)
   Classe à appliquer sur un bloc Groupe : article__maillage
   -------------------------------------------------------------------------- */

.article__maillage {
    border-top: 2px solid rgba(var(--bb-bleu-nuit), 0.1);
    padding-top: 2rem;
    margin-top: 3rem;
}

.article__maillage h3 {
    margin-top: 0;
    margin-bottom: 1.25rem;
}

.article__maillage ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.article__maillage li {
    margin-bottom: 0.85rem;
    padding-left: 1.5rem;
    position: relative;
}

.article__maillage li::before {
    content: "→";
    position: absolute;
    left: 0;
    top: 0;
    color: rgb(var(--bb-jaune-signal));
    font-weight: 700;
    font-size: 1.1rem;
}

.article__maillage a {
    color: rgb(var(--bb-bleu-nuit));
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease;
}

.article__maillage a:hover {
    border-bottom-color: rgb(var(--bb-jaune-signal));
}

/* --------------------------------------------------------------------------
   14. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
    .article {
        padding: 2rem 1rem 3rem;
    }

    .article h2 {
        margin: 2.5rem 0 1rem;
    }

    .article__chapo {
        font-size: 1.125rem;
    }

    .article__cta {
        padding: 2rem 1.25rem;
    }

    .article__auteur {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .article table {
        font-size: 0.9rem;
    }

    .article th,
    .article td {
        padding: 0.6rem 0.75rem;
    }
}

/* ==========================================================================
   ARTICLE — Éléments injectés par single.php (cover, header, nav)
   ========================================================================== */

/* --------------------------------------------------------------------------
   15. Cover : image mise en avant en tête d'article
   Placée en dehors du container .article dans single.php pour pouvoir
   dépasser la largeur de 720px du corps de l'article
   -------------------------------------------------------------------------- */

.article__cover {
    max-width: 1200px;
    margin: 3rem auto 2.5rem;
    padding: 0 1.5rem;
}

.article__cover img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    margin: 0;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

@media (max-width: 640px) {
    .article__cover {
        margin-top: 1.5rem;
        margin-bottom: 1.5rem;
        padding: 0 1rem;
    }
}

/* --------------------------------------------------------------------------
   16. Header d'article (titre H1 + meta) — injecté par single.php
   -------------------------------------------------------------------------- */

.article__header {
    margin: 0 0 2rem;
}

.article__header .article__titre {
    margin: 0 0 1rem;
}

.article__header .article__meta {
    margin: 0;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(var(--bb-bleu-nuit), 0.12);
}

/* --------------------------------------------------------------------------
   17. Corps de l'article (le the_content)
   -------------------------------------------------------------------------- */

.article__body {
    margin: 0 0 3rem;
}

/* --------------------------------------------------------------------------
   18. Taxonomies (catégories + tags) en pied d'article
   -------------------------------------------------------------------------- */

.article__taxonomies {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem 0;
    margin: 2rem 0;
    border-top: 1px solid rgba(var(--bb-bleu-nuit), 0.1);
    border-bottom: 1px solid rgba(var(--bb-bleu-nuit), 0.1);
    font-size: 0.95rem;
}

.article__taxonomies .article__label {
    font-weight: 600;
    color: rgb(var(--bb-bleu-nuit));
    margin-right: 0.5rem;
}

.article__taxonomies a {
    color: rgb(var(--bb-bleu-nuit));
    text-decoration: none;
    border-bottom: 2px solid rgb(var(--bb-jaune-signal));
    padding-bottom: 1px;
}

.article__taxonomies a:hover {
    border-bottom-color: rgb(var(--bb-bleu-nuit));
}

/* --------------------------------------------------------------------------
   19. Navigation entre articles (précédent / suivant)
   -------------------------------------------------------------------------- */

.article__nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 3rem 0 1rem;
    padding-top: 2rem;
    border-top: 2px solid rgba(var(--bb-bleu-nuit), 0.1);
}

.article__nav-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.25rem 1.5rem;
    background: rgba(var(--bb-creme-soft, var(--bb-creme)), 0.5);
    border-radius: 8px;
    text-decoration: none;
    color: rgb(var(--bb-bleu-nuit));
    transition: transform 0.15s ease, background 0.15s ease;
}

.article__nav-item:hover {
    transform: translateY(-2px);
    background: rgba(var(--bb-jaune-signal), 0.12);
}

.article__nav-next {
    text-align: right;
    align-items: flex-end;
}

.article__nav-label {
    font-size: 0.85rem;
    color: rgba(var(--bb-text), 0.6);
    font-weight: 500;
}

.article__nav-title {
    font-weight: 600;
    line-height: 1.35;
}

/* ==========================================================================
   ARCHIVE — Listing du blog (archive.php)
   ========================================================================== */

.webi-archive {
    max-width: 1120px;
    margin: 0 auto;
    padding: 6rem 1.5rem 4rem;
}

@media (max-width: 640px) {
    .webi-archive {
        padding: 3rem 1rem 3rem;
    }
}

.archive__header {
    text-align: center;
    margin: 0 auto 3rem;
    max-width: 720px;
}

.archive__titre {
    font-family: var(--font-heading, "Inter", system-ui, sans-serif);
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 800;
    line-height: 1.15;
    color: rgb(var(--bb-bleu-nuit));
    margin: 0 0 1rem;
    letter-spacing: -0.02em;
}

.archive__description {
    color: rgba(var(--bb-text), 0.75);
    font-size: 1.1rem;
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Grille de cartes d'articles
   -------------------------------------------------------------------------- */

.archive__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin: 0 0 3rem;
}

.archive__card {
    display: flex;
    flex-direction: column;
    background: rgb(var(--bb-creme));
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(var(--bb-bleu-nuit), 0.08);
}

.archive__card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(var(--bb-bleu-nuit), 0.1);
}

.archive__card-image {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: rgba(var(--bb-bleu-nuit), 0.05);
}

.archive__card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.archive__card:hover .archive__card-image img {
    transform: scale(1.04);
}

.archive__card-body {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 1.5rem;
    flex: 1;
}

.archive__card-cat {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgb(var(--bb-bleu-nuit));
    font-weight: 600;
    margin: 0;
}

.archive__card-titre {
    font-family: var(--font-heading, "Inter", system-ui, sans-serif);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.25;
    color: rgb(var(--bb-bleu-nuit));
    margin: 0;
    letter-spacing: -0.01em;
}

.archive__card-titre a {
    color: inherit;
    text-decoration: none;
}

.archive__card-titre a:hover {
    color: rgb(var(--bb-bleu-nuit));
    text-decoration: underline;
    text-decoration-color: rgb(var(--bb-jaune-signal));
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.archive__card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: rgba(var(--bb-text), 0.6);
    margin: 0;
}

.archive__card-excerpt {
    font-size: 0.95rem;
    line-height: 1.55;
    color: rgba(var(--bb-text), 0.8);
    margin: 0;
    flex: 1;
}

.archive__card-link {
    color: rgb(var(--bb-bleu-nuit));
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    margin-top: 0.5rem;
    border-bottom: 2px solid rgb(var(--bb-jaune-signal));
    padding-bottom: 2px;
    align-self: flex-start;
    transition: gap 0.15s ease;
}

.archive__card-link:hover {
    border-bottom-color: rgb(var(--bb-bleu-nuit));
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */

.archive__pagination {
    margin-top: 2rem;
}

.archive__pagination .nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.archive__pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    background: rgba(var(--bb-creme-soft, var(--bb-creme)), 0.5);
    color: rgb(var(--bb-bleu-nuit));
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background 0.15s ease;
}

.archive__pagination .page-numbers:hover,
.archive__pagination .page-numbers.current {
    background: rgb(var(--bb-bleu-nuit));
    color: rgb(var(--bb-creme));
}

.archive__empty {
    text-align: center;
    padding: 4rem 1rem;
    color: rgba(var(--bb-text), 0.6);
    font-size: 1.1rem;
}

/* --------------------------------------------------------------------------
   Responsive Archive + Nav article
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
    .archive__grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

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

    .article__nav-next {
        text-align: left;
        align-items: flex-start;
    }
}
