/* ================================================================
   Newsberg - Home custom design V3
   Styles strictement limites a la page d'accueil (.home).
   ================================================================ */

/* ---------- TITRES DE BLOCS ---------- */
.home .mg-sec-title,
.home .mg-wid-title {
    border: 0 !important;
}

.home .mg-sec-title h4,
.home .mg-wid-title h6,
.home .mg-sidebar .mg-widget > h6,
.home .mg-widget > h6,
.home .mg-widget .wp-block-group > h2,
.home .mg-widget .wp-block-heading,
.home .wp-block-search .wp-block-search__label {
    display: inline-block !important;
    width: auto !important;
    max-width: 100%;
    margin: 0 0 16px 0 !important;
    padding: 9px 18px !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: #d10014 !important;
    color: #fff !important;
    line-height: 1.35 !important;
    box-shadow: 0 5px 15px rgba(209, 0, 20, .28) !important;
    transition: background-color .35s ease, color .35s ease,
                transform .35s ease, box-shadow .35s ease !important;
}

/* Retire les pointes/triangles du style original pour conserver l'arrondi. */
.home .mg-sec-title h4::before,
.home .mg-sec-title h4::after,
.home .mg-wid-title h6::before,
.home .mg-wid-title h6::after,
.home .mg-sidebar .mg-widget > h6::before,
.home .mg-sidebar .mg-widget > h6::after,
.home .mg-widget > h6::before,
.home .mg-widget > h6::after,
.home .mg-widget .wp-block-group > h2::before,
.home .mg-widget .wp-block-group > h2::after,
.home .wp-block-search .wp-block-search__label::before,
.home .wp-block-search .wp-block-search__label::after {
    display: none !important;
    content: none !important;
}

.home .mg-sec-title h4 a,
.home .mg-wid-title h6 a,
.home .mg-sidebar .mg-widget > h6 a,
.home .mg-widget > h6 a,
.home .mg-widget .wp-block-group > h2 a,
.home .mg-widget .wp-block-heading a {
    color: #fff !important;
    text-decoration: none !important;
    transition: color .35s ease !important;
}

.home .mg-sec-title h4:hover,
.home .mg-wid-title h6:hover,
.home .mg-sidebar .mg-widget > h6:hover,
.home .mg-widget > h6:hover,
.home .mg-widget .wp-block-group > h2:hover,
.home .mg-widget .wp-block-heading:hover,
.home .wp-block-search .wp-block-search__label:hover {
    background: #ff6500 !important;
    color: #fff !important;
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(255, 101, 0, .40) !important;
}

.home .mg-sec-title h4 a:hover,
.home .mg-wid-title h6 a:hover,
.home .mg-sidebar .mg-widget > h6 a:hover,
.home .mg-widget > h6 a:hover,
.home .mg-widget .wp-block-group > h2 a:hover,
.home .mg-widget .wp-block-heading a:hover {
    color: #fff200 !important;
}

/* ---------- LIENS ---------- */
.home .mg-widget a,
.home .mg-posts-sec a,
.home .mg-posts-sec-inner a,
.home .small-list-post a {
    transition: color .30s ease !important;
}

.home .mg-widget a:hover,
.home .mg-widget a:focus,
.home .mg-posts-sec a:hover,
.home .mg-posts-sec a:focus,
.home .mg-posts-sec-inner a:hover,
.home .mg-posts-sec-inner a:focus,
.home .small-list-post a:hover,
.home .small-list-post a:focus {
    color: #ff6500 !important;
}

/* ---------- MINIATURES ---------- */
.home .mg-sidebar img,
.home .mg-widget img,
.home .mg-posts-sec img,
.home .mg-posts-sec-inner img,
.home .mg-post-box img,
.home .mg-blog-post img,
.home .mg-posts-modul-6 img,
.home .small-list-post img,
.home .post-form img {
    border-radius: 13px !important;
    box-shadow: 0 5px 16px rgba(0, 0, 0, .20) !important;
    transition: transform .42s ease, box-shadow .42s ease,
                filter .42s ease !important;
}

.home .mg-sidebar a:hover img,
.home .mg-widget a:hover img,
.home .mg-posts-sec a:hover img,
.home .mg-posts-sec-inner a:hover img,
.home .mg-post-box a:hover img,
.home .mg-blog-post a:hover img,
.home .mg-posts-modul-6 a:hover img,
.home .small-list-post a:hover img,
.home .post-form a:hover img,
.home .mg-sidebar img:hover,
.home .mg-widget img:hover {
    transform: translateY(-5px) scale(1.035);
    box-shadow: 0 0 0 2px rgba(209, 0, 20, .28),
                0 10px 30px rgba(209, 0, 20, .46) !important;
    filter: saturate(1.10) brightness(1.03);
}

/* ---------- ANIMATION AU SCROLL, BLOC PAR BLOC ---------- */
/* Sans JavaScript, rien n'est masque. La classe .newsberg-reveal-ready
   n'est ajoutee qu'apres initialisation du script. */
.home .newsberg-reveal-ready {
    opacity: 0;
    transform: translate3d(150px, 0, 0);
    transition: opacity 1.25s cubic-bezier(.22,.61,.36,1),
                transform 1.25s cubic-bezier(.22,.61,.36,1);
    will-change: opacity, transform;
}

.home .newsberg-reveal-ready.newsberg-reveal-visible {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

@media (max-width: 767px) {
    .home .mg-sec-title h4,
    .home .mg-wid-title h6,
    .home .mg-sidebar .mg-widget > h6,
    .home .mg-widget > h6,
    .home .mg-widget .wp-block-group > h2,
    .home .mg-widget .wp-block-heading {
        padding: 8px 13px !important;
        border-radius: 9px !important;
    }

    .home .mg-sidebar img,
    .home .mg-widget img,
    .home .mg-posts-sec img,
    .home .mg-posts-sec-inner img {
        border-radius: 10px !important;
    }

    .home .newsberg-reveal-ready {
        transform: translate3d(95px, 0, 0);
        transition-duration: 1.05s;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home .newsberg-reveal-ready,
    .home .newsberg-reveal-ready.newsberg-reveal-visible {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* V5 - le conteneur complet de l'article (texte + miniature) est anime. */
.home .newsberg-reveal-ready {
    backface-visibility: hidden;
}

/* La miniature suit exactement le mouvement de son bloc parent.
   On ne lui applique aucune animation d'apparition independante. */
.home .newsberg-reveal-ready img {
    backface-visibility: hidden;
}

/* ================================================================
   V6 - Miniatures premium : arrondi + glow + zoom + aperçu agrandi
   ================================================================ */
.home .mg-sidebar img,
.home .mg-widget img,
.home .mg-posts-sec img,
.home .mg-posts-sec-inner img,
.home .mg-post-box img,
.home .mg-blog-post img,
.home .mg-posts-modul-6 img,
.home .small-list-post img,
.home .post-form img {
    border: 3px solid rgba(255,255,255,.92) !important;
    border-radius: 16px !important;
    box-shadow:
        0 0 0 1px rgba(209,0,20,.22),
        0 7px 20px rgba(0,0,0,.22),
        0 0 18px rgba(209,0,20,.18) !important;
    transform-origin: center center;
    transition: transform .38s cubic-bezier(.2,.8,.2,1),
                box-shadow .38s ease,
                filter .38s ease !important;
}

/* Zoom local de la miniature au survol */
.home .mg-sidebar a:hover img,
.home .mg-widget a:hover img,
.home .mg-posts-sec a:hover img,
.home .mg-posts-sec-inner a:hover img,
.home .mg-post-box a:hover img,
.home .mg-blog-post a:hover img,
.home .mg-posts-modul-6 a:hover img,
.home .small-list-post a:hover img,
.home .post-form a:hover img,
.home .mg-sidebar img:hover,
.home .mg-widget img:hover,
.home .mg-posts-sec img:hover,
.home .mg-posts-sec-inner img:hover {
    transform: translateY(-6px) scale(1.07) !important;
    box-shadow:
        0 0 0 3px rgba(255,101,0,.35),
        0 14px 34px rgba(0,0,0,.30),
        0 0 28px rgba(255,101,0,.62),
        0 0 48px rgba(209,0,20,.32) !important;
    filter: saturate(1.13) contrast(1.03) brightness(1.05) !important;
    position: relative;
    z-index: 8;
}

/* Aperçu agrandi flottant : injecté par home-reveal.js */
.newsberg-image-preview {
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: min(760px, 72vw);
    max-height: 82vh;
    padding: 7px;
    border-radius: 20px;
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(255,101,0,.38);
    box-shadow:
        0 18px 55px rgba(0,0,0,.42),
        0 0 0 3px rgba(255,255,255,.72),
        0 0 30px rgba(255,101,0,.58),
        0 0 58px rgba(209,0,20,.28);
    opacity: 0;
    transform: translateY(10px) scale(.94);
    transition: opacity .20s ease, transform .24s cubic-bezier(.2,.8,.2,1);
    pointer-events: none;
    overflow: hidden;
}

.newsberg-image-preview.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.newsberg-image-preview img {
    display: block;
    width: 100%;
    height: auto;
    max-height: calc(82vh - 14px);
    object-fit: contain;
    border-radius: 14px;
    box-shadow: none !important;
    transform: none !important;
    filter: none !important;
}

/* Pas d'aperçu flottant sur appareils tactiles/petits écrans. */
@media (hover: none), (max-width: 767px) {
    .newsberg-image-preview { display: none !important; }

    .home .mg-sidebar a:hover img,
    .home .mg-widget a:hover img,
    .home .mg-posts-sec a:hover img,
    .home .mg-posts-sec-inner a:hover img,
    .home .mg-post-box a:hover img,
    .home .mg-blog-post a:hover img,
    .home .mg-posts-modul-6 a:hover img,
    .home .small-list-post a:hover img,
    .home .post-form a:hover img,
    .home .mg-sidebar img:hover,
    .home .mg-widget img:hover {
        transform: none !important;
    }
}

/* ================================================================
   V7 - Correction Newsberg : les miniatures sont des background-image
   Structure reelle : div.mg-post-thumb.back-img.md
   ================================================================ */
.home .mg-post-thumb.back-img,
.home .mg-post-thumb.back-img.md {
    position: relative;
    overflow: visible !important;
    border: 3px solid rgba(255,255,255,.96) !important;
    border-radius: 18px !important;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    box-shadow:
        0 0 0 1px rgba(209,0,20,.28),
        0 8px 20px rgba(0,0,0,.24),
        0 0 22px rgba(209,0,20,.22) !important;
    transform: translateZ(0) scale(1);
    transform-origin: center center;
    transition:
        transform .45s cubic-bezier(.2,.8,.2,1),
        box-shadow .45s ease,
        filter .45s ease !important;
    will-change: transform;
}

/* Le lien transparent garde exactement l'arrondi de la miniature. */
.home .mg-post-thumb.back-img > a.link-div,
.home .mg-post-thumb.back-img.md > a.link-div {
    border-radius: inherit !important;
}

/* Hover : agrandissement visible + glow renforcé. */
.home .mg-post-thumb.back-img:hover,
.home .mg-post-thumb.back-img.md:hover {
    transform: translateY(-7px) scale(1.055) !important;
    box-shadow:
        0 0 0 3px rgba(255,101,0,.45),
        0 16px 38px rgba(0,0,0,.34),
        0 0 30px rgba(255,101,0,.70),
        0 0 58px rgba(209,0,20,.40) !important;
    filter: saturate(1.10) brightness(1.04) contrast(1.03);
    z-index: 20;
}

/* Evite qu'un parent coupe le zoom de la miniature. */
.home article,
.home .mg-posts-sec-post,
.home .mg-sec-top-post,
.home .col-md-6 {
    overflow: visible !important;
}

@media (max-width: 767px) {
    .home .mg-post-thumb.back-img,
    .home .mg-post-thumb.back-img.md {
        border-radius: 13px !important;
    }
    .home .mg-post-thumb.back-img:hover,
    .home .mg-post-thumb.back-img.md:hover {
        transform: none !important;
    }
}
