/**
 * Galerie Chantiers Volt Électrique - Style Front-Office Refondu
 * Grille harmonisée (Ratio 4:3 parfait, finitions luxe, 100% responsive)
 */

/* ==========================================================================
   0. NEUTRALISATION STRICTE DES CONTENEURS PRÉFORMATÉS (<pre>)
   ========================================================================== */

pre:has(.volt-gallery-wrapper),
.wp-block-preformatted:has(.volt-gallery-wrapper),
.entry-content pre:has(.volt-gallery-wrapper) {
    white-space: normal !important;
    font-family: inherit !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: normal !important;
    font-size: inherit !important;
    overflow: visible !important;
    box-shadow: none !important;
}

/* ==========================================================================
   1. CONTENEUR PRINCIPAL & GRILLE MODERNE
   ========================================================================== */

.volt-gallery-wrapper {
    width: 100%;
    margin: 30px auto 50px auto;
    box-sizing: border-box;
    white-space: normal !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.volt-gallery-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 26px !important;
    width: 100% !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
    float: none !important;
}

/* Variantes de colonnes */
.volt-cols-2 .volt-gallery-grid {
    grid-template-columns: repeat(2, 1fr) !important;
}

.volt-cols-4 .volt-gallery-grid {
    grid-template-columns: repeat(4, 1fr) !important;
}

/* ==========================================================================
   2. CARTE RÉALISATION HARMONISÉE (RATIO CONSTANT & FINITIONS CANON)
   ========================================================================== */

.volt-gallery-item {
    display: block !important;
    position: relative !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Éléments masqués pour le chargement progressif */
.volt-gallery-item.volt-item-hidden {
    display: none !important;
}

.volt-gallery-card-link {
    display: block !important;
    text-decoration: none !important;
    color: inherit !important;
    outline: none !important;
    border: none !important;
}

.volt-image-card {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3; /* Format universel parfait : tous les blocs ont exactement la même taille ! */
    border-radius: 16px;
    overflow: hidden;
    background: #0f172a;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(226, 232, 240, 0.9);
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.45s cubic-bezier(0.16, 1, 0.3, 1), 
                border-color 0.3s ease;
    will-change: transform, box-shadow;
}

/* Survol de la carte */
.volt-gallery-item:hover .volt-image-card {
    transform: translateY(-8px);
    box-shadow: 0 22px 35px -10px rgba(15, 23, 42, 0.22), 0 10px 18px -5px rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.6);
}

/* Image fluide au ratio contrôlé sans déformation */
.volt-img-fluid {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; /* Remplissage impeccable sans déformation */
    object-position: center !important;
    display: block !important;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.volt-gallery-item:hover .volt-img-fluid {
    transform: scale(1.08) !important;
}

/* ==========================================================================
   3. HABILLAGE TEXTUEL & OVERLAY ÉLÉGANT
   ========================================================================== */

.volt-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 18px 20px;
    background: linear-gradient(180deg, 
        rgba(15, 23, 42, 0.2) 0%, 
        rgba(15, 23, 42, 0) 30%, 
        rgba(15, 23, 42, 0.75) 70%, 
        rgba(15, 23, 42, 0.96) 100%
    );
    box-sizing: border-box;
    transition: background 0.35s ease;
}

.volt-gallery-item:hover .volt-card-overlay {
    background: linear-gradient(180deg, 
        rgba(15, 23, 42, 0.35) 0%, 
        rgba(15, 23, 42, 0.1) 25%, 
        rgba(15, 23, 42, 0.85) 65%, 
        rgba(15, 23, 42, 0.98) 100%
    );
}

/* ==========================================================================
   MODE ÉPURÉ SANS TITRES (LE BADGE VOLT ÉLECTRIQUE ET LA VILLE RESTENT VISIBLES)
   ========================================================================== */

.volt-no-titles .volt-card-overlay {
    background: linear-gradient(180deg, 
        rgba(15, 23, 42, 0.25) 0%, 
        rgba(15, 23, 42, 0) 30%, 
        rgba(15, 23, 42, 0.1) 60%, 
        rgba(15, 23, 42, 0.85) 100%
    );
}

.volt-no-titles .volt-gallery-item:hover .volt-card-overlay {
    background: linear-gradient(180deg, 
        rgba(15, 23, 42, 0.4) 0%, 
        rgba(15, 23, 42, 0.05) 30%, 
        rgba(15, 23, 42, 0.3) 60%, 
        rgba(15, 23, 42, 0.95) 100%
    );
}

.volt-card-top {
    display: flex;
    justify-content: flex-start;
}

.volt-badge-brand {
    background: rgba(245, 158, 11, 0.95);
    color: #0f172a;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
}

.volt-card-bottom {
    transform: translateY(2px);
    transition: transform 0.35s ease;
}

.volt-gallery-item:hover .volt-card-bottom {
    transform: translateY(0);
}

.volt-card-title {
    color: #ffffff !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
    margin: 0 0 6px 0 !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6) !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

.volt-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.volt-card-loc {
    color: #fbbf24;
    font-size: 12px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.volt-action-zoom {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.volt-gallery-item:hover .volt-action-zoom {
    background: #f59e0b;
    color: #0f172a;
    transform: scale(1.12);
}

/* ==========================================================================
   4. BOUTON CHARGER PLUS DE RÉALISATIONS
   ========================================================================== */

.volt-loadmore-wrap {
    text-align: center;
    margin: 45px auto 25px auto;
    width: 100%;
}

.volt-loadmore-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    background: #0f172a !important;
    color: #ffffff !important;
    border: 2px solid #f59e0b !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    padding: 14px 34px !important;
    border-radius: 50px !important;
    cursor: pointer !important;
    box-shadow: 0 10px 25px -5px rgba(245, 158, 11, 0.25) !important;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    user-select: none !important;
}

.volt-loadmore-btn:hover {
    background: #f59e0b !important;
    color: #0f172a !important;
    transform: translateY(-3px) scale(1.02) !important;
    box-shadow: 0 16px 30px -5px rgba(245, 158, 11, 0.45) !important;
}

.volt-btn-icon {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.volt-loadmore-btn:hover .volt-btn-icon {
    transform: rotate(15deg) scale(1.2);
}

/* ==========================================================================
   5. MODALE LIGHTBOX PLEIN ÉCRAN
   ========================================================================== */

.volt-lightbox {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 2147483647 !important;
    display: none !important; /* STRICTEMENT MASQUÉ PAR DÉFAUT */
    align-items: center !important;
    justify-content: center !important;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none !important;
}

/* Visible UNIQUEMENT lorsqu'on clique sur une photo */
.volt-lightbox.volt-active {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.volt-lightbox-backdrop {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(10, 15, 25, 0.96) !important;
    backdrop-filter: blur(12px) !important;
    z-index: 1 !important;
    cursor: pointer !important;
}

.volt-lightbox-panel {
    position: relative !important;
    max-width: 92vw !important;
    max-height: 92vh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10 !important;
}

.volt-lightbox-figure {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.volt-lightbox-img {
    max-width: 90vw;
    max-height: 82vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    transition: opacity 0.25s ease;
}

.volt-lightbox-info {
    width: 100%;
    margin-top: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffffff;
}

.volt-lb-caption {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #f1f5f9;
}

.volt-lb-counter {
    font-size: 13px;
    color: #f59e0b;
    font-weight: 700;
    margin-left: 20px;
}

.volt-lb-btn {
    position: fixed !important;
    background: rgba(15, 23, 42, 0.85) !important;
    border: 2px solid rgba(255, 255, 255, 0.85) !important;
    color: #ffffff !important;
    width: 54px !important;
    height: 54px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.25s ease !important;
    z-index: 2147483647 !important;
    user-select: none !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6) !important;
    padding: 0 !important;
    outline: none !important;
}

.volt-lb-btn svg {
    display: block;
    pointer-events: none;
    transition: transform 0.2s ease;
}

.volt-lb-btn:hover {
    background: #f59e0b !important;
    border-color: #f59e0b !important;
    color: #0f172a !important;
    transform: scale(1.15) !important;
}

.volt-lb-close {
    top: 25px !important;
    right: 25px !important;
}

.volt-lb-prev {
    left: 25px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

.volt-lb-prev:hover {
    transform: translateY(-50%) scale(1.15) !important;
}

.volt-lb-next {
    right: 25px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

.volt-lb-next:hover {
    transform: translateY(-50%) scale(1.15) !important;
}

.volt-lb-loader {
    display: none;
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: voltSpin 0.8s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes voltSpin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ==========================================================================
   6. RESPONSIVE DESIGN (TABLETTE & MOBILE)
   ========================================================================== */

@media (max-width: 980px) {
    .volt-gallery-grid,
    .volt-cols-4 .volt-gallery-grid,
    .volt-cols-3 .volt-gallery-grid,
    .volt-cols-2 .volt-gallery-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 18px !important;
    }
}

@media (max-width: 600px) {
    .volt-gallery-grid,
    .volt-cols-4 .volt-gallery-grid,
    .volt-cols-3 .volt-gallery-grid,
    .volt-cols-2 .volt-gallery-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .volt-image-card {
        aspect-ratio: 4 / 3;
        border-radius: 14px;
    }

    .volt-card-title {
        font-size: 14px !important;
    }

    .volt-loadmore-btn {
        width: 100% !important;
        padding: 14px 20px !important;
        font-size: 14px !important;
    }

    .volt-lb-btn {
        width: 44px !important;
        height: 44px !important;
    }
    .volt-lb-prev { left: 10px !important; }
    .volt-lb-next { right: 10px !important; }
    .volt-lb-close { top: 15px !important; right: 15px !important; }
}
