/* ============================================================
   Gallery Template 9 — GC Custom
   Version : 2.0 (2026-06-25)
   Corrections :
     - Galerie invisible sur smartphone (breakpoint 375px trop restrictif)
     - Slider horizontal tactile sur mobile (scroll-snap)
     - Hover effects et UX améliorés
     - target=_blank géré dans gallery-template-9.js
   ============================================================ */


/* ── Conteneur principal ────────────────────────────────── */

#wps-gallery-template-9 {
    padding: 10px 0 20px;
    position: relative;
}


/* ── DESKTOP : grille Masonry 4 colonnes ────────────────── */

#wps-gallery-template-9-image-container {
    /* Masonry gère le layout en JS — on lui laisse de l'espace */
    position: relative;
    width: 100%;
}

.wpps-t9-item {
    width: 24%;
    margin: 0 0.5% 1% 0.5%;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    /* Transition douce au hover */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 2px;
}

.wpps-t9-item.w2 {
    width: 48%;
}

.wpps-t9-item:hover {
    transform: scale(1.025);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    z-index: 2;
}

.wpps-t9-item a {
    display: block;
    position: relative;
    overflow: hidden;
}

.wpps-t9-item a img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 0;
    border: none;
    /* Marge du thème parent qui déborde sur les images de galerie */
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    transition: opacity 0.25s ease;
}

.wpps-t9-item a:hover img {
    opacity: 0.88;
}

/* Indicateur visuel discret : icône loupe au survol */
.wpps-t9-item a::after {
    content: "🔍";
    position: absolute;
    bottom: 8px;
    right: 10px;
    font-size: 18px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.wpps-t9-item a:hover::after {
    opacity: 1;
}


/* ── Lightbox : titre & overlay ─────────────────────────── */

.wps-template9-overlay-title {
    text-transform: capitalize;
    font-weight: bold;
    font-size: 16px;
    margin: 5px 0 8px;
    color: #fff;
}

.wps-template9-overlay-description {
    font-size: 13px;
    color: #ddd;
    margin-bottom: 10px;
}

.wps-template9-overlay-buy {
    margin-top: 10px;
}

.wps-template9-overlay-buy a img {
    max-width: 100%;
    transition: opacity 0.15s ease;
}

.wps-template9-overlay-buy a:hover img {
    opacity: 0.85;
}


/* ── Bouton principal dans la lightbox ──────────────────── */
/* "Ouvrir dans un nouvel onglet" remplace "Add to Cart"    */

.wps-t9-open-tab-wrapper {
    margin-top: 14px;
    text-align: center;
}

.wps-t9-open-tab {
    display: inline-block;
    padding: 9px 22px;
    background: #6d0a14;
    color: #fff !important;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 0.04em;
    border-radius: 4px;
    text-decoration: none !important;
    transition: background 0.2s ease, transform 0.15s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.wps-t9-open-tab:hover {
    background: #9b1020;
    transform: translateY(-1px);
}

.wps-t9-open-tab:active {
    transform: translateY(0);
}


/* ── Popup "Add to Cart" (modal WPS) ────────────────────── */

#variationTable {
    font-size: 12px;
    border: 1px solid #ddd;
    border-collapse: collapse;
    width: 100%;
}

#variationTable thead tr th {
    font-weight: bold;
    padding: 10px 5px;
    border: 1px solid #ccc;
    background: #e0e0e0;
}

#variationTable tbody tr td {
    font-weight: normal;
    padding: 4px;
    border: 1px solid #ddd;
}

#variationTable .wps_tr_odd  { background: #fff; }
#variationTable .wps_tr_even { background: #f3f3f3; }

#thumImg {
    width: 125px;
    padding: 4px;
    border: 1px solid #ddd;
}

#add_to_cart_dialog .wpps_image_title {
    font-size: 12px;
    padding: 15px 0;
    text-transform: uppercase;
}

#add_to_cart_dialog .qtyInput {
    width: auto !important;
}

.add_to_cart_popup_success_msg {
    margin: 10px 0;
    padding: 10px;
    background-color: #ddf5db;
    border: 1px solid #b2e3af;
    color: #252000;
    font-size: 14px;
    line-height: 26px;
}

.wps_item_added_msg {
    font-family: Arial, sans-serif;
    font-size: 24px;
    padding-top: 10px;
}

.wps_popup_items_added_list {
    border-top: 1px solid #d5e6d7;
    margin: 20px 0;
    padding: 5px 0;
    font-size: 14px;
}

.wps_popup_view_cart,
.wps_popup_continue_shopping {
    border-radius: 2px;
    border-style: solid;
    border-width: 1px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 1px 0 rgba(255,255,255,0.3) inset;
    cursor: pointer;
    display: inline-block;
    font-size: 13px;
    font-weight: bold;
    line-height: 17px;
    margin: 0 10px 0 0;
    outline: none;
    padding: 5px 16px;
    text-align: center;
    text-decoration: none;
    vertical-align: baseline;
}

.wps_popup_view_cart {
    background: #c6df9f;
    border-color: #acc488 #98b86d #86ac53;
}

.wps_popup_continue_shopping {
    background: #d4d4d4;
    border-color: #c4c4c4 #b8b8b8 #adadad;
}

.wps_popup_view_cart_section a,
.wps_popup_continue_shopping_section a {
    text-decoration: none;
}


/* ── Pagination ─────────────────────────────────────────── */

.wps-photo-gallery-pagination {
    clear: both;
    padding: 12px 0;
    text-align: center;
}


/* ── TABLETTE : 3 colonnes jusqu'à 1024px ───────────────── */

@media screen and (max-width: 1024px) {
    .wpps-t9-item {
        width: 32%;
        margin: 0 0.5% 1% 0.5%;
    }

    .wpps-t9-item.w2 {
        width: 65%;
    }
}


/* ── TABLETTE : 2 colonnes jusqu'à 768px ────────────────── */

@media screen and (max-width: 768px) {
    .wpps-t9-item {
        width: 48%;
        margin: 0 0.5% 1% 0.5%;
    }

    .wpps-t9-item.w2 {
        width: 97%;
    }
}


/* ── SMARTPHONE : slider horizontal < 767px ─────────────── */
/*
   Sur mobile :
   - Masonry est désactivé par gallery-template-9.js
   - Le container devient un flex horizontal défilable
   - scroll-snap donne un effet de défilement page par page
   - touch-action permet le swipe natif iOS/Android
*/

@media screen and (max-width: 767px) {

    #wps-gallery-template-9 {
        /* Espace pour les indicateurs de scroll */
        padding-bottom: 30px;
    }

    /* Bandeau d'aide au glissement */
    #wps-gallery-template-9::before {
        content: "← Glissez pour parcourir les photos →";
        display: block;
        text-align: center;
        font-size: 12px;
        color: #888;
        padding: 6px 0 10px;
        letter-spacing: 0.03em;
    }

    #wps-gallery-template-9-image-container {
        /* Réinitialiser les règles Masonry (position: relative injectée par JS) */
        position: static !important;
        height: auto !important;

        /* Slider horizontal */
        display: flex !important;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch; /* momentum scroll iOS */
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        gap: 10px;
        padding: 6px 16px 16px;

        /* Scrollbar fine et discrète */
        scrollbar-width: thin;
        scrollbar-color: #6d0a14 #e0e0e0;
    }

    #wps-gallery-template-9-image-container::-webkit-scrollbar {
        height: 5px;
    }

    #wps-gallery-template-9-image-container::-webkit-scrollbar-track {
        background: #e0e0e0;
        border-radius: 3px;
    }

    #wps-gallery-template-9-image-container::-webkit-scrollbar-thumb {
        background-color: #6d0a14;
        border-radius: 3px;
    }

    /* Chaque vignette = une "carte" dans le slider */
    .wpps-t9-item {
        /* Réinitialiser la position absolue injectée par Masonry */
        position: static !important;
        top: auto !important;
        left: auto !important;

        flex: 0 0 78%;       /* largeur de chaque carte */
        width: 78%;
        max-width: 340px;
        margin: 0;           /* gap gère l'espacement */
        scroll-snap-align: center;
        border-radius: 4px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.2);
        overflow: hidden;
        /* Désactiver le scale hover sur tactile pour éviter le bug de position */
        transform: none;
        transition: box-shadow 0.2s ease;
    }

    .wpps-t9-item:hover,
    .wpps-t9-item:active {
        transform: none;
    }

    .wpps-t9-item a img {
        width: 100%;
        height: 220px;
        object-fit: cover; /* recadrage propre */
        margin: 0 !important;
    }

    /* Cacher le pseudo-élément loupe sur tactile */
    .wpps-t9-item a::after {
        display: none;
    }

    .wpps-t9-item.w2 {
        flex: 0 0 90%;
        width: 90%;
    }
}


/* ── Très petit smartphone < 360px ─────────────────────── */

@media screen and (max-width: 359px) {
    .wpps-t9-item {
        flex: 0 0 88%;
        width: 88%;
    }
}


/* ── Mobile paysage (landscape) < 768px ─────────────────── */
/*
   iPhone SE paysage : 667px — reste en mode slider
   On affiche 2 cartes partielles pour suggérer le défilement
*/

@media screen and (max-width: 767px) and (orientation: landscape) {

    #wps-gallery-template-9::before {
        display: none; /* texte d'aide moins utile en paysage */
    }

    .wpps-t9-item {
        flex: 0 0 55%;
        width: 55%;
        max-width: none;
    }

    .wpps-t9-item a img {
        height: 180px;
    }
}
