/* ── FxShareAndPrint — Barre flottante ─────────────────────────────────── */

#fxsap-bar {
    position: fixed;
    top: 30%;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 3px;
    pointer-events: none;
}

.fxsap-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    cursor: pointer;
    pointer-events: all;
    transition: filter .15s ease, transform .15s ease;
    overflow: hidden;
    position: relative;
}

.fxsap-btn:focus-visible {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

.fxsap-btn:hover {
    transform: translateX(2px);
    z-index: 1;
}

.fxsap-btn svg {
    display: block;
    flex-shrink: 0;
    transition: color .15s ease;
}

.fxsap-label {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--fxsap-color);
    padding-right: 8px;
}

/* ── Toast copie ────────────────────────────────────────────────────────── */
#fxsap-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(60px);
    background: #222;
    color: #fff;
    padding: 12px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity .25s ease, transform .25s ease;
    pointer-events: none;
    max-width: 300px;
}
#fxsap-toast strong { color: #fff; font-weight: 700; }

#fxsap-toast.fxsap-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Impression ─────────────────────────────────────────────────────────── */
@media print {

    /* 1. Mise en page */
    @page {
        margin: 2cm;
        size: A4 portrait;
    }

    /* ================================================================
     * STRATEGIE PRINCIPALE : masquer TOUT, puis révéler l'article
     * Cette approche est plus robuste qu'une liste de sélecteurs.
     * ================================================================ */

    /* 2. Cache tout le body */
    body > * {
        display: none !important;
    }

    /* 3. Révèle progressivement jusqu'au contenu de l'article */

    /* Niveau 1 : le wrapper principal */
    body > #page,
    body > .site,
    body > #wrapper,
    body > .wrapper,
    body > main,
    body > #main,
    body > .l-page,
    body > div { display: block !important; }

    /* Niveau 2 : zone de contenu (pas la sidebar) */
    #page > #content,
    #page > main,
    #page > .site-content,
    .site > #content,
    .site > main,
    .site > .site-content,
    #wrapper > #content,
    #wrapper > main,
    .wrapper > #content,
    .l-page > #content,
    body > main > *,
    body > #main > * { display: block !important; }

    /* Masque explicitement les sidebars à tous niveaux */
    aside,
    .sidebar,
    #sidebar,
    #secondary,
    .widget-area,
    [id*="sidebar"],
    [class*="sidebar"] { display: none !important; }

    /* Niveau 3 : l'article lui-même */
    article,
    .post,
    .entry,
    .hentry,
    .single-post,
    #content article,
    .content-area article,
    main article { display: block !important; }

    /* 4. Dans l'article : masque les blocs parasites */

    /* Métadonnées (catégories, auteur, date, lien Editer) */
    .entry-meta,
    .post-meta,
    .byline,
    .posted-on,
    .cat-links,
    .tags-links,
    .post-categories,
    .post-tags,
    .edit-link,
    .post-edit-link,
    [class*="entry-meta"],
    [class*="post-meta"] { display: none !important; }

    /* Notre barre de partage */
    #fxsap-bar,
    #fxsap-toast { display: none !important; }

    /* Formulaires (newsletter dans l'article) */
    form,
    .newsletter,
    .newsletter-form,
    .mc4wp-form,
    .mailpoet_form,
    [class*="newsletter"],
    [class*="subscribe"] { display: none !important; }

    /* Boutons de partage social dans l'article */
    .addtoany_share,
    .a2a_floating_style,
    .a2a_kit,
    .sharethis,
    .social-share,
    .post-share,
    .entry-share,
    [class*="share-"] { display: none !important; }

    /* Commentaires */
    .comments-area,
    #comments,
    .comment-respond { display: none !important; }

    /* Articles liés */
    .related-posts,
    .related,
    [class*="related"] { display: none !important; }

    /* WooCommerce */
    .woocommerce,
    .woocommerce-page,
    .products,
    .product,
    .wc-block-grid,
    .add_to_cart_button,
    .cart,
    [class*="woocommerce"],
    [class*="wc-"] { display: none !important; }

    /* Dons / Stripe / paiement */
    [class*="stripe"],
    [id*="stripe"],
    [class*="donation"],
    [class*="donate"],
    [class*="don-"],
    .give-form,
    .give-wrap,
    .charitable,
    [class*="payment"],
    a[href*="buy.stripe.com"],
    a[href*="stripe.com"] { display: none !important; }

    /* Publicités */
    .ad, .ads, .advertisement,
    .banner,
    [id*="google_ad"],
    [class*="advert"] { display: none !important; }

    /* Sliders */
    .slider, .carousel, .slideshow { display: none !important; }

    /* 5. Typographie propre */
    *,
    *::before,
    *::after {
        background: transparent !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body {
        font-family: Georgia, "Times New Roman", serif;
        font-size: 12pt;
        line-height: 1.65;
        color: #000 !important;
        background: #fff !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    article,
    .entry,
    .post {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        float: none !important;
        color: #000 !important;
    }

    h1 { font-size: 20pt; margin-bottom: .4em; page-break-after: avoid; }
    h2 { font-size: 16pt; page-break-after: avoid; }
    h3 { font-size: 14pt; page-break-after: avoid; }
    h4, h5, h6 { font-size: 12pt; page-break-after: avoid; }
    p { orphans: 3; widows: 3; color: #000 !important; }

    /* Liens : couleur noire, PAS d'URL affichée */
    a {
        color: #000 !important;
        text-decoration: underline;
    }
    /* Supprime l'affichage des URLs (comportement par défaut de certains navigateurs) */
    a::after {
        content: "" !important;
        display: none !important;
    }

    /* 6. Images */
    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
    }

    figure, blockquote, table, pre { page-break-inside: avoid; }

    blockquote {
        border-left: 3pt solid #999;
        padding-left: 12pt;
        margin-left: 0;
        font-style: italic;
    }

    .page-break { page-break-before: always; }
}

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    #fxsap-bar {
        display: none;
    }
}
