/* ------------------------------------------------------------------ */
/* Chapô (style de bloc core/paragraph « bbab-chapo »)                 */
/* ------------------------------------------------------------------ */

.is-style-bbab-chapo {
    font-size: 1.15em;
    line-height: 1.55;
    font-weight: 500;
    margin-block: 1.5em;
}

/* ------------------------------------------------------------------ */
/* Bloc dynamique « Article lié » (bbab/article-lie)                   */
/* ------------------------------------------------------------------ */

.bbab-article-lie {
    /* Un site redéfinit ces trois variables pour accorder la carte à sa charte. */
    --bbab-lie-accent: currentColor;
    --bbab-lie-border: color-mix(in srgb, currentColor 14%, transparent);
    --bbab-lie-surface: transparent;

    margin-block: 2.2em;
    padding: 1em;
    background: var(--bbab-lie-surface);
    border: 1px solid var(--bbab-lie-border);
    border-radius: 14px;
    box-shadow: 0 1px 2px color-mix(in srgb, currentColor 6%, transparent);
    transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}

/* La carte est un objet qu'on ouvre, pas un passage mis en retrait comme une
   citation : contour sur les quatre côtés, et elle se soulève au survol. */
.bbab-article-lie:hover {
    border-color: color-mix(in srgb, var(--bbab-lie-accent) 55%, transparent);
    box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--bbab-lie-accent) 40%, transparent);
    transform: translateY(-2px);
}

.bbab-article-lie__inner {
    display: flex;
    gap: 1.1em;
    align-items: center;
}

.bbab-article-lie__figure {
    flex: 0 0 8.5em;
    margin: 0;
    min-width: 0;
}

.bbab-article-lie__figure-link {
    display: block;
}

.bbab-article-lie__image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: 10px;
}

.bbab-article-lie__body {
    flex: 1 1 auto;
    min-width: 0;
}

.bbab-article-lie__kicker {
    display: flex;
    align-items: center;
    gap: .5em;
    margin: 0 0 .35em;
    font-size: .72em;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--bbab-lie-accent);
}

.bbab-article-lie__kicker::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--bbab-lie-border), transparent);
}

/* Titres en paragraphe : les sommaires automatiques ne les prennent pas pour des chapitres. */
.bbab-article-lie__title {
    margin: 0 0 .4em;
    font-size: 1.08em;
    font-weight: 700;
    line-height: 1.35;
}

.bbab-article-lie__link {
    text-decoration: none;
    color: inherit;
}

.bbab-article-lie__link::after {
    content: "\2192";
    display: inline-block;
    margin-left: .35em;
    color: var(--bbab-lie-accent);
    transition: transform .25s ease;
}

.bbab-article-lie:hover .bbab-article-lie__link::after {
    transform: translateX(.3em);
}

.bbab-article-lie__link:focus-visible {
    text-decoration: underline;
}

.bbab-article-lie__excerpt {
    margin: 0;
    font-size: .93em;
    line-height: 1.5;
    opacity: .85;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 619px) {
    .bbab-article-lie__inner {
        flex-direction: column;
        align-items: stretch;
        gap: .9em;
    }

    .bbab-article-lie__figure {
        flex-basis: auto;
        width: 100%;
    }

    .bbab-article-lie__excerpt {
        -webkit-line-clamp: 3;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bbab-article-lie,
    .bbab-article-lie__link::after {
        transition: none;
    }

    .bbab-article-lie:hover {
        transform: none;
    }
}

/* ------------------------------------------------------------------ */
/* Bloc dynamique « Offre » (bbab/offre) — reprend le rendu historique */
/* ------------------------------------------------------------------ */

.bbab-offre {
    margin-block: 2em;
}

.bb-article-builder__offer-fallback {
    padding: 1.5em;
    border-radius: 12px;
    background-color: color-mix(in srgb, currentColor 6%, transparent);
}

.bb-article-builder__offer-logo-wrap {
    margin-bottom: 1em;
}

.bb-article-builder__offer-logo {
    display: block;
    max-width: 200px;
    height: auto;
}

.bb-article-builder__offer-advantage {
    margin: 0 0 .5em;
    font-weight: 600;
}

.bb-article-builder__offer-title {
    margin: 0 0 .5em;
    font-size: 1.5em;
    font-weight: 700;
    line-height: 1.25;
}

.bb-article-builder__offer-description {
    margin: 0 0 1em;
}

/* Bouton plein dès que l'offre porte ses deux couleurs : le fond reprend la couleur
   du texte, le libellé celle du fond, donc le contraste de la carte est conservé.
   Sans couleurs renseignées, les replis rendent le bouton en contour comme avant. */
.bb-article-builder__offer-button {
    display: inline-block;
    padding: .6em 1.2em;
    border: 1px solid var(--bbab-offre-texte, currentColor);
    border-radius: 999px;
    background-color: var(--bbab-offre-texte, transparent);
    text-decoration: none;
    color: var(--bbab-offre-fond, inherit);
}

.bb-article-builder__offer-button:hover,
.bb-article-builder__offer-button:focus-visible {
    text-decoration: underline;
}

/* ------------------------------------------------------------------ */
/* Bloc dynamique « Panorama » (bbab/panorama)                         */
/* Une citation pleine largeur, puis les images sur une ligne : mêmes  */
/* largeurs, même ratio 3:2, gouttière régulière. Le nombre de         */
/* colonnes vient du rendu (une à trois images). Sous 620 px, une      */
/* seule colonne.                                                      */
/* ------------------------------------------------------------------ */

.bbab-panorama {
    margin-block: 2.5em;
}

.bbab-panorama__quote {
    margin: 0 0 1.5em;
    padding: 0;
    border: 0;
    font-size: 1.2em;
    line-height: 1.45;
    font-weight: 500;
}

.bbab-panorama__quote > :first-child {
    margin-top: 0;
}

.bbab-panorama__quote > :last-child {
    margin-bottom: 0;
}

.bbab-panorama__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25em;
}

.bbab-panorama__grid--cols-1 {
    grid-template-columns: minmax(0, 1fr);
}

.bbab-panorama__grid--cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bbab-panorama__item {
    margin: 0;
    min-width: 0;
}

.bbab-panorama__image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: 8px;
}

.bbab-panorama__caption {
    margin: .5em 0 0;
    font-size: .85em;
    line-height: 1.4;
    opacity: .75;
}

@media (max-width: 619px) {
    .bbab-panorama__grid,
    .bbab-panorama__grid--cols-2 {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Espace réservé dans l’éditeur avant sélection */
.bbab-block-placeholder {
    padding: 1em 1.25em;
    border: 1px dashed color-mix(in srgb, currentColor 35%, transparent);
    border-radius: 8px;
}

.bbab-block-placeholder p {
    margin: .25em 0 0;
    opacity: .75;
}

/* Emplacements d’images du panorama dans le panneau latéral de l’éditeur */
.bbab-panorama-slots-label {
    margin: 1em 0 .5em;
    font-weight: 600;
}

.bbab-panorama-slot {
    display: flex;
    align-items: center;
    gap: .5em;
    margin-bottom: .5em;
}

/* ------------------------------------------------------------------ */
/* Liens contextuels (maillage interne et sources externes)            */
/* ------------------------------------------------------------------ */

a.bbab-contextual-link,
a.bbab-contextual-link--internal,
a.bbab-contextual-link--external,
.custom-article-content .p_onecol_text_article a {
    text-decoration: none;
    background-image: linear-gradient(to right, rgba(0, 0, 0, .22), rgba(0, 0, 0, .22)), linear-gradient(to right, currentColor, currentColor);
    background-repeat: no-repeat;
    background-position: 0 100%, 0 100%;
    background-size: 100% 1px, 0 2px;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    transition: background-size 280ms ease, color 280ms ease;
}

.custom-article-content .p_onecol_text_article :is(ul, ol, blockquote) { margin-block: 1.25em; max-width: 100%; }
.custom-article-content .p_onecol_text_article :is(ul, ol) { padding-inline-start: 1.5em; }
.custom-article-content .p_onecol_text_article ol { list-style: decimal outside; }
.custom-article-content .p_onecol_text_article li + li { margin-block-start: .5em; }
.custom-article-content .p_onecol_text_article blockquote {
    margin-inline: 0;
    padding-inline-start: 1.25em;
    border-inline-start: 3px solid currentColor;
    overflow-wrap: anywhere;
}

a.bbab-contextual-link:hover,
a.bbab-contextual-link:focus-visible,
.custom-article-content .p_onecol_text_article a:hover,
.custom-article-content .p_onecol_text_article a:focus-visible {
    background-size: 100% 1px, 100% 2px;
}

@supports (color: color-mix(in srgb, black 50%, transparent)) {
    a.bbab-contextual-link,
    .custom-article-content .p_onecol_text_article a {
        background-image: linear-gradient(to right, color-mix(in srgb, currentColor 25%, transparent), color-mix(in srgb, currentColor 25%, transparent)), linear-gradient(to right, currentColor, currentColor);
    }
}

@media (prefers-reduced-motion: reduce) {
    a.bbab-contextual-link,
    .custom-article-content .p_onecol_text_article a {
        transition: none;
    }
}

/* Galeries du plugin : légendes éditoriales sous l’image, jamais par-dessus (lisibles sur mobile). */
.wp-block-gallery.bbab-gallery.has-nested-images figure.wp-block-image {
    flex-direction: column;
    align-items: stretch;
}
.wp-block-gallery.bbab-gallery.has-nested-images figure.wp-block-image figcaption {
    position: static;
    max-height: none;
    overflow: visible;
    margin: .5em 0 0;
    padding: 0;
    background: none;
    color: inherit;
    font-size: .875em;
    line-height: 1.4;
    text-align: left;
    text-shadow: none;
}
.wp-block-gallery.bbab-gallery.has-nested-images figure.wp-block-image:has(figcaption)::before {
    content: none;
}

/* ------------------------------------------------------------------ */
/* Liens du texte mis en avant (chapô) : soulignement épais vert       */
/* Mode historique (widget Elementor, bloc .excerpt_article) et mode   */
/* blocs (paragraphe « Chapô »). Couleur réglable par thème avec       */
/* --bbab-highlight-link-color (vert BimBeau #77E7B1 par défaut).      */
/* ------------------------------------------------------------------ */

.custom-article-content .excerpt_article a,
.is-style-bbab-chapo a {
    color: inherit;
    font-weight: inherit;
    background-image: none;
    text-decoration-line: underline;
    text-decoration-color: var(--bbab-highlight-link-color, #77e7b1);
    text-decoration-thickness: .28em;
    text-underline-offset: .06em;
    text-decoration-skip-ink: none;
    transition: text-decoration-thickness 220ms ease, text-underline-offset 220ms ease;
}

.custom-article-content .excerpt_article a:hover,
.custom-article-content .excerpt_article a:focus-visible,
.is-style-bbab-chapo a:hover,
.is-style-bbab-chapo a:focus-visible {
    text-decoration-thickness: .42em;
    text-underline-offset: 0;
}

.custom-article-content .excerpt_article a:focus-visible,
.is-style-bbab-chapo a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .custom-article-content .excerpt_article a,
    .is-style-bbab-chapo a {
        transition: none;
    }
}
