.afpv-store-featured,
.afpv-store-video,
.afpv-store-dialog-video {
    position: relative;
}
.afpv-store-stage {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
    overflow: hidden;
}
.afpv-store-stage[hidden],
.afpv-store-dialog-video[hidden] {
    display: none;
}
.afpv-store-stage > .afpv-store-poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    margin: 0;
}
.afpv-store-stage > .afpv-store-play {
    position: absolute;
    inset: 0;
    z-index: 1;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.afpv-store-play:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: -4px;
}
.afpv-store-play-icon {
    display: block;
    width: 64px;
    max-width: 20%;
    line-height: 0;
}
.afpv-store-play-icon img {
    display: block;
    width: 100%;
    height: auto;
}
.afpv-store-stage > .afpv-store-play .afpv-store-play-icon img {
    margin: 0;
}
.afpv-store-stage > .afpv-store-player {
    position: relative;
    z-index: 2;
    display: block;
    border: 0;
    width: var(--afpv-player-width, 100%);
    height: var(--afpv-player-height, 100%);
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    margin: 0;
}
.afpv-store-playing > .afpv-store-play,
.afpv-store-playing > .afpv-store-poster {
    visibility: hidden;
}
.afpv-store-dialog-video {
    width: 100%;
    min-height: min(75vh, 700px);
}
.afpv-store-dialog-video > img {
    visibility: hidden;
}

.afpv-store-video-active > .woocommerce-product-gallery__trigger {
    display: none !important;
}
.woocommerce-product-gallery .flex-control-thumbs > li,
.afpv-store-thumb {
    position: relative;
}
.afpv-store-thumb-icon {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: var(--afpv-thumb-icon-size, 20.8px);
    height: var(--afpv-thumb-icon-size, 20.8px);
    padding: 0;
    background: transparent;
    pointer-events: none;
}

.afpv-store-card-layout {
    display: block;
    visibility: hidden;
    pointer-events: none;
}
.afpv-store-card > .afpv-store-stage {
    inset: auto;
    left: var(--afpv-card-media-left, 0);
    top: var(--afpv-card-media-top, 0);
    width: var(--afpv-card-media-width, 100%);
    height: var(--afpv-card-media-height, 100%);
}
.afpv-store-card > .afpv-store-stage > .afpv-store-poster {
    object-fit: cover;
}
.afpv-store-card {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
}
.afpv-woodmart-video .afpv-store-card-layout img {
    width: 100%;
    height: auto;
}
/* Hover photos must not cover the video that replaced the primary image. */
.product-grid-item .afpv-woodmart-video ~ .hover-img {
    display: none;
}
.afpv-store-expand {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.afpv-store-expand > span {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 1px solid #fff;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.7);
}
body.afpv-video-popup-open {
    overflow: hidden;
}
.afpv-legacy-media {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
}
/* Block templates do not always load WooCommerce's classic image constraints. */
.afpv-legacy-layout-image {
    max-width: 100%;
}
.afpv-legacy-choice {
    position: relative;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}
.afpv-legacy-choice img {
    display: block;
    width: 100%;
}
.afpv-legacy-slide[hidden] {
    display: none;
}
.afpv-legacy-gallery .afpv-store-stage > .afpv-store-player {
    width: var(--afpv-player-width, 100%) !important;
    height: var(--afpv-player-height, 100%) !important;
}
.afpv-legacy-gallery .afpv-store-stage > .afpv-store-play {
    width: 100%;
}
.afpv-store-thumb-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.afpv-legacy-choice-image {
    position: relative;
}
.afpv-legacy-html .Addify_Product_Videos-thumbnails {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}
.afpv-legacy-html .afpv-legacy-choice {
    width: 100%;
    min-height: 44px;
}
.afpv-legacy-html .afpv-legacy-choice > img {
    aspect-ratio: 1;
    object-fit: cover;
}

.afpv-store-icon-cover {
    background: #767676;
}
img.afpv-store-icon-thumbnail,
.afpv-store-icon-thumbnail > img {
    box-sizing: border-box;
    padding: 20%;
    background: #767676;
    object-fit: contain;
}

.afpv-legacy-gallery {
    min-width: 0;
    max-width: 100%;
}
.product-gallery > .afpv-legacy-gallery {
    width: 100%;
    float: none;
}

.afpv-video-popup {
    box-sizing: border-box;
    width: min(1100px, calc(100vw - 32px));
    max-width: none;
    height: calc(100dvh - 32px);
    max-height: none;
    padding: 48px 48px 0;
    border: 0;
    border-radius: 0;
    background: #141618;
    color: #fff;
    overflow: hidden;
}
.afpv-video-popup[open] {
    display: grid;
    grid-template-rows: minmax(0, 1fr) 88px;
}
.afpv-video-popup::backdrop { background: rgba(0, 0, 0, 0.85); }
.afpv-video-popup-media { position: relative; min-height: 0; width: 100%; height: 100%; }
.afpv-popup-image { display: block; width: 100%; height: 100%; object-fit: contain; }
.afpv-video-popup button {
    box-sizing: border-box;
    border: 0;
    padding: 0;
    min-width: 44px;
    width: 44px;
    height: 44px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    line-height: 1;
    box-shadow: none;
    border-radius: 0;
    font-size: 28px;
}
.afpv-video-popup button:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.afpv-video-popup button:hover, .afpv-video-popup button:active, .afpv-video-popup button:focus { background: transparent; color: #fff; }
.afpv-popup-close { position: absolute; right: 4px; top: 2px; }
.afpv-popup-counter { position: absolute; left: 16px; top: 14px; font-size: 14px; font-variant-numeric: tabular-nums; }
.afpv-popup-previous, .afpv-popup-next { position: absolute; top: calc(50% - 22px); }
.afpv-popup-previous { left: 0; }
.afpv-popup-next { right: 0; }
.afpv-popup-thumbnail-row { display: flex; align-items: center; justify-content: center; min-width: 0; }
.afpv-popup-thumbnails { display: flex; gap: 10px; padding: 5px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.afpv-popup-thumbnails::-webkit-scrollbar { display: none; }
.afpv-video-popup .afpv-popup-thumbnail { position: relative; flex: 0 0 56px; width: 56px; height: 56px; }
.afpv-popup-thumbnail img { width: 100%; height: 100%; object-fit: cover; border-radius: 3px; }
.afpv-popup-thumbnail[aria-current="true"] { outline: 2px solid #fff; outline-offset: 2px; }
.afpv-popup-video-badge { position: absolute; bottom: 2px; right: 2px; border-radius: 50%; background: #141618; width: 16px; height: 16px; font-size: 10px; display: grid; place-items: center; }
.afpv-video-popup [hidden], .afpv-popup-single .afpv-popup-previous, .afpv-popup-single .afpv-popup-next, .afpv-popup-single .afpv-popup-counter, .afpv-popup-single .afpv-popup-thumbnail-row { display: none; }
.afpv-popup-single[open] { grid-template-rows: minmax(0, 1fr); padding-bottom: 16px; }
.afpv-popup-stage { width: 100%; height: 100%; min-height: 0; position: absolute; inset: 0; }
.afpv-popup-stage .afpv-store-player { object-fit: contain; }
.afpv-video-popup-instagram .afpv-popup-stage { background: transparent; }
.afpv-photoswipe-media { position: absolute; inset: 44px 0; }
.afpv-photoswipe-media .afpv-popup-stage { position: absolute; inset: 0; }
@media (max-width: 768px), (max-height: 500px) {
    .afpv-video-popup {
        width: 100vw;
        height: 100dvh;
        margin: 0;
        padding: max(48px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(60px, calc(52px + env(safe-area-inset-bottom))) max(12px, env(safe-area-inset-left));
    }
    .afpv-video-popup[open] { grid-template-rows: minmax(0, 1fr); }
    .afpv-popup-thumbnail-row { display: none; }
    .afpv-popup-counter { top: auto; bottom: max(22px, calc(16px + env(safe-area-inset-bottom))); left: 50%; transform: translateX(-50%); }
    .afpv-popup-previous, .afpv-popup-next { top: auto; bottom: max(6px, env(safe-area-inset-bottom)); }
    .afpv-popup-previous { left: calc(50% - 100px); }
    .afpv-popup-next { right: calc(50% - 100px); }
    .afpv-popup-close { top: env(safe-area-inset-top); right: env(safe-area-inset-right); }
}
