/* ═══════════════════════════════════════════════════════════
 *  AO Product Gallery – v1.0 (final compact)
 *  ═══════════════════════════════════════════════════════════ */

/* ── Main image ──────────────────────────────────────────── */
.aopg-gallery button,
.aopg-lightbox button {
    outline: none !important;
    outline-color: transparent !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
}
.aopg-gallery button:focus,
.aopg-gallery button:focus-visible,
.aopg-gallery button:focus-within,
.aopg-gallery button:active,
.aopg-lightbox button:focus,
.aopg-lightbox button:focus-visible,
.aopg-lightbox button:focus-within,
.aopg-lightbox button:active {
    outline: none !important;
    outline-color: transparent !important;
    box-shadow: none !important;
}

.aopg-gallery {
    --aopg-radius: 8px;
    --aopg-thumb-radius: 6px;
    --aopg-thumb-size: 72px;
    --aopg-arrow-bg: rgba(0,0,0,0.35);
    --aopg-arrow-color: #fff;
    --aopg-active-border: #e8730a;
    max-width: 100%;
}

/* Container – only responsible for rounding and centering */
.aopg-main-wrap {
    position: relative;
    overflow: hidden;
    border-radius: var(--aopg-radius);
    background: transparent !important;
    cursor: zoom-in;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Image – gets the height limit directly */
.aopg-main-img {
    display: block;
    max-width: 100%;
    max-height: 400px;          /* desktop limit – compact */
    width: auto;
    height: auto;
    object-fit: contain;
    transition: opacity .2s ease;
    user-select: none;
    -webkit-user-drag: none;
}

/* Slightly larger on very wide screens */
@media (min-width: 1200px) {
    .aopg-main-img {
        max-height: 500px;
    }
}

/* Mobile: limit to half the viewport height */
@media (max-width: 768px) {
    .aopg-main-img {
        max-height: 50vh;
    }
}

.aopg-main-img.aopg-fade {
    opacity: 0;
}

/* ── Arrows – perfectly round on all devices ───────────────── */
.aopg-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    aspect-ratio: 1 / 1 !important;
    border: none !important;
    border-radius: 50% !important;
    background: var(--aopg-arrow-bg);
    color: var(--aopg-arrow-color);
    cursor: pointer;
    opacity: 0;
    transition: opacity .25s ease, background .15s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 0 !important;
    line-height: 1;
}

.aopg-arrow svg {
    stroke: var(--aopg-arrow-color);
    width: 28px !important;
    height: 28px !important;
    min-width: 28px;
    min-height: 28px;
    display: block;
    margin: 0 auto;
}

.aopg-gallery:hover .aopg-arrow,
.aopg-arrow:focus-visible {
    opacity: 1;
}

.aopg-arrow:hover {
    background: rgba(0,0,0,0.55);
}

.aopg-arrow-left  { left: 12px; }
.aopg-arrow-right { right: 12px; }

/* ── Counter badge ───────────────────────────────────────── */
.aopg-counter {
    position: absolute;
    bottom: 10px;
    right: 12px;
    z-index: 2;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: rgba(0,0,0,0.4);
    padding: 3px 10px;
    border-radius: 20px;
    pointer-events: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    letter-spacing: .02em;
}

/* ── Thumbnails ──────────────────────────────────────────── */
.aopg-thumbs-wrap {
    margin-top: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}
.aopg-thumbs-wrap::-webkit-scrollbar {
    height: 4px;
}
.aopg-thumbs-wrap::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}
.aopg-thumbs {
    display: flex;
    gap: 8px;
    padding: 4px 0;
}
.aopg-thumb {
    flex: 0 0 auto;
    width: var(--aopg-thumb-size);
    height: var(--aopg-thumb-size);
    padding: 0;
    border: 2px solid transparent !important;
    border-radius: var(--aopg-thumb-radius);
    background: #ffffff !important;
    cursor: pointer;
    overflow: hidden;
    transition: transform .15s ease;
}
.aopg-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: calc(var(--aopg-thumb-radius) - 2px);
}
.aopg-thumb:hover,
.aopg-thumb:focus,
.aopg-thumb:focus-visible,
.aopg-thumb:active {
    border-color: var(--aopg-active-border) !important;
}
.aopg-thumb-active,
.aopg-thumb-active:hover,
.aopg-thumb-active:focus,
.aopg-thumb-active:focus-visible,
.aopg-thumb-active:active {
    border-color: var(--aopg-active-border) !important;
}

/* ═══════════════════════════════════════════════════════════
 *  Lightbox (unchanged)
 *  ═══════════════════════════════════════════════════════════ */
.aopg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity .25s ease, visibility .25s ease;
}
.aopg-lightbox[aria-hidden="false"] {
    visibility: visible;
    opacity: 1;
}
.aopg-lb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.aopg-lb-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90vw;
    max-height: 90vh;
}
.aopg-lb-img {
    max-width: 90vw;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 6px;
    user-select: none;
    -webkit-user-drag: none;
    transition: opacity .2s ease;
}
.aopg-lb-img.aopg-fade {
    opacity: 0;
}
.aopg-lb-close {
    position: absolute;
    top: -44px;
    right: -8px;
    z-index: 3;
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
    opacity: .7;
    transition: opacity .15s;
}
.aopg-lb-close:hover { opacity: 1; }
/* Lightbox arrows – same style as gallery arrows */
.aopg-lb-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    aspect-ratio: 1 / 1 !important;
    border: none !important;
    border-radius: 50% !important;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: pointer;
    transition: background 0.15s ease;
    padding: 0 !important;
    line-height: 1;
}

.aopg-lb-arrow:hover {
    background: rgba(0,0,0,0.55);
}

.aopg-lb-arrow svg {
    stroke: #fff;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px;
    min-height: 28px;
    display: block;
    margin: 0 auto;
}

/* Position adjustments for lightbox */
.aopg-lb-prev {
    left: -64px;
}

.aopg-lb-next {
    right: -64px;
}

/* On mobile, bring arrows closer to the image */
@media (max-width: 768px) {
    .aopg-lb-prev {
        left: 8px;
    }
    .aopg-lb-next {
        right: 8px;
    }
    .aopg-lb-arrow {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        min-height: 34px !important;
        opacity: 0.9;
    }
}
.aopg-lb-counter {
    margin-top: 12px;
    color: rgba(255,255,255,.65);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .04em;
}
.aopg-lb-thumbs {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    overflow-x: auto;
    max-width: 90vw;
    padding: 4px 0;
}
.aopg-lb-thumbs button {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 2px solid transparent !important;
    border-radius: 4px;
    overflow: hidden;
    background: transparent;
    cursor: pointer;
    opacity: .5;
    transition: opacity .15s;
}
.aopg-lb-thumbs button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.aopg-lb-thumbs button:hover { opacity: .8; }
.aopg-lb-thumbs button.aopg-lb-thumb-active {
    opacity: 1;
    border-color: #fff !important;
}

/* ── Mobile overrides ────────────────────────────────────── */
@media (max-width: 768px) {
    .aopg-arrow {
        opacity: 1;
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        min-height: 34px !important;
    }
    .aopg-arrow-left  { left: 6px; }
    .aopg-arrow-right { right: 6px; }

    .aopg-thumb {
        width: 56px !important;
        height: 56px !important;
    }

    .aopg-lb-prev { left: 4px; }
    .aopg-lb-next { right: 4px; }
    .aopg-lb-close { top: 4px; right: 4px; }
    .aopg-lb-img { max-height: 65vh; }
}

/* ── Touch swipe hint ────────────────────────────────────── */
@media (pointer: coarse) {
    .aopg-main-wrap {
        touch-action: pan-y;
    }
}
