/* ========================================================================
   HP STEEL - single-product.css
   CSS RIÊNG TRANG CHI TIẾT SẢN PHẨM: layout 2 cột, gallery ảnh
   (thumbnail vuông + ảnh chính), bảng thông số.
   Chỉ được enqueue ở single product (xem functions.php).
   Phần dùng chung (gồm typography .hp-entry-content) ở main.css.
   ===================================================================== */

.hp-pd {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.hp-pd img {
  width: 100%;
  border-radius: 12px;
}

.hp-pd-images {
  display: block;
  width: 100%;
  overflow: hidden;
}

.hp-pd h1 {
  font-size: 30px;
  color: var(--hp-dark);
  margin-bottom: 14px;
}

.hp-pd p {
  color: #666;
  margin-bottom: 18px;
}

/* ---- Gallery ảnh: thumbnail dọc bên trái + ảnh chính (2 swiper đồng bộ) ---- */
.hp-pd-gallery {
  /* Height cố định ở desktop: thumbs chia đều đúng 4 hình theo height này. */
  --hp-pd-h: 480px;
  --hp-pd-gap: 10px; /* = spaceBetween trong product-gallery.js */
  display: flex;
  gap: 12px;
  height: var(--hp-pd-h);

  position: sticky;
  position: -webkit-sticky;
  top: 200px;
}

/* Thumb vuông: bề rộng cột = chiều cao 1 slide = (height - 3 khoảng cách) / 4. */
.hp-pd-gallery__thumbs {
  flex: 0 0 calc((var(--hp-pd-h) - 3 * var(--hp-pd-gap)) / 4);
  width: calc((var(--hp-pd-h) - 3 * var(--hp-pd-gap)) / 4);
  height: 100%;
}

/* Không ép height slide - Swiper tự tính: (height thumbs - 3 khoảng cách) / 4. */
.hp-pd-gallery__thumbs .swiper-slide {
  cursor: pointer;
  opacity: .6;
  transition: opacity .2s;
}

.hp-pd-gallery__thumbs .swiper-slide-thumb-active {
  opacity: 1;
}

.hp-pd-gallery__thumbs .hp-pd-gallery__thumb-item {
  width: 100%;
  height: 100%;
  border: 2px solid var(--hp-steel-light);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color .2s;
  box-sizing: border-box;
}

.hp-pd-gallery__thumbs .swiper-slide-thumb-active .hp-pd-gallery__thumb-item {
  border-color: var(--hp-red);
}

.hp-pd-gallery__thumbs img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.hp-pd-gallery__main {
  flex: 1;
  min-width: 0;
  height: 100%;
}

.hp-pd-gallery__main .hp-pd-gallery__main-item {
  position: relative;
  width: 100%;
  height: 100%;
}

.hp-pd-gallery__main img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.hp-pd-gallery__main .swiper-button-prev,
.hp-pd-gallery__main .swiper-button-next {
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .35);
  transition: background .2s;
}

.hp-pd-gallery__main .swiper-button-prev:hover,
.hp-pd-gallery__main .swiper-button-next:hover {
  background: var(--hp-red);
}

.hp-pd-gallery__main .swiper-button-prev::after,
.hp-pd-gallery__main .swiper-button-next::after {
  font-size: 15px;
  font-weight: 700;
}

.hp-pd-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hp-pd-content .hp-btn--red {
  max-width: fit-content;
}

.hp-section__description .hp-container > h2 {
  display: block;
  text-align: center;
  color: var(--hp-red);
  font-size: 32px;
  line-height: 1.6;
  text-transform: uppercase;
}

/* Typography chung của .hp-entry-content nằm ở main.css (dùng chung với trang Giới thiệu). */

/* ---- Responsive ---- */
@media(max-width:900px) {

  .hp-pd {
    grid-template-columns: 1fr;
  }
}

/* Dưới 768px (khớp breakpoint JS): thumbnail chuyển ngang, nằm dưới ảnh chính. */
@media(max-width:767px) {

  .hp-pd-gallery {
    flex-direction: column-reverse;
    height: auto;
  }

  .hp-pd-gallery__thumbs {
    flex: none;
    width: 100%;
    height: auto;
  }

  /* Thumb ngang: Swiper chia bề rộng cho 4, chiều cao vuông theo aspect-ratio. */
  .hp-pd-gallery__thumbs .hp-pd-gallery__thumb-item {
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .hp-pd-gallery__main {
    height: auto;
  }

  .hp-pd-gallery__main .hp-pd-gallery__main-item {
    aspect-ratio: 4 / 3;
  }
}
