.product-photo-trigger, #product-photos button:not([data-photo-index]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 5px 13px;
  border: 1px solid #dce2e7;
  border-radius: 12px;
  background: #fff;
  color: #253541;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  cursor: pointer;
}
.product-photo-trigger svg, #product-photos button svg {
  flex: none;
  width: 18px;
  height: 18px;
}
.product-photo-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.product-photo-tools [data-photo-open="album"] {
  background: #edf3f8;
  border-color: #d2e0eb;
  font-weight: 700;
}
.product-gallery .product-thumbs {
  gap: 8px;
  margin: 8px 0;
  padding: 3px 2px 5px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  user-select: none;
}
.product-gallery .product-thumbs button {
  width: clamp(52px, 5vw, 72px);
  aspect-ratio: 1;
  padding: 3px;
  border-radius: 10px;
  scroll-snap-align: start;
  cursor: pointer;
}
.product-gallery .product-thumbs.can-drag,
.product-gallery .product-thumbs.can-drag button { cursor: grab; }
.product-gallery .product-thumbs.is-dragging,
.product-gallery .product-thumbs.is-dragging button { cursor: grabbing; }
.product-gallery .product-thumbs.is-dragging { scroll-snap-type: none; }
.product-gallery .product-thumbs img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.product-photo-main {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  cursor: zoom-in;
}
.product-main.product-photo-main { max-height: 64svh; border-radius: 28px; background: #f5f6f7; }
.product-photo-main img { display: block; }
.product-gallery .product-thumbs [aria-pressed="true"] { border-color: #526979; box-shadow: inset 0 0 0 1px #526979; }
.product-thumbs button:focus-visible,
.product-photo-trigger:focus-visible, .product-photo-main:focus-visible,
#product-photos button:focus-visible { outline: 3px solid #42769d; outline-offset: 2px; }

html:has(#product-photos[open]) { overflow: hidden; }
#product-photos {
  box-sizing: border-box;
  width: min(920px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100% - 32px);
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 22px;
  background: #fff;
  color: #21313d;
  box-shadow: 0 20px 80px #101c2833;
}
#product-photos::backdrop { background: rgb(19 29 37 / 78%); }
[data-photo-panel] { padding: 0 clamp(14px, 2.5vw, 28px) clamp(15px, 2.5vw, 28px); }
[data-photo-panel] header {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-block: 14px;
  background: inherit;
}
#product-photos[data-mode="album"] header { background: #fff; }
[data-photo-title] {
  flex: 1 1 110px;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: clamp(16px, 2vw, 22px);
  line-height: 1.5;
}
[data-photo-grid] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr));
  gap: clamp(8px, 1.5vw, 16px);
  padding: 4px;
}
[data-photo-index] {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 14px;
  background: #f3f5f6;
  cursor: zoom-in;
}
[data-photo-index] img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
[data-photo-index][aria-current="true"] { border-color: #536c80; }
[data-photo-index]:hover, .product-photo-trigger:hover { border-color: #788d9d; }

#product-photos[data-mode="full"] {
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  margin: 0;
  overflow: hidden;
  border-radius: 0;
  background: #17212a;
  color: #fff;
}
#product-photos[data-mode="full"] [data-photo-panel] {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: max(8px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
           max(8px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: #17212a;
  color: #fff;
}
#product-photos[data-mode="full"] header { position: static; padding-block: 0 8px; }
[data-photo-slide] {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
[data-photo-image] {
  flex: 1;
  display: block;
  width: 100%;
  height: 0;
  min-height: 0;
  object-fit: contain;
  border-radius: 10px;
  background: #f3f4f5;
  touch-action: pan-y pinch-zoom;
  user-select: none;
}
[data-photo-slide] nav { display: flex; align-items: center; justify-content: center; gap: 14px; }
[data-photo-count] { min-width: 55px; text-align: center; font-variant-numeric: tabular-nums; }
#product-photos[data-mode="full"] button {
  border-color: #596876;
  background: #23313c;
  color: #fff;
}
#product-photos[data-mode="full"] button:hover { background: #324451; }
#product-photos[data-mode="full"] button:focus-visible { outline-color: #b6d9f4; }
@media (max-width: 600px) {
  #product-photos { width: calc(100% - 16px); max-height: calc(100% - 16px); border-radius: 16px; }
  [data-photo-grid] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
