/* Product page gallery, zoom viewer, recently viewed & compare */
.pd-gallery { display: grid; gap: 12px; position: sticky; top: calc(var(--header-height, 92px) + 16px); }
.pd-stage { position: relative; aspect-ratio: 1 / 1; border-radius: 24px; overflow: hidden; background: var(--tint, #f1ede5); transition: background .5s cubic-bezier(.22,1,.36,1); cursor: zoom-in; }
.pd-main { position: absolute; inset: 5%; width: 90%; height: 90%; object-fit: contain; filter: drop-shadow(0 22px 22px rgba(22,20,15,.18)); transition: opacity .16s ease, transform .4s cubic-bezier(.22,1,.36,1); }
.pd-main.is-swapping { opacity: 0; transform: scale(.97); }
.pd-stage.is-loading::after { content: ""; position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px; border-radius: 50%; border: 3px solid rgba(0,0,0,.12); border-top-color: #16140f; animation: pd-spin .8s linear infinite; }
@keyframes pd-spin { to { transform: rotate(360deg); } }
.pd-lens { position: absolute; inset: 0; background-repeat: no-repeat; background-color: #f7f4ee; opacity: 0; pointer-events: none; transition: opacity .2s; }
.pd-stage.is-zooming .pd-lens { opacity: 1; }
.pd-zoom-btn { position: absolute; right: 14px; bottom: 14px; display: inline-flex; gap: 6px; align-items: center; min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: rgba(255,255,255,.92); font: 600 .85rem var(--font-sans); cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.12); z-index: 2; }
.pd-hint { position: absolute; left: 14px; bottom: 18px; margin: 0; font-size: .75rem; color: rgba(22,20,15,.55); }
.pd-stage.is-zooming .pd-hint, .pd-stage.is-zooming .pd-zoom-btn { opacity: 0; }
.pd-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.pd-thumb { flex: none; width: 72px; height: 72px; border-radius: 14px; border: 2px solid transparent; background: var(--tint); padding: 4px; cursor: pointer; transition: border-color .2s, transform .2s; }
.pd-thumb img { width: 100%; height: 100%; object-fit: contain; }
.pd-thumb:hover { transform: translateY(-2px); }
.pd-thumb.is-active { border-color: #16140f; }

.pd-viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #0f0e0c; color: #fff; display: none; grid-template-rows: auto 1fr auto; }
.pd-viewer[open] { display: grid; animation: pd-fade .25s ease; }
.pd-viewer::backdrop { background: rgba(0,0,0,.85); }
@keyframes pd-fade { from { opacity: 0; } to { opacity: 1; } }
.pd-viewer__top { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
.pd-viewer__title { margin: 0; font-weight: 600; font-size: .95rem; }
.pd-viewer__count { color: rgba(255,255,255,.55); font-weight: 400; margin-left: 6px; }
.pd-viewer__tools { display: flex; gap: 8px; }
.pd-viewer__tools button, .pd-viewer__nav { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 1.3rem; cursor: pointer; }
.pd-viewer__tools button:hover, .pd-viewer__nav:hover { background: rgba(255,255,255,.22); }
.pd-viewer__stage { position: relative; overflow: hidden; touch-action: none; display: grid; place-items: center; cursor: zoom-in; user-select: none; }
.pd-viewer__stage.is-zoomed { cursor: grab; }
.pd-viewer__stage img { max-width: min(92vw, 1000px); max-height: 100%; object-fit: contain; transition: transform .15s ease-out; will-change: transform; }
.pd-viewer__nav { position: absolute; top: 50%; transform: translateY(-50%); font-size: 2rem; }
.pd-viewer__nav--prev { left: 12px; } .pd-viewer__nav--next { right: 12px; }
.pd-viewer__thumbs { display: flex; gap: 8px; justify-content: center; overflow-x: auto; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); }
.pd-viewer__thumbs button { flex: none; width: 60px; height: 60px; border-radius: 12px; border: 2px solid transparent; background: rgba(255,255,255,.08); padding: 4px; cursor: pointer; }
.pd-viewer__thumbs button.is-active { border-color: #fff; }
.pd-viewer__thumbs img { width: 100%; height: 100%; object-fit: contain; }

.pd-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.pd-tools button, .pd-tools a { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(22,20,15,.12); background: #fff; color: #16140f; font: 600 .85rem var(--font-sans); cursor: pointer; text-decoration: none; }
.pd-tools button.is-on { background: #16140f; color: #fff; }

.recent-strip { margin-top: 32px; }
.recent-strip h2 { font: 600 1.4rem var(--font-display); margin: 0 0 14px; }
.recent-list { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.recent-list a { flex: none; width: 150px; text-decoration: none; color: #16140f; font-size: .85rem; font-weight: 600; }
.recent-list span.img { display: block; aspect-ratio: 1; border-radius: 16px; background: var(--tint, #f1ede5); margin-bottom: 6px; padding: 8px; }
.recent-list img { width: 100%; height: 100%; object-fit: contain; }

.compare-bar { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 1500; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px; border-radius: 999px; background: #16140f; color: #fff; box-shadow: 0 16px 40px rgba(0,0,0,.3); font-size: .9rem; }
.compare-bar a { background: #fff; color: #16140f; border-radius: 999px; padding: 8px 14px; font-weight: 700; text-decoration: none; }
.compare-bar button { background: transparent; border: 0; color: rgba(255,255,255,.7); cursor: pointer; font: inherit; }
.shop-card__compare { position: absolute; right: 12px; bottom: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); cursor: pointer; display: grid; place-items: center; z-index: 2; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.shop-card__compare.is-on { background: #16140f; color: #fff; }

@media (max-width: 900px) { .pd-gallery { position: static; } .pd-hint { display: none; } }
@media (prefers-reduced-motion: reduce) { .pd-main, .pd-viewer__stage img { transition: none; } }
