/* ================================================================
   ROVA — product.css
   Стили страницы товара (pages/product.html): галерея фото, переключение
   цвета (со сплэш-анимацией), выбор размера, кнопка добавления в корзину,
   аккордеон описания/состава, блок похожих товаров.
================================================================ */

/* ── Страница ───────────────────────────────────────────────── */
.product-page {
  position: relative; z-index: 1;
  max-width: 1280px; margin: 0 auto; padding: 32px 5vw 80px;
}

/* ── Основная сетка ─────────────────────────────────────────── */
.product-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 52px; align-items: start;
}

/* ── Галерея ────────────────────────────────────────────────── */
/* Раньше было position:sticky — но у sticky-элемента внутри grid область
   прилипания ограничена высотой его же строки (максимум из двух колонок).
   У всех текущих товаров описание короче фото, инфо-колонка ниже галереи,
   строка подгоняется под саму галерею — запас на sticky нулевой, и фото
   просто едет вместе со страницей рывком вместо фиксации. Убрали sticky
   совсем — обычный скролл в потоке, без рывков и без искусственного
   раздувания инфо-колонки под запас. */
.product-gallery { position: static; }

.gallery-main {
  position: relative; aspect-ratio: 3/4;
  border-radius: 20px; overflow: hidden;
  background: var(--cream); margin-bottom: 14px;
}
.gallery-main-img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.3s; }

.gallery-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; background: none; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  z-index: 10; transition: all 0.2s;
}
.gallery-arrow:hover { transform: translateY(-50%) scale(1.15); }
.gallery-arrow svg {
  width: 28px; height: 28px; color: var(--white);
  filter: drop-shadow(0 1px 3px rgba(74,53,37,0.5));
}
.gallery-arrow--prev { left: 10px; }
.gallery-arrow--next { right: 10px; }

.gallery-counter {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  background: rgba(74,53,37,0.6); color: var(--cream);
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em;
  padding: 4px 12px; border-radius: 50px; backdrop-filter: blur(4px);
}

.gallery-badge {
  position: absolute; top: 16px; left: 16px;
  background: var(--terra); color: #fff;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 5px 12px; border-radius: 50px; z-index: 5;
}
.gallery-badge--oos { background: var(--soft-gray); color: var(--text-light); }

.gallery-discount-badge {
  position: absolute; top: 16px; right: 16px;
  background: #E63946; color: #fff;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 5px 12px; border-radius: 50px; z-index: 5;
}

.gallery-thumbs-wrap { margin-top: 14px; }
.gallery-thumbs-wrap .gallery-thumbs { display: none; padding-top: 8px; }
.gallery-thumbs-wrap.open .gallery-thumbs { display: flex; }

.btn-more-photos {
  display: flex; align-items: center; gap: 6px; justify-content: center;
  width: 100%; background: none; border: 1px solid var(--soft-gray);
  border-radius: 8px; padding: 8px 14px; cursor: pointer;
  font-family: 'Montserrat', sans-serif; font-size: 0.75rem; font-weight: 600;
  color: var(--text-light); transition: all 0.2s;
}
.btn-more-photos:hover { border-color: var(--choco); color: var(--choco); }
.btn-more-photos svg { width: 14px; height: 14px; transition: transform 0.25s; }
.gallery-thumbs-wrap.open .btn-more-photos svg { transform: rotate(180deg); }

.gallery-thumbs {
  display: flex; gap: 10px; overflow-x: auto;
  scrollbar-width: none; padding-bottom: 4px;
}
.gallery-thumbs::-webkit-scrollbar { display: none; }

.gallery-thumb {
  flex-shrink: 0; width: 72px; height: 90px;
  border-radius: 10px; overflow: hidden; cursor: pointer;
  border: 2px solid transparent; transition: all 0.2s; opacity: 0.6;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb.active,
.gallery-thumb:hover { border-color: var(--terra); opacity: 1; }

/* ── Информация о товаре ────────────────────────────────────── */
.product-info { display: flex; flex-direction: column; }

.product-name {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 600;
  color: var(--choco); line-height: 1.2; margin-bottom: 24px;
}

.product-price-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--soft-gray);
}
.product-price {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.8rem; font-weight: 700; color: var(--choco); letter-spacing: -0.01em;
}
.product-price-row .price-wrap { align-items: flex-start; }
.product-price-row .price-new { font-size: 1.8rem; }
.product-price-row .price-old { font-size: 0.9rem; }

.product-loading { text-align: center; padding: 80px 20px; color: var(--text-light); }

.product-wish-btn {
  background: none; border: none; padding: 4px; flex-shrink: 0;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-light); transition: color 0.2s;
}
.product-wish-btn:hover,
.product-wish-btn.active { color: var(--terra); }
.product-wish-btn svg { width: 24px; height: 24px; }

.product-option-block { margin-bottom: 24px; }

/* ── Сплэш при переключении цвета ───────────────────────────── */
.color-switch-splash {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  opacity: 0; transition: opacity 0.18s ease;
  pointer-events: none;
}
.color-switch-splash.visible { opacity: 1; pointer-events: auto; }
.color-switch-splash span {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.4rem, 8vw, 4rem);
  letter-spacing: 0.28em; margin-right: -0.28em; /* компенсация трекинга для оптического центра */
  color: var(--choco);
  animation: splashPulse 1.2s ease-in-out infinite;
}
@keyframes splashPulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

/* ── Фото цветов ────────────────────────────────────────────── */
.color-photos { display: flex; gap: 10px; flex-wrap: wrap; }

.color-photo-wrap,
.color-photo-wrap:visited { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: inherit; }

.color-photo {
  width: 60px; height: 76px; border-radius: 8px; overflow: hidden;
  cursor: pointer; border: 2px solid transparent; transition: all 0.2s; opacity: 0.6;
}
.color-photo img { width: 100%; height: 100%; object-fit: cover; }
.color-photo.active,
.color-photo:hover { border-color: var(--terra); opacity: 1; }

.color-photo-label {
  font-size: 0.62rem; color: var(--text-light);
  text-align: center; margin-top: 4px; transition: color 0.2s;
}
.color-photo-wrap:hover .color-photo-label,
.color-photo-wrap.active .color-photo-label { color: var(--terra); }

/* ── Размеры ────────────────────────────────────────────────── */
.size-options { display: flex; gap: 8px; flex-wrap: wrap; }

.size-btn {
  min-width: 52px; height: 40px; padding: 0 12px;
  border-radius: 8px; border: 1.5px solid var(--soft-gray);
  background: var(--white); font-family: 'Montserrat', sans-serif;
  font-size: 0.78rem; font-weight: 600; color: var(--text);
  cursor: pointer; transition: all 0.2s;
}
.size-btn:hover { border-color: var(--choco); color: var(--choco); }
.size-btn.active { background: var(--choco); border-color: var(--choco); color: #fff; }
.size-btn.oos { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }

.size-table-wrap { margin-top: 12px; }
.btn-size-table {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; padding: 0;
  font-family: 'Montserrat', sans-serif; font-size: 0.72rem; font-weight: 600;
  color: var(--terra); letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer; transition: opacity 0.2s;
}
.btn-size-table:hover { opacity: 0.7; }
.btn-size-table svg { width: 13px; height: 13px; transition: transform 0.25s; }
.size-table-wrap.open .btn-size-table svg { transform: rotate(180deg); }

.size-table { display: none; margin-top: 10px; width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.size-table-wrap.open .size-table { display: table; }
.size-table th {
  text-align: left; font-weight: 600; color: var(--text-light);
  font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 6px 10px 6px 0; border-bottom: 1px solid var(--soft-gray);
}
.size-table td { padding: 7px 10px 7px 0; color: var(--choco); border-bottom: 1px solid rgba(232,224,213,0.5); }
.size-table tr:last-child td { border-bottom: none; }
.size-table .oos-row td { color: var(--text-light); text-decoration: line-through; }

/* ── Кнопка корзины + счётчик ───────────────────────────────── */
.product-actions { margin: 28px 0 24px; }

.btn-add-cart {
  width: 100%; height: 52px; border: none; border-radius: 50px;
  background: var(--choco); color: var(--white);
  font-family: 'Montserrat', sans-serif; font-size: 0.85rem;
  font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer; transition: all 0.25s;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
/* Составной селектор — product.css грузится после style.css, общий .hidden
   оттуда проиграл бы каскад против display:flex выше при равной специфичности. */
.btn-add-cart.hidden { display: none; }
.btn-add-cart:hover { background: var(--terra); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(200,122,90,0.3); }
.btn-add-cart:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-add-cart svg { width: 18px; height: 18px; }

.qty-control {
  display: none; align-items: center; height: 52px;
  border-radius: 50px; overflow: hidden;
  border: 2px solid var(--choco); background: var(--white); width: 100%;
}
.qty-control.visible { display: flex; }
.qty-control-btn {
  flex: 1; height: 100%; border: none; background: none;
  font-size: 1.4rem; font-weight: 300; color: var(--choco);
  cursor: pointer; transition: background 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.qty-control-btn:hover { background: var(--cream); }
.qty-control-num {
  font-family: 'Montserrat', sans-serif; font-size: 1rem; font-weight: 700;
  color: var(--choco); padding: 0 20px; white-space: nowrap;
}

/* ── Мета-данные ────────────────────────────────────────────── */
.product-meta {
  border-top: 1px solid var(--soft-gray); padding-top: 4px;
  display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 0;
}
.meta-key {
  color: var(--text-light); font-size: 0.78rem;
  padding: 10px 14px 10px 0; border-bottom: 1px solid rgba(232,224,213,0.5);
}
.meta-val {
  color: var(--choco); font-weight: 500; font-size: 0.82rem;
  padding: 10px 0; border-bottom: 1px solid rgba(232,224,213,0.5);
}
.meta-key:nth-last-child(2),
.meta-val:last-child { border-bottom: none; }

/* ── Аккордеон ──────────────────────────────────────────────── */
.product-accordion { margin-top: 24px; border-top: 1px solid var(--soft-gray); }
.acc-item { border-bottom: 1px solid var(--soft-gray); }
.acc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0; cursor: pointer; background: none; border: none;
  width: 100%; text-align: left; font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem; font-weight: 600; color: var(--choco); letter-spacing: 0.04em;
}
.acc-head svg { width: 16px; height: 16px; color: var(--terra); transition: transform 0.25s; flex-shrink: 0; }
.acc-item.open .acc-head svg { transform: rotate(180deg); }
.acc-body {
  max-height: 0; overflow: hidden; padding: 0;
  transition: max-height 0.35s ease, padding 0.3s;
  font-size: 0.82rem; line-height: 1.8; color: var(--text-light);
}
.acc-item.open .acc-body { max-height: 400px; padding-bottom: 16px; }
.acc-body ul { padding-left: 18px; }
.acc-body li { margin-bottom: 4px; }

/* ── Товар не найден ────────────────────────────────────────── */
.product-not-found { text-align: center; padding: 100px 20px; }
.product-not-found h2 { font-family: 'Playfair Display', serif; font-size: 1.8rem; color: var(--choco); margin-bottom: 16px; }
.product-not-found p { color: var(--text-light); margin-bottom: 28px; }

/* ── Похожие товары ─────────────────────────────────────────── */
.similar-section { margin-top: 72px; padding-top: 48px; border-top: 1px solid var(--soft-gray); }
.similar-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.4rem, 3vw, 1.9rem); color: var(--choco); margin-bottom: 28px;
}
.similar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.similar-card {
  background: var(--white); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 2px 12px var(--shadow); transition: transform 0.25s, box-shadow 0.25s; cursor: pointer;
}
.similar-card:hover { transform: translateY(-5px); box-shadow: 0 12px 32px rgba(74,53,37,0.14); }
.similar-img { position: relative; aspect-ratio: 3/4; overflow: hidden; background: var(--cream); }
.similar-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.similar-card:hover .similar-img img { transform: scale(1.05); }
.similar-body { padding: 14px 16px 18px; }
.similar-category {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--terra); display: block; margin-bottom: 5px;
}
.similar-name { font-family: 'Playfair Display', serif; font-size: 0.95rem; font-weight: 600; color: var(--choco); line-height: 1.3; margin-bottom: 8px; }
.similar-price-wrap .price-wrap { align-items: stretch; }
.similar-price-wrap .price-row { width: 100%; }
.similar-price-wrap .price-discount-badge { margin-left: auto; }

/* ── Адаптив ────────────────────────────────────────────────── */
@media (min-width: 1440px) {
  .product-page { max-width: 1400px; padding: 40px 5vw 100px; }
  .product-grid { gap: 72px; }
  .product-name { font-size: 2.4rem; }
  .product-price { font-size: 2.4rem; }
  .gallery-thumb { width: 88px; height: 112px; }
  .color-photo { width: 72px; height: 92px; }
  .size-btn { min-width: 62px; height: 48px; font-size: 0.88rem; }
  .btn-add-cart { height: 58px; font-size: 0.92rem; }
  .qty-control { height: 58px; }
  .similar-grid { grid-template-columns: repeat(4, 1fr); gap: 24px; }
  .similar-title { font-size: 1.6rem; }
}

@media (min-width: 2560px) {
  .product-page { max-width: 2200px; padding: 48px 5vw 140px; }
  .product-grid { gap: 100px; }
  .product-name { font-size: 3.2rem; }
  .product-price { font-size: 3rem; }
  .gallery-thumb { width: 120px; height: 152px; }
  .color-photo { width: 96px; height: 124px; }
  .size-btn { min-width: 80px; height: 60px; font-size: 1rem; }
  .btn-add-cart { height: 72px; font-size: 1.05rem; letter-spacing: 0.12em; }
  .qty-control { height: 72px; }
  .similar-grid { grid-template-columns: repeat(5, 1fr); gap: 32px; }
  .similar-title { font-size: 2rem; }
  .similar-name { font-size: 1rem; }
  .acc-head { font-size: 1rem; }
  .acc-body { font-size: 0.95rem; }
}

@media (max-width: 1024px) {
  .product-page { padding: 24px 24px 60px; }
  .product-name { font-size: 1.9rem; }
  .product-price { font-size: 2rem; }
  .gallery-thumb { width: 72px; height: 92px; }
  .color-photo { width: 62px; height: 80px; }
  .size-btn { min-width: 54px; height: 42px; }
  .btn-add-cart { height: 52px; }
  .qty-control { height: 52px; }
  .similar-grid { gap: 16px; }
}

@media (max-width: 900px) {
  .product-grid { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 768px) {
  .product-page { padding: 16px 20px 60px; }
  .product-name { font-size: 1.7rem; }
  .product-price { font-size: 1.8rem; }
  .gallery-thumb { width: 66px; height: 84px; }
  .color-photo { width: 58px; height: 74px; }
  .size-btn { min-width: 52px; height: 40px; font-size: 0.8rem; }
  .btn-add-cart { height: 50px; font-size: 0.84rem; }
  .qty-control { height: 50px; }
  .similar-grid { gap: 14px; }
  .similar-title { font-size: 1.3rem; }
}
@media (max-width: 640px) {
  /* Страница */
  .product-page { padding: 6px 12px 60px; }

  /* Сетка — уже 1 колонка с 900px, уменьшаем gap */
  .product-grid { gap: 20px; }

  /* Галерея */
  .gallery-thumb { width: 58px; height: 74px; }

  /* Название и цена */
  .product-name { font-size: 1.35rem; margin-bottom: 16px; }
  .product-price { font-size: 1.5rem; }
  .product-price-row { margin-bottom: 20px; padding-bottom: 16px; }

  /* Цветовые фото */
  .color-photo { width: 50px; height: 64px; }
  .color-photos { gap: 8px; }

  /* Размеры */
  .size-btn { min-width: 46px; height: 36px; font-size: 0.74rem; }

  /* Кнопка корзины */
  .product-actions { margin: 20px 0 16px; }
  .btn-add-cart { height: 46px; font-size: 0.78rem; }
  .qty-control { height: 46px; }

  /* Мета */
  .product-meta { grid-template-columns: minmax(100px, 38%) 1fr; }
  .meta-key, .meta-val { font-size: 0.74rem; padding-top: 8px; padding-bottom: 8px; }

  /* Аккордеон */
  .acc-head { font-size: 0.8rem; padding: 13px 0; }
  .acc-body { font-size: 0.78rem; }

  /* Похожие */
  .similar-section { margin-top: 48px; padding-top: 32px; }
  .similar-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .similar-body { padding: 10px 12px 14px; }
  .similar-category { font-size: 0.55rem; }
  .similar-name { font-size: 0.78rem; margin-bottom: 5px; }
  .similar-price-wrap .price-new { font-size: 0.78rem; }
  .similar-title { font-size: 1.2rem; margin-bottom: 16px; }
}

@media (max-width: 425px) {
  .product-name { font-size: 1.3rem; }
  .product-price { font-size: 1.4rem; }
  .gallery-thumb { width: 54px; height: 70px; }
  .color-photo { width: 48px; height: 62px; }
  .size-btn { min-width: 44px; height: 35px; }
  .btn-add-cart { height: 45px; }
}

@media (max-width: 393px) {
  .product-name { font-size: 1.35rem; }
  .product-price { font-size: 1.5rem; }
  .gallery-thumb { width: 58px; height: 74px; }
  .color-photo { width: 50px; height: 64px; }
  .size-btn { min-width: 46px; height: 36px; }
  .btn-add-cart { height: 46px; }
}

@media (max-width: 375px) {
  .product-page { padding: 4px 10px 60px; }
  .product-name { font-size: 1.25rem; }
  .product-price { font-size: 1.35rem; }
  .gallery-thumb { width: 52px; height: 68px; }
  .color-photo { width: 46px; height: 58px; }
  .size-btn { min-width: 42px; height: 34px; font-size: 0.7rem; }
  .btn-add-cart { height: 44px; font-size: 0.75rem; }
  .similar-grid { gap: 8px; }
  .similar-name { font-size: 0.75rem; }
}

@media (max-width: 360px) {
  .product-page { padding: 4px 9px 60px; }
  .product-name { font-size: 1.2rem; }
  .product-price { font-size: 1.3rem; }
  .gallery-thumb { width: 50px; height: 64px; }
  .color-photo { width: 44px; height: 56px; }
  .size-btn { min-width: 41px; height: 33px; font-size: 0.69rem; }
  .btn-add-cart { height: 43px; font-size: 0.73rem; }
  .similar-grid { gap: 7px; }
  .similar-name { font-size: 0.73rem; }
  .meta-key, .meta-val { font-size: 0.7rem; }
}

@media (max-width: 320px) {
  .product-page { padding: 4px 8px 60px; }
  .product-name { font-size: 1.15rem; }
  .product-price { font-size: 1.25rem; }
  .gallery-thumb { width: 48px; height: 62px; }
  .color-photo { width: 42px; height: 54px; }
  .size-btn { min-width: 40px; height: 32px; font-size: 0.68rem; }
  .btn-add-cart { height: 42px; font-size: 0.72rem; }
  .qty-control { height: 42px; }
  .meta-key, .meta-val { font-size: 0.68rem; }
  .similar-grid { gap: 6px; }
  .similar-body { padding: 8px 8px 10px; }
  .similar-name { font-size: 0.72rem; }
}
