/* ═══════════════════════════════════════════════════
   gallery.css — específico de gallery.html (desktop)
   Requiere shared.css cargado antes
   Responsive en gallery-mobile.css
   ═══════════════════════════════════════════════════ */

body {
    min-height: 100dvh;
}

/* ── Layout ────────────────────────────────────────── */
.layout {
    min-height: calc(100dvh - var(--header-h) - var(--footer-h));
}

/* ── Main ──────────────────────────────────────────── */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 2.5rem 3rem;
    margin-left: calc(-1 * var(--sidebar-collapsed));
    transition: margin-left var(--transition);
}

body:not(.sidebar-closed) main {
    margin-left: calc(-1 * var(--sidebar-w));
}

/* ── Filtros ───────────────────────────────────────── */
.gallery-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.8rem;
    flex-wrap: wrap;
}
 
.filter-btn {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    background: transparent;
    border: 1.5px solid rgba(42, 42, 42, 0.25);
    border-radius: 2px;
    padding: 0.35rem 1rem;
    cursor: pointer;
    color: var(--text);
    opacity: 0.55;
    transition: opacity 0.2s, border-color 0.2s, background 0.2s;
}
 
.filter-btn:hover {
    opacity: 0.85;
    border-color: rgba(42, 42, 42, 0.5);
}
 
.filter-btn.active {
    opacity: 1;
    background: #0f201b;
    color: #39ff8a;
    border-color: #0f201b;
}

/* ── Grid — 3 columnas ────────────────────────────── */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-width: 732px;
    margin: 0 auto;
    width: 100%;
}

/* ── Items ─────────────────────────────────────────── */
.gallery-item {
    break-inside: avoid;
    display: inline-block;
    width: 100%;
    margin-bottom: 6px;
    border-radius: 2px;
    overflow: hidden;
    background: #d6e0db;
    cursor: zoom-in;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.gallery-item-inner {
    position: relative;
    width: 100%;
    overflow: hidden;
    line-height: 0;
}

.gallery-item img {
    width: 100%;
    display: block;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.04);
}

/* ── Illustrations: filas flex con orientación ─────── */
.gallery-grid.illustration-view {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 732px;
    margin: 0 auto;
    width: 100%;
}
.illustration-row {
    display: flex;
    gap: 6px;
}
.illustration-row .gallery-item {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}
.illustration-row .gallery-item.landscape {
    flex: 2;
}
.illustration-row .gallery-item-inner {
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.illustration-row .gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Overlay con título ────────────────────────────── */
.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15, 32, 27, 0.82) 0%, transparent 55%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1rem 1.1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    font-style: italic;
    color: #fff;
    letter-spacing: 0.04em;
    line-height: 1.2;
}

.gallery-item-tag {
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #39ff8a;
    margin-top: 0.25rem;
}

/* ── Lightbox ──────────────────────────────────────── */
#lightbox {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
    cursor: zoom-out;
    touch-action: none;
}

#lightbox.active {
    opacity: 1;
    pointer-events: all;
}

#lightbox-img {
    max-width: 88vw;
    max-height: 88dvh;
    object-fit: contain;
    border-radius: 2px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7);
    cursor: default;
    transform: scale(0.95);
    transition: transform 0.28s cubic-bezier(0.34, 1.3, 0.64, 1), opacity 0.12s ease;
}

#lightbox.active #lightbox-img {
    transform: scale(1);
}

.lightbox-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 1000;
    user-select: none;
}

.lightbox-arrow:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.08);
}

.lightbox-arrow img {
    width: 26px;
    height: 26px;
    filter: brightness(0) invert(1);
}

#lightbox-prev { left: 1.5rem; }
#lightbox-next { right: 1.5rem; }

.lightbox-close {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: background 0.2s, transform 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.08);
}

@media (max-width: 480px) {
    .lightbox-close {
        top: 0.75rem;
        right: 0.75rem;
        width: 36px;
        height: 36px;
    }
}