/*
 * Варианты карточки товара (обновление 12).
 * Вид выбирается в админке: /admin/storefront → «Карточка товара».
 *   classic   — прежний вид (фото слева, информация справа)
 *   boutique  — сетка фото 2 колонки, узкая колонка покупки справа
 *   editorial — три колонки: текст | фото | покупка
 *   lookbook  — лента крупных фото во всю ширину, информация ниже
 */

/* ---------- Общее для всех вариантов ---------- */
.size-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.size-guide {
  font-size: 11px;
  color: #6b6b6b;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.detail-lead {
  margin: 0 0 8px;
  color: #444;
  line-height: 1.75;
  white-space: pre-line;
}

/* Закреплённая панель покупки: появляется, когда основная кнопка ушла с экрана */
.buy-bar {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px clamp(16px, 3vw, 32px);
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: rgb(255 255 255 / 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
  font-size: 13px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.buy-bar[hidden] {
  display: flex !important;
  visibility: hidden;
}
.buy-bar.is-shown {
  visibility: visible;
  transform: none;
}
.buy-bar-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.buy-bar-size {
  color: #6b6b6b;
}
.buy-bar .primary {
  width: auto;
  min-width: 180px;
  margin: 0;
  border-radius: 0;
}

/* Общая премиальная типографика для новых вариантов */
.product-detail:not(.card-classic) .detail-info h1 {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.product-detail:not(.card-classic) .product-origin {
  display: none;
}
.product-detail:not(.card-classic) .detail-price {
  margin: 10px 0 32px;
  font-size: 13px;
  letter-spacing: 0.04em;
}
.product-detail:not(.card-classic) .size-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b6b6b;
}
.product-detail:not(.card-classic) .size-option > span:first-of-type {
  min-width: 48px;
  min-height: 40px;
  border: 1px solid var(--line);
  font-size: 12px;
}
.product-detail:not(.card-classic) .size-option input:checked + span {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.product-detail:not(.card-classic) .purchase-actions .primary,
.buy-bar .primary {
  min-height: 52px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.product-detail:not(.card-classic) .detail-info [data-wish] {
  font-size: 12px;
}
.product-detail:not(.card-classic) .detail-info summary {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.product-detail:not(.card-classic) .detail-info details p {
  white-space: pre-line;
  line-height: 1.75;
}
.product-detail:not(.card-classic) .photo-zoom-plus {
  opacity: 0;
  transition: opacity 0.25s ease;
}
.product-detail:not(.card-classic) .product-photo:hover .photo-zoom-plus,
.product-detail:not(.card-classic) .product-photo:focus-visible .photo-zoom-plus {
  opacity: 1;
}
.product-detail:not(.card-classic) .next-product {
  font-size: 12px;
}

/* ================= Компьютер ================= */
@media (min-width: 1025px) and (hover: hover), (min-width: 1367px) {
  /* ---------- Бутик ---------- */
  .product-detail.card-boutique {
    grid-template-columns: minmax(0, 2fr) minmax(360px, 1fr);
  }
  .card-boutique .product-gallery {
    background: none;
  }
  .card-boutique .product-gallery-track {
    grid-template-columns: 1fr 1fr;
  }
  .card-boutique .product-photo:only-child {
    grid-column: 1 / -1;
  }
  .card-boutique .product-photo img {
    height: auto;
    min-height: 0;
    aspect-ratio: 4 / 5;
    object-fit: cover;
  }
  .card-boutique .product-gallery-dots,
  .card-boutique .product-gallery-count {
    display: none;
  }
  .card-boutique .detail-info {
    display: flex;
    justify-content: center;
    min-height: calc(100svh - var(--header));
    align-items: center;
    padding: 48px clamp(32px, 4vw, 64px);
  }
  .card-boutique .detail-head,
  .card-boutique .detail-side {
    width: 100%;
    max-width: 360px;
  }
  .card-boutique .detail-info {
    flex-direction: column;
  }

  /* ---------- Редакция ---------- */
  .product-detail.card-editorial {
    grid-template-columns: minmax(260px, 1fr) minmax(0, 1.25fr) minmax(300px, 1fr);
  }
  .card-editorial .detail-info {
    display: contents;
  }
  .card-editorial .product-gallery {
    grid-column: 2;
    grid-row: 1;
    background: none;
  }
  .card-editorial .detail-head,
  .card-editorial .detail-side {
    grid-row: 1;
    position: sticky;
    top: var(--header);
    align-self: start;
    padding: 56px clamp(28px, 3vw, 56px);
  }
  .card-editorial .detail-head {
    grid-column: 1;
  }
  .card-editorial .detail-side {
    grid-column: 3;
  }
  .card-editorial .detail-lead {
    margin-top: 0;
    font-size: 13px;
  }
  .card-editorial .detail-price {
    margin-bottom: 28px;
  }
  .card-editorial .product-photo img {
    height: auto;
    min-height: 0;
    aspect-ratio: 4 / 5;
    object-fit: cover;
  }
  .card-editorial .product-gallery-dots,
  .card-editorial .product-gallery-count {
    display: none;
  }

  /* ---------- Лукбук ---------- */
  .product-detail.card-lookbook {
    display: block;
  }
  .card-lookbook .product-gallery {
    background: none;
  }
  .card-lookbook .product-gallery-track {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    cursor: grab;
  }
  .card-lookbook .product-gallery-track::-webkit-scrollbar {
    display: none;
  }
  .card-lookbook .product-photo {
    flex: 0 0 auto;
    width: auto;
    scroll-snap-align: start;
  }
  .card-lookbook .product-photo img {
    width: auto;
    height: calc(100svh - var(--header) - 96px);
    min-height: 420px;
    aspect-ratio: 4 / 5;
    object-fit: cover;
  }
  .card-lookbook .product-gallery-dots {
    position: static;
    flex-direction: row;
    justify-content: center;
    width: auto;
    margin: 0;
    padding: 14px 0 0;
  }
  .card-lookbook .product-gallery-count {
    left: 32px;
    bottom: 18px;
  }
  .card-lookbook .detail-info {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: clamp(32px, 8vw, 160px);
    max-width: 1280px;
    margin: 0 auto;
    padding: 56px 32px 72px;
  }
  .card-lookbook .detail-head h1 {
    font-size: 15px;
  }
}

/* ================= Телефон и планшет ================= */
@media (max-width: 1024px), (hover: none) and (pointer: coarse) and (max-width: 1366px) {
  .product-detail:not(.card-classic) .detail-info {
    padding: 28px 20px 96px;
  }
  .card-boutique .detail-info {
    text-align: center;
  }
  .card-boutique .size-row {
    justify-content: center;
  }
  .card-boutique .size-options {
    justify-content: center;
  }
  .card-lookbook .product-photo {
    flex: 0 0 84%;
  }
  .card-lookbook .product-gallery-track {
    gap: 2px;
  }
  .card-lookbook .product-photo img {
    object-fit: cover;
  }
  .card-editorial .detail-lead {
    font-size: 13px;
  }
  .buy-bar .primary {
    min-width: 0;
    flex: none;
    padding: 0 20px;
  }
  .buy-bar-price {
    display: none;
  }
}
