.product-gallery-open { position: relative; display: block; width: 100%; padding: 0; border: 0; background: var(--soft); cursor: zoom-in; }
.product-gallery-open:focus-visible { outline: 3px solid var(--brand-dark); outline-offset: -4px; }
.product-gallery-main { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--soft); }
.product-gallery-open-hint { position: absolute; right: 14px; bottom: 14px; padding: 7px 11px; border-radius: 4px; background: rgba(255,253,250,.94); color: var(--ink); font-size: 12px; box-shadow: 0 2px 10px #39312722; }
.product-detail > :first-child { min-width: 0; }
.product-gallery-strip { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; }
.product-gallery-thumbs { position: relative; display: flex; flex: 1 1 auto; min-width: 0; gap: 10px; overflow-x: auto; padding: 12px 2px 5px; scroll-snap-type: x mandatory; overscroll-behavior-inline: contain; }
.product-gallery-strip-arrow { flex: 0 0 34px; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--ink); font: 24px/1 var(--heading); }
.product-gallery-strip-arrow:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-dark); }
.product-gallery-strip-arrow:disabled { opacity: .35; cursor: default; }
.product-gallery-thumb { flex: 0 0 86px; width: 86px; height: 86px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #fff; scroll-snap-align: start; }
.product-gallery-thumb:hover,.product-gallery-thumb.is-active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.product-gallery-thumb:focus-visible,.product-gallery-modal-thumb:focus-visible,.product-gallery-arrow:focus-visible,.product-gallery-strip-arrow:focus-visible { outline: 3px solid var(--brand-dark); outline-offset: 2px; }
.product-gallery-thumb img,.product-gallery-modal-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 3px; }

.product-gallery-modal .modal-dialog { max-width: min(1180px,calc(100% - 32px)); }
.product-gallery-modal .modal-content { max-height: calc(100vh - 32px); border: 0; background: var(--paper); }
.product-gallery-modal .modal-header { align-items: flex-start; gap: 20px; border-color: var(--line); padding: 18px 22px; }
.product-gallery-modal .modal-title { margin: 4px 0 0; font: 24px/1.2 var(--heading); }
.product-gallery-modal-actions { display: flex; align-items: center; gap: 18px; white-space: nowrap; color: var(--muted); font-size: 13px; }
.product-gallery-modal .modal-body { min-height: 0; overflow: auto; padding: 18px 22px 20px; }
.product-gallery-viewer { display: grid; grid-template-columns: 88px minmax(0,1fr); gap: 18px; }
.product-gallery-modal-thumbs { position: relative; display: flex; flex-direction: column; gap: 10px; max-height: min(70vh,720px); overflow-y: auto; padding: 2px; }
.product-gallery-modal-thumb { flex: 0 0 82px; width: 82px; height: 82px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.product-gallery-modal-thumb:hover,.product-gallery-modal-thumb.is-active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.product-gallery-viewer-main { min-width: 0; }
.product-gallery-stage { position: relative; background: #f7f4ee; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.product-gallery-zoom-window { height: min(67vh,700px); min-height: 350px; overflow: auto; background: #fff; }
.product-gallery-zoom-window img { display: block; width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.product-gallery-zoom-window.is-zoomed img { width: 180%; height: auto; max-width: none; max-height: none; cursor: zoom-out; }
.product-gallery-arrow { position: absolute; z-index: 2; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,253,250,.94); color: var(--ink); font: 30px/1 var(--heading); box-shadow: 0 2px 10px #39312722; }
.product-gallery-arrow:hover { border-color: var(--brand); color: var(--brand-dark); }
.product-gallery-arrow[data-product-gallery-prev] { left: 12px; }
.product-gallery-arrow[data-product-gallery-next] { right: 12px; }
.product-gallery-viewer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 12px; color: var(--muted); font-size: 12px; }

@media (max-width: 767px) {
    .product-gallery-modal .modal-dialog { max-width: calc(100% - 16px); }
    .product-gallery-viewer { grid-template-columns: 1fr; }
    .product-gallery-modal-thumbs { order: 2; flex-direction: row; max-height: none; overflow-x: auto; overflow-y: hidden; }
    .product-gallery-zoom-window { height: min(58vh,540px); min-height: 280px; }
}
@media (max-width: 575px) {
    .product-gallery-thumb { flex-basis: 70px; width: 70px; height: 70px; }
    .product-gallery-modal .modal-dialog { max-width: 100%; }
    .product-gallery-modal .modal-content { max-height: 100vh; }
    .product-gallery-modal .modal-header { padding: 16px; }
    .product-gallery-modal .modal-title { font-size: 20px; }
    .product-gallery-modal .modal-body { padding: 12px 14px 18px; }
    .product-gallery-open-hint { right: 9px; bottom: 9px; }
    .product-gallery-arrow { width: 36px; height: 36px; font-size: 26px; }
    .product-gallery-viewer-toolbar span { display: none; }
}
