/**
 * Styles pour la galerie photo "Mémoire Vive"
 * Auteur: André Soupart
 * Description: Styles CSS pour galerie responsive 4 colonnes avec diaporama
 */

/* ========== CONTENEUR DE GALERIE ========== */

/* Conteneur principal de galerie */
.gallery-container {
    background: linear-gradient(135deg, rgba(248,249,250,0.1), rgba(233,236,239,0.1));
    border-radius: 1rem;
    padding: 2rem;
    margin: 2rem 0;
}

/* Information de galerie */
.gallery-info {
    margin: 1rem 0;
    padding: 0.75rem;
    background: rgba(255,255,255,0.1);
    border-radius: 0.5rem;
    backdrop-filter: blur(10px);
}

.gallery-info i {
    color: #007bff;
    margin-right: 0.5rem;
}

/* ========== GRILLE DE GALERIE ========== */

/* Grille de galerie 4 colonnes */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}

/* Items de galerie */
.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease;
    cursor: pointer;
    outline: none;
}

.gallery-item:hover,
.gallery-item:focus {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.gallery-image-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-image {
    transform: scale(1.05);
}

/* ========== OVERLAY ET INFORMATIONS ========== */

/* Overlay d'information */
.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(25,25,25,0.9));
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1rem;
}

.gallery-item:hover .image-overlay,
.gallery-item:focus .image-overlay {
    opacity: 1;
}

.image-info {
    color: white;
    text-align: center;
    width: 100%;
}

.image-info h5 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
    line-height: 1.2;
}

.image-info p {
    margin: 0 0 0.25rem 0;
    font-size: 0.8rem;
    opacity: 0.9;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

.image-number {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(0,0,0,0.3);
    border-radius: 1rem;
    display: inline-block;
}

/* ========== EFFET DE BRILLANCE ========== */

/* Effet de brillance au hover */
.gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 45%, rgba(255,255,255,0.1) 50%, transparent 55%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 2;
}

.gallery-item:hover::before {
    opacity: 1;
}

/* ========== MODAL ET DIAPORAMA ========== */

/* Forcer le body à être noir quand le modal est ouvert */
body:has(.modal[style*="block"]) {
    background: #000000 !important;
    overflow: hidden;
}

/* Modal principal */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: #000000 !important;
    background-color: #000000 !important;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Quand le modal est ouvert, cacher tous les éléments de navigation */
.modal[style*="block"] ~ *,
.modal[style*="block"] ~ * *,
body:has(.modal[style*="block"]) nav,
body:has(.modal[style*="block"]) .navbar,
body:has(.modal[style*="block"]) header nav {
    z-index: 1 !important;
}

.modal-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    background: transparent;
}

/* Slides */
.mySlides {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease-in-out;
    background: transparent;
    margin: 0;
    padding: 0;
}

/* S'assurer que les slides visibles utilisent flex correctement */
.mySlides[style*="block"] {
    display: flex !important;
}

.modal-image {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

/* Bouton de fermeture */
.close {
    position: fixed;
    top: 20px;
    right: 30px;
    color: #ffffff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10002;
    transition: color 0.3s ease;
    background: rgba(0,0,0,0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
}

/* ========== NAVIGATION ========== */

/* Boutons de navigation */
.prev, .next {
    cursor: pointer;
    position: fixed;
    top: 50%;
    width: auto;
    margin-top: -22px;
    padding: 16px 20px;
    color: white;
    font-weight: bold;
    font-size: 24px;
    background: rgba(0,0,0,0.7);
    border: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    user-select: none;
    z-index: 10002;
    backdrop-filter: blur(5px);
}

.prev {
    left: 20px;
}

.next {
    right: 20px;
}

.prev:hover, .next:hover {
    background: rgba(0,0,0,0.8);
    transform: scale(1.1);
}

.prev:focus, .next:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* ========== ÉLÉMENTS D'INFORMATION ========== */

/* Compteur d'images */
.numbertext {
    color: #f2f2f2;
    font-size: 14px;
    padding: 8px 12px;
    position: absolute;
    top: 0;
    left: 0;
    background: rgba(0,0,0,0.6);
    border-radius: 0 0 8px 0;
}

/* Légende d'image */
.image-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(25,25,25,0.9));
    color: white;
    padding: 2rem 1rem 1rem;
    text-align: center;
}

.image-caption h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
}

.image-caption p {
    margin: 0;
    opacity: 0.9;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

/* ========== AIDE DE NAVIGATION ========== */

/* Aide de navigation */
.navigation-help {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.8);
    text-align: center;
    background: rgba(0,0,0,0.3);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

.navigation-help small {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.keyboard-shortcut {
    background: rgba(255,255,255,0.2);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.75rem;
}

/* ========== ACCESSIBILITÉ ========== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ========== STYLES POUR LE TEXTE DESCRIPTIF ========== */

/* Style pour le texte descriptif */
.lead p {
    margin-bottom: 1.5rem;
    line-height: 1.7;
    color: #495057;
    font-size: 1.1rem;
}

.lead p:last-child {
    font-style: italic;
    color: #343a40;
    border-left: 4px solid #007bff;
    padding-left: 1rem;
    margin-left: 1rem;
}

/* ========== RESPONSIVE DESIGN ========== */

/* Responsive pour tablettes (1024px et moins) */
@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
}

/* Responsive pour petites tablettes (768px et moins) */
@media (max-width: 768px) {
    .gallery-container {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .image-overlay {
        opacity: 1;
        background: linear-gradient(to bottom, transparent 30%, rgba(25,25,25,0.8));
    }
    
    .image-info h5 {
        font-size: 0.9rem;
    }
    
    .image-info p {
        font-size: 0.75rem;
    }
    
    .image-number {
        font-size: 0.7rem;
    }
    
    .navigation-help {
        display: none;
    }
    
    .gallery-item:hover {
        transform: none;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }
    
    .lead p {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .lead p:last-child {
        margin-left: 0;
        padding-left: 0.75rem;
    }
}

/* Responsive pour mobile (480px et moins) */
@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .gallery-item {
        aspect-ratio: 4/3;
    }
    
    .close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }
    
    .prev, .next {
        padding: 12px;
        font-size: 20px;
    }
}

/* ========== PROTECTION ANTI-COPIE ========== */

/* Désactiver la sélection et le glisser-déposer sur toutes les images protégées */
.protected-image {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto;
}

/* Empêcher la sélection sur les conteneurs d'images */
.gallery-image-container,
.modal-content {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Overlay invisible pour bloquer le clic droit sur les images de galerie */
.gallery-image-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    pointer-events: auto;
    z-index: 1;
}

/* Masquer les options du navigateur sur les images */
.protected-image::selection {
    background: transparent;
}

.protected-image::-moz-selection {
    background: transparent;
}

/* CSS pour empêcher l'impression spécifique aux images */
@media print {
    .protected-image {
        display: none !important;
    }
    
    .gallery-container::after {
        content: "Ces images sont protégées et ne peuvent pas être imprimées.";
        font-size: 16px;
        color: #666;
        text-align: center;
        display: block;
        padding: 2rem;
    }
}

/* Désactiver le glisser-déposer sur Firefox */
.protected-image[draggable="false"] {
    -moz-user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

/* Protection contre les outils de développement (cache les images quand les DevTools sont ouverts) */
@media screen and (max-width: 1px) {
    .protected-image {
        opacity: 0.1;
        filter: blur(10px);
    }
}