/**
 * VFX Sobre Nós - Estilos do Frontend (Galeria por Setor + Lightbox)
 *
 * Carregado condicionalmente apenas em páginas que utilizam o shortcode
 * [vfx_sobrenos] para minimizar impacto em LCP/CLS.
 */

.vfx-sobrenos-root {
    --vfx-sobrenos-brand-color: #0959b8;
    --vfx-sobrenos-brand-color-overlay: #0959b866;
    --vfx-sobrenos-text-muted: #64748b;
    box-sizing: border-box;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 0;
    font-family: inherit;
}

.vfx-sobrenos-root *,
.vfx-sobrenos-root *::before,
.vfx-sobrenos-root *::after {
    box-sizing: border-box;
}

.vfx-sobrenos-root .vfx-sobrenos-gallery {
    width: 100%;
}

.vfx-sobrenos-root .vfx-sobrenos-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 32px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e2e8f0;
}

.vfx-sobrenos-root .vfx-sobrenos-tab-button {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: transparent;
    border: 0;
    border-radius: 8px 8px 0 0;
    color: var(--vfx-sobrenos-text-muted);
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.vfx-sobrenos-root .vfx-sobrenos-tab-button:hover,
.vfx-sobrenos-root .vfx-sobrenos-tab-button.vfx-sobrenos-is-active {
    color: var(--vfx-sobrenos-brand-color);
}

.vfx-sobrenos-root .vfx-sobrenos-tab-button:hover {
    background-color: #f1f5f9;
}

.vfx-sobrenos-root .vfx-sobrenos-tab-button.vfx-sobrenos-is-active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--vfx-sobrenos-brand-color);
    border-radius: 4px 4px 0 0;
}

.vfx-sobrenos-root .vfx-sobrenos-tab-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

.vfx-sobrenos-root .vfx-sobrenos-gallery-grid {
    position: relative;
    min-height: 200px;
    opacity: 1;
    transition: opacity 0.2s ease-out;
}

.vfx-sobrenos-root .vfx-sobrenos-gallery-grid.vfx-sobrenos-is-fading {
    opacity: 0;
}

.vfx-sobrenos-root .vfx-sobrenos-tab-panel {
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
    width: 100%;
}

.vfx-sobrenos-root .vfx-sobrenos-tab-panel.vfx-sobrenos-is-active {
    display: flex;
}

@keyframes vfxSobrenosSlideUpFade {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.vfx-sobrenos-root .vfx-sobrenos-gallery-item {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    cursor: pointer;
    opacity: 0;
    animation: vfxSobrenosSlideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: var(--vfx-sobrenos-anim-delay, 0ms);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

@media (min-width: 640px) {
    .vfx-sobrenos-root .vfx-sobrenos-gallery-item {
        width: calc(50% - 12px);
    }
}

@media (min-width: 1024px) {
    .vfx-sobrenos-root .vfx-sobrenos-gallery-item {
        width: calc(33.333% - 16px);
    }
}

.vfx-sobrenos-root .vfx-sobrenos-gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
}

.vfx-sobrenos-root .vfx-sobrenos-image-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    background-color: #e2e8f0;
    aspect-ratio: 4 / 3;
}

.vfx-sobrenos-root .vfx-sobrenos-gallery-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.vfx-sobrenos-root .vfx-sobrenos-gallery-item:hover .vfx-sobrenos-gallery-img {
    transform: scale(1.05);
}

.vfx-sobrenos-root .vfx-sobrenos-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--vfx-sobrenos-brand-color-overlay);
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.vfx-sobrenos-root .vfx-sobrenos-zoom-icon {
    width: 32px;
    height: 32px;
    color: #fff;
    filter: drop-shadow(0 2px 4px rgb(0 0 0 / 0.3));
}

.vfx-sobrenos-root .vfx-sobrenos-empty-message {
    width: 100%;
    padding: 48px;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    color: var(--vfx-sobrenos-text-muted);
    text-align: center;
    animation: vfxSobrenosSlideUpFade 0.5s ease forwards;
}

/*
 * Seletores do lightbox NÃO são escopados em `.vfx-sobrenos-root` de propósito:
 * o JS move o elemento `.vfx-sobrenos-lightbox` para ser filho direto de <body>
 * na inicialização, para escapar de contextos de empilhamento (stacking contexts)
 * criados por containers do tema/page builder (transform, filter, contain, etc.),
 * que "prendiam" o modal atrás de outros elementos mesmo com z-index alto.
 */
.vfx-sobrenos-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgb(0 0 0 / 0.95);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.vfx-sobrenos-lightbox.vfx-sobrenos-is-open {
    opacity: 1;
    pointer-events: auto;
}

.vfx-sobrenos-lightbox-close,
.vfx-sobrenos-lightbox-prev,
.vfx-sobrenos-lightbox-next {
    position: absolute;
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: rgb(255 255 255 / 0.1);
    border: 0;
    border-radius: 50%;
    color: rgb(255 255 255 / 0.7);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.vfx-sobrenos-lightbox-close:hover,
.vfx-sobrenos-lightbox-prev:hover,
.vfx-sobrenos-lightbox-next:hover {
    background: rgb(255 255 255 / 0.2);
    color: #fff;
}

.vfx-sobrenos-lightbox-close {
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
}

.vfx-sobrenos-lightbox-prev {
    top: 50%;
    left: 20px;
    width: 56px;
    height: 56px;
    transform: translateY(-50%);
}

.vfx-sobrenos-lightbox-next {
    top: 50%;
    right: 20px;
    width: 56px;
    height: 56px;
    transform: translateY(-50%);
}

.vfx-sobrenos-lightbox-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 40px 80px;
}

.vfx-sobrenos-lightbox-image-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    max-width: 100%;
    max-height: 85vh;
}

.vfx-sobrenos-lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.5);
}

.vfx-sobrenos-lightbox-caption {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 24px 16px 16px;
    background: linear-gradient(to top, rgb(0 0 0 / 0.8), transparent);
    color: #fff;
    text-align: center;
    pointer-events: none;
}

.vfx-sobrenos-lightbox-category {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .vfx-sobrenos-lightbox-content {
        padding: 20px;
    }

    .vfx-sobrenos-lightbox-prev,
    .vfx-sobrenos-lightbox-next {
        top: auto;
        bottom: 20px;
        width: 40px;
        height: 40px;
        transform: none;
    }

    .vfx-sobrenos-lightbox-prev {
        left: 30%;
    }

    .vfx-sobrenos-lightbox-next {
        right: 30%;
    }
}

.vfx-sobrenos-root .vfx-sobrenos-gallery-item:focus-visible,
.vfx-sobrenos-root .vfx-sobrenos-tab-button:focus-visible,
.vfx-sobrenos-lightbox-close:focus-visible,
.vfx-sobrenos-lightbox-prev:focus-visible,
.vfx-sobrenos-lightbox-next:focus-visible {
    outline: 2px solid var(--vfx-sobrenos-brand-color, #0959b8);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .vfx-sobrenos-root .vfx-sobrenos-gallery-item,
    .vfx-sobrenos-root .vfx-sobrenos-empty-message {
        animation: none;
        opacity: 1;
    }

    .vfx-sobrenos-root .vfx-sobrenos-gallery-item,
    .vfx-sobrenos-root .vfx-sobrenos-gallery-img,
    .vfx-sobrenos-root .vfx-sobrenos-overlay,
    .vfx-sobrenos-root .vfx-sobrenos-tab-button,
    .vfx-sobrenos-lightbox,
    .vfx-sobrenos-root .vfx-sobrenos-gallery-grid {
        transition: none;
    }

    .vfx-sobrenos-root .vfx-sobrenos-gallery-item:hover,
    .vfx-sobrenos-root .vfx-sobrenos-gallery-item:hover .vfx-sobrenos-gallery-img {
        transform: none;
    }
}
