/* Separate entry point so swiping or tapping the product itself keeps its usual behavior. */
.card-media [data-gallery-open] {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  min-width: 54px;
  min-height: 52px;
  padding: 5px 7px;
  border: 1px solid rgb(255 255 255 / 55%);
  border-radius: 7px;
  color: #fff;
  background: rgb(49 38 33 / 82%);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: .02em;
}
.card-media [data-gallery-open]::before {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  margin: 1px 12px 12px 0;
  border-radius: 1.5px;
  background: currentColor;
  box-shadow: 12px 0, 0 12px, 12px 12px;
}
.card-media [data-gallery-open][hidden],
#pcs-photo-viewer button[hidden] { display: none; }
@media (hover: hover) {
  .card-media [data-gallery-open]:hover { background: var(--cherry); }
}

:root.pcs-gallery-open { overflow: hidden; }
#pcs-photo-grid,
#pcs-photo-viewer {
  inset: 0;
  margin: auto;
  padding: 0;
  max-width: none;
  max-height: none;
  border: 0;
  color: #29211e;
  font-family: var(--sans);
}
#pcs-photo-grid::backdrop { background: rgb(24 20 19 / 66%); }
#pcs-photo-viewer::backdrop { background: rgb(13 12 12 / 78%); }
#pcs-photo-grid {
  width: min(800px, calc(100vw - 36px));
  overflow: visible;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 56px rgb(0 0 0 / 22%);
}
.pcs-grid-panel {
  display: flex;
  flex-direction: column;
  max-height: 86vh;
  max-height: min(880px, 86dvh);
}
.pcs-grid-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px 6px 18px;
}
.pcs-grid-header h2 {
  font: 700 clamp(14px, 2.5vw, 17px)/1.4 var(--sans);
  overflow-wrap: anywhere;
}
.pcs-close, .pcs-view-prev, .pcs-view-next {
  position: relative;
  flex: none;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #352c28;
  cursor: pointer;
  touch-action: manipulation;
}
.pcs-close::before, .pcs-close::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}
.pcs-close::before { transform: rotate(45deg); }
.pcs-close::after { transform: rotate(-45deg); }
.pcs-grid-header .pcs-close { background: #f3eeea; }
.pcs-grid-scroll {
  min-height: 0;
  padding: 2px 18px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 0 0 10px 10px;
}
.pcs-grid-scroll section + section { margin-top: 22px; }
.pcs-grid-scroll h3 {
  margin: 4px 0 8px;
  font: 700 .875rem/1.5 var(--sans);
}
.pcs-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.pcs-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  background: #f4f2ef;
}
.pcs-thumb:focus-visible { outline-offset: -3px; }
.pcs-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
#pcs-photo-viewer {
  width: min(100vw, calc(100vh - 24px), 1000px);
  width: min(100vw, calc(100dvh - 24px), 1000px);
  overflow: visible;
  border-radius: 0;
  background: #fff;
}
.pcs-view-stage {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.pcs-view-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
}
#pcs-photo-viewer button { position: absolute; background: rgb(255 255 255 / 88%); }
#pcs-photo-viewer .pcs-close { right: 8px; top: 8px; }
.pcs-view-prev, .pcs-view-next { top: 50%; transform: translateY(-50%); }
.pcs-view-prev { left: 6px; }
.pcs-view-next { right: 6px; }
.pcs-view-prev::before, .pcs-view-next::before {
  content: "";
  width: 12px;
  height: 12px;
  border-top: 2.5px solid currentColor;
  border-right: 2.5px solid currentColor;
}
.pcs-view-prev::before { transform: translateX(2px) rotate(-135deg); }
.pcs-view-next::before { transform: translateX(-2px) rotate(45deg); }
.pcs-view-status {
  position: absolute;
  inset: auto 8px 8px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  font-size: .8125rem;
  font-weight: 700;
  line-height: 1.4;
}
.pcs-view-status span {
  padding: 3px 7px;
  border-radius: 3px;
  background: rgb(255 255 255 / 90%);
}
.pcs-view-color:empty { visibility: hidden; }
.pcs-view-count { flex: none; font-variant-numeric: tabular-nums; }
@media (max-width: 650px) {
  .pcs-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .pcs-grid-scroll { padding: 2px 12px 12px; }
  .pcs-grid-header { padding: 5px 6px 5px 12px; }
}
