/*
 * Product image lightbox, Modern style (Customizer: "Lightbox style").
 * Restyles WooCommerce's PhotoSwipe (default skin) and the gallery magnifier button. Everything is scoped
 * under body.ahura-lightbox-modern and loaded after photoswipe-default-skin.
 */
body.ahura-lightbox-modern .pswp {
    --ahura-lb-accent: var(--ahura-theme-primary, #ffffff);
    --ahura-lb-glass: rgba(255, 255, 255, .1);
    --ahura-lb-glass-hover: rgba(255, 255, 255, .2);
    --ahura-lb-line: rgba(255, 255, 255, .14);
    --ahura-lb-icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
    --ahura-lb-icon-fs: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5'/%3E%3C/svg%3E");
    --ahura-lb-icon-fs-exit: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5'/%3E%3C/svg%3E");
    --ahura-lb-icon-zoom-in: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4 4M8.5 11h5M11 8.5v5'/%3E%3C/svg%3E");
    --ahura-lb-icon-zoom-out: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4 4M8.5 11h5'/%3E%3C/svg%3E");
    --ahura-lb-icon-prev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 5l-7 7 7 7'/%3E%3C/svg%3E");
    --ahura-lb-icon-next: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5l7 7-7 7'/%3E%3C/svg%3E");
}

/* Backdrop: deep and blurred; dark enough on its own where blur is not supported. */
body.ahura-lightbox-modern .pswp .pswp__bg {
    background: rgba(9, 11, 16, .95);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    backdrop-filter: blur(18px) saturate(1.2);
}

/*
 * Photos sit on a light rounded card, like the product gallery: products shot on a transparent
 * background (common for PNG/WebP) would otherwise disappear into the dark backdrop.
 */
body.ahura-lightbox-modern .pswp .pswp__img {
    border-radius: 16px;
    background-color: #f4f5f7;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

body.ahura-lightbox-modern .pswp .pswp__img--placeholder--blank {
    background-color: #f4f5f7;
}

/* Top bar: no strip, just floating glass controls. */
body.ahura-lightbox-modern .pswp .pswp__top-bar,
body.ahura-lightbox-modern .pswp .pswp__ui--fit .pswp__top-bar {
    box-sizing: border-box;
    gap: 10px;
    align-items: flex-start;
    height: 72px;
    padding: 14px 16px;
    background: transparent;
}

/*
 * WooCommerce's photoswipe.css forces the sprite, a transparent background and no shadow on
 * button.pswp__button with !important. The sprite is shrunk away (background-size is not forced) and
 * each button draws its glass circle and icon on ::after instead.
 */
body.ahura-lightbox-modern .pswp .pswp__button {
    background-size: 0 0;
    opacity: 1;
}

body.ahura-lightbox-modern .pswp .pswp__button::after {
    content: "";
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    border: 1px solid var(--ahura-lb-line);
    border-radius: 50%;
    background: var(--ahura-lb-glass) var(--ahura-lb-icon, none) no-repeat center / 20px 20px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    pointer-events: none;
    transition: background-color .2s ease, transform .2s ease;
}

body.ahura-lightbox-modern .pswp .pswp__button:hover::after,
body.ahura-lightbox-modern .pswp .pswp__button:focus-visible::after {
    background-color: var(--ahura-lb-glass-hover);
    transform: scale(1.06);
}

/* WooCommerce's top bar is a flex row packed to its end (the right, or the left on RTL pages). */
body.ahura-lightbox-modern .pswp .pswp__top-bar .pswp__button {
    position: relative;
    flex: none;
    width: 44px;
    height: 44px;
    margin: 0;
}

body.ahura-lightbox-modern .pswp .pswp__button--close {
    --ahura-lb-icon: var(--ahura-lb-icon-close);
}

body.ahura-lightbox-modern .pswp .pswp__button--fs {
    --ahura-lb-icon: var(--ahura-lb-icon-fs);
}

body.ahura-lightbox-modern .pswp.pswp--fs .pswp__button--fs {
    --ahura-lb-icon: var(--ahura-lb-icon-fs-exit);
}

body.ahura-lightbox-modern .pswp .pswp__button--zoom {
    --ahura-lb-icon: var(--ahura-lb-icon-zoom-in);
}

body.ahura-lightbox-modern .pswp.pswp--zoomed-in .pswp__button--zoom {
    --ahura-lb-icon: var(--ahura-lb-icon-zoom-out);
}

/* Counter: a glass pill pinned to the other side of the top bar. */
body.ahura-lightbox-modern .pswp .pswp__counter {
    position: absolute;
    top: 14px;
    right: auto;
    left: 16px;
    box-sizing: border-box;
    height: 44px;
    padding: 0 16px;
    border: 1px solid var(--ahura-lb-line);
    border-radius: 999px;
    background: var(--ahura-lb-glass);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: #ffffff;
    direction: ltr;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 42px;
    opacity: 1;
}

body.ahura-lightbox-modern.rtl .pswp .pswp__counter {
    right: 16px;
    left: auto;
}

/* Side arrows: large glass circles. PhotoSwipe still hides them on touch screens (swipe there). */
body.ahura-lightbox-modern .pswp .pswp__button--arrow--left,
body.ahura-lightbox-modern .pswp .pswp__button--arrow--right {
    top: 50%;
    width: 52px;
    height: 52px;
    margin-top: -26px;
}

body.ahura-lightbox-modern .pswp .pswp__button--arrow--left::after,
body.ahura-lightbox-modern .pswp .pswp__button--arrow--right::after {
    background-size: 22px 22px;
}

body.ahura-lightbox-modern .pswp .pswp__button--arrow--left {
    left: 20px;
    --ahura-lb-icon: var(--ahura-lb-icon-prev);
}

body.ahura-lightbox-modern .pswp .pswp__button--arrow--right {
    right: 20px;
    --ahura-lb-icon: var(--ahura-lb-icon-next);
}

body.ahura-lightbox-modern .pswp .pswp__button--arrow--left::before,
body.ahura-lightbox-modern .pswp .pswp__button--arrow--right::before {
    content: none;
}

body.ahura-lightbox-modern .pswp .pswp__button:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
    border-radius: 50%;
}

/* Caption: plain centered text, above the thumbnail strip when there is one. */
body.ahura-lightbox-modern .pswp .pswp__caption,
body.ahura-lightbox-modern .pswp .pswp__ui--fit .pswp__caption {
    background: transparent;
}

body.ahura-lightbox-modern .pswp .pswp__caption__center {
    max-width: 640px;
    color: rgba(255, 255, 255, .85);
    font-size: 14px;
    text-align: center;
}

body.ahura-lightbox-modern .pswp.ahura-pswp-has-thumbs .pswp__caption {
    bottom: 92px;
}

/* Thumbnail strip (js/lightbox-modern.js). */
body.ahura-lightbox-modern .pswp .ahura-pswp-thumbs {
    position: absolute;
    bottom: 18px;
    left: 50%;
    z-index: 1600;
    display: flex;
    gap: 8px;
    box-sizing: border-box;
    max-width: calc(100% - 32px);
    padding: 6px;
    overflow-x: auto;
    border: 1px solid var(--ahura-lb-line);
    border-radius: 16px;
    background: rgba(255, 255, 255, .08);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    scrollbar-width: none;
    transform: translateX(-50%);
    transition: opacity .25s ease;
}

body.ahura-lightbox-modern .pswp .ahura-pswp-thumbs::-webkit-scrollbar {
    display: none;
}

body.ahura-lightbox-modern .pswp .ahura-pswp-thumb {
    flex: none;
    width: 56px;
    height: 56px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
    opacity: .5;
    transition: opacity .2s ease, box-shadow .2s ease;
}

body.ahura-lightbox-modern .pswp .ahura-pswp-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Video slides have no image to show: a play mark instead. */
body.ahura-lightbox-modern .pswp .ahura-pswp-thumb--video {
    background: rgba(255, 255, 255, .16) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M8 5.5v13l11-6.5z'/%3E%3C/svg%3E") no-repeat center / 22px 22px;
}

body.ahura-lightbox-modern .pswp .ahura-pswp-thumb:hover {
    opacity: .85;
}

body.ahura-lightbox-modern .pswp .ahura-pswp-thumb.is-active {
    opacity: 1;
    box-shadow: 0 0 0 2px var(--ahura-lb-accent);
}

body.ahura-lightbox-modern .pswp .ahura-pswp-thumb:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* The strip fades with the rest of the controls (opening animation, idle mouse). */
body.ahura-lightbox-modern .pswp .pswp__ui--hidden .ahura-pswp-thumbs,
body.ahura-lightbox-modern .pswp .pswp__ui--idle .ahura-pswp-thumbs {
    opacity: 0;
}

@media (max-width: 600px) {
    body.ahura-lightbox-modern .pswp .pswp__top-bar,
    body.ahura-lightbox-modern .pswp .pswp__ui--fit .pswp__top-bar {
        gap: 8px;
        padding: 12px;
    }

    body.ahura-lightbox-modern .pswp .pswp__counter {
        top: 12px;
        left: 12px;
    }

    body.ahura-lightbox-modern.rtl .pswp .pswp__counter {
        right: 12px;
        left: auto;
    }

    body.ahura-lightbox-modern .pswp .pswp__top-bar .pswp__button {
        width: 40px;
        height: 40px;
    }

    body.ahura-lightbox-modern .pswp .ahura-pswp-thumb {
        width: 46px;
        height: 46px;
    }

    body.ahura-lightbox-modern .pswp.ahura-pswp-has-thumbs .pswp__caption {
        bottom: 80px;
    }
}

/* The magnifier button on the product gallery: a glass circle with a crisp icon. */
body.ahura-lightbox-modern div.product div.images .woocommerce-product-gallery__trigger {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(15, 23, 42, .06);
    background: rgba(255, 255, 255, .88) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4 4M8.5 11h5M11 8.5v5'/%3E%3C/svg%3E") no-repeat center / 20px 20px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(15, 23, 42, .12);
    transition: transform .2s ease, box-shadow .2s ease;
}

body.ahura-lightbox-modern div.product div.images .woocommerce-product-gallery__trigger::before,
body.ahura-lightbox-modern div.product div.images .woocommerce-product-gallery__trigger::after {
    content: none;
}

body.ahura-lightbox-modern div.product div.images .woocommerce-product-gallery__trigger:hover {
    transform: scale(1.06);
    box-shadow: 0 8px 22px rgba(15, 23, 42, .18);
}

@media (prefers-reduced-motion: reduce) {
    body.ahura-lightbox-modern .pswp .pswp__button::after,
    body.ahura-lightbox-modern .pswp .ahura-pswp-thumbs,
    body.ahura-lightbox-modern .pswp .ahura-pswp-thumb,
    body.ahura-lightbox-modern div.product div.images .woocommerce-product-gallery__trigger {
        transition: none;
    }
}
