:root {
    --bg-color: #0c0c0c;
    --text-color: #ffffff;
    --muted-color: #888888;
    --accent-color: #ffffff;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Work Sans', sans-serif;
}

body, html {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    user-select: none;
    -webkit-user-select: none;
    /* Ocultar cursor nativo en desktop */
    cursor: none; 
    overflow-x: hidden;
}

/* Forzar que enlaces y botones tampoco tengan el cursor nativo */
a, button, img {
    cursor: none !important;
}

/* === 3. TEXTURA DE CINE (FILM GRAIN) === */
.grain {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 50;
    opacity: 0.04;
    background: url('data:image/svg+xml;utf8,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)"/%3E%3C/svg%3E');
}

/* === 2. CURSOR PERSONALIZADO === */
.cursor {
    position: fixed;
    top: 0; left: 0;
    width: 10px;
    height: 10px;
    background-color: var(--accent-color);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10010; /* Mayor al lightbox */
    transform: translate(-50%, -50%);
    transition: width 0.3s cubic-bezier(0.25, 1, 0.5, 1), height 0.3s cubic-bezier(0.25, 1, 0.5, 1), background-color 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    mix-blend-mode: difference; /* Efecto premium donde invierte los colores de lo que está detrás */
}

.cursor .cursor-text {
    opacity: 0;
    color: black;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    transition: opacity 0.3s ease;
}

/* Estado del cursor cuando pasa por una foto */
.cursor.hover-img {
    width: 35px;
    height: 35px;
    background-color: rgba(255, 255, 255, 1);
    mix-blend-mode: difference;
}

.cursor.hover-img .cursor-text {
    display: none;
}

/* Ocultar custom cursor en celulares */
@media (max-width: 768px) {
    body, html, a, button, img { cursor: auto !important; }
    .cursor { display: none !important; }
}

/* === HEADER === */
header {
    text-align: center;
    padding: 8rem 1rem 4rem 1rem;
    position: relative;
    z-index: 60;
}

header h1 {
    font-family: var(--font-heading);
    margin: 0;
    font-size: 3.5rem;
    font-weight: 400;
    letter-spacing: 3px;
}

header h1 .separator {
    color: var(--muted-color);
    font-weight: 300;
    margin: 0 15px;
}

header p {
    color: var(--muted-color);
    margin-top: 1.5rem;
    font-size: 1.1rem;
    font-weight: 300;
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* === FILTROS Y DESPLEGABLE === */
.filter-wrapper {
    margin-top: 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.filter-toggle {
    background: transparent;
    border: none;
    color: var(--muted-color);
    font-family: var(--font-body);
    font-size: 0.65rem; /* Más discreto */
    letter-spacing: 5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.4s ease, opacity 0.4s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.2rem 0.5rem;
    opacity: 0.8;
}

.filter-toggle:hover { 
    color: var(--text-color); 
    opacity: 1;
}

.toggle-icon {
    font-size: 1rem;
    font-weight: 300;
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.filter-toggle.open .toggle-icon {
    transform: rotate(45deg);
}

.filters-container {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    /* Efecto suave al abrir/cerrar */
    max-height: 500px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.7s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.5s ease, margin-top 0.5s ease;
}

.filters-container.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    pointer-events: none;
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--muted-color);
    padding: 0.3rem 0.8rem;
    font-family: var(--font-body);
    font-size: 0.7rem; /* Botones más pequeños y elegantes */
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: color 0.4s ease;
    position: relative;
}

.filter-btn::after {
    content: '';
    position: absolute;
    bottom: 0; left: 50%;
    width: 0; height: 1px;
    background-color: var(--text-color);
    transition: all 0.4s ease;
    transform: translateX(-50%);
}

.filter-btn:hover { color: var(--text-color); }
.filter-btn:hover::after { width: 100%; }
.filter-btn.active { color: var(--text-color); }
.filter-btn.active::after { width: 100%; }

/* === GALERÍA Y BLUR-UP LOADER === */
main {
    padding: 0 4vw 6rem 4vw;
    max-width: 1800px;
    margin: 0 auto;
    position: relative;
    z-index: 60;
}

.gallery {
    column-count: 3;
    column-gap: 3vw;
}

@media (max-width: 1200px) { .gallery { column-count: 3; } }
@media (max-width: 900px) { .gallery { column-count: 2; column-gap: 3vw; } }
@media (max-width: 600px) { .gallery { column-count: 1; } }

.gallery-item {
    break-inside: avoid;
    margin-bottom: 3vw;
    overflow: hidden;
    background-color: #111;
    position: relative;
    -webkit-user-drag: none; 
}

/* Capa transparente arriba para proteger la imagen de descargas */
.gallery-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10;
}

.gallery-item img {
    width: 100%;
    display: block;
    /* 4. BLUR UP LOADER INICIAL */
    filter: blur(20px);
    transform: scale(1.1);
    opacity: 0;
    transition: filter 1.2s ease, opacity 1.2s ease, transform 1.2s ease;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
}

/* Cuando JS le agrega la clase .loaded, se enfoca */
.gallery-item img.loaded {
    filter: blur(0);
    transform: scale(1);
    opacity: 1;
}

.gallery-item:hover img.loaded {
    transform: scale(1.04);
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* === 1. ANIMACIONES DE APARICIÓN (REVEAL) === */
.reveal {
    opacity: 0;
    transform: translateY(60px);
    transition: opacity 1s cubic-bezier(0.25, 1, 0.5, 1), transform 1s cubic-bezier(0.25, 1, 0.5, 1);
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-text {
    opacity: 0;
    transform: translateY(30px);
    transition: all 1s cubic-bezier(0.25, 1, 0.5, 1);
}
.reveal-text.active {
    opacity: 1;
    transform: translateY(0);
}
.delay-1 { transition-delay: 0.2s; }
.delay-2 { transition-delay: 0.4s; }

/* === SPINNER LOADER ELEGANTE === */
.loader {
    display: flex;
    justify-content: center;
    padding: 5rem 0;
}
.spinner {
    width: 40px; height: 40px;
    border: 1px solid rgba(255,255,255,0.05);
    border-top-color: var(--muted-color);
    border-radius: 50%;
    animation: spin 1s infinite cubic-bezier(0.6, 0.2, 0.4, 0.8);
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
.error { color: #e74c3c; text-align: center; padding: 2rem; font-family: monospace; }

/* === LIGHTBOX === */
.lightbox {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(8, 8, 8, 0.98);
    display: flex; justify-content: center; align-items: center;
    z-index: 10000;
    opacity: 0; pointer-events: none;
    transition: opacity 0.5s ease;
    backdrop-filter: blur(15px);
}
.lightbox:not(.hidden) { opacity: 1; pointer-events: auto; }
.lightbox-content { display: flex; flex-direction: column; align-items: center; max-width: 90%; max-height: 90vh; }
.lightbox img {
    max-width: 100%; max-height: 85vh;
    object-fit: contain;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    -webkit-user-drag: none; -webkit-touch-callout: none;
}
.lightbox-caption {
    margin-top: 2.5rem; color: var(--text-color);
    font-size: 0.85rem; letter-spacing: 2px; text-transform: uppercase;
}
.close-btn {
    position: absolute; top: 40px; right: 50px;
    color: var(--muted-color); font-size: 40px; font-weight: 300;
    transition: color 0.3s, transform 0.3s; z-index: 1001;
}
.close-btn:hover { color: white; transform: rotate(90deg); }
