/* HGGallery - custom gallery replacing the Cloudinary Product Gallery widget. */

.hgg { max-width: 100%; }

.hgg-stage {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background: #f7eec4; /* letterbox color, matches old widget theme */
    overflow: hidden;
    cursor: zoom-in;
    border-radius: 2px;
}

.hgg-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.hgg-layer.hgg-visible { opacity: 1; }

.hgg-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid rgba(51, 122, 183, 0.25);
    border-top-color: #337ab7;
    border-radius: 50%;
    animation: hgg-spin 0.8s linear infinite;
    pointer-events: none;
}

@keyframes hgg-spin { to { transform: rotate(360deg); } }

.hgg-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 56px;
    border: 0;
    border-radius: 6px;
    background: rgba(51, 122, 183, 0.85); /* #337ab7 */
    color: #ffffff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    transition: background 0.15s ease;
}

.hgg-nav:hover { background: #23527c; }
.hgg-prev { left: 10px; }
.hgg-next { right: 10px; }

.hgg-counter {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.55);
    color: #ffffff;
    font-size: 13px;
    z-index: 2;
    pointer-events: none;
}

.hgg-expand {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.45);
    color: #ffffff;
    font-size: 16px;
    pointer-events: none;
}

.hgg-thumbs {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.hgg-thumb {
    flex: 0 0 auto;
    width: 100px;
    height: 75px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 3px;
    background: none;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.15s ease, border-color 0.15s ease;
}

.hgg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px;
    display: block;
}

.hgg-thumb:hover { opacity: 1; }
.hgg-thumb-active { border-color: #337ab7; opacity: 1; }

/* --- fullscreen lightbox --- */

.hgg-lightbox {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.92);
    z-index: 10000;
}

.hgg-lightbox.hgg-open { display: flex; }

.hgg-lightbox-img {
    max-width: 95vw;
    max-height: 92vh;
    object-fit: contain;
    cursor: zoom-out;
}

.hgg-lightbox-counter { top: 14px; left: 14px; right: auto; }

.hgg-close {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.hgg-close:hover { background: rgba(255, 255, 255, 0.25); }

.hgg-noscroll { overflow: hidden; }

@media (max-width: 767px) {
    .hgg-nav { width: 34px; height: 48px; font-size: 16px; }
    .hgg-thumb { width: 72px; height: 54px; }
    .hgg-expand { display: none; }
}
