/* PDP — Makeup-like 3-col top + sections below */

.pdp {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-5);
  align-items: start;
  margin-bottom: var(--sp-8);
}

.pdp__gallery {
  order: 1;
}

.pdp__info {
  order: 2;
}

.pdp__badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.pdp__buy {
  order: 3;
}

.pdp__brand {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-muted);
}

.pdp__title {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: 1.25;
  color: var(--c-head);
}

.pdp__type {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--c-muted);
}

.pdp__rating {
  display: inline-flex;
  margin-bottom: var(--sp-3);
  text-decoration: none;
  color: inherit;
}

.pdp__rating:hover .rating__count {
  text-decoration: underline;
  color: var(--c-head);
}

.pdp__lead {
  margin: 0 0 var(--sp-4);
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--c-ink);
}

.pdp__highlights {
  margin: 0 0 var(--sp-4);
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--sp-1);
  font-size: var(--fs-sm);
  color: var(--c-ink);
}

.pdp__highlights span {
  color: var(--c-muted);
  margin-right: var(--sp-1);
}

.gallery__main {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--c-paper);
  border: 1px solid var(--c-line-soft);
}

@media (max-width: 1023px) {
  .gallery__main {
    width: min(300px, 100%);
    height: 300px;
    max-height: 300px;
    margin-inline: auto;
    aspect-ratio: unset;
  }

  .gallery__main img {
    object-fit: contain;
  }
}

.gallery__main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery__thumbs-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

.gallery__thumb-arrow {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--c-head);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.gallery__thumb-arrow[hidden] {
  display: none;
}

.gallery__thumbs {
  display: flex;
  gap: var(--sp-2);
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: var(--sp-1);
}

.gallery__thumbs::-webkit-scrollbar {
  display: none;
}

.gallery__thumb {
  flex: 0 0 68px;
  width: 68px;
  height: 68px;
  padding: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--c-line-soft);
  background: var(--c-paper);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color var(--transition);
}

.gallery__thumb.is-active,
.gallery__thumb:hover {
  border-color: var(--c-accent);
}

.gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Buybox */
.buybox {
  padding: var(--sp-4);
  background: #fff;
  border: 1px solid var(--c-line-soft);
  border-radius: var(--radius-md);
  display: grid;
  gap: var(--sp-3);
}

.buybox__price-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
}

.buybox__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-2) var(--sp-3);
}

.product__price {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--c-sale);
  line-height: 1.1;
}

.product__price--sale {
  color: var(--c-sale);
}

.buybox__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
}

.buybox__buy {
  flex: 1 1 160px;
  min-height: 48px;
}

.buybox__buy:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.buybox__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  font-size: var(--fs-sm);
}

.product__stock {
  margin: 0;
  font-weight: 500;
  color: var(--c-success);
}

.product__stock.is-out {
  color: var(--c-sale);
}

.buybox__sku {
  color: var(--c-muted);
  font-size: var(--fs-xs);
}

.buybox__perks {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
}

.buybox__perks a {
  color: var(--c-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.buybox__perks a:hover {
  color: var(--c-head);
}

.wish-btn--buybox {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: 1px solid var(--c-line);
  border-radius: 50%;
  background: #fff;
}

.pro-hint {
  margin: 0;
  padding: var(--sp-3);
  border-radius: var(--radius-md);
  background: rgba(165, 118, 42, 0.1);
  color: var(--c-pro);
  font-size: var(--fs-sm);
}

/* Variant dropdown */
.product-variant {
  position: relative;
  z-index: 4;
}

.product-variant__trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--c-line);
  border-radius: 2px;
  background: #fff;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--c-ink);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.product-variant--single .product-variant__trigger {
  cursor: default;
}

.product-variant__trigger:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 1px;
}

.product-variant.is-open .product-variant__trigger {
  border-color: #111;
  border-radius: 2px 2px 0 0;
  position: relative;
  z-index: 5;
}

.product-variant__thumb {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  overflow: hidden;
  background: #f7f7f7;
}

.product-variant__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-variant__label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-variant__chevron {
  flex: 0 0 12px;
  width: 12px;
  height: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23111' stroke-width='1.5' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform var(--transition);
}

.product-variant.is-open .product-variant__chevron {
  transform: rotate(180deg);
}

.product-variant__list {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 1px);
  z-index: 4;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid #111;
  border-top: 0;
  background: #fff;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
  max-height: 260px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.product-variant.is-open .product-variant__list,
.product-variant.is-open .product-variant__list[hidden] {
  display: block;
}

.product-variant--single .product-variant__list,
.product-variant--single .product-variant__list[hidden] {
  display: none;
}

/* Відкриття лише через .is-open (JS: hover/click). CSS :hover лишав список
   відкритим після вибору, бо курсор ще над селектом. */

.product-variant__option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 12px 6px 6px;
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--c-ink);
}

.product-variant__option:hover,
.product-variant__option:focus-visible {
  background: #f2f2f2;
  outline: none;
}

.product-variant__option.is-selected {
  background: #f2f2f2;
}

.product-variant__option.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.product-variant__stock {
  margin-left: auto;
  font-size: var(--fs-xs);
  color: var(--c-sale);
}


@media (min-width: 1024px) {
  .pdp {
    grid-template-columns: minmax(220px, 0.85fr) minmax(0, 1.25fr) minmax(300px, 0.95fr);
    gap: var(--sp-6) var(--sp-8);
  }

  .pdp__info {
    order: 1;
    grid-column: 1;
    grid-row: 1;
  }

  .pdp__gallery {
    order: 2;
    grid-column: 2;
    grid-row: 1;
  }

  .pdp__buy {
    order: 3;
    grid-column: 3;
    grid-row: 1;
    position: sticky;
    top: calc(var(--header-h) + var(--sp-3));
    z-index: 1;
    align-self: start;
  }

  .pdp__title {
    font-size: var(--fs-2xl);
  }

  /* Makeup-like: main photo + portrait thumbs + side chevrons */
  .gallery__thumbs-row {
    gap: var(--sp-1);
    margin-top: var(--sp-4);
  }

  .gallery__thumb-arrow {
    display: inline-flex;
  }

  .gallery__thumb-arrow[hidden] {
    display: none;
  }

  .gallery__thumbs {
    gap: 10px;
    justify-content: center;
    padding-bottom: 0;
  }

  .gallery__thumb {
    flex: 0 0 76px;
    width: 76px;
    height: 102px;
    border-radius: 0;
    border: 2px solid var(--c-line-soft);
    background: #fff;
    transition: border-color 0.2s ease;
  }

  .gallery__thumb.is-active {
    border-color: #111;
  }

  .gallery__thumb:hover {
    border-color: #111;
  }

  .gallery__thumb img {
    object-fit: contain;
  }
}

@media (max-width: 599px) {
  .buybox {
    padding: var(--sp-3);
  }
}

@supports (-webkit-touch-callout: none) {
  .buybox__buy,
  .product-variant__trigger {
    min-height: 44px;
  }
}
