/* ME Ingressos — Galeria 1.3.7 */
.mei-gallery-wrapper,
.mei-gallery-carousel-wrapper {
    --gallery-accent: var(--mei-gallery-title, var(--mei-accent, #fff900));
    --gallery-text: var(--mei-gallery-text, #ffffff);
    --gallery-card: var(--mei-gallery-card-bg, rgba(0, 0, 0, .78));
    --gallery-border: var(--mei-gallery-card-border, #fff900);
    --gallery-glow: var(--mei-glow, rgba(255, 249, 0, .45));
    width: min(1180px, calc(100% - 32px));
    margin: 48px auto;
    color: var(--gallery-text);
    box-sizing: border-box;
}

.mei-gallery-wrapper *,
.mei-gallery-carousel-wrapper * {
    box-sizing: border-box;
}

.mei-gallery-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 26px;
    margin-bottom: 24px;
    background: var(--gallery-card);
    border: 1px solid var(--gallery-border);
    border-radius: 18px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.mei-gallery-kicker {
    display: block;
    margin-bottom: 6px;
    color: var(--gallery-accent);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.mei-gallery-header h2,
.mei-gallery-event-title h3 {
    margin: 0 !important;
    color: var(--gallery-accent) !important;
    font-weight: 900 !important;
    line-height: 1.1;
}

.mei-gallery-main-meta,
.mei-gallery-event-title p {
    margin: 8px 0 0;
    color: var(--gallery-text);
}

.mei-gallery-filter {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 260px;
}

.mei-gallery-filter label {
    color: var(--gallery-text);
    font-weight: 800;
}

.mei-gallery-filter select {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    color: var(--mei-gallery-filter-text, #fff) !important;
    background: var(--mei-gallery-filter-bg, rgba(0, 0, 0, .45)) !important;
    border: 1px solid var(--mei-gallery-filter-border, #fff) !important;
    border-radius: 9px;
}

.mei-gallery-event {
    padding: 26px;
    margin-bottom: 28px;
    background: var(--gallery-card);
    border: 1px solid var(--gallery-border);
    border-radius: 18px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.mei-gallery-event-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.mei-gallery-event-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    color: var(--mei-secondary-text, #fff900) !important;
    background: transparent;
    border: 1px solid var(--mei-secondary-text, #fff900);
    border-radius: 8px;
    font-weight: 900;
    text-decoration: none !important;
    transition: .22s ease;
}

.mei-gallery-event-open:hover {
    color: var(--mei-secondary-hover-text, #000) !important;
    background: var(--mei-secondary-hover-bg, #fff900);
    border-color: var(--mei-secondary-hover-border, #fff900);
    box-shadow: 0 0 28px var(--gallery-glow);
    transform: translateY(-2px);
}

/* Grade tipo masonry: fotos lado a lado, com alturas variadas. */
.mei-gallery-grid {
    display: grid !important;
    grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
    grid-auto-flow: dense;
    grid-auto-rows: 42px;
    gap: 14px;
    width: 100%;
}

.mei-gallery-item {
    position: relative;
    display: block !important;
    grid-column: span 4;
    grid-row: span 8;
    min-width: 0;
    overflow: hidden;
    background: #000;
    border: 1px solid var(--gallery-border);
    border-radius: 16px;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    text-decoration: none !important;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.mei-gallery-item-1,
.mei-gallery-item-5 {
    grid-row: span 11;
}

.mei-gallery-item-2,
.mei-gallery-item-6 {
    grid-row: span 8;
}

.mei-gallery-item-3 {
    grid-column: span 8;
    grid-row: span 9;
}

.mei-gallery-item-4 {
    grid-row: span 10;
}

.mei-gallery-item img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover !important;
    margin: 0 !important;
    transition: transform .38s ease, filter .38s ease;
}

.mei-gallery-item-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, .82), rgba(0, 0, 0, .08) 65%);
    transition: opacity .3s ease, backdrop-filter .3s ease;
}

.mei-gallery-item-overlay span {
    color: var(--gallery-accent) !important;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.mei-gallery-item:hover {
    z-index: 2;
    border-color: var(--gallery-accent);
    box-shadow: 0 0 32px var(--gallery-glow);
    transform: translateY(-3px);
}

.mei-gallery-item:hover img {
    filter: brightness(.52) blur(1.5px);
    transform: scale(1.06);
}

.mei-gallery-item:hover .mei-gallery-item-overlay {
    opacity: 1;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.mei-gallery-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 14px;
    margin-top: 24px;
}

.mei-gallery-footer-actions .mei-success-button {
    flex: 0 1 250px;
}

/* Cards de galerias na Home. */
.mei-gallery-carousel-track {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 20px;
    width: 100%;
}

.mei-gallery-carousel-card {
    position: relative;
    display: block !important;
    min-width: 0;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: #000;
    border: 2px solid var(--gallery-border);
    border-radius: 18px;
    box-shadow: 0 0 24px var(--gallery-glow);
    text-decoration: none !important;
    transition: transform .3s ease, box-shadow .3s ease;
}

.mei-gallery-carousel-card img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover !important;
    margin: 0 !important;
    transition: transform .42s ease, filter .42s ease;
}

.mei-gallery-carousel-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    opacity: 0;
    background: rgba(0, 0, 0, .48);
    backdrop-filter: blur(0);
    -webkit-backdrop-filter: blur(0);
    transition: opacity .32s ease, backdrop-filter .32s ease;
}

.mei-gallery-carousel-title {
    padding: 12px 22px;
    color: var(--gallery-accent) !important;
    background: rgba(0, 0, 0, .84);
    border-radius: 999px;
    font-size: clamp(20px, 2.2vw, 30px);
    font-weight: 900;
    line-height: 1.1;
    text-align: center;
    transform: translateY(12px);
    transition: transform .32s ease;
}

.mei-gallery-carousel-overlay small {
    color: var(--gallery-text) !important;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
    transform: translateY(12px);
    transition: transform .32s ease;
}

.mei-gallery-carousel-card:hover {
    box-shadow: 0 0 38px var(--gallery-glow);
    transform: translateY(-5px);
}

.mei-gallery-carousel-card:hover img {
    filter: brightness(.42) blur(3px);
    transform: scale(1.08);
}

.mei-gallery-carousel-card:hover .mei-gallery-carousel-overlay {
    opacity: 1;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.mei-gallery-carousel-card:hover .mei-gallery-carousel-title,
.mei-gallery-carousel-card:hover .mei-gallery-carousel-overlay small {
    transform: translateY(0);
}

.mei-gallery-empty {
    padding: 28px;
    color: var(--gallery-text);
    background: var(--gallery-card);
    border: 1px solid var(--gallery-border);
    border-radius: 18px;
    text-align: center;
}

/* Lightbox */
body.mei-gallery-lightbox-open {
    overflow: hidden;
}

.mei-gallery-lightbox[hidden] {
    display: none !important;
}

.mei-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) 64px;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: var(--mei-gallery-lightbox-bg, rgba(0, 0, 0, .92));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.mei-gallery-lightbox-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.mei-gallery-lightbox-stage img {
    display: block;
    max-width: 100%;
    max-height: 82vh;
    border: 1px solid var(--gallery-border);
    border-radius: 14px;
    box-shadow: 0 0 50px rgba(0, 0, 0, .55);
}

.mei-gallery-lightbox-caption {
    margin-top: 14px;
    color: var(--gallery-text);
    font-weight: 800;
    text-align: center;
}

.mei-gallery-lightbox-close,
.mei-gallery-lightbox-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    color: var(--mei-primary-text, #000);
    background: var(--mei-primary-bg, #fff900);
    border: 1px solid var(--mei-primary-bg, #fff900);
    border-radius: 999px;
    box-shadow: 0 0 22px var(--gallery-glow);
    font-weight: 900;
    cursor: pointer;
}

.mei-gallery-lightbox-close {
    position: fixed;
    top: 18px;
    right: 22px;
    font-size: 29px;
}

.mei-gallery-lightbox-nav {
    font-size: 38px;
}

@media (max-width: 900px) {
    .mei-gallery-header,
    .mei-gallery-event-title {
        align-items: stretch;
        flex-direction: column;
    }

    .mei-gallery-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    }

    .mei-gallery-item,
    .mei-gallery-item-3 {
        grid-column: span 3;
    }

    .mei-gallery-carousel-track {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 600px) {
    .mei-gallery-wrapper,
    .mei-gallery-carousel-wrapper {
        width: min(100% - 20px, 1180px);
        margin: 28px auto;
    }

    .mei-gallery-event,
    .mei-gallery-header {
        padding: 18px;
    }

    .mei-gallery-grid {
        grid-template-columns: 1fr !important;
        grid-auto-rows: auto;
    }

    .mei-gallery-item,
    .mei-gallery-item-1,
    .mei-gallery-item-2,
    .mei-gallery-item-3,
    .mei-gallery-item-4,
    .mei-gallery-item-5,
    .mei-gallery-item-6 {
        grid-column: auto;
        grid-row: auto;
        aspect-ratio: 4 / 5;
    }

    .mei-gallery-carousel-track {
        grid-template-columns: 1fr !important;
    }

    .mei-gallery-carousel-card {
        aspect-ratio: 4 / 5;
    }

    .mei-gallery-carousel-overlay {
        opacity: 1;
        justify-content: flex-end;
        background: linear-gradient(to top, rgba(0, 0, 0, .84), transparent 68%);
        backdrop-filter: none;
    }

    .mei-gallery-carousel-title,
    .mei-gallery-carousel-overlay small {
        transform: none;
    }

    .mei-gallery-lightbox {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    .mei-gallery-lightbox-nav {
        position: fixed;
        bottom: 20px;
    }

    .mei-gallery-lightbox-prev {
        left: 20px;
    }

    .mei-gallery-lightbox-next {
        right: 20px;
    }

    .mei-gallery-footer-actions {
        flex-direction: column;
    }
}
