/* Rangrez Shop UX — 24 Nov 2026
   1) Hide category/search chrome on scroll down, reveal on scroll up
   2) Product image lightbox + gallery swipe
   Preview-only until Sajid Sir says live. */

.rzs-sticky-filters,
.wt-bar {
  transition: top 0.28s ease;
}
@media (prefers-reduced-motion: reduce) {
  .rzs-sticky-filters,
  .wt-bar { transition: none; }
}

/* Main product gallery: zoom affordance + swipe */
.rzs-gallery-main {
  position: relative;
  cursor: zoom-in;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.rzs-gallery-main img {
  pointer-events: none;
}
.rzs-gallery-main:focus-visible {
  outline: 2px solid var(--shop-neel, #2E3A87);
  outline-offset: 3px;
}
.rz-ux-zoomhint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(27, 27, 47, 0.72);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(27, 27, 47, 0.2);
}
.rz-ux-zoomhint svg { width: 18px; height: 18px; }
.rz-ux-counter,
.rz-ux-dots {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 2;
}
.rz-ux-counter {
  top: 10px;
  background: rgba(27, 27, 47, 0.72);
  color: #fff;
  font: 600 12px/1 Poppins, system-ui, sans-serif;
  padding: 5px 9px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.rz-ux-dots {
  bottom: 8px;
  display: flex;
  gap: 8px;
  pointer-events: auto;
  align-items: center;
}
/* Visual dots stay small; the button hit target is at least 24×24 with 8px gap. */
.rz-ux-dots button {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: transparent;
  cursor: pointer;
  position: relative;
  flex: none;
}
.rz-ux-dots button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(27, 27, 47, 0.45);
  transform: translate(-50%, -50%);
}
.rz-ux-dots button[aria-current="true"]::after {
  background: var(--shop-neel, #2E3A87);
  width: 16px;
}
.rz-ux-dots button:focus-visible {
  outline: 2px solid var(--shop-neel, #2E3A87);
  outline-offset: 2px;
}

/* Also style the legacy ShopProduct page gallery */
[data-testid="shop-product-page"] section[aria-label="Product images"] {
  position: relative;
}
[data-testid="shop-product-page"] section[aria-label="Product images"] > img {
  cursor: zoom-in;
  touch-action: pan-y;
  user-select: none;
}

/* Lightbox */
.rz-ux-lb[hidden] { display: none !important; }
.rz-ux-lb {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  background: rgba(8, 9, 16, 0.94);
  color: #fff;
  touch-action: none;
}
.rz-ux-lb-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
}
.rz-ux-lb-count {
  font: 600 14px/1.2 Poppins, system-ui, sans-serif;
}
.rz-ux-lb-close,
.rz-ux-lb-prev,
.rz-ux-lb-next {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rz-ux-lb-close {
  width: 44px;
  height: 44px;
  font-size: 28px;
  line-height: 1;
}
.rz-ux-lb-prev,
.rz-ux-lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  font-size: 32px;
  line-height: 1;
  z-index: 2;
}
.rz-ux-lb-prev { left: max(8px, env(safe-area-inset-left, 0px)); }
.rz-ux-lb-next { right: max(8px, env(safe-area-inset-right, 0px)); }
.rz-ux-lb-close:hover,
.rz-ux-lb-prev:hover,
.rz-ux-lb-next:hover { background: rgba(255, 255, 255, 0.22); }
.rz-ux-lb-close:focus-visible,
.rz-ux-lb-prev:focus-visible,
.rz-ux-lb-next:focus-visible {
  outline: 2px solid #F2A71B;
  outline-offset: 2px;
}
.rz-ux-lb-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: zoom-in;
}
.rz-ux-lb-stage.is-zoomed { cursor: grab; }
.rz-ux-lb-stage.is-zoomed.is-panning { cursor: grabbing; }
.rz-ux-lb-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}
.rz-ux-lb-dots {
  flex: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
}
.rz-ux-lb-dots button {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: transparent;
  cursor: pointer;
  position: relative;
  flex: none;
}
.rz-ux-lb-dots button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  transform: translate(-50%, -50%);
}
.rz-ux-lb-dots button[aria-current="true"]::after {
  background: #F2A71B;
  width: 18px;
}
.rz-ux-lb-dots button:focus-visible {
  outline: 2px solid #F2A71B;
  outline-offset: 2px;
}
body.rz-ux-lb-open { overflow: hidden; }

@media (max-width: 699px) {
  .rz-ux-lb-prev,
  .rz-ux-lb-next { width: 40px; height: 40px; font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .rz-ux-lb-stage img { transition: none !important; }
}

/* CLS: reserve a square main-image slot. Do not set aspect-ratio or
   contain:layout in a way that lets the photo's intrinsic size widen the
   grid (that overflowed iPhone: image ~563px in a 358px column, white
   strip on the left, horizontal scroll, dots sitting on the thumbs). */
.rzs-product-layout,
.rzs-gallery,
.rzs-gallery-main,
.rzs-thumbnails,
.rzs-product-info {
  min-width: 0;
  max-width: 100%;
}
.rzs-gallery {
  width: 100%;
  overflow-x: hidden;
}
.rzs-gallery-main {
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.rzs-gallery-main img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
}
.rzs-thumbnails {
  min-height: 70px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
@media (min-width: 700px) {
  .rzs-chrome {
    min-height: 153px;
  }
  .rzs-product-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 38px;
    min-height: 0;
  }
  /* Hold the above-the-fold slot while "Loading product…" is on screen, so the
     footer is not left mid-viewport and then pushed down (CLS 0.643 on desktop). */
  main.rzs-product-main {
    min-height: calc(100vh - 160px);
  }
  .rzs-gallery {
    width: 100%;
    min-height: calc((min(100%, 1200px) - 38px) / 2);
  }
}
@media (max-width: 699px) {
  /* Thumbnails + counter already exist; 24px hit-target buttons look like
     big grey/blue circles on iOS Safari and sat on the thumb row. */
  .rz-ux-dots { display: none; }
  .rzs-chrome {
    min-height: 97px;
  }
  main.rzs-product-main {
    min-height: calc(min(100vw, 1200px) * 0.92 + 96px);
  }
  .rzs-product-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
  }
}

/* Overlay sits as a sibling of the React-managed image, so we do not
   insert children into .rzs-gallery-main (that caused a render loop). */
.rzs-gallery,
[data-testid="shop-product-page"] section[aria-label="Product images"] {
  position: relative;
}
/* Cover only the square main image, not the thumbnail row (thumbs were
   reported as obscured 62×14 touch targets when the overlay used inset:0). */
.rz-ux-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  pointer-events: none;
  z-index: 3;
  border-radius: 17px;
  overflow: hidden;
}
.rz-ux-overlay .rz-ux-dots { pointer-events: auto; }
/* When the gallery is sticky, keep the overlay in the same box */
.rzs-gallery-main + .rz-ux-overlay { /* main is first; overlay follows */ }

html.rz-ux-cats-hidden .wt-bar {
  pointer-events: none;
  visibility: hidden;
}
