/* ===== GALERIE PHOTO - DESIGN ULTRA MODERNE 2026 ===== */
/* ===== PREMIÈRE PHOTO AUTO, LES AUTRES AU SCROLL ===== */

/* Variables - Palette épurée */
:root {
    --primary: #0066ff;
    --primary-light: #3385ff;
    --primary-dark: #0044cc;
    --accent: #00e5ff;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --bg-glass: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 30px 60px -15px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 40px rgba(0, 102, 255, 0.3);
    --transition-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ===== ANIMATION D'ENTRÉE SPECTACULAIRE ===== */
@keyframes flyInFromBottom {
    0% {
        opacity: 0;
        transform: translateZ(-200px) translateY(100px) rotateX(-10deg);
        filter: blur(10px);
    }
    40% {
        opacity: 0.5;
        filter: blur(5px);
    }
    100% {
        opacity: 1;
        transform: translateZ(0) translateY(0) rotateX(0);
        filter: blur(0);
    }
}

@keyframes flyInFromLeft {
    0% {
        opacity: 0;
        transform: translateX(-150px) translateZ(-100px) rotateY(15deg);
        filter: blur(8px);
    }
    100% {
        opacity: 1;
        transform: translateX(0) translateZ(0) rotateY(0);
        filter: blur(0);
    }
}

@keyframes flyInFromRight {
    0% {
        opacity: 0;
        transform: translateX(150px) translateZ(-100px) rotateY(-15deg);
        filter: blur(8px);
    }
    100% {
        opacity: 1;
        transform: translateX(0) translateZ(0) rotateY(0);
        filter: blur(0);
    }
}

@keyframes textReveal {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== ÉTAT INITIAL : TOUT EST CACHÉ SAUF LA PREMIÈRE ===== */
.photo-card {
    margin-bottom: 100px;
    opacity: 0;
    visibility: hidden;
    position: relative;
    perspective: 1000px;
    background: transparent !important;
    border: none !important;
    border-bottom: 1px solid var(--border-light) !important;
    padding: 0 0 3rem 0;
}

.photo-card:last-child {
    border-bottom: none !important;
    margin-bottom: 0;
}

/* La première photo est visible immédiatement */
.photo-card:first-of-type {
    opacity: 1;
    visibility: visible;
    animation: flyInFromBottom 0.8s var(--transition-smooth) forwards;
}

/* Les autres photos deviennent visibles quand on scroll */
.photo-card.visible {
    opacity: 1;
    visibility: visible;
}

/* Alternance des animations pour les photos au scroll */
.photo-card.visible:nth-of-type(odd):not(:first-of-type) {
    animation: flyInFromLeft 0.8s var(--transition-smooth) forwards;
}

.photo-card.visible:nth-of-type(even):not(:first-of-type) {
    animation: flyInFromRight 0.8s var(--transition-smooth) forwards;
}

/* Animations des éléments enfants */
.photo-card .photo-date,
.photo-card .entry-title,
.photo-card .metadata-item,
.photo-card .entry-description {
    opacity: 0;
}

/* Première photo : animations des enfants */
.photo-card:first-of-type .photo-date {
    animation: textReveal 0.6s var(--transition-smooth) forwards;
    animation-delay: 0.2s;
}

.photo-card:first-of-type .entry-title {
    animation: textReveal 0.6s var(--transition-smooth) forwards;
    animation-delay: 0.3s;
}

.photo-card:first-of-type .metadata-item:nth-child(1) {
    animation: textReveal 0.5s var(--transition-smooth) forwards;
    animation-delay: 0.4s;
}

.photo-card:first-of-type .metadata-item:nth-child(2) {
    animation: textReveal 0.5s var(--transition-smooth) forwards;
    animation-delay: 0.45s;
}

.photo-card:first-of-type .metadata-item:nth-child(3) {
    animation: textReveal 0.5s var(--transition-smooth) forwards;
    animation-delay: 0.5s;
}

.photo-card:first-of-type .entry-description {
    animation: textReveal 0.6s var(--transition-smooth) forwards;
    animation-delay: 0.5s;
}

/* Photos au scroll : animations des enfants */
.photo-card.visible .photo-date {
    animation: textReveal 0.6s var(--transition-smooth) forwards;
    animation-delay: 0.2s;
}

.photo-card.visible .entry-title {
    animation: textReveal 0.6s var(--transition-smooth) forwards;
    animation-delay: 0.3s;
}

.photo-card.visible .metadata-item:nth-child(1) {
    animation: textReveal 0.5s var(--transition-smooth) forwards;
    animation-delay: 0.4s;
}

.photo-card.visible .metadata-item:nth-child(2) {
    animation: textReveal 0.5s var(--transition-smooth) forwards;
    animation-delay: 0.45s;
}

.photo-card.visible .metadata-item:nth-child(3) {
    animation: textReveal 0.5s var(--transition-smooth) forwards;
    animation-delay: 0.5s;
}

.photo-card.visible .entry-description {
    animation: textReveal 0.6s var(--transition-smooth) forwards;
    animation-delay: 0.5s;
}

/* ===== LAYOUT - CORRIGÉ POUR L'ALTERNANCE ===== */
.photo-card .row {
    align-items: center;
    margin: 0;
    flex-direction: row;
}

.photo-card.image-right .row {
    flex-direction: row-reverse !important;
}

/* ===== CONTAINER IMAGE ===== */
.photo-thumbnail-container {
    position: relative;
    cursor: pointer;
    padding: 0 1rem;
    transform-style: preserve-3d;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.thumbnail-wrapper {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 24px;
    overflow: hidden;
    background: transparent;
    border: none;
    box-shadow: var(--shadow-lg);
    transition: all 0.4s var(--transition-smooth);
    transform-style: preserve-3d;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.photo-card:hover .thumbnail-wrapper {
    transform: translateZ(20px) scale(1.01);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s var(--transition-smooth);
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: auto;
}

.photo-card:hover .thumbnail-wrapper img {
    transform: scale(1.05);
}

/* Overlay loupe */
.thumbnail-wrapper::after {
    content: "🔍";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 102, 255, 0.4);
    z-index: 2;
}

.photo-card:hover .thumbnail-wrapper::after {
    opacity: 1;
}

/* Badge date sur l'image */
.photo-badge {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    color: white;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    z-index: 3;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ===== CONTENU TEXTE CONDENSÉ ===== */
.photo-content-wrapper {
    padding: 15px 0 15px 30px;
    height: 100%;
    display: flex;
    flex-direction: column;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.photo-card.image-right .photo-content-wrapper {
    padding: 15px 30px 15px 0;
}

@media (max-width: 992px) {
    .photo-content-wrapper,
    .photo-card.image-right .photo-content-wrapper {
        padding: 25px 0 0 0;
    }
}

/* Date */
.photo-date {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--primary);
    margin-bottom: 10px;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Titre */
.entry-title {
    font-weight: 800;
    margin-bottom: 12px;
    font-size: 2.2rem;
    line-height: 1.2;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

@media (max-width: 768px) {
    .entry-title {
        font-size: 1.8rem;
    }
}

/* Métadonnées compactes */
.metadata-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px 25px;
    margin: 10px 0 12px;
}

.metadata-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.metadata-item i {
    font-size: 1.1rem;
    color: var(--primary);
}

.metadata-item:hover {
    color: var(--primary);
}

/* Description condensée */
.entry-description {
    margin: 8px 0 12px;
    padding: 14px 18px;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 0.9rem;
    border: 1px solid var(--border-light);
    max-height: 120px;
    overflow-y: auto;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Scrollbar stylisée */
.entry-description::-webkit-scrollbar {
    width: 4px;
}

.entry-description::-webkit-scrollbar-track {
    background: transparent;
}

.entry-description::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

/* ===== LIGHTBOX ===== */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.96);
    backdrop-filter: blur(20px);
    display: none;
    place-items: center;
    padding: 4vh 4vw;
    z-index: 9999;
}

.lightbox.active {
    display: grid;
}

.lightbox-content {
    width: 100%;
    max-width: 1400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-img {
    width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 20px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: auto;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.lightbox-close {
    position: absolute;
    top: 25px;
    right: 30px;
    font-size: 2.5rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    backdrop-filter: blur(10px);
    color: white;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    z-index: 10000;
}

.lightbox-close:hover {
    opacity: 1;
    transform: rotate(90deg);
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    backdrop-filter: blur(10px);
    color: white;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    z-index: 10000;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev { left: 25px; }
.lightbox-next { right: 25px; }

/* ===== MODE NUIT ===== */
[data-bs-theme="dark"] {
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --bg-glass: rgba(255, 255, 255, 0.03);
    --border-light: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .entry-title {
    background: linear-gradient(135deg, #ffffff 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

[data-bs-theme="dark"] .entry-description {
    background: rgba(20, 20, 30, 0.6);
}

[data-bs-theme="dark"] .thumbnail-wrapper {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

/* ===== PROTECTION CONTRE LE TÉLÉCHARGEMENT - RENFORCÉE ===== */
.photo-thumbnail {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: auto;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 992px) {
    .photo-card {
        margin-bottom: 70px;
    }
}

@media (max-width: 768px) {
    .photo-card {
        margin-bottom: 50px;
        padding-bottom: 2rem;
    }
    
    .photo-card .row,
    .photo-card.image-right .row {
        flex-direction: column !important;
    }
    
    .photo-thumbnail-container {
        padding: 0 0.5rem;
        margin-bottom: 20px;
        width: 100%;
    }
    
    .thumbnail-wrapper {
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
    }
    
    .photo-content-wrapper {
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
        text-align: left;
    }
    
    .entry-title {
        font-size: 1.6rem;
    }
    
    .metadata-grid {
        gap: 12px;
    }
    
    .entry-description {
        padding: 12px;
        font-size: 0.85rem;
    }
    
    .thumbnail-wrapper::after {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .lightbox-prev,
    .lightbox-next {
        width: 45px;
        height: 45px;
        font-size: 2rem;
    }
    
    .lightbox-prev { left: 15px; }
    .lightbox-next { right: 15px; }
    
    .lightbox-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .entry-title {
        font-size: 1.4rem;
    }
    
    .photo-badge {
        bottom: 10px;
        left: 10px;
        padding: 4px 10px;
        font-size: 0.65rem;
    }
}