.detail-gallery {
    --gallery-ink: #20201e;
    --gallery-accent: #a7643f;
    --gallery-stage-height: 0px;
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    width: 100%;
}

.detail-gallery__thumbnails {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: var(--gallery-stage-height);
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #b8b5b1 transparent;
}

.detail-gallery__thumbnail {
    display: block;
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    padding: 0;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 3px;
    background: #e5e3e0;
    cursor: pointer;
    transition: border-color .2s ease, opacity .2s ease;
}

.detail-gallery__thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.detail-gallery [hidden] { display: none !important; }
.detail-gallery__thumbnail:hover { opacity: .82; }
.detail-gallery__thumbnail.is-active { border: 2px solid var(--gallery-accent); }

.detail-gallery__stage {
    position: relative;
    min-width: 0;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #e7e5e2;
}

.detail-gallery__image {
    position: absolute;
    inset: 0;
    display: none;
    width: 100%;
    height: 100%;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.detail-gallery__image.is-active { display: block; }
.detail-gallery__image > img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s cubic-bezier(.2,.7,.2,1); }
.detail-gallery__image:hover > img { transform: scale(1.025); }

.detail-gallery__zoom-hint {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: #fff;
    font: 500 13px/1.2 'Poppins', sans-serif;
    letter-spacing: .02em;
    opacity: 0;
    background: rgb(20 19 18 / 22%);
    transition: opacity .22s ease;
}
.detail-gallery__zoom-hint i { font-size: 27px; }
.detail-gallery__image:hover .detail-gallery__zoom-hint,
.detail-gallery__image:focus-visible .detail-gallery__zoom-hint { opacity: 1; }

.detail-gallery__arrow,
.detail-gallery__viewer-arrow {
    position: absolute;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid rgb(255 255 255 / 48%);
    border-radius: 50%;
    color: #fff;
    background: rgb(32 32 30 / 65%);
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}
.detail-gallery__arrow:hover, .detail-gallery__viewer-arrow:hover { background: var(--gallery-accent); transform: scale(1.06); }
.detail-gallery__arrow--previous { top: 50%; left: 12px; transform: translateY(-50%); }
.detail-gallery__arrow--previous:hover { transform: translateY(-50%) scale(1.06); }
.detail-gallery__arrow--next { top: 50%; right: 12px; transform: translateY(-50%); }
.detail-gallery__arrow--next:hover { transform: translateY(-50%) scale(1.06); }
.detail-gallery__empty { display: grid; place-items: center; height: 100%; color: #87837f; font-size: 36px; }
.detail-gallery__empty-message { max-width: 32ch; padding: 24px; margin: 0; font-size: 15px; line-height: 1.7; text-align: center; }

.detail-gallery__dialog {
    position: fixed;
    inset: 0;
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    color: #f6f4f1;
    background: transparent;
    overflow: hidden;
}
.detail-gallery__dialog::backdrop { background: rgb(12 12 12 / 94%); backdrop-filter: blur(8px); }
.detail-gallery__viewer { position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; }
.detail-gallery__toolbar { position: absolute; z-index: 4; top: 0; right: 0; left: 0; display: flex; align-items: center; justify-content: space-between; min-height: 70px; padding: 12px 24px; background: linear-gradient(rgb(0 0 0 / 48%), transparent); }
.detail-gallery__counter { font: 500 13px 'Poppins', sans-serif; letter-spacing: .08em; }
.detail-gallery__tools { display: flex; gap: 8px; }
.detail-gallery__tools button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; height: 44px; padding: 0 13px; border: 1px solid rgb(255 255 255 / 24%); border-radius: 24px; color: #fff; background: rgb(255 255 255 / 9%); cursor: pointer; transition: background .2s ease; font: 500 12px 'Poppins', sans-serif; white-space: nowrap; }
.detail-gallery__tools button i { font-size: 14px; }
.detail-gallery__tools button:hover { background: rgb(255 255 255 / 22%); }
.detail-gallery__tools .detail-gallery__close { margin-left: 12px; background: rgb(255 255 255 / 16%); }
.detail-gallery__canvas { display: grid; flex: 1; place-items: center; min-height: 0; padding: 76px 90px 62px; overflow: hidden; touch-action: none; cursor: grab; }
.detail-gallery__canvas.is-dragging { cursor: grabbing; }
.detail-gallery__canvas img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; user-select: none; transform-origin: center center; will-change: transform; }
.detail-gallery__viewer-arrow { top: 50%; z-index: 3; width: 48px; height: 48px; transform: translateY(-50%); }
.detail-gallery__viewer-arrow--previous { left: 22px; }
.detail-gallery__viewer-arrow--next { right: 22px; }
.detail-gallery__help { position: absolute; right: 0; bottom: 13px; left: 0; margin: 0; color: rgb(255 255 255 / 62%); text-align: center; font: 400 12px 'Poppins', sans-serif; }
.detail-gallery__dialog :focus-visible, .detail-gallery :focus-visible { outline: 3px solid #d9a47e; outline-offset: 3px; }

@media (max-width: 991.98px) {
    .detail-gallery { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .detail-gallery__thumbnails { order: 2; flex-direction: row; max-height: none; max-width: 100%; padding: 2px 0 7px; overflow-x: auto; overflow-y: hidden; }
    .detail-gallery__thumbnail { flex-basis: 64px; width: 64px; height: 64px; }
    .detail-gallery__stage { order: 1; }
    .detail-gallery__canvas { padding: 108px 54px 58px; }
    .detail-gallery__toolbar { min-height: 98px; flex-direction: column; align-items: flex-start; gap: 8px; padding: 10px 12px; }
    .detail-gallery__tools { width: 100%; gap: 5px; overflow-x: auto; padding-bottom: 2px; }
    .detail-gallery__tools button { flex: 0 0 auto; height: 38px; padding: 0 11px; }
    .detail-gallery__tools .detail-gallery__close { margin-left: auto; }
    .detail-gallery__viewer-arrow { width: 40px; height: 40px; }
    .detail-gallery__viewer-arrow--previous { left: 8px; }
    .detail-gallery__viewer-arrow--next { right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    .detail-gallery *, .detail-gallery__dialog * { transition-duration: .01ms !important; }
}
