/* ==========================================================================
   Section: #gallery - Full-Width Seamless Mosaic Gallery Wall (100% Width, Zero Gap)
   Fundo Limpo / Neutro (Sem Fundo Colorido) e Cards Sem Texto
   ========================================================================== */

#gallery.gallery-section {
    background-color: var(--colors-canvas, #ffffff);
    color: var(--colors-ink, #111113);
    padding: 64px 0 0 0;
    position: relative;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    width: 100%;
    overflow: hidden;
}

/* ==========================================================================
   1. Cabeçalho Editorial (Clean / Sem Fundo Colorido)
   ========================================================================== */

.gallery-header-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 36px;
    flex-wrap: wrap;
}

.gallery-header-text {
    max-width: 680px;
}

.gallery-eyebrow {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--colors-primary, #0066cc);
    margin-bottom: 8px;
}

.gallery-headline {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif;
    font-size: clamp(32px, 3.8vw, 44px);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.015em;
    color: #111113;
    margin: 0 0 10px 0;
}

.gallery-subhead {
    font-size: 17px;
    line-height: 1.48;
    letter-spacing: -0.2px;
    color: #555761;
    margin: 0;
}

.gallery-header-action {
    display: flex;
    align-items: center;
}

.gallery-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: transparent;
    color: #111113;
    border: 1.5px solid rgba(0, 0, 0, 0.16);
    border-radius: var(--rounded-pill, 9999px);
    padding: 9px 22px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    letter-spacing: -0.1px;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.gallery-pill-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-color: #111113;
    color: #111113;
}

/* ==========================================================================
   2. Full-Width Seamless Mosaic Grid (100% Width, Zero Gaps, Sem Textos)
   ========================================================================== */

.gallery-seamless-wall {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    background-color: var(--colors-canvas, #ffffff);
    overflow: hidden;
}

.gallery-seamless-item {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background-color: var(--colors-canvas-parchment, #f5f5f7);
    cursor: pointer;
    margin: 0;
    padding: 0;
    border: none;
    outline: none;
    display: block;
    border-radius: 0 !important;
}

/* Cantos estritamente retos no template padrao (sem cantos arredondados) */
.gallery-seamless-wall .gallery-seamless-item,
.gallery-seamless-item.gallery-cinema-card,
.gallery-seamless-wall .gallery-cinema-card,
.gallery-seamless-img,
.gallery-seamless-overlay,
.gallery-seamless-shimmer,
.gallery-seamless-border {
    border-radius: 0 !important;
}

/* Imagem Base */
.gallery-seamless-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    filter: brightness(0.97) saturate(1.02);
    transition: filter 0.35s ease;
}

/* Hover: Transição de Exposição (Sem Scale, Sem Shadow) */
.gallery-seamless-item:hover .gallery-seamless-img,
.gallery-seamless-item:focus .gallery-seamless-img {
    filter: brightness(0.78) saturate(1.22) contrast(1.06);
}

/* Overlay Frosted Glass no Hover (Sem Scale, Sem Shadow) */
.gallery-seamless-overlay {
    position: absolute;
    inset: 0;
    background: rgba(12, 12, 16, 0.42);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Feixe de Luz / Shimmer (Sem Scale, Sem Shadow) */
.gallery-seamless-shimmer {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -120%;
    width: 80%;
    background: linear-gradient(
        115deg,
        transparent 0%,
        rgba(255, 255, 255, 0.02) 20%,
        rgba(255, 255, 255, 0.18) 50%,
        rgba(255, 255, 255, 0.02) 80%,
        transparent 100%
    );
    pointer-events: none;
    z-index: 3;
    transition: left 0.65s cubic-bezier(0.2, 1, 0.3, 1);
}

.gallery-seamless-item:hover .gallery-seamless-shimmer {
    left: 140%;
}

/* Borda Fina de Contorno Interno */
.gallery-seamless-border {
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 255, 255, 0.06);
    pointer-events: none;
    z-index: 4;
    transition: border-color 0.3s ease;
}

.gallery-seamless-item:hover .gallery-seamless-border,
.gallery-seamless-item:focus .gallery-seamless-border {
    border-color: rgba(255, 255, 255, 0.35);
}

/* Ícone de Canto Discreto para Vídeos (Sem Texto) */
.gallery-seamless-corner-icon {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 5;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    pointer-events: none;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.gallery-seamless-item:hover .gallery-seamless-corner-icon {
    background-color: var(--colors-primary, #0066cc);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Badge de Identificação do Tipo de Mídia no Card */
.gallery-media-pill-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 6;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(15, 17, 23, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--rounded-pill, 9999px);
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.gallery-seamless-item:hover .gallery-media-pill-badge {
    background: rgba(15, 17, 23, 0.88);
    border-color: rgba(255, 255, 255, 0.35);
}

/* Botão Central Circular de Ação (Slide e Fade, Sem Texto, Sem Scale, Sem Shadow) */
.gallery-seamless-action-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% + 14px));
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    color: #111113;
    border: 1px solid rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    z-index: 5;
    pointer-events: none;
    transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                background-color 0.2s ease,
                color 0.2s ease;
}

.gallery-seamless-item:hover .gallery-seamless-action-circle,
.gallery-seamless-item:focus .gallery-seamless-action-circle {
    opacity: 1;
    transform: translate(-50%, -50%);
}

/* ==========================================================================
   3. Lightbox Cinema Modal
   ========================================================================== */

#galleryModal .modal-dialog {
    max-width: 1080px;
    margin: 1.75rem auto;
}

#galleryModal .modal-content {
    background-color: #000000;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}

.gallery-theater-stage {
    position: relative;
    width: 100%;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #000000;
}

.gallery-theater-topbar {
    position: absolute;
    top: 16px;
    left: 20px;
    right: 20px;
    z-index: 25;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gallery-counter-pill {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--rounded-pill, 9999px);
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
}

.gallery-theater-topbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.gallery-theater-tool-btn,
.gallery-theater-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.18s ease;
}

.gallery-theater-tool-btn:hover,
.gallery-theater-close:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: scale(1.05);
}

.gallery-theater-stage {
    touch-action: pan-y;
}

/* Spinner de Carregamento */
.gallery-media-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.gallery-spinner {
    width: 38px;
    height: 38px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: gallery-spin 0.8s linear infinite;
}

@keyframes gallery-spin {
    to { transform: rotate(360deg); }
}

/* Toast de Partilha */
.gallery-share-toast {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(18, 18, 22, 0.92);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
    padding: 8px 18px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 50;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.gallery-share-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.gallery-theater-media-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 30px 20px;
}

.gallery-media-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gallery-theater-img,
.gallery-theater-video {
    max-width: 100%;
    max-height: 72vh;
    object-fit: contain;
    border-radius: 8px;
}

.gallery-theater-iframe-wrap {
    width: 100%;
    max-width: 960px;
    aspect-ratio: 16 / 9;
}

.gallery-theater-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

/* Setas de navegação */
.gallery-theater-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
    z-index: 20;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.gallery-theater-nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

.gallery-theater-nav-btn.prev-btn {
    left: 20px;
}

.gallery-theater-nav-btn.next-btn {
    right: 20px;
}

/* Legenda Inferior do Lightbox */
.gallery-theater-caption-box {
    width: 100%;
    padding: 16px 28px 24px 28px;
    background: linear-gradient(180deg, transparent 0%, rgba(10, 10, 12, 0.85) 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: none;
}

.gallery-theater-title {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: #ffffff;
    margin: 0 0 6px 0;
}

.gallery-theater-description {
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    max-height: 120px;
    overflow-y: auto;
}

/* Empty State */
.gallery-empty-card {
    background: #f8f9fa;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
    padding: 40px;
    text-align: center;
    color: #6b7280;
}

/* ==========================================================================
   4. Página Dedicada (Sem Fundo Colorido)
   ========================================================================== */

#gallery.standalone-gallery-page,
.standalone-gallery-page {
    background-color: #ffffff !important;
    background: #ffffff !important;
    color: #111113 !important;
    min-height: 70vh;
    padding: 48px 0 64px 0 !important;
}

.standalone-gallery-page .gallery-headline {
    color: #111113 !important;
}

.standalone-gallery-page .gallery-subhead {
    color: #555761 !important;
}

/* ==========================================================================
   5. Breakpoints Responsivos
   ========================================================================== */

@media (min-width: 1600px) {
    .gallery-seamless-wall {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1199.98px) {
    .gallery-seamless-wall {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 991.98px) {
    #gallery.gallery-section {
        padding: 48px 0 0 0;
    }

    .gallery-header-row {
        margin-bottom: 24px;
    }
}

@media (max-width: 767.98px) {
    #gallery.gallery-section {
        padding: 40px 0 0 0;
    }

    .gallery-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .gallery-seamless-wall {
        grid-template-columns: repeat(2, 1fr);
    }

    .gallery-seamless-item {
        aspect-ratio: 1 / 1;
    }

    .gallery-seamless-action-circle {
        width: 44px;
        height: 44px;
    }

    .gallery-theater-nav-btn {
        width: 38px;
        height: 38px;
    }

    .gallery-theater-nav-btn.prev-btn {
        left: 10px;
    }

    .gallery-theater-nav-btn.next-btn {
        right: 10px;
    }

    .gallery-theater-stage {
        min-height: 50vh;
    }
}

@media (max-width: 575.98px) {
    .gallery-headline {
        font-size: 28px;
    }

    .gallery-theater-media-wrap {
        padding: 50px 10px 20px 10px;
    }

    .gallery-theater-img,
    .gallery-theater-video {
        max-height: 55vh;
    }
}
