/*
 * Shared AQC image behavior layer.
 *
 * Palette classes own editable dimensions, crop, spacing, color, and radius.
 * This file restores runtime-only image interaction from the legacy image
 * helpers: image zoom on hover plus the centered dark action circle.
 */

html[data-cta-mode="follower_only"] .we-image-preview-open {
    display: none !important;
}

html[data-cta-mode="suppress"] .aqc-nextarrow-c {
    display: none !important;
}

[data-aqc-image-action] {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    cursor: pointer;
}

/*
 * Legacy AQCActionView shells keep their absolute image tree for AOS,
 * lightGallery, and the action overlay. The palette's imgc-heightpc-* and
 * imgc-heightvwp-* families supply --aqc-image-frame-height; restore the
 * historical zero-height frame only for explicitly tagged legacy shells.
 * Strict normal-flow image wrappers keep the palette stylesheet geometry.
 */
[data-aqc-legacy-image-frame][class*="imgc-heightpc"],
[data-aqc-legacy-image-frame][class*="imgc-heightvwp"] {
    height: 0 !important;
    aspect-ratio: auto !important;
    padding-bottom: var(--aqc-image-frame-height, 100%) !important;
}

[data-aqc-legacy-image-frame][class*="imgc-heightpc"] > .image-w > .w:not(.absolute),
[data-aqc-legacy-image-frame][class*="imgc-heightvwp"] > .image-w > .w:not(.absolute) {
    aspect-ratio: auto !important;
    padding-bottom: var(--aqc-image-frame-height, 100%) !important;
}

[data-aqc-legacy-image-frame][class*="imgc-heightpc"] > .image-w > .w.absolute,
[data-aqc-legacy-image-frame][class*="imgc-heightvwp"] > .image-w > .w.absolute {
    padding-bottom: 0 !important;
}

[data-aqc-legacy-image-frame][class*="hgu-"],
[data-aqc-legacy-image-frame][class*="hpc-"] {
    aspect-ratio: auto !important;
    padding-bottom: 0 !important;
}

[data-aqc-legacy-image-frame][class*="hgu-"] > .image-w,
[data-aqc-legacy-image-frame][class*="hpc-"] > .image-w {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    height: 100%;
}

[data-aqc-legacy-image-frame][class*="hgu-"] > .image-w > .w,
[data-aqc-legacy-image-frame][class*="hpc-"] > .image-w > .w {
    height: 100%;
    aspect-ratio: auto !important;
    padding-bottom: 0 !important;
}

[data-aqc-image-action] [data-aqc-image-element] {
    transition: transform 360ms ease, filter 360ms ease;
    transform-origin: center;
    will-change: transform;
}

/*
 * Minimal legacy image-shell contract. The CSSClass-only AQC widgets no
 * longer load aqc-blocks.css, but the legacy CTA image helper still renders
 * `.image-w > .w > img`. Keep just the structural part here so media-fit-cover
 * has a real frame to fill.
 */
[data-aqc-legacy-image-frame] > .image-w {
    position: absolute !important;
    width: 100%;
}

[data-aqc-legacy-image-frame] > .image-w > .w {
    position: relative;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

[data-aqc-legacy-image-frame] > .image-w > .w.absolute {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

[data-aqc-legacy-image-frame] > .image-w > .w > [data-aqc-image-element] {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: var(--mcfw-media-fit, cover) !important;
    object-position: var(--mcfw-media-position, center center) !important;
    background-size: var(--mcfw-media-bg-size, cover) !important;
    background-position: var(--mcfw-media-position, center center) !important;
    background-repeat: no-repeat;
    transform: scale(1.15);
    transition: transform 0.8s cubic-bezier(.05, .69, .14, 1), filter 360ms ease;
    z-index: 10;
}

[data-aqc-legacy-image-frame] > .image-w:hover > .w > [data-aqc-image-element] {
    transform: scale(1);
}

[data-aqc-image-action]::before,
[data-aqc-image-action]::after {
    position: absolute;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 220ms ease, transform 220ms ease;
}

[data-aqc-image-action]::before {
    content: "";
    inset: 0;
    background: rgba(0, 0, 0, 0.16);
}

[data-aqc-image-action]::after {
    content: "+";
    top: 50%;
    left: 50%;
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.76);
    color: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 44px;
    font-weight: 300;
    line-height: 1;
    transform: translate(-50%, -50%) scale(0.84);
}

[data-aqc-image-action][data-aqc-action-view]::before,
[data-aqc-image-action][data-aqc-action-view]::after {
    content: none;
    display: none;
}

.aqc-nextarrow-c {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
}

.no-pointer-events {
    pointer-events: none;
}

.aqc-nextarrow-background.visible,
.aqc-nextarrow-foreground.visible,
.aqc-nextarrow-foreground.grow {
    opacity: 0;
}

@media (hover: hover) and (pointer: fine) {
    .aqc-nextarrow-c {
        opacity: 1;
    }

    .aqc-nextarrow-background {
        position: absolute;
        width: 80px;
        height: 80px;
        margin-left: -40px;
        margin-top: -40px;
        background: white;
        border-radius: 50%;
        transform-origin: center;
        transform: scale(0);
        transition: transform 0.4s ease, opacity 0.3s ease-in;
        z-index: 13;
    }

    .aqc-nextarrow-background.visible,
    .aqc-nextarrow-background.grow {
        opacity: 1;
    }

    .aqc-nextarrow-background.grow {
        transform: scale(1);
    }

    .aqc-nextarrow-foreground {
        position: absolute;
        width: 104px;
        height: 104px;
        margin-left: -52px;
        margin-top: -52px;
        border-radius: 50%;
        background: black;
        transform: scale(0);
        transform-origin: center;
        transition: transform 0.23s ease-out, opacity 0.17s ease-out;
        display: flex;
        flex-flow: row;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 13;
    }

    .aqc-nextarrow-foreground.visible {
        transition: opacity 0.24s ease 0.3s;
        transition-property: transform;
        opacity: 1;
    }

    .aqc-nextarrow-foreground.grow {
        opacity: 1;
        transform: scale(1);
    }

    .aqc-nextarrow-foreground > .icon {
        font-family: linearicons;
        font-size: 30px;
        color: white;
    }

    .aqc-nextarrow-foreground .aqc-action-cta-content {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        min-width: 0;
        color: white;
        font-weight: 700;
        line-height: 1;
        white-space: nowrap;
    }

    .aqc-nextarrow-foreground .aqc-action-cta-material {
        font-family: 'Material Icons';
        font-size: 30px;
        font-weight: normal;
        line-height: 1;
        letter-spacing: 0;
        text-transform: none;
        display: inline-block;
        white-space: nowrap;
        word-wrap: normal;
        direction: ltr;
        -webkit-font-feature-settings: 'liga';
        -webkit-font-smoothing: antialiased;
    }

    .aqc-nextarrow-foreground .aqc-action-cta-text {
        display: inline-block;
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 14px;
    }

    .aqc-nextarrow-foreground.aqc-action-has-text {
        width: auto;
        min-width: 104px;
        padding: 0 26px;
        border-radius: 999px;
        margin-left: 0;
        margin-top: 0;
        transform: translate(-50%, -50%) scale(0);
    }

    .aqc-nextarrow-foreground.aqc-action-has-text.grow {
        transform: translate(-50%, -50%) scale(1);
    }

    .aqc-nextarrow-c.aqc-action-mode-static_center .aqc-nextarrow-background,
    .aqc-nextarrow-c.aqc-action-mode-static_center .aqc-nextarrow-foreground {
        left: 50%;
        top: 50%;
        margin-left: 0;
        margin-top: 0;
        transform: translate(-50%, -50%) scale(0);
    }

    .aqc-nextarrow-c.aqc-action-mode-static_center .aqc-nextarrow-background.grow,
    .aqc-nextarrow-c.aqc-action-mode-static_center .aqc-nextarrow-foreground.grow {
        transform: translate(-50%, -50%) scale(1);
    }

    .aqc-nextarrow-c.aqc-action-mode-static_corner .aqc-nextarrow-background {
        left: auto;
        top: auto;
        right: 36px;
        bottom: 36px;
        margin-left: 0;
        margin-top: 0;
        transform: scale(0);
    }

    .aqc-nextarrow-c.aqc-action-mode-static_corner .aqc-nextarrow-foreground {
        left: auto;
        top: auto;
        right: 24px;
        bottom: 24px;
        margin-left: 0;
        margin-top: 0;
        transform: scale(0);
    }

    .aqc-nextarrow-c.aqc-action-mode-static_corner .aqc-nextarrow-background.grow,
    .aqc-nextarrow-c.aqc-action-mode-static_corner .aqc-nextarrow-foreground.grow {
        transform: scale(1);
    }

    .aqc-nextarrow-c.aqc-action-mode-static_center .aqc-nextarrow-foreground.aqc-action-has-text {
        left: 50%;
        top: 50%;
        margin-left: 0;
        margin-top: 0;
        transform: translate(-50%, -50%) scale(0);
    }

    .aqc-nextarrow-c.aqc-action-mode-static_center .aqc-nextarrow-foreground.aqc-action-has-text.grow {
        transform: translate(-50%, -50%) scale(1);
    }

    .aqc-nextarrow-c.aqc-action-mode-static_corner .aqc-nextarrow-foreground.aqc-action-has-text {
        left: auto;
        top: auto;
        right: 24px;
        bottom: 24px;
        margin-left: 0;
        margin-top: 0;
        transform-origin: bottom right;
        transform: scale(0);
    }

    .aqc-nextarrow-c.aqc-action-mode-static_corner .aqc-nextarrow-foreground.aqc-action-has-text.grow {
        transform: scale(1);
    }
}

[data-aqc-image-action]:hover [data-aqc-image-element],
[data-aqc-image-action]:focus-within [data-aqc-image-element] {
    transform: scale(1.06);
    filter: saturate(1.04);
}

[data-aqc-image-action]:hover::before,
[data-aqc-image-action]:focus-within::before,
[data-aqc-image-action]:hover::after,
[data-aqc-image-action]:focus-within::after {
    opacity: 1;
}

[data-aqc-image-action]:hover::after,
[data-aqc-image-action]:focus-within::after {
    transform: translate(-50%, -50%) scale(1);
}

@media (prefers-reduced-motion: reduce) {
    [data-aqc-image-action] [data-aqc-image-element],
    [data-aqc-image-action]::before,
    [data-aqc-image-action]::after {
        transition: none;
    }

    [data-aqc-image-action]:hover [data-aqc-image-element],
    [data-aqc-image-action]:focus-within [data-aqc-image-element] {
        transform: none;
    }
}
