/* ==========================================================================
   Bandeau sticky de capture d'e-mails

   Le formulaire lui-meme vient de capture.css : ce fichier ne traite que le
   conteneur (position, apparition, fermeture, comportement mobile).

   EMPILEMENT : le bandeau prend --z-fixed (300 par defaut), au-dessus de la
   timeline du sommaire (z-index 100) et de la barre `.pdc-toc-bar`
   (calc(--z-sticky - 1) = 199). Il reste volontairement SOUS la sticky bar
   wc-plus (99999) : mais les deux ne coexistent jamais : PDC_Klaviyo_Sticky
   refuse de s'afficher quand une barre partenaire est prevue sur le contenu.
   ========================================================================== */

.pdc-sticky {
    position: fixed;
    z-index: var(--z-fixed, 300);
    box-sizing: border-box;
    background: var(--color-bg, #fff);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
    opacity: 0;
    transition: transform 300ms ease, opacity 300ms ease;
}

.pdc-sticky[hidden] {
    display: none;
}

.pdc-sticky__inner {
    max-width: var(--content-width, 1280px);
    margin: 0 auto;
    padding: 0.9rem 3rem 0.9rem 1.25rem;
}

/* Le bandeau n'a pas d'encadre propre : il EST le cadre. */
.pdc-sticky .pdc-capture {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    align-items: center;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
}

.pdc-sticky .pdc-capture__intro {
    flex: 1 1 280px;
    min-width: 0;
    margin: 0;
}

.pdc-sticky .pdc-capture__title {
    font-size: 1.05rem;
}

.pdc-sticky .pdc-capture__text {
    font-size: 0.88rem;
}

.pdc-sticky .pdc-capture__form {
    flex: 1 1 340px;
    max-width: 460px;
}

.pdc-sticky .pdc-capture__msg {
    flex: 1 1 100%;
    margin-top: 0;
}

/* ----- Etape 2 dans le bandeau -----
   Le bandeau est large et peu haut : les listes s'alignent en ligne et
   passent a la ligne suivante plutot que de l'etirer verticalement. */

.pdc-sticky .pdc-capture__lists {
    flex: 1 1 100%;
    margin-top: 0;
}

.pdc-sticky .pdc-capture__lists-title {
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
}

.pdc-sticky .pdc-capture__lists-options {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.1rem 0.6rem;
    margin-bottom: 0.6rem;
}

.pdc-sticky .pdc-capture__list-option {
    flex: 0 1 auto;
    padding: 0.3rem 0.45rem;
    font-size: 0.86rem;
}

.pdc-sticky .pdc-capture__btn--confirm {
    width: auto;
    min-width: 180px;
}

/* ----- Bouton de fermeture ----- */

.pdc-sticky__close {
    position: absolute;
    top: 0.5rem;
    right: 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    color: var(--color-text-muted, #6b7280);
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: color 150ms ease, background-color 150ms ease;
}

.pdc-sticky__close:hover {
    color: var(--color-text, #111827);
    background: color-mix(in srgb, var(--color-text, #111827) 8%, transparent);
}

.pdc-sticky__close:focus-visible {
    outline: 2px solid var(--color-primary, #040404);
    outline-offset: 2px;
}

/* ==========================================================================
   Position : bas (defaut)
   Aucun croisement possible avec la barre de sommaire, qui est en haut.
   ========================================================================== */

.pdc-sticky--bottom {
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateY(100%);
    border-top: 3px solid var(--color-accent, #f59e0b);
}

.pdc-sticky--bottom.is-visible {
    transform: translateY(0);
    opacity: 1;
}

/* ==========================================================================
   Position : haut
 --pdc-sticky-offset est calcule en JS : hauteur du header + hauteur de la
   barre de sommaire quand elle est visible, pour se placer dessous plutot que
   par-dessus.
   ========================================================================== */

.pdc-sticky--top {
    top: var(--pdc-sticky-offset, var(--header-height, 80px));
    right: 0;
    left: 0;
    transform: translateY(-120%);
    border-bottom: 3px solid var(--color-accent, #f59e0b);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.pdc-sticky--top.is-visible {
    transform: translateY(0);
    opacity: 1;
}

/* ==========================================================================
   Position : encadre lateral (desktop uniquement)
   ========================================================================== */

.pdc-sticky--side {
    right: 1.5rem;
    bottom: 1.5rem;
    width: min(380px, calc(100vw - 3rem));
    transform: translateY(120%);
    border: 1px solid var(--color-border, #e5e7eb);
    border-top: 3px solid var(--color-accent, #f59e0b);
    border-radius: var(--radius-lg, 0.75rem);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.pdc-sticky--side.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.pdc-sticky--side .pdc-capture {
    display: block;
}

.pdc-sticky--side .pdc-capture__intro {
    margin-bottom: 0.9rem;
}

/* ==========================================================================
   Mobile
   Sous 700px, le lateral et le haut sont intenables : le premier mange
   l'ecran, le second s'empile sous le header ET la barre de sommaire. Les deux
   repassent donc en bas, pleine largeur.
   ========================================================================== */

@media (max-width: 700px) {
    .pdc-sticky--side,
    .pdc-sticky--top {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: auto;
        border: 0;
        border-top: 3px solid var(--color-accent, #f59e0b);
        border-radius: 0;
        transform: translateY(100%);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
    }

    .pdc-sticky--side.is-visible,
    .pdc-sticky--top.is-visible {
        transform: translateY(0);
    }

    .pdc-sticky__inner {
        padding: 0.8rem 1rem 0.9rem;
    }

    /* Le titre suffit : sur un ecran de telephone, l'argument pousse le champ
       hors de vue et gene la lecture de l'article. */
    .pdc-sticky .pdc-capture__text {
        display: none;
    }

    .pdc-sticky .pdc-capture__title {
        font-size: 0.98rem;
        padding-right: 2rem;
    }

    .pdc-sticky .pdc-capture__intro {
        margin-bottom: 0.6rem;
    }

    .pdc-sticky .pdc-capture__form {
        flex: 1 1 100%;
        max-width: none;
    }

    .pdc-sticky__close {
        top: 0.35rem;
        right: 0.35rem;
    }
}

/* ==========================================================================
   Cohabitation avec la timeline du sommaire (>= 1200px)

   Le theme affiche `.pdc-toc-timeline` en `position: fixed` (top 200px,
   max-height calc(100vh - 200px)) : elle descend donc jusqu'au bas exact du
   viewport. Le bandeau, fixe en bas sur toute la largeur avec un z-index
   superieur, recouvrirait ses derniers elements. Le padding-bottom pose sur le
   body n'y peut rien : un element `fixed` est hors du flux.

   On raccourcit donc la timeline de la hauteur exacte du bandeau, mesuree en
   JS (--pdc-sticky-height) et posee sur <html> avec la classe d'etat.

 --pdc-toc-top reprend le 200px du theme (themes/PDC/assets/css/toc.css) : a
   reporter ici si cette valeur y change.
   ========================================================================== */

@media (min-width: 1200px) {
    .pdc-sticky-active--bottom .pdc-toc-timeline {
        max-height: calc(100vh - var(--pdc-toc-top, 200px) - var(--pdc-sticky-height, 0px));
    }

    .pdc-sticky-active--top .pdc-toc-timeline {
        top: calc(var(--pdc-toc-top, 200px) + var(--pdc-sticky-height, 0px));
        max-height: calc(100vh - var(--pdc-toc-top, 200px) - var(--pdc-sticky-height, 0px));
    }

    /* En encadre lateral, le bandeau occupe le bas A DROITE et la timeline est
       a gauche : ils ne se croisent pas, rien a corriger. */
}

@media (prefers-reduced-motion: reduce) {
    .pdc-sticky {
        transition: opacity 200ms ease;
        transform: none !important;
    }
}
