/* Closed product cards keep their existing layout; only interactions and dialog are added. */
.product-detail-main-image[data-gallery-open] {
  color: inherit;
  text-decoration: none;
  cursor: zoom-in;
  touch-action: manipulation;
}
.product-detail-thumbs > [data-gallery-index] { display: block; line-height: 0; }
.product-detail-thumbs > [data-gallery-index][aria-current="true"] { outline: 2px solid #244b75; outline-offset: 1px; }
[data-gallery-open]:focus-visible, [data-gallery-index]:focus-visible { outline: 3px solid #244b75; outline-offset: 2px; }
.search-result-image { position: relative; }
.search-result-image [data-product-hover] { position: absolute; inset: 0; }
.product-card [data-product-hover], .search-result-card [data-product-hover] { opacity: 0 !important; transition: opacity 0.3s linear; pointer-events: none; }
.product-card [data-product-hover][hidden], .search-result-card [data-product-hover][hidden] { display: none !important; }
.product-card:hover [data-product-hover], .search-result-image:hover [data-product-hover] { opacity: 1 !important; }
.dipiu-gallery-open { overflow: hidden; }
.dipiu-product-gallery-dialog {
  width: min(96vw, 1280px);
  height: min(94vh, 1000px);
  height: min(94dvh, 1000px);
  max-width: calc(100% - 24px);
  max-height: calc(100% - 24px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: #071a3d;
  box-shadow: 0 12px 48px #0005;
}
.dipiu-product-gallery-dialog:not([open]) { display: none; }
.dipiu-product-gallery-dialog[open] { display: flex; flex-direction: column; }
.dipiu-product-gallery-dialog::backdrop { background: rgb(7 16 36 / 72%); }
.dipiu-product-gallery-dialog [hidden] { display: none !important; }
.dipiu-gallery-head, .dipiu-gallery-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; }
.dipiu-gallery-head { padding-top: max(8px, env(safe-area-inset-top)); }
.dipiu-gallery-head p { margin: 0; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.dipiu-product-gallery-dialog button { min-width: 44px; min-height: 44px; border: 1px solid #d9dee7; border-radius: 6px; background: #fff; color: #071a3d; font: inherit; cursor: pointer; touch-action: manipulation; user-select: none; }
.dipiu-product-gallery-dialog button:focus-visible { outline: 3px solid #244b75; outline-offset: 2px; }
.dipiu-product-gallery-dialog button:active { background: #e9eef5; }
.dipiu-gallery-head button { flex: 0 0 44px; font-size: 26px; }
.dipiu-gallery-stage { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); place-items: center; flex: 1; min-height: 0; min-width: 0; overflow: auto; background: #f3f4f6; overscroll-behavior: contain; touch-action: pan-y pinch-zoom; }
.dipiu-gallery-stage > img { display: block; min-width: 0; min-height: 0; max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; }
.dipiu-gallery-stage.is-zoomed { display: block; touch-action: pan-x pan-y pinch-zoom; }
.dipiu-gallery-stage.is-zoomed > img { width: auto; height: auto; max-width: none; max-height: none; min-width: 0; margin: auto; }
.dipiu-gallery-controls { justify-content: center; }
.dipiu-gallery-controls button { padding: 4px 12px; }
.dipiu-gallery-controls [data-gallery-prev], .dipiu-gallery-controls [data-gallery-next] { font-size: 24px; }
.dipiu-gallery-error { margin: 0; padding: 8px 12px; color: #8b1b1b; font-size: 14px; }
.dipiu-gallery-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 6px 12px max(10px, env(safe-area-inset-bottom)); flex-shrink: 0; overscroll-behavior: contain; }
.dipiu-product-gallery-dialog .dipiu-gallery-thumb { flex: 0 0 56px; width: 56px; height: 64px; padding: 2px; }
.dipiu-gallery-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.dipiu-product-gallery-dialog .dipiu-gallery-thumb[aria-pressed="true"] { border: 2px solid #244b75; }
@media (prefers-reduced-motion: reduce) { .product-card [data-product-hover], .product-card:hover [data-product-hover], .search-result-image [data-product-hover], .search-result-image:hover [data-product-hover] { transition: none !important; } }
