.aew-gallery {
    width: 100%;
    --aew-card-aspect: 2 / 1;
    --aew-card-image-bg: transparent;
    --aew-image-pos-x: 50%;
    --aew-image-pos-y: 50%;
    position: relative;
    overflow: visible;
    z-index: 0;
    isolation: isolate;
}

.aew-gallery__bg {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100vw;
    left: 50%;
    transform: translateX(-50%);
    z-index: 0;
    pointer-events: none;
}

.aew-bg-layer {
    position: absolute;
    inset: 0;
}

.aew-gallery__inner {
    position: relative;
    z-index: 1;
    width: 100%;
}

.aew-gallery__title {
    margin: 0 0 16px;
}

.aew-filters {
    display: flex;
    flex-wrap: wrap;
    column-gap: 12px;
    row-gap: 12px;
    margin: 0 0 24px;
}

.aew-filter__button {
    display: inline-flex;
    align-items: stretch;
    padding: 1px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    box-sizing: border-box;
    position: relative;
    isolation: isolate;
    transition: color 0.2s ease;
}

/* Gradient layer sits behind the inner content.
   We fade it via opacity so the transition is smooth
   (CSS cannot interpolate gradients directly). */
.aew-filter__button::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: -1;
}

/* Desktop / mouse-hover only — never fires on touch screens */
@media (hover: hover) and (pointer: fine) {
    .aew-filter__button:hover::after {
        opacity: 1;
    }
}

.aew-filter__inner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: inherit;
    background: transparent;
    color: inherit;
    position: relative;
    z-index: 1;
    transition: background-color 0.2s ease, background-image 0.2s ease, color 0.2s ease;
}

.aew-filter__label {
    line-height: 1;
}

.aew-filter__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    line-height: 1;
}

.aew-filter__icon svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
}

.aew-filter__icon--active {
    display: none;
}

.aew-filter__button.is-active .aew-filter__icon--normal {
    display: none;
}

.aew-filter__button.is-active .aew-filter__icon--active {
    display: inline-flex;
}

.aew-icons-active-only .aew-filter__icon--normal {
    display: none;
}

.aew-icons-active-only .aew-filter__icon--active {
    display: none;
}

.aew-icons-active-only .aew-filter__button.is-active .aew-filter__icon--active {
    display: inline-flex;
}

.aew-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.aew-card {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: transparent;
}

.aew-card__image {
    position: relative;
    border-radius: inherit;
    overflow: hidden;
    aspect-ratio: var(--aew-card-aspect);
    background: var(--aew-card-image-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.aew-card__image-inner {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: inherit;
    overflow: hidden;
}

.aew-card__image-inner img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: var(--aew-image-pos-x) var(--aew-image-pos-y) !important;
}

.aew-card__image-overlay {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    border-radius: inherit;
    z-index: 1;
}

.aew-card__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    padding: 24px;
    background: transparent;
    z-index: 2;
}

.aew-card__content {
    max-width: 100%;
}

.aew-card__title {
    margin: 0 0 8px;
    color: #ffffff;
}

.aew-card__text {
    margin: 0 0 16px;
    color: #ffffff;
}

.aew-card__button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    cursor: pointer;
    color: #ffffff;
    border: 1px solid currentColor;
    border-radius: 999px;
    padding: 6px 12px;
    background: transparent;
}

.aew-button__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.aew-button__icon svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
}

.aew-play-button {
    position: absolute;
    right: 24px;
    bottom: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    z-index: 10;
    transition: all 0.25s ease;
    border: 2px solid transparent;
}

.aew-play-button svg {
    width: 50%;
    height: 50%;
    fill: currentColor;
    margin-left: 0% !important;
}

.aew-card:hover .aew-card__overlay {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.aew-card:hover .aew-card__image-overlay {
    opacity: 1;
}

.aew-card.is-hidden {
    display: none;
}

@media (max-width: 767px) {
    .aew-grid {
        grid-template-columns: 1fr;
    }
}

@media (hover: none) and (pointer: coarse) {
    /* Block hover styles ONLY on non-active filter buttons for touch/mobile.
       We must use :not(.is-active) so the active gradient is preserved.
       Elementor outputs :hover and .is-active in the same rule, so without
       this guard the reset would strip the active gradient too. */
    .aew-filter__button:not(.is-active):hover .aew-filter__inner {
        background-color: transparent !important;
        background-image: none !important;
    }

    .aew-filter__button:not(.is-active):hover {
        background-color: transparent !important;
        background-image: none !important;
    }

    /* Explicitly re-assert the ::after gradient layer for active buttons
       so the border-gradient (set on the wrapper via ::after) stays visible. */
    .aew-filter__button.is-active::after {
        opacity: 1 !important;
    }

    .aew-card.is-active .aew-card__overlay {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .aew-card.is-active .aew-card__image-overlay {
        opacity: 1;
    }

    .aew-card:focus-within .aew-card__overlay {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .aew-card:focus-within .aew-card__image-overlay {
        opacity: 1;
    }
}