/* ============================================================
   Encarts promo cross-promo
   - PC (>=1200px) : bande laterale droite qui REDUIT la page
     (navbar + contenu + footer retrecis), la pub ne recouvre rien.
   - Mobile (<1200px) : barre basse, le contenu est decale vers le haut.
   - Revele par js/promo-ads.js seulement si non connecte (classe
     html.promo-rail-on posee a ce moment -> aucun flash, pas de pub si connecte).
   ============================================================ */

#promo-ads {
    position: fixed;
    z-index: 999; /* sous la navbar (1030) et la bulle contact (1000) */
    box-sizing: border-box;
    font-family: inherit;
}
#promo-ads[hidden] { display: none; }
#promo-ads * { box-sizing: border-box; }

/* ---- Petite croix = fermer les pubs -> mene a la connexion (CTA) ---- */
.promo-close {
    position: absolute;
    z-index: 3;
    width: 26px;
    height: 26px;
    line-height: 24px;
    text-align: center;
    border-radius: 50%;
    background: #1f2933;
    color: #fff;
    font-size: 18px;
    font-weight: 400;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.promo-close:hover { background: #000; color: #fff; }

/* ---- Carte (injectee par JS) ---- */
.promo-slot { transition: opacity 0.4s ease; }
.promo-slot.is-swapping { opacity: 0; }

.promo-card {
    display: block;
    overflow: hidden;
    background: #fff;
    border-radius: 12px;
    text-decoration: none;
    color: #2b2b2b;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
    border-top: 4px solid var(--brand, #7cb810);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.promo-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}
.promo-card__media { display: block; background: #f2f2ee; }
.promo-card__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.promo-card__body { display: block; padding: 9px 11px 11px; }
.promo-card__title {
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
    color: #1f2933;
}
.promo-card__text {
    display: block;
    margin-top: 4px;
    font-size: 0.76rem;
    line-height: 1.3;
    color: #5a6570;
}
.promo-card__cta {
    display: inline-block;
    margin-top: 9px;
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
    border-radius: 999px;
    background: var(--brand, #7cb810);
}
.promo-card__cta .fa { margin-left: 5px; transition: transform 0.2s ease; }
.promo-card:hover .promo-card__cta .fa { transform: translateX(3px); }

/* ============================================================
   PC : bande laterale droite qui retrecit la page (ne recouvre rien)
   ============================================================ */
@media (min-width: 1200px) {
    /* Reduit la page : tout (navbar fixe, fonds pleine largeur, footer)
       laisse une bande a droite pour la pub. Classe posee par promo-ads.js. */
    html.promo-rail-on body { padding-right: 256px; }
    html.promo-rail-on .navbar { right: 256px; }
    /* la bulle contact a un style inline right:30px -> !important pour la
       repositionner a gauche de la bande pub */
    html.promo-rail-on #floatingBubble { right: 286px !important; }

    html.promo-rail-on #promo-ads {
        top: 55px;            /* sous la navbar (hauteur 55px) */
        right: 0;
        bottom: 0;
        width: 256px;
        padding: 16px 16px 12px;
        background: #f6f8f4;
        border-left: 1px solid #e2e4dd;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }
    .promo-mobile { display: none; }
    .promo-pc {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    .promo-pc .promo-slot { flex: 0 0 auto; }
    .promo-pc .promo-card__media { height: 104px; }
    .promo-pc .promo-card__body { padding: 8px 11px 10px; }
    .promo-pc .promo-card__text {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    /* croix en haut a droite de la bande */
    html.promo-rail-on #promo-ads .promo-close { top: 8px; right: 8px; }
}

/* ============================================================
   Mobile / tablette : barre fixe en bas, 1 carte horizontale.
   Le contenu est decale vers le haut (padding-bottom) pour ne rien cacher.
   ============================================================ */
@media (max-width: 1199.98px) {
    html.promo-rail-on body { padding-bottom: 150px; }

    #promo-ads {
        left: 8px;
        right: 8px;
        /* au-dessus de la barre de partage sticky ShareThis (~40px) */
        bottom: 60px;
        width: auto;
    }
    .promo-pc { display: none; }
    .promo-mobile { display: block; }
    .promo-mobile .promo-card {
        display: flex;
        align-items: stretch;
        border-top: none;
        border-left: 4px solid var(--brand, #7cb810);
    }
    /* Vignette en proportion paysage (~1.8:1) comme les images og.
       Hauteur DEFINIE (96px) : indispensable pour que object-fit:cover
       contraigne aussi les images portrait (couvertures de livre),
       sinon la carte prend la hauteur intrinseque de l'image. */
    .promo-mobile .promo-card__media {
        flex: 0 0 174px;
        width: 174px;
        height: 96px;
    }
    .promo-mobile .promo-card__media img { height: 100%; }
    .promo-mobile .promo-card__body {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 8px 12px;
        min-width: 0;
    }
    /* description masquee sur mobile pour garder la carte compacte */
    .promo-mobile .promo-card__text { display: none; }
    .promo-mobile .promo-card__title {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .promo-mobile .promo-card__cta { align-self: flex-start; margin-top: 8px; padding: 4px 10px; }
    /* croix au-dessus du coin haut-droit de la barre */
    #promo-ads .promo-close { top: -13px; right: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .promo-slot,
    .promo-card,
    .promo-card__cta .fa { transition: none; }
}
