/*
 Theme Name:   Divi Modèles Hama Subtheme
 Theme URI:    http://www.modeles-hama.com/
 Description:  Customs for Divi theme
 Author:       Simon JANVIER
 Author URI:   http://www.simonjanvier.com
 Template:     Divi
 Version:      1.0.5
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Tags:         custom
 Text Domain:  divi-modeles-hama-subtheme
*/

/* Container for pagination (home / blog Divi) — bat Divi wp-page_navi.css */
.wp-pagenavi {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 6px !important;
    margin: 24px 0 16px !important;
    padding: 0 4px !important;
    border-top: none !important;
    font-family: 'Open Sans', Helvetica, Arial, Lucida, sans-serif;
    font-size: 14px !important;
    line-height: 1 !important;
    text-align: center !important;
    clear: both;
    box-sizing: border-box;
}

.wp-pagenavi .pages {
    flex: 0 0 100% !important;
    margin: 0 0 4px !important;
    text-align: center !important;
    color: #64748b !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border: none !important;
}

.wp-pagenavi .current,
.wp-pagenavi a.page,
.wp-pagenavi a.nextpostslink,
.wp-pagenavi a.last,
.wp-pagenavi a.first,
.wp-pagenavi a.previouspostslink {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 40px !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 6px 12px !important;
    border: 1px solid #e3e8ef !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: #1f2937 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.wp-pagenavi .current {
    background: #2e71d4 !important;
    border-color: #2e71d4 !important;
    color: #fff !important;
    cursor: default;
}

.wp-pagenavi a.page:hover,
.wp-pagenavi a.page:focus-visible,
.wp-pagenavi a.nextpostslink:hover,
.wp-pagenavi a.nextpostslink:focus-visible,
.wp-pagenavi a.last:hover,
.wp-pagenavi a.last:focus-visible,
.wp-pagenavi a.first:hover,
.wp-pagenavi a.first:focus-visible,
.wp-pagenavi a.previouspostslink:hover,
.wp-pagenavi a.previouspostslink:focus-visible {
    background: #eff6ff !important;
    border-color: #2e71d4 !important;
    color: #1d4ed8 !important;
}

.wp-pagenavi .extend {
    margin: 0 !important;
    padding: 0 2px !important;
    color: #94a3b8 !important;
    min-width: auto !important;
    border: none !important;
    background: transparent !important;
}

@media screen and (max-width: 767px) {
    .wp-pagenavi {
        gap: 5px !important;
        margin: 20px 0 12px !important;
    }

    .wp-pagenavi .pages {
        margin-bottom: 6px !important;
        font-size: 12px !important;
    }

    .wp-pagenavi .current,
    .wp-pagenavi a.page,
    .wp-pagenavi a.nextpostslink,
    .wp-pagenavi a.last,
    .wp-pagenavi a.first,
    .wp-pagenavi a.previouspostslink {
        min-width: 42px !important;
        min-height: 42px !important;
        padding: 8px 10px !important;
        font-size: 14px !important;
    }

    /* Libellés longs : masqués sur mobile (évite une 2e ligne orpheline) */
    .wp-pagenavi a.last,
    .wp-pagenavi a.first {
        display: none !important;
    }
}

/* Carousel produit — styles déplacés dans assets/css/single-product.css */

/* Responsive */
@media screen and (max-width: 768px) {
    .grid-sizer, .grid-item {
        width: 100% !important;
    }
}

/* Footer */
p#footer-info,p#footer-info a{color:#FFFFFF;}

/* Products sidebar widget */
.woocommerce ul.product_list_widget li img{float:left;width:64px;background: #FFFFFF;padding:4px;border:solid 1px silver; margin: 0 12px 12px 0;}

.woocommerce ul.product_list_widget li .WooZone-price-info{display:none;}
.woocommerce ul.product_list_widget li .WooZone-free-shipping{display:none;}

/* Sidebar */
.rpwe-block a{font-size: 15px;font-weight:600;}
.woocommerce ul.product_list_widget li  a{font-size: 15px;font-weight:600;    line-height: 1.3;
}

/* --- CLS : structure fixe --- */

#main-header,
.et_pb_section_0_tb_header {
    min-height: 80px;
}

.home .et_pb_section_0 {
    min-height: 450px !important;
}

.home .et_pb_section_0 img {
    aspect-ratio: 400 / 250;
    width: 100% !important;
    height: auto !important;
    object-fit: cover;
    object-position: center center;
    display: block;
}

.et_pb_post img,
.entry-featured-image-url img,
.entry-content img[width][height] {
    width: 100% !important;
    height: auto !important;
    display: block;
    background: #f0f0f0;
}

img {
    height: auto;
    max-width: 100%;
}

body, h1, h2, h3, h4, h5, h6 {
    font-display: swap !important;
}

/* AdSense : hauteur fixe (anti-CLS) — overflow clip, pas d'expansion */
.adsense-container {
    display: block;
    overflow: hidden;
    text-align: center;
    background: #f8f8f8;
    contain: layout style size;
    box-sizing: border-box;
}

ins.adsbygoogle {
    display: block !important;
    contain: layout style size !important;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

#top-ad-container {
    margin: 10px auto;
    height: 100px;
    min-height: 100px;
    max-height: 100px;
}

.mhama-ad-header {
    width: 100%;
    max-width: 728px;
    height: 100px !important;
    min-height: 100px !important;
    max-height: 100px !important;
}

.mhama-ad-sidebar-wrap {
    height: 250px;
    min-height: 250px;
    max-height: 250px;
    margin: 0 auto;
    overflow: hidden;
}

.mhama-ad-sidebar {
    width: 300px;
    max-width: 100%;
    height: 250px !important;
    min-height: 250px !important;
    max-height: 250px !important;
}

#footer-ad-container {
    margin: 10px auto;
    height: 100px;
    min-height: 100px;
    max-height: 100px;
}

.mhama-ad-footer {
    width: 100%;
    max-width: 728px;
    height: 100px !important;
    min-height: 100px !important;
    max-height: 100px !important;
}

@media (min-width: 768px) {
    #top-ad-container,
    .mhama-ad-header {
        height: 90px !important;
        min-height: 90px !important;
        max-height: 90px !important;
    }

    #footer-ad-container,
    .mhama-ad-footer {
        height: 90px !important;
        min-height: 90px !important;
        max-height: 90px !important;
    }
}

@media (max-width: 767px) {
    .mhama-ad-header,
    .mhama-ad-footer {
        max-width: 320px;
        height: 100px !important;
        min-height: 100px !important;
        max-height: 100px !important;
    }
}

/* Facebook Page : réserve fixe header seul (anti-CLS ; timeline Meta en panne) */
.fb-page,
.fb-page > span {
    display: block !important;
    min-height: 130px;
    max-height: 160px;
    overflow: hidden;
    max-width: 100%;
    background: #f5f5f5;
}

/* Desktop : réserves header TB + grille blog */
@media (min-width: 981px) {
    .et_pb_section_0_tb_header {
        min-height: 200px;
    }

    .et_pb_row_0_tb_header {
        min-height: 80px;
    }

    .et_pb_row_1_tb_header {
        min-height: 110px;
    }

    .home .et_pb_section_0 {
        min-height: 1600px !important;
    }

    .home .et_pb_blog_grid {
        min-height: 1400px;
    }
}

/* Sidebar : image encart partenaire */
#sidebar .wp-block-image img {
    width: 100% !important;
    max-width: 300px !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.rpwe-ul li img {
    width: 45px !important;
    height: 45px !important;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.et_pb_blog_grid .et_pb_post:first-child img {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

/* Blog cards (home + archives) : titres, dates, excerpts */
.home .et_pb_post .entry-title,
.home .et_pb_post h2.entry-title,
.blog .et_pb_post .entry-title,
.blog .et_pb_post h2.entry-title {
    line-height: 1.25 !important;
    margin-bottom: 0 !important;
    padding-bottom: 2px !important;
}

.home .et_pb_post .post-meta,
.blog .et_pb_post .post-meta {
    font-size: 12px !important;
    line-height: 1.35 !important;
    margin-top: 0 !important;
    margin-bottom: 6px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.home .et_pb_post .post-content,
.home .et_pb_post .post-content p,
.blog .et_pb_post .post-content,
.blog .et_pb_post .post-content p {
    line-height: 1.4 !important;
}

/* LCP : image à la une des articles */
.single .et_post_meta_wrapper .mhama-lcp-picture,
.single .et_post_meta_wrapper img {
    width: 100%;
    max-width: 1080px;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: center center;
    display: block;
    background: #f0f0f0;
}

.single .et_post_meta_wrapper .mhama-lcp-picture img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: center center;
}

/* ------------------------------------------------------------------
   Articles mobile : lecture (marges + typo)
   Corrige Divi : container 80%, line-height 2.2, weight 300, h2 16px
   ------------------------------------------------------------------ */
@media screen and (max-width: 980px) {
    body.single-post #main-content .container {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
        box-sizing: border-box;
    }

    body.single-post #left-area {
        width: 100% !important;
    }

    /* Home : mêmes gouttières (Divi .et_pb_row = 80% → 38px) */
    body.home .et_builder_inner_content > .et_pb_section:not([class*="_tb_header"]) .et_pb_row {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
        box-sizing: border-box !important;
    }

    body.home .et_builder_inner_content > .et_pb_section:not([class*="_tb_header"]) .et_pb_column {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Garder le padding Divi (19px) des cards : les vignettes
       ont margin -20px — sans padding elles débordent hors carte. */
}

@media screen and (max-width: 767px) {
    body.single-post,
    body.single-post #left-area,
    body.single-post .entry-content {
        font-weight: 400 !important;
        line-height: 1.6 !important;
        color: #2a2a2a;
    }

    body.single-post #main-content .container {
        padding-left: 14px !important;
        padding-right: 14px !important;
        padding-top: 24px !important;
    }

    body.home .et_builder_inner_content > .et_pb_section:not([class*="_tb_header"]) .et_pb_row {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    body.single-post h1.entry-title {
        font-size: 1.5rem !important; /* 24px */
        line-height: 1.28 !important;
        font-weight: 600 !important;
        letter-spacing: -0.01em;
        padding-bottom: 8px !important;
        margin: 0 0 4px !important;
    }

    body.single-post #left-area .post-meta {
        font-size: 0.8125rem !important; /* 13px */
        line-height: 1.45 !important;
        padding-bottom: 12px !important;
        color: #5a5a5a;
    }

    body.single-post .entry-content p,
    body.single-post .entry-content li {
        font-size: 1.0625rem !important; /* 17px */
        line-height: 1.6 !important;
        font-weight: 400 !important;
    }

    body.single-post .entry-content p {
        padding-bottom: 0.9em !important;
        margin: 0 !important;
    }

    /* Annule Divi phone : .et_pb_post h2 { font-size: 16px } */
    body.single-post .et_pb_post h2,
    body.single-post .entry-content h2 {
        font-size: 1.25rem !important; /* 20px */
        line-height: 1.3 !important;
        font-weight: 600 !important;
        padding-bottom: 0.4em !important;
        margin: 1.35em 0 0.15em !important;
    }

    body.single-post .entry-content h3 {
        font-size: 1.125rem !important; /* 18px */
        line-height: 1.35 !important;
        font-weight: 600 !important;
        padding-bottom: 0.35em !important;
        margin: 1.2em 0 0.1em !important;
    }

    body.single-post .entry-content h4 {
        font-size: 1.0625rem !important; /* 17px */
        line-height: 1.35 !important;
        font-weight: 600 !important;
        padding-bottom: 0.3em !important;
        margin: 1.1em 0 0.1em !important;
    }

    body.single-post .entry-content img {
        margin: 0.4em 0 0.8em !important;
        border-radius: 4px;
    }

    body.single-post .entry-content ul,
    body.single-post .entry-content ol {
        padding-left: 1.15em !important;
        padding-bottom: 0.9em !important;
        line-height: 1.55 !important;
    }

    body.single-post .entry-content li {
        padding-bottom: 0.35em;
    }
}

@media screen and (max-width: 479px) {
    body.single-post #main-content .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    body.home .et_builder_inner_content > .et_pb_section:not([class*="_tb_header"]) .et_pb_row {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    body.single-post h1.entry-title {
        font-size: 1.375rem !important; /* 22px */
    }

    /* Double filet vs règle Divi ≤479px */
    body.single-post .et_pb_post h2,
    body.single-post .entry-content h2 {
        font-size: 1.1875rem !important; /* 19px */
    }
}

/* ------------------------------------------------------------------
   Header mobile : sticky compact, burger à droite, menu tactile
   ------------------------------------------------------------------ */
@media screen and (max-width: 980px) {
    /* Barre sticky basse */
    .et-l--header {
        position: sticky !important;
        top: 0 !important;
        z-index: 100000 !important;
        background: #fff !important;
        box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
    }

    .et_pb_section_0_tb_header {
        min-height: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        background: #fff !important;
    }

    /* 2e rangée Theme Builder trop haute / vide sur mobile */
    .et_pb_row_1_tb_header {
        display: none !important;
    }

    .et_pb_row_0_tb_header {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 6px 12px !important;
        box-sizing: border-box !important;
    }

    .et_pb_row_0_tb_header > .et_pb_column {
        float: none !important;
        margin: 0 !important;
        padding: 0 !important;
        min-height: 0 !important;
    }

    .et_pb_column_0_tb_header {
        width: auto !important;
        flex: 1 1 auto !important;
        max-width: calc(100% - 56px) !important;
    }

    .et_pb_column_1_tb_header {
        width: auto !important;
        flex: 0 0 auto !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 6px !important;
        margin-left: auto !important;
    }

    /* Logo compact */
    .et_pb_image_0_tb_header,
    .et_pb_image_0_tb_header .et_pb_image_wrap {
        margin: 0 !important;
        line-height: 0 !important;
    }

    .et_pb_image_0_tb_header img {
        max-height: 36px !important;
        width: auto !important;
        height: auto !important;
        max-width: 160px !important;
    }

    /* Langue avant le burger ; burger tout à droite */
    .et_pb_column_1_tb_header .language-switcher-for-divi-polylang,
    .et_pb_column_1_tb_header [class*="language-switcher"] {
        order: 1 !important;
        margin: 0 !important;
        transform: scale(0.9);
        transform-origin: right center;
    }

    .et_pb_column_1_tb_header .et_pb_menu_0_tb_header {
        order: 2 !important;
        margin: 0 !important;
        width: auto !important;
    }

    .et_pb_menu_0_tb_header .et_pb_menu_inner_container,
    .et_pb_menu_0_tb_header .et_pb_menu__wrap {
        display: flex !important;
        justify-content: flex-end !important;
        align-items: center !important;
        width: auto !important;
        margin: 0 !important;
        float: none !important;
    }

    .et_pb_menu_0_tb_header .et_mobile_nav_menu {
        display: block !important;
        float: none !important;
        margin: 0 !important;
        position: relative !important;
    }

    .et_pb_menu_0_tb_header .mobile_nav {
        text-align: right !important;
    }

    /* Zone tactile burger ≥ 44px */
    .et_pb_menu_0_tb_header .mobile_menu_bar {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        cursor: pointer;
    }

    .et_pb_menu_0_tb_header .mobile_menu_bar:before {
        top: auto !important;
        position: relative !important;
        font-size: 32px !important;
        line-height: 1 !important;
    }

    /* Menu ouvert : pleine largeur, utilisable au doigt */
    .et_pb_menu_0_tb_header #mobile_menu1,
    .et_pb_menu_0_tb_header ul.et_mobile_menu {
        position: absolute !important;
        top: 100% !important;
        right: 0 !important;
        left: auto !important;
        width: min(100vw, 375px) !important;
        max-width: calc(100vw - 16px) !important;
        min-width: 260px !important;
        margin: 4px 0 0 !important;
        padding: 8px 0 !important;
        background: #fff !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 12px !important;
        box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16) !important;
        box-sizing: border-box !important;
        z-index: 100001 !important;
        text-align: left !important;
    }

    .et_pb_menu_0_tb_header #mobile_menu1 li,
    .et_pb_menu_0_tb_header ul.et_mobile_menu li {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
    }

    .et_pb_menu_0_tb_header #mobile_menu1 a,
    .et_pb_menu_0_tb_header ul.et_mobile_menu a {
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
        min-height: 48px !important;
        padding: 12px 18px !important;
        margin: 0 !important;
        font-size: 1.0625rem !important;
        font-weight: 600 !important;
        line-height: 1.3 !important;
        color: #0f172a !important;
        text-align: left !important;
        box-sizing: border-box !important;
        border-bottom: 1px solid #f1f5f9 !important;
    }

    .et_pb_menu_0_tb_header #mobile_menu1 li:last-child a,
    .et_pb_menu_0_tb_header ul.et_mobile_menu li:last-child a {
        border-bottom: 0 !important;
    }

    .et_pb_menu_0_tb_header #mobile_menu1 a:hover,
    .et_pb_menu_0_tb_header #mobile_menu1 a:focus-visible,
    .et_pb_menu_0_tb_header ul.et_mobile_menu a:hover,
    .et_pb_menu_0_tb_header ul.et_mobile_menu a:focus-visible {
        background: #f8fafc !important;
        color: #1d4ed8 !important;
    }
}

@media screen and (max-width: 479px) {
    .et_pb_menu_0_tb_header #mobile_menu1,
    .et_pb_menu_0_tb_header ul.et_mobile_menu {
        position: fixed !important;
        top: 52px !important;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
    }
}
