/* =============================================================
   АйсФуд — галерея в карточке товара (gallery.js).
   Лента кадров внутри фотослота .pdp__main, миниатюры под ним,
   просмотр во весь экран. Подложку под прозрачными снимками даёт
   сам слот (--ph-fall), как и у основного фото.
   ============================================================= */

/* ---------- лента --------------------------------------------- */
.gal__track {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.gal__track::-webkit-scrollbar { display: none; }
.gal__track:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.gal__slide {
  flex: 0 0 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.gal__slide img { cursor: zoom-in; }

/* Стрелки — только там, где есть мышь: на телефоне листают пальцем. */
.gal__nav {
  position: absolute; top: 50%; z-index: 2;
  width: 40px; height: 40px; margin-top: -20px;
  display: none; align-items: center; justify-content: center;
  padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: rgba(22,22,22,.72);
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s var(--ease), background .2s var(--ease);
}
:root[data-theme="light"] .gal__nav { background: rgba(255,255,255,.85); }
.gal__nav--prev { left: 10px; }
.gal__nav--next { right: 10px; }
.gal__nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.gal__nav:disabled { opacity: 0 !important; pointer-events: none; }
@media (hover: hover) and (pointer: fine) {
  .gal__nav { display: flex; }
  .pdp__main.gal:hover .gal__nav, .gal__nav:focus-visible { opacity: 1; }
}

/* Точки: сколько кадров и на каком мы. */
.gal__dots {
  position: absolute; left: 0; right: 0; bottom: 10px; z-index: 2;
  display: flex; justify-content: center; gap: 6px;
  pointer-events: none;
}
.gal__dots span {
  width: 6px; height: 6px; border-radius: 3px;
  background: var(--text); opacity: .3;
  transition: width .2s var(--ease), opacity .2s var(--ease);
}
.gal__dots span.is-on { width: 16px; opacity: .85; }

/* ---------- миниатюры ----------------------------------------- */
/* width: 0 + min-width: 100% — ряд не распирает колонку сетки своей
   шириной: на телефоне пять миниатюр шире экрана, и без этого вся
   страница уезжала вбок. Лишнее прокручивается внутри ряда. */
.gal__thumbs {
  position: relative;
  display: flex; gap: 8px;
  width: 0; min-width: 100%;
  margin-top: 10px; padding: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.gal__thumbs::-webkit-scrollbar { display: none; }
.gal__thumb {
  flex: 0 0 68px; width: 68px; height: 68px;
  padding: 0;
  border: 1px solid var(--line); border-radius: var(--r);
  cursor: pointer;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.gal__thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.gal__thumb:hover { border-color: var(--text-3); }
.gal__thumb[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.gal__thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- во весь экран ------------------------------------- */
.gal-lock, .gal-lock body { overflow: hidden; }
.gal-lb {
  position: fixed; inset: 0; z-index: 1000;
  background:
    radial-gradient(60% 50% at 50% 60%, rgba(255,168,56,.10), transparent 70%),
    rgba(12,12,12,.96);
  color: #fff;
}
.gal-lb__stage {
  position: absolute; inset: 0;
  display: flex;
  overflow: hidden;
}
.gal-lb__img {
  flex: none;
  margin: auto;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 110px);
  max-height: calc(100dvh - 110px);
  object-fit: contain;
  cursor: zoom-in;
  -webkit-user-select: none; user-select: none;
  -webkit-user-drag: none;
}
.gal-lb.is-zoom .gal-lb__stage { overflow: auto; }
.gal-lb.is-zoom .gal-lb__img { max-width: none; max-height: none; cursor: zoom-out; }
.gal-lb__btn {
  position: absolute; z-index: 2;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #fff;
  cursor: pointer;
  transition: background .2s var(--ease), opacity .2s var(--ease);
}
.gal-lb__btn:hover { background: rgba(255,255,255,.22); }
.gal-lb__btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.gal-lb__btn:disabled { opacity: .25; cursor: default; }
.gal-lb__btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.gal-lb__close { top: 12px; right: 12px; }
.gal-lb__nav { top: 50%; margin-top: -22px; }
.gal-lb__nav--prev { left: 12px; }
.gal-lb__nav--next { right: 12px; }
.gal-lb.is-zoom .gal-lb__nav { display: none; }
.gal-lb__count {
  position: absolute; top: 26px; left: 0; right: 0;
  text-align: center;
  font: 600 .9rem/1 var(--f-label, sans-serif);
  color: rgba(255,255,255,.8);
  pointer-events: none;
}
/* На телефоне стрелки в просмотре только мешают — листают свайпом. */
@media (max-width: 600px) { .gal-lb__nav { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .gal__nav, .gal__dots span, .gal__thumb, .gal-lb__btn { transition: none; }
}
