/*
 * «Монумент» — полноэкранный просмотр фото товара (обновление 13).
 * Логика: static/js/product-viewer.js
 */
.mv {
  --mv-paper: 239 236 230; /* тёплый фон, как у предметных съёмок */
  --mv-veil: 1;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  color: var(--ink);
  background: rgb(var(--mv-paper) / var(--mv-veil));
  overscroll-behavior: contain;
}
.mv::backdrop {
  background: transparent;
}
.mv[open] {
  display: block;
  animation: none;
}

/* ---------- Сцена и кадры ---------- */
.mv-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}
.mv-img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  transform-origin: 0 0;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.mv-img[hidden] {
  display: none;
}
.mv-img.is-under {
  z-index: 0;
}
.mv-img:not(.is-under) {
  z-index: 1;
}
@media (hover: hover) and (pointer: fine) {
  .mv-stage {
    cursor: none;
  }
}

/* ---------- Курсор-лупа ---------- */
.mv-cursor {
  position: fixed;
  z-index: 5;
  top: 0;
  left: 0;
  width: 84px;
  height: 84px;
  margin: -42px 0 0 -42px;
  border: 1px solid rgb(255 255 255 / 0.95);
  border-radius: 50%;
  box-shadow:
    0 0 0 1px rgb(0 0 0 / 0.1),
    inset 0 0 0 1px rgb(0 0 0 / 0.06);
  background: rgb(255 255 255 / 0.08);
  backdrop-filter: blur(2px);
  pointer-events: none;
  display: grid;
  place-items: center;
  transition:
    opacity 0.25s ease,
    width 0.35s ease,
    height 0.35s ease,
    margin 0.35s ease;
}
.mv-cursor span::before,
.mv-cursor span::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 1px;
  margin: 0 0 0 -8px;
  background: #fff;
  box-shadow: 0 0 2px rgb(0 0 0 / 0.35);
}
.mv-cursor span::after {
  transform: rotate(90deg);
  transition: transform 0.35s ease;
}
.mv-cursor[data-mode="out"] span::after {
  transform: rotate(0deg);
}
.mv-cursor[data-mode="out"] {
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
}
.mv-cursor.is-hidden {
  opacity: 0;
}
@media (hover: none), (pointer: coarse) {
  .mv-cursor {
    display: none;
  }
}

/* ---------- Интерфейс поверх кадра ---------- */
.mv-top,
.mv-rail,
.mv-buy,
.mv-arrow {
  opacity: 0;
  transition: opacity 0.6s ease;
}
.mv.is-ready .mv-top,
.mv.is-ready .mv-rail,
.mv.is-ready .mv-buy,
.mv.is-ready .mv-arrow {
  opacity: 1;
}
.mv.is-ready .mv-rail {
  transition-delay: 0.08s;
}
.mv.is-ready .mv-buy {
  transition-delay: 0.16s;
}
/* Крупный план: остаётся только кадр, счётчик и «Закрыть» */
.mv.is-deep .mv-rail,
.mv.is-deep .mv-buy,
.mv.is-deep .mv-arrow,
.mv.is-deep .mv-hint {
  opacity: 0;
  pointer-events: none;
}

.mv-top {
  position: fixed;
  z-index: 4;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 22px clamp(18px, 3vw, 40px) 48px;
  color: #fff;
  text-shadow: 0 1px 12px rgb(0 0 0 / 0.25);
  background: linear-gradient(to bottom, rgb(0 0 0 / 0.32), rgb(0 0 0 / 0));
  pointer-events: none;
}
.mv-top > * {
  pointer-events: auto;
}
.mv-brand {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.32em;
}
.mv-count {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
}
.mv-count b {
  font-size: clamp(28px, 3.2vw, 46px);
  font-weight: 300;
  letter-spacing: 0;
}
.mv-count i {
  font-style: normal;
  opacity: 0.6;
}
.mv-close {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  color: inherit;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.mv-close span {
  font-size: 16px;
  letter-spacing: 0;
}

/* Миниатюры слева */
.mv-rail {
  position: fixed;
  z-index: 4;
  top: 50%;
  left: clamp(18px, 3vw, 40px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 70vh;
  overflow-y: auto;
  scrollbar-width: none;
  transform: translateY(-50%);
}
.mv-rail button {
  position: relative;
  width: 48px;
  height: 60px;
  padding: 0;
  overflow: hidden;
  background: rgb(var(--mv-paper));
  opacity: 0.55;
  transition: opacity 0.3s ease;
}
.mv-rail button:hover,
.mv-rail button[aria-current="true"] {
  opacity: 1;
}
.mv-rail button[aria-current="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px var(--ink);
}
.mv-rail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Стрелки внизу по центру */
.mv-arrow {
  position: fixed;
  z-index: 4;
  bottom: clamp(18px, 3vw, 36px);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--ink);
  font-size: 18px;
  background: rgb(255 255 255 / 0.86);
  backdrop-filter: blur(10px);
  transition:
    opacity 0.6s ease,
    background 0.25s ease;
}
.mv-arrow:hover {
  background: #fff;
}
.mv-prev {
  left: calc(50% - 56px);
}
.mv-next {
  left: calc(50% + 8px);
}

/* Подсказка */
.mv-hint {
  position: fixed;
  z-index: 4;
  left: 50%;
  bottom: clamp(80px, 9vh, 110px);
  margin: 0;
  padding: 10px 18px;
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.06em;
  background: rgb(0 0 0 / 0.55);
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translate(-50%, 8px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
  pointer-events: none;
}
.mv-hint.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Панель покупки ---------- */
.mv-buy {
  position: fixed;
  z-index: 4;
  right: clamp(18px, 3vw, 40px);
  bottom: clamp(18px, 3vw, 40px);
  width: 320px;
  padding: 22px;
  background: rgb(255 255 255 / 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.mv-buy-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.mv-buy-price {
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.mv-sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.mv-sizes button {
  min-width: 44px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #cfcac2;
  font-size: 12px;
  background: transparent;
}
.mv-sizes button[aria-pressed="true"] {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.mv-sizes button:disabled {
  color: #aaa;
  text-decoration: line-through;
}
.mv-add {
  width: 100%;
  min-height: 50px;
  color: #fff;
  background: var(--ink);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: background 0.25s ease;
}
.mv-add:hover:not(:disabled) {
  background: #000;
}
.mv-add:disabled {
  background: #8d8a85;
}

/* Уведомление «Добавлено в корзину» поверх просмотра */
.mv #toast {
  z-index: 6;
}

/* ---------- Телефон и планшет ---------- */
@media (max-width: 767px), (hover: none) and (pointer: coarse) {
  .mv-rail,
  .mv-arrow {
    display: none;
  }
  .mv-top {
    padding: 14px 16px;
  }
  .mv-brand {
    letter-spacing: 0.24em;
  }
  .mv-count b {
    font-size: 26px;
  }
  .mv-buy {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    padding: 14px 16px max(14px, env(safe-area-inset-bottom));
  }
  .mv-buy-head {
    margin-bottom: 10px;
  }
  .mv-sizes {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin-bottom: 10px;
  }
  .mv-sizes button {
    flex: none;
  }
  .mv-hint {
    bottom: 170px;
    white-space: nowrap;
  }
}

/* Карточка товара: на компьютере фото открывается по клику — подсказка-курсор */
@media (hover: hover) and (pointer: fine) {
  .product-photo {
    cursor: zoom-in;
  }
}

/* Фокус: просмотр получает его сам, без рамки; рамка фото — внутри кадра */
.mv-stage:focus {
  outline: none;
}
.product-photo:focus-visible {
  outline-offset: -4px;
}
