.icephoto-gallery {
    --icephoto-gap: 10px;
    position: relative;
    width: 100%;
    display: block;
}
.icephoto-item {
    position: absolute;
    border-radius: var(--icephoto-radius, 0);
    display: block;
    overflow: hidden;
    background: #eee;
    cursor: zoom-in;
    box-sizing: border-box;
}
.icephoto-item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    transition: transform .25s ease;
}
.icephoto-item:hover img {
    transform: scale(1.025);
}
.icephoto-empty {
    padding: 24px;
    border: 1px dashed #bbb;
}

body.icephoto-lightbox-open {
    overflow: hidden;
}

.icephoto-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 20px;
    box-sizing: border-box;
    overscroll-behavior: contain;
}
.icephoto-lightbox.is-open {
    display: flex;
}
.icephoto-lightbox-toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.icephoto-counter {
    color: #222;
    font-size: 14px;
    line-height: 1;
    letter-spacing: .04em;
    pointer-events: none;
}
.icephoto-stage {
    position: relative;
    width: min(94vw, 1800px);
    height: min(88vh, 1200px);
    padding: 28px 72px 24px;
    box-sizing: border-box;
    background: #fff;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
    align-items: center;
    justify-items: center;
    gap: 10px;
    touch-action: pan-y;
}
.icephoto-image-wrap {
    min-height: 0;
    min-width: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
}
.icephoto-image-wrap img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.icephoto-image-name {
    position: static;
    width: min(80vw, 900px);
    max-width: 100%;
    min-height: 18px;
    padding: 2px 8px;
    margin: 0;
    box-sizing: border-box;
    color: #222;
    background: transparent;
    font-size: 14px;
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}
.icephoto-lightbox img {
    user-select: none;
    -webkit-user-drag: none;
    box-shadow: 0 12px 50px rgba(0,0,0,.35);
}
.icephoto-lightbox button[hidden] {
    display: none;
}

/* WordPress alignment support */
.icephoto-gallery.alignwide {
    width: 100%;
    max-width: none;
}
.icephoto-gallery.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    box-sizing: border-box;
}

@media (max-width: 700px) {
    .icephoto-gallery {
        --icephoto-gap: 6px;
    }
    .icephoto-lightbox {
        padding: 10px;
    }
    .icephoto-stage {
        width: 96vw;
        height: 88vh;
        padding: 24px 58px 18px;
    }
    .icephoto-close,
    .icephoto-prev,
    .icephoto-next {
        width: 44px;
        height: 44px;
    }
    .icephoto-close {
        top: 12px;
        right: 12px;
    }
    .icephoto-prev {
        left: 8px;
    }
    .icephoto-next {
        right: 8px;
    }
}


/* Lightbox image actions: always occupy their own row below the image. */
.icephoto-actions {
    position: static !important;
    grid-row: 3;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 7px;
    border-radius: 999px;
    background: rgba(20, 20, 20, .72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 1;
    pointer-events: auto;
    transition: transform .2s ease;
    z-index: 4;
}
.icephoto-stage:hover .icephoto-actions,
.icephoto-actions:focus-within {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}
.icephoto-action {
    min-height: 40px;
    padding: 0 13px;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    color: #fff;
    text-decoration: none;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.icephoto-action:hover {
    background: rgba(255,255,255,.14);
}
.icephoto-action:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
.icephoto-action.is-favorite {
    color: #fff;
}
.icephoto-download {
    color: rgba(255,255,255,.55);
    cursor: not-allowed;
}
.icephoto-download:hover {
    color: rgba(255,255,255,.7);
    background: transparent;
}

@media (hover: none), (pointer: coarse) {
    .icephoto-actions {
        opacity: 1;
        transform: translate(-50%, 0);
        pointer-events: auto;
    }
}
@media (max-width: 600px) {
    .icephoto-actions {
        max-width: calc(100vw - 24px);
        overflow-x: auto;
        justify-content: flex-start;
        scrollbar-width: none;
    }
    .icephoto-actions::-webkit-scrollbar {
        display: none;
    }
    .icephoto-action {
        min-width: 44px;
        padding: 0 11px;
    }
    .icephoto-action span {
        display: none;
    }
}

.icephoto-product-picker{position:fixed;inset:0;z-index:999999;display:none}
.icephoto-product-picker.is-open{display:block}
.icephoto-product-picker-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.62)}
.icephoto-product-picker-panel{position:absolute;right:0;top:0;height:100%;width:min(460px,94vw);background:#fff;box-shadow:-12px 0 40px rgba(0,0,0,.25);overflow:auto;animation:icephotoPickerIn .22s ease-out}
.icephoto-product-picker-close{position:absolute;right:14px;top:10px;border:0;background:none;font-size:30px;line-height:1;cursor:pointer;z-index:2}
.icephoto-product-picker-content{padding:34px 28px 28px}
.icephoto-product-picker-content h2{margin:0 0 18px;font-size:25px}
.icephoto-product-picker-image-wrap{height:180px;background:#eee;margin-bottom:22px;display:flex;align-items:center;justify-content:center;overflow:hidden}
.icephoto-product-picker-image-wrap img{width:100%;height:100%;object-fit:contain}
.icephoto-product-picker-section{font-size:11px;letter-spacing:.12em;font-weight:700;margin:0 0 9px}
.icephoto-product-options{display:grid;gap:8px}
.icephoto-product-option{position:relative;text-align:left;padding:14px 16px;border:1px solid #d7d7d7;background:#fff;border-radius:5px;cursor:pointer;display:grid;grid-template-columns:1fr auto;gap:3px 12px}
.icephoto-product-option:hover{border-color:#777}
.icephoto-product-option.is-selected{border-color:#111;box-shadow:inset 0 0 0 1px #111}
.icephoto-product-option-name{font-weight:600}
.icephoto-product-option-price{font-weight:600}
.icephoto-product-option small{grid-column:1/-1;color:#666}
.icephoto-product-add{width:100%;margin-top:18px;padding:13px 16px;border:0;background:#111;color:#fff;border-radius:4px;font-weight:600;cursor:pointer}
.icephoto-product-add:disabled{opacity:.45;cursor:not-allowed}
.icephoto-product-empty{color:#666}
.icephoto-cart-banner{position:fixed;right:22px;bottom:22px;z-index:1000000;background:#fff;box-shadow:0 8px 30px rgba(0,0,0,.2);border-radius:8px;padding:13px 14px;display:flex;align-items:center;gap:10px;transform:translateY(120%);opacity:0}
.icephoto-cart-banner.is-visible{animation:icephotoBannerIn .3s ease-out forwards}
.icephoto-cart-banner-check{width:24px;height:24px;border-radius:50%;background:#111;color:#fff;display:grid;place-items:center;font-size:14px}
.icephoto-cart-banner a{font-weight:600;text-decoration:underline}
.icephoto-cart-banner button{border:0;background:none;font-size:20px;cursor:pointer;margin-left:3px}
@keyframes icephotoPickerIn{from{transform:translateX(30px);opacity:.6}to{transform:translateX(0);opacity:1}}
@keyframes icephotoBannerIn{from{transform:translateY(120%);opacity:0}to{transform:translateY(0);opacity:1}}
@media(max-width:600px){.icephoto-product-picker-panel{width:100%}.icephoto-product-picker-content{padding:28px 18px 20px}.icephoto-product-picker-image-wrap{height:150px}.icephoto-cart-banner{left:12px;right:12px;bottom:12px;flex-wrap:wrap}}


/* Large preview when an IcePhoto image is clicked from the WooCommerce cart. */
.icephoto-cart-preview-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000002;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(0,0,0,.92);
}
.icephoto-cart-preview-lightbox.is-open {
    display: flex;
}
.icephoto-cart-preview-stage {
    position: relative;
    max-width: min(94vw, 1500px);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.icephoto-cart-preview-stage img {
    display: block;
    max-width: 94vw;
    max-height: 84vh;
    width: auto;
    height: auto;
    object-fit: contain;
    box-sizing: border-box;
    box-shadow: 0 12px 50px rgba(0,0,0,.45);
}
.icephoto-cart-preview-name {
    margin-top: 12px;
    max-width: 90vw;
    color: #fff;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.icephoto-cart-preview-close {
    position: absolute;
    top: 14px;
    right: 18px;
    z-index: 2;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
}
.icephoto-cart-preview-close:hover {
    background: rgba(255,255,255,.22);
}
body.icephoto-cart-preview-open {
    overflow: hidden;
}
.icephoto-cart-thumbnail,
.wc-block-cart-item__image img {
    /* Make IcePhoto previews in the cart about 50% larger. */
    transform: scale(1.5);
    transform-origin: center center;
    position: relative;
    z-index: 2;
    cursor: default;
}
@media (max-width: 600px) {
    .icephoto-cart-preview-lightbox { padding: 12px; }
    .icephoto-cart-preview-stage img { max-width: 96vw; max-height: 82vh; }
}


/* Persistent browser-local favorites. */
.icephoto-favorites-launcher {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 999990;
    border: 0;
    border-radius: 999px;
    padding: 11px 15px;
    background: rgba(20,20,20,.92);
    color: #fff;
    box-shadow: 0 8px 30px rgba(0,0,0,.25);
    cursor: pointer;
    font: inherit;
}
.icephoto-favorites-launcher b {
    display: inline-flex;
    min-width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    border-radius: 50%;
    background: #fff;
    color: #111;
    font-size: 12px;
}
.icephoto-favorites-panel {
    position: fixed;
    inset: 0;
    z-index: 999998;
    display: none;
}
.icephoto-favorites-panel.is-open { display: block; }
.icephoto-favorites-backdrop {
    position: absolute; inset: 0; background: rgba(0,0,0,.45);
}
.icephoto-favorites-box {
    position: absolute;
    right: 20px; bottom: 20px;
    width: min(420px, calc(100vw - 40px));
    max-height: min(70vh, 620px);
    overflow: auto;
    box-sizing: border-box;
    padding: 22px;
    background: #fff;
    color: #111;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.icephoto-favorites-box h2 { margin: 0 0 14px; font-size: 20px; }
.icephoto-favorites-close {
    position: absolute; top: 10px; right: 12px; border: 0; background: transparent;
    font-size: 28px; cursor: pointer; color: #111;
}
.icephoto-favorites-list { display: grid; gap: 8px; }
.icephoto-favorite-row {
    display: flex; align-items: center; gap: 12px; width: 100%;
    border: 0; background: transparent; padding: 6px; border-radius: 10px;
    text-align: left; cursor: pointer; font: inherit; color: inherit;
}
.icephoto-favorite-row:hover { background: #f2f2f2; }
.icephoto-favorite-row img { width: 68px; height: 54px; object-fit: cover; border-radius: 6px; }
.icephoto-favorites-empty { margin: 0; color: #666; }
@media (max-width: 600px) {
    .icephoto-favorites-launcher { right: 12px; bottom: 12px; }
    .icephoto-favorites-box { right: 12px; bottom: 12px; width: calc(100vw - 24px); }
}

/* IcePhoto galleries use their own gallery UI; hide the theme's adjacent
 * Previous/Next post navigation on IcePhoto gallery single pages. */
body.single-icephoto_gallery .post-navigation,
body.single-icephoto_gallery .posts-navigation,
body.single-icephoto_gallery .nav-links,
body.single-icephoto_gallery .nav-previous,
body.single-icephoto_gallery .nav-next,
body.single-icephoto_gallery .wp-block-post-navigation-link,
body.single-icephoto_gallery .wp-block-post-navigation,
body.single-icephoto_gallery .wp-block-query-pagination,
body.single-icephoto_gallery .wp-block-query-pagination-previous,
body.single-icephoto_gallery .wp-block-query-pagination-next {
    display: none !important;
}
