/* KORRTO — галерея карточки товара (06.11.2026, согласовано Ильёй; стенд — prototypes/pdp-gallery-2026-11-06/).
   ТЗ: tz/2026-11-06-правки-карточек-поток-2.md, п. 2. Слой поверх assets/css/product.css.
   1) Галерея по высоте экрана: кадр 3:4 не выше окна (13" Mac — 1440×800).
   2) Миниатюры — столбик той же высоты, прокрутка внутри + стрелки вверх/вниз.
   3) Кадр не растягивается по высоте миниатюр: счётчик и стрелки — на фото.
   4) Увеличение: кнопка-лупа и клик по фото — просмотр на весь экран, приближение. */

@media (min-width: 1025px) {
  /* Крошки в одну строку: длинное название товара (до 150 знаков из 1С) переносило их на 2 строки — галерея съезжала на 27 px
     и низ фото выходил за экран 13" (2 из 222 карточек, 06.11). Полное название — в заголовке ниже. */
  .crumbs { flex-wrap: nowrap; min-width: 0; }
  .crumbs > * { flex: none; }
  .crumbs > [aria-current="page"] { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pd-top {
    --gal-h: clamp(460px, calc(100svh - 190px), 780px);   /* 190 = полоса + шапка + крошки + отступ */
    --gal-w: min(calc(var(--gal-h) * .75), calc(56vw - 150px));
    grid-template-columns: auto minmax(0, 1fr);
  }
  .gallery { grid-template-columns: 76px var(--gal-w); align-items: start; top: calc(var(--head-h) + 20px); }
  .gallery__main { align-self: start; }
  .gallery__track { height: calc(var(--gal-w) / .75); aspect-ratio: auto; }

  .gallery__thumbs-wrap { position: relative; height: calc(var(--gal-w) / .75); }
  .gallery__thumbs { height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; scroll-behavior: smooth; padding: 3px; margin: -3px; }
  .gallery__thumbs::-webkit-scrollbar { display: none; }
  .gallery__thumbs button { flex: none; width: 100%; }
  .gth-nav { position: absolute; left: 0; right: 0; z-index: 2; height: 36px; display: grid; place-items: center; border: 0; padding: 0; color: var(--ink); cursor: pointer; transition: opacity .2s; }
  .gth-nav svg { width: 18px; height: 18px; }
  .gth-nav--up { top: 0; background: linear-gradient(#fff 35%, rgba(255,255,255,0)); }
  .gth-nav--down { bottom: 0; background: linear-gradient(rgba(255,255,255,0), #fff 65%); }
  .gth-nav[hidden] { display: none; }
  /* одно фото или нет фото: миниатюр нет — кадр без левой колонки */
  .gallery:has(.gallery__thumbs:empty) { grid-template-columns: var(--gal-w); }
  .gallery:has(.gallery__thumbs:empty) .gallery__thumbs-wrap { display: none; }
  .gallery:has(.gallery__thumbs:empty) .gallery__main { grid-column: 1; }
}
/* планшет и телефон: миниатюр нет (product.css), обёртка не должна занимать строку */
@media (max-width: 1024px) { .gallery__thumbs-wrap { display: none; } }

/* Лупа и курсор */
.gallery__track { cursor: zoom-in; }
.gallery__zoom { position: absolute; right: 16px; top: 16px; z-index: 3; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); color: var(--ink); display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 14px -6px rgba(0,0,0,.3); transition: background-color .2s, transform .2s var(--ease); }
.gallery__zoom:hover { background: #fff; transform: scale(1.06); }
.gallery__zoom svg { width: 20px; height: 20px; }
.gallery__zoom[hidden] { display: none; }
@media (max-width: 767px) { .gallery__zoom { right: 12px; top: 12px; width: 40px; height: 40px; } }

/* Просмотр на весь экран */
.glb { position: fixed; inset: 0; z-index: 200; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: #161615; color: #fff; opacity: 0; visibility: hidden; transition: opacity .2s, visibility 0s .2s; }
.glb.is-open { opacity: 1; visibility: visible; transition: opacity .2s, visibility 0s; }
.glb__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; }
.glb__count { font-size: 13px; color: rgba(255,255,255,.7); }
.glb__hint { font-size: 13px; color: rgba(255,255,255,.55); }
.glb__btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.06); color: #fff; display: grid; place-items: center; cursor: pointer; transition: background-color .2s; }
.glb__btn:hover { background: rgba(255,255,255,.16); }
.glb__btn svg { width: 20px; height: 20px; }
.glb__stage { position: relative; overflow: hidden; display: grid; place-items: center; touch-action: pan-y; }
.glb__img { max-width: calc(100vw - 180px); max-height: calc(100svh - 170px); width: auto; height: auto; object-fit: contain; cursor: zoom-in; user-select: none; -webkit-user-drag: none; transition: transform .25s var(--ease); }
.glb.is-zoom .glb__img { cursor: zoom-out; transform: scale(2.2); transition: none; }
.glb__prev, .glb__next { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; }
.glb__prev { left: 20px; } .glb__next { right: 20px; }
.glb.is-zoom .glb__prev, .glb.is-zoom .glb__next { display: none; }
.glb__thumbs { display: flex; gap: 8px; justify-content: center; padding: 12px 20px 18px; overflow-x: auto; scrollbar-width: none; }
.glb__thumbs::-webkit-scrollbar { display: none; }
.glb__thumbs button { flex: none; width: 48px; height: 64px; padding: 0; border: 0; background: #2a2a28; opacity: .5; outline: 1px solid transparent; outline-offset: 2px; cursor: pointer; transition: opacity .2s, outline-color .2s; }
.glb__thumbs button[aria-current="true"] { opacity: 1; outline-color: #fff; }
.glb__thumbs img { width: 100%; height: 100%; object-fit: cover; }
body.glb-on { overflow: hidden; }
@media (max-width: 767px) {
  .glb__hint { display: none; }
  .glb__img { max-width: 100vw; max-height: calc(100svh - 150px); }
  .glb__prev, .glb__next { display: none; }
  .glb__bar { padding: 10px 12px; }
  .glb__thumbs { justify-content: flex-start; padding: 10px 12px calc(14px + env(safe-area-inset-bottom)); }
}
