/* ==========================================
   VARIABLES & RESET
   ========================================== */

:root {
    --purple: #60519b;
    --dark: #31323c;
    --light: #bfc0d1;
    --bg: #1a1a24;
    --surface: #242430;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--light);
    position: relative;
}

/* Particules flottantes */
.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--purple);
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat 15s infinite ease-in-out;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 12s; }
.particle:nth-child(2) { left: 25%; animation-delay: 2s; animation-duration: 15s; }
.particle:nth-child(3) { left: 40%; animation-delay: 4s; animation-duration: 18s; }
.particle:nth-child(4) { left: 55%; animation-delay: 1s; animation-duration: 14s; }
.particle:nth-child(5) { left: 70%; animation-delay: 3s; animation-duration: 16s; }
.particle:nth-child(6) { left: 85%; animation-delay: 5s; animation-duration: 13s; }
.particle:nth-child(7) { left: 15%; animation-delay: 6s; animation-duration: 17s; }
.particle:nth-child(8) { left: 90%; animation-delay: 2.5s; animation-duration: 19s; }

@keyframes particleFloat {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    10% { opacity: 0.3; }
    90% { opacity: 0.3; }
    100% { transform: translateY(-100px) scale(1); opacity: 0; }
}

/* Grain texture */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 10;
}

/* Mesh gradient animé */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(96, 81, 155, 0.25) 0%, transparent 40%),
        radial-gradient(ellipse at 80% 80%, rgba(191, 192, 209, 0.15) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 50%, rgba(96, 81, 155, 0.2) 0%, transparent 50%);
    animation: meshMove 15s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes meshMove {
    0%, 100% { background-position: 0% 0%, 100% 100%, 50% 50%; opacity: 1; }
    50% { background-position: 20% 30%, 80% 70%, 60% 40%; opacity: 0.8; }
}

/* ==========================================
   LAYOUT
   ========================================== */

.container {
    height: 100vh;
    display: flex;
    position: relative;
    z-index: 1;
}

/* ==========================================
   SIDEBAR
   ========================================== */

.sidebar {
    width: 80px;
    background: rgba(36, 36, 48, 0.7);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(96, 81, 155, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 0;
    gap: 40px;
    position: relative;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, transparent 0%, var(--purple) 30%, var(--purple) 70%, transparent 100%);
    opacity: 0.6;
    animation: slideGlow 3s ease-in-out infinite;
}

@keyframes slideGlow {
    0%, 100% { opacity: 0.4; transform: translateY(0); }
    50% { opacity: 0.8; transform: translateY(20px); }
}

.back-link {
    font-size: 1.5rem;
    color: var(--light);
    text-decoration: none;
    transition: all 0.3s;
    opacity: 0.7;
}

.back-link:hover {
    opacity: 1;
    transform: translateX(-5px);
    color: var(--purple);
}

.divider {
    width: 30px;
    height: 1px;
    background: rgba(96, 81, 155, 0.3);
}

.year {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--purple);
    letter-spacing: 0.1em;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    text-transform: uppercase;
}

/* ==========================================
   MAIN
   ========================================== */

.main {
    flex: 1;
    padding: 40px 60px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* ==========================================
   HEADER
   ========================================== */

.header {
    margin-bottom: 40px;
    animation: fadeIn 0.8s ease-out;
    flex-shrink: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    gap: 40px;
}

.header-text {
    flex: 1;
}

.page-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 15px;
    background: linear-gradient(135deg, var(--light) 0%, var(--purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-description {
    font-size: 1.1rem;
    color: var(--light);
    opacity: 0.7;
    line-height: 1.6;
    max-width: 500px;
}

/* Stats */
.stats {
    display: flex;
    align-items: center;
    gap: 25px;
    background: rgba(36, 36, 48, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(96, 81, 155, 0.3);
    border-radius: 16px;
    padding: 20px 30px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-number {
    font-size: 2rem;
    font-weight: 900;
    color: var(--purple);
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--light);
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: rgba(96, 81, 155, 0.3);
}

/* Filtres */
.filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 12px 24px;
    background: rgba(36, 36, 48, 0.6);
    border: 1px solid rgba(96, 81, 155, 0.3);
    border-radius: 30px;
    color: var(--light);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: capitalize;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(96, 81, 155, 0.2), transparent);
    transition: left 0.5s;
}

.filter-btn:hover::before {
    left: 100%;
}

.filter-icon {
    font-size: 0.6rem;
    transition: transform 0.3s;
}

.filter-btn:hover {
    border-color: var(--purple);
    background: rgba(96, 81, 155, 0.2);
    transform: translateY(-2px);
}

.filter-btn:hover .filter-icon {
    transform: scale(1.3);
}

.filter-btn.active {
    background: var(--purple);
    border-color: var(--purple);
    color: var(--light);
    box-shadow: 0 5px 20px rgba(96, 81, 155, 0.3);
}

.filter-btn.active .filter-icon {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==========================================
   GALERIE
   ========================================== */

.gallery {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Layout asymétrique */
.gallery-item:nth-child(1) {
    grid-column: span 8;
}

.gallery-item:nth-child(2) {
    grid-column: span 4;
}

.gallery-item:nth-child(3) {
    grid-column: span 4;
}

.gallery-item:nth-child(4) {
    grid-column: span 8;
}

.gallery-item:nth-child(5) {
    grid-column: span 6;
}

.gallery-item:nth-child(6) {
    grid-column: span 6;
}

/* Projets suivants en 6 colonnes */
.gallery-item:nth-child(n+7) {
    grid-column: span 6;
}

.gallery-item {
    position: relative;
    background: rgba(36, 36, 48, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(96, 81, 155, 0.3);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    cursor: pointer;
}

.gallery-item::before {
    content: attr(data-index);
    position: absolute;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: rgba(26, 26, 36, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(96, 81, 155, 0.4);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--purple);
    z-index: 3;
    transition: all 0.3s;
}

.gallery-item.hide {
    display: none;
}

.gallery-item:hover {
    transform: translateY(-8px);
    border-color: var(--purple);
    box-shadow: 
        0 25px 60px rgba(96, 81, 155, 0.5),
        0 0 0 1px rgba(96, 81, 155, 0.3);
}

.gallery-item:hover::before {
    background: var(--purple);
    color: var(--light);
    transform: scale(1.1);
}

/* Carrousel */
.gallery-carousel {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.carousel-images {
    width: 100%;
    height: 100%;
    position: relative;
}

.carousel-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.4s;
}

.carousel-image.active {
    opacity: 1;
}

.gallery-item:hover .carousel-image.active {
    transform: scale(1.1);
}

/* Boutons du carrousel */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(96, 81, 155, 0.8);
    border: none;
    color: var(--light);
    font-size: 1.5rem;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s;
    z-index: 10;
}

.carousel-btn:hover {
    background: var(--purple);
    transform: translateY(-50%) scale(1.1);
}

.carousel-btn.prev {
    left: 8px;
}

.carousel-btn.next {
    right: 8px;
}

.gallery-item:hover .carousel-btn {
    opacity: 1;
}

/* Masquer les boutons si une seule image */
.gallery-carousel:has(.carousel-images img:only-child) .carousel-btn {
    display: none;
}

/* Indicateurs */
.carousel-indicators {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.indicator {
    width: 8px;
    height: 8px;
    background: rgba(191, 192, 209, 0.5);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

.indicator.active {
    background: var(--purple);
    transform: scale(1.3);
}

.indicator:hover {
    background: var(--light);
}

/* Masquer les indicateurs si une seule image */
.gallery-carousel:has(.carousel-images img:only-child) .carousel-indicators {
    display: none;
}

.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px;
    background: linear-gradient(to top, rgba(26, 26, 36, 0.95) 0%, rgba(26, 26, 36, 0.8) 60%, transparent 100%);
    opacity: 0;
    transition: opacity 0.4s;
    z-index: 5;
}

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

.gallery-overlay h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--light);
    margin-bottom: 8px;
}

.gallery-overlay p {
    font-size: 1rem;
    color: var(--light);
    opacity: 0.8;
    line-height: 1.5;
}

/* ==========================================
   LIGHTBOX
   ========================================== */

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 36, 0.7);
    backdrop-filter: blur(20px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    animation: lightboxFadeIn 0.4s ease;
}

@keyframes lightboxFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    animation: lightboxZoomIn 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes lightboxZoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 
        0 30px 100px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(96, 81, 155, 0.3);
    transition: transform 0.3s ease;
}

.lightbox-caption {
    text-align: center;
    max-width: 600px;
    animation: lightboxSlideUp 0.5s ease 0.1s backwards;
}

@keyframes lightboxSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lightbox-caption h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--light);
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.lightbox-caption p {
    font-size: 1.1rem;
    color: var(--light);
    opacity: 0.8;
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.lightbox-counter {
    display: inline-block;
    padding: 10px 20px;
    background: rgba(96, 81, 155, 0.4);
    border: 1px solid rgba(96, 81, 155, 0.6);
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--light);
    backdrop-filter: blur(10px);
}

.lightbox-close {
    position: absolute;
    top: 25px;
    right: 25px;
    background: transparent;
    border: none;
    color: var(--light);
    font-size: 2rem;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.lightbox-close:hover {
    opacity: 1;
    color: var(--purple);
    transform: scale(1.2);
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--light);
    font-size: 3rem;
    width: 80px;
    height: 80px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0.5;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    opacity: 1;
    color: var(--purple);
    transform: translateY(-50%) scale(1.2);
}

.lightbox-prev:active,
.lightbox-next:active {
    transform: translateY(-50%) scale(1);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* Masquer les boutons lightbox si une seule image */
.lightbox.single-image .lightbox-prev,
.lightbox.single-image .lightbox-next {
    display: none;
}

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

@media (max-width: 1024px) {
    .gallery {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .gallery-item:nth-child(1),
    .gallery-item:nth-child(2),
    .gallery-item:nth-child(3),
    .gallery-item:nth-child(4),
    .gallery-item:nth-child(5),
    .gallery-item:nth-child(6),
    .gallery-item:nth-child(n+7) {
        grid-column: span 6;
    }
}

@media (max-width: 768px) {
    .main {
        padding: 30px 40px;
    }
    
    .sidebar {
        width: 60px;
        padding: 30px 0;
    }
    
    .header-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .stats {
        width: 100%;
        justify-content: center;
    }
    
    .gallery {
        grid-template-columns: 1fr;
    }
    
    .gallery-item:nth-child(1),
    .gallery-item:nth-child(2),
    .gallery-item:nth-child(3),
    .gallery-item:nth-child(4),
    .gallery-item:nth-child(5),
    .gallery-item:nth-child(6),
    .gallery-item:nth-child(n+7) {
        grid-column: span 1;
    }
    
    .lightbox-close {
        top: 15px;
        right: 15px;
        font-size: 1.5rem;
        width: 35px;
        height: 35px;
    }
    
    .lightbox-prev,
    .lightbox-next {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-content img {
        max-height: 70vh;
    }
}
