/* ============================================
   Webvia Logo Gallery — frontend
   Estética GRANA: claro, editorial, acento #3d2817, Manrope
   Prefijo: wvlg-
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700&display=swap');

.wvlg-wrap {
    width: 100%;
    margin: 0 auto;
    font-family: 'Manrope', system-ui, -apple-system, sans-serif;
    color: #3d2817;
}

/* ---------- Filtros ----------
 * Layout: "Todos" a la izquierda en posición absoluta,
 * logos centrados respecto al wrap completo (no respecto al espacio restante).
 */
.wvlg-filters {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 48px;
    padding-bottom: 32px;
    border-bottom: 1px solid rgba(61, 40, 23, 0.12);
    min-height: 72px;
}

/*
 * NOTA — reset.css del theme:
 * El theme aplica border 1px solid #c36 y color #c36 (bordó) a TODOS los <button>.
 * Por eso TODAS las propiedades visuales de los botones del plugin van con !important.
 * No tocar este blindaje sin antes verificar que el reset del theme cambió.
 */
.wvlg-filter {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    cursor: pointer;
    font-family: 'Manrope', system-ui, sans-serif !important;
    color: #3d2817 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transition: opacity 0.3s ease, transform 0.25s ease, background 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
    letter-spacing: normal !important;
    min-width: 0 !important;
    min-height: 0 !important;
    width: auto !important;
    height: auto !important;
}

.wvlg-filter:focus-visible {
    outline: 2px solid #3d2817 !important;
    outline-offset: 4px;
}

/* Botón "Todos" — absoluto a la izquierda, no afecta el centrado de los logos */
.wvlg-filter--all {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem !important;
    font-weight: 500 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.12em !important;
    padding: 8px 16px !important;
    border: 1px solid rgba(61, 40, 23, 0.3) !important;
    border-radius: 999px !important;
    background: transparent !important;
    color: #3d2817 !important;
    opacity: 0.6;
    line-height: 1 !important;
    margin-top: -16px; /* compensa el padding-bottom de .wvlg-filters para centrar verticalmente con los logos */
}

.wvlg-filter--all:hover {
    opacity: 1;
    border-color: #3d2817 !important;
}

.wvlg-filter--all.is-active {
    opacity: 1;
    background: #3d2817 !important;
    color: #fdfbf7 !important;
    border-color: #3d2817 !important;
}

/* Contenedor de logos — centrado respecto al wrap */
.wvlg-filters-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 80px;
    flex-wrap: wrap;
}

/* Botones logo */
.wvlg-filter--logo {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.wvlg-filter--logo img {
    max-height: 72px;
    width: auto;
    display: block;
    filter: grayscale(100%);
    opacity: 0.5;
    transition: filter 0.3s ease, opacity 0.3s ease, transform 0.25s ease;
}

.wvlg-filter--logo:hover img {
    opacity: 0.85;
    transform: scale(1.04);
}

.wvlg-filter--logo.is-active img {
    filter: grayscale(0%);
    opacity: 1;
}

/* ---------- Grid ---------- */
.wvlg-grid {
    display: grid;
    grid-template-columns: repeat(var(--wvlg-cols, 4), 1fr);
    gap: 0;
}

.wvlg-item {
    margin: 0;
    overflow: hidden;
    background: #f7f3ec;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.wvlg-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    aspect-ratio: 4 / 3;
    transition: transform 0.5s ease;
}

.wvlg-item-link {
    display: block;
    width: 100%;
    height: 100%;
    cursor: zoom-in;
    text-decoration: none;
    color: inherit;
}

.wvlg-item:hover img {
    transform: scale(1.03);
}

.wvlg-item.is-hidden {
    opacity: 0;
    transform: scale(0.96);
    pointer-events: none;
    display: none;
}

.wvlg-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: rgba(61, 40, 23, 0.5);
    padding: 48px 20px;
    font-size: 0.95rem;
}

/* ============================================
   Lightbox
   ============================================ */
.wvlg-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(20, 12, 6, 0.92);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    padding: 40px 20px;
    box-sizing: border-box;
    font-family: 'Manrope', system-ui, sans-serif;
}

.wvlg-lightbox.is-open {
    display: flex;
    opacity: 1;
}

.wvlg-lb-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
}

.wvlg-lb-img {
    max-width: min(1400px, 92vw);
    max-height: 88vh;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

/* Botones del lightbox — blindados contra el reset.css #c36 del theme */
.wvlg-lb-close,
.wvlg-lb-prev,
.wvlg-lb-next {
    background: transparent !important;
    border: none !important;
    color: #fdfbf7 !important;
    cursor: pointer;
    padding: 12px !important;
    margin: 0 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    border-radius: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    width: auto !important;
    height: auto !important;
    line-height: 1 !important;
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.2s ease !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.wvlg-lb-close:hover,
.wvlg-lb-prev:hover,
.wvlg-lb-next:hover {
    opacity: 1;
}

.wvlg-lb-close {
    position: absolute !important;
    top: 16px;
    right: 16px;
    z-index: 2;
}

.wvlg-lb-prev,
.wvlg-lb-next {
    flex-shrink: 0;
    z-index: 2;
}

.wvlg-lb-prev:hover { transform: translateX(-2px); }
.wvlg-lb-next:hover { transform: translateX(2px); }

.wvlg-lb-prev svg,
.wvlg-lb-next svg,
.wvlg-lb-close svg {
    display: block;
}

@media (max-width: 600px) {
    .wvlg-lightbox {
        padding: 20px 8px;
    }
    .wvlg-lb-prev,
    .wvlg-lb-next {
        padding: 8px !important;
    }
    .wvlg-lb-prev svg,
    .wvlg-lb-next svg {
        width: 24px;
        height: 24px;
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .wvlg-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .wvlg-filters {
        margin-bottom: 32px;
        padding-bottom: 24px;
        min-height: 60px;
    }
    .wvlg-filters-logos {
        gap: 48px;
    }
    .wvlg-filter--logo img {
        max-height: 52px;
    }
}

@media (max-width: 600px) {
    /* En mobile el "Todos" pasa a fluir normal arriba, los logos abajo */
    .wvlg-filters {
        flex-direction: column;
        gap: 20px;
        min-height: 0;
    }
    .wvlg-filter--all {
        position: static;
        transform: none;
        margin-top: 0;
        align-self: flex-start;
        font-size: 0.65rem !important;
        padding: 6px 12px !important;
    }
    .wvlg-filters-logos {
        gap: 28px;
        width: 100%;
    }
    .wvlg-filter--logo img {
        max-height: 40px;
    }
    .wvlg-grid {
        grid-template-columns: 1fr;
    }
}
