/*
 * R27 Lightbox — product image gallery viewer.
 * Self-contained: only depends on r27-lightbox.js. No external libraries.
 */

.r27lb-trigger {
    position: relative;
    cursor: zoom-in;
}

/*
 * Magnifier badge over the main product image.
 * The wrapper is a square overlay matching the 1:1 main image, so the pill
 * sits on the image's bottom-right corner rather than over the thumbnails.
 */
.r27lb-hint {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 14px;
    box-sizing: border-box;
    pointer-events: none;
}

.r27lb-hint-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(20, 20, 22, .72);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #f5f2ec;
    font-size: .6875rem;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    transition: opacity .3s ease, transform .3s ease;
}

.r27lb-hint-pill svg {
    width: 14px;
    height: 14px;
    color: #d6c3a3;
}

@media (hover: hover) {
    .r27lb-hint-pill { opacity: 0; transform: translateY(6px); }
    .image-info:hover .r27lb-hint-pill { opacity: 1; transform: none; }
}

/* ---------- Overlay ---------- */

.r27lb {
    --r27lb-gold: #b0976d;
    --r27lb-gold-light: #d6c3a3;
    --r27lb-bg: #141416;
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse at 50% 40%, rgba(176, 151, 109, .14), transparent 60%),
        rgba(20, 20, 22, .97);
    color: #f5f2ec;
    font-family: 'Be Vietnam Pro', Arial, sans-serif;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility 0s linear .3s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.r27lb.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity .3s ease;
}

html.r27lb-locked,
html.r27lb-locked body {
    overflow: hidden;
}

/* ---------- Top bar ---------- */

.r27lb-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    flex: none;
}

.r27lb-title {
    min-width: 0;
    overflow: hidden;
    color: var(--r27lb-gold-light);
    font-size: .875rem;
    font-weight: 500;
    letter-spacing: .03em;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.r27lb-counter {
    flex: none;
    color: rgba(245, 242, 236, .6);
    font-size: .8125rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: .08em;
}

.r27lb-counter b {
    color: var(--r27lb-gold);
    font-weight: 600;
}

.r27lb-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: none;
}

.r27lb-btn {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid rgba(214, 195, 163, .22);
    border-radius: 50%;
    background: rgba(255, 255, 255, .04);
    color: #f5f2ec;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, color .2s ease, transform .2s ease;
}

.r27lb-btn svg {
    width: 18px;
    height: 18px;
}

.r27lb-btn:hover,
.r27lb-btn:focus-visible {
    border-color: var(--r27lb-gold);
    background: var(--r27lb-gold);
    color: #141416;
    outline: none;
}

/* ---------- Stage ---------- */

.r27lb-stage {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
}

.r27lb-figure {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 8px 88px;
    box-sizing: border-box;
}

.r27lb-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 0 1px rgba(214, 195, 163, .15);
    cursor: zoom-in;
    transform-origin: center center;
    transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .25s ease;
    will-change: transform;
    -webkit-user-drag: none;
}

.r27lb.is-zoomed .r27lb-img {
    cursor: grab;
}

.r27lb.is-dragging .r27lb-img {
    cursor: grabbing;
    transition: none;
}

.r27lb-img.is-loading {
    opacity: 0;
}

.r27lb-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border: 2px solid rgba(214, 195, 163, .2);
    border-top-color: var(--r27lb-gold);
    border-radius: 50%;
    animation: r27lb-spin .8s linear infinite;
    opacity: 0;
    transition: opacity .2s ease;
    pointer-events: none;
}

.r27lb.is-loading .r27lb-spinner {
    opacity: 1;
}

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

.r27lb-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 52px;
    height: 52px;
    margin-top: -26px;
}

.r27lb-nav svg {
    width: 22px;
    height: 22px;
}

.r27lb-prev { left: 22px; }
.r27lb-next { right: 22px; }

.r27lb.is-single .r27lb-nav,
.r27lb.is-single .r27lb-thumbs {
    display: none;
}

/* ---------- Caption + thumbnails ---------- */

.r27lb-foot {
    flex: none;
    padding: 12px 20px 18px;
    text-align: center;
}

.r27lb-caption {
    min-height: 1.4em;
    margin: 0 auto 12px;
    max-width: 760px;
    color: rgba(245, 242, 236, .72);
    font-size: .8125rem;
    line-height: 1.5;
}

.r27lb-caption::before,
.r27lb-caption::after {
    content: '';
    display: inline-block;
    width: 22px;
    height: 1px;
    margin: 0 12px;
    vertical-align: middle;
    background: var(--r27lb-gold);
    opacity: .6;
}

.r27lb-thumbs {
    display: flex;
    justify-content: center;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 2px;
    scrollbar-width: none;
}

.r27lb-thumbs::-webkit-scrollbar {
    display: none;
}

.r27lb-thumb {
    flex: none;
    width: 64px;
    height: 64px;
    padding: 3px;
    border: 1px solid rgba(214, 195, 163, .2);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    opacity: .5;
    transition: opacity .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.r27lb-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.r27lb-thumb:hover {
    opacity: .85;
    transform: translateY(-2px);
}

.r27lb-thumb.is-active {
    opacity: 1;
    border-color: var(--r27lb-gold);
    box-shadow: 0 0 0 1px var(--r27lb-gold), 0 6px 18px rgba(176, 151, 109, .25);
}

.r27lb-thumb:focus-visible {
    outline: 2px solid var(--r27lb-gold);
    outline-offset: 2px;
}

/* ---------- Mobile ---------- */

@media (max-width: 767px) {
    .r27lb-bar { padding: 10px 12px; }
    .r27lb-title { display: none; }
    .r27lb-btn { width: 38px; height: 38px; }
    .r27lb-figure { padding: 0 12px; }
    .r27lb-nav { width: 40px; height: 40px; margin-top: -20px; background: rgba(20, 20, 22, .55); }
    .r27lb-prev { left: 8px; }
    .r27lb-next { right: 8px; }
    .r27lb-foot { padding: 10px 12px 16px; }
    .r27lb-caption { font-size: .75rem; margin-bottom: 10px; }
    .r27lb-caption::before,
    .r27lb-caption::after { width: 14px; margin: 0 8px; }
    .r27lb-thumbs { justify-content: flex-start; }
    .r27lb-thumb { width: 52px; height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
    .r27lb,
    .r27lb-img,
    .r27lb-thumb { transition: none; }
}
