/* ============================================================
   產品詳情頁專屬樣式 (Product Detail)
   獨立定義設計變量，不依賴 category.css
   ============================================================ */

:root {
  --color-gold: #c6a57b;
  --color-gold-hover: #b38f62;
  --color-dark: #2c2a29;
  --color-muted: #6c757d;
  --color-bg-light: #faf8f5;
  --color-card-border: #f0ece6;
  --font-serif: 'Noto Serif TC', serif;
  --font-sans: 'Noto Sans TC', sans-serif;
  --transition-smooth: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.product-hero {
  background-color: var(--color-bg-light);
  border-bottom: 1px solid var(--color-card-border);
  padding: 2.5rem 1.25rem 1.5rem;
}
.product-hero .hero-subtitle {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: var(--color-gold);
  font-weight: 700;
  text-transform: uppercase;
}
.product-hero .hero-title {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--color-dark);
  letter-spacing: 0.04em;
}
.product-hero .hero-divider {
  width: 36px;
  height: 2px;
  background-color: var(--color-gold);
  margin: 0.5rem auto 0;
}
@media (min-width: 768px) {
  .product-hero { padding: 3.5rem 1.5rem 2rem; }
  .product-hero .hero-title { font-size: 2.2rem; }
}

/* ---- 產品展示區 ---- */
.product-gallery-wrapper {
  padding: 2.5rem 0;
  background-color: #ffffff;
}
.product-gallery-wrapper .gallery-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}
.gallery-images {
  flex: 1 1 48%;
  min-width: 300px;
}
.gallery-info {
  flex: 1 1 44%;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* ---- 主圖區 ---- */
.main-image-wrap {
  position: relative;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  background-color: var(--color-bg-light);
  box-shadow: 0 8px 32px rgba(44, 42, 41, 0.06);
  border: 1px solid var(--color-card-border);
}

.main-image-carousel {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.main-image-carousel img {
  flex: 0 0 100%;
  min-width: 0;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  font-size: 3.5rem;
  font-weight: 300;
  color: rgba(80, 80, 80, 0.55);
  padding: 0.5rem 0.8rem;
  z-index: 5;
  cursor: pointer;
  transition: color 0.3s ease;
  line-height: 1;
}
.carousel-btn:hover {
  color: rgba(40, 40, 40, 0.85);
}
.carousel-btn.prev { left: 8px; }
.carousel-btn.next { right: 8px; }

/* ---- 縮圖列 (4張一排) ---- */
.thumbnail-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 16px;
  max-width: 560px;
}
.thumb-item {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
  background-color: var(--color-bg-light);
}
.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.thumb-item:hover img { transform: scale(1.08); }
.thumb-item.active {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 2px rgba(198,165,123,0.25);
}

/* ---- 產品資訊 ---- */
.product-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--color-gold);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
  font-family: var(--font-sans);
}
.product-name {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--color-dark);
  line-height: 1.3;
  margin-bottom: 0.2rem;
}
.product-sub {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-bottom: 1rem;
  font-family: var(--font-sans);
}
.product-price {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--color-gold);
  letter-spacing: 0.02em;
  line-height: 1.2;
  margin-bottom: 1.2rem;
  font-family: var(--font-serif);
}
.product-price small {
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-muted);
}
.product-desc {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--color-muted);
  margin-bottom: 1.2rem;
  font-family: var(--font-sans);
}

/* ---- 產品規格區 (純文字, 無圖示) ---- */
.product-specs {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem 0;
  display: flex;
  flex-wrap: wrap;
  font-family: var(--font-sans);
  border-top: 1px solid var(--color-card-border);
  padding-top: 1rem;
}
.product-specs li {
  font-size: 0.85rem;
  color: var(--color-dark);
  line-height: 1.8;
  width: 50%;
  letter-spacing: 0.04em;
}
.product-specs li:nth-child(1),
.product-specs li:nth-child(2) {
  border-bottom: 1px solid var(--color-card-border);
  padding-bottom: 0.2rem;
  margin-bottom: 0.2rem;
}
@media (max-width: 480px) {
  .product-specs li {
    width: 100%;
  }
  .product-specs li:nth-child(1),
  .product-specs li:nth-child(2) {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
  }
}

/* ---- 價格表 (卡片化) ---- */
.price-card {
  border: 1px solid var(--color-card-border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.2rem;
  background: #ffffff;
  font-family: var(--font-sans);
}
.price-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.price-card th,
.price-card td {
  padding: 0.6rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--color-card-border);
}
.price-card th {
  background-color: var(--color-bg-light);
  font-weight: 600;
  color: var(--color-dark);
  letter-spacing: 0.05em;
  font-size: 0.8rem;
  text-transform: uppercase;
}
.price-card tr:last-child td { border-bottom: none; }
.price-card td:last-child {
  font-weight: 600;
  color: var(--color-gold);
}

.price-note {
  font-size: 0.82rem;
  color: var(--color-muted);
  margin-top: -0.4rem;
  margin-bottom: 2rem;
  font-family: var(--font-sans);
}

/* ---- CTA 按鈕群組 (膠囊形 · 紅白配色) ---- */
.cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.2rem;
  justify-content: center;
}

/* 紅色實心按鈕 (填寫喜帖資訊) */
.btn-gold-solid {
  background-color: #dc3545;
  color: #ffffff;
  border: none;
  padding: 0.65rem 2rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  border-radius: 9999px;
  transition: var(--transition-smooth);
  font-family: var(--font-sans);
  text-decoration: none !important;
}
.btn-gold-solid:hover {
  background-color: #b02a37;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(220, 53, 69, 0.30);
}

/* 白色底＋灰框黑字按鈕 (喜帖訂購流程) */
.btn-outline-muted {
  background-color: #ffffff;
  color: #2c2a29;
  border: 1px solid #cccccc;
  padding: 0.65rem 2rem;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  border-radius: 9999px;
  transition: var(--transition-smooth);
  font-family: var(--font-sans);
  text-decoration: none !important;
}

.btn-outline-muted:hover {
  background-color: #f5f5f5;
  color: #1a1a1a;
  border-color: #999999;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

/* ---- 注意事項 ---- */
.notes-block {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-card-border);
}
.notes-block h4 {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-dark);
  margin-bottom: 0.8rem;
}
.notes-block ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.2rem;
  font-family: var(--font-sans);
}
.notes-block ul li {
  font-size: 0.85rem;
  color: var(--color-muted);
  line-height: 1.85;
  position: relative;
  padding-left: 1.2rem;
}
.notes-block ul li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--color-gold);
}

/* ---- 相關產品 (置中) ---- */
.related-section {
  padding: 3rem 0 2rem;
  background-color: #ffffff;
  border-top: 1px solid var(--color-card-border);
}
.related-section .section-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--color-dark);
  text-align: center;
  margin-bottom: 2rem;
  letter-spacing: 0.05em;
}
.related-section .section-title span {
  color: var(--color-gold);
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 180px));
  justify-content: center;
  gap: 1.5rem;
  max-width: 100%;
  margin: 0 auto;
}
.related-card {
  background: #ffffff;
  border: 1px solid var(--color-card-border);
  border-radius: 4px;
  overflow: hidden;
  transition: var(--transition-smooth);
  height: 100%;
  display: flex;
  flex-direction: column;
}
.related-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(44,42,41,0.06);
  border-color: var(--color-gold);
}
.related-card .img-wrap {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--color-bg-light);
}
.related-card .img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.related-card:hover .img-wrap img { transform: scale(1.05); }
.related-card .body {
  padding: 1rem 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.related-card .body .name {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-dark);
  margin-bottom: 0.2rem;
}
.related-card .body .name a {
  color: var(--color-dark);
  text-decoration: none;
  transition: color 0.3s ease;
}
.related-card .body .name a:hover { color: var(--color-gold); }
.related-card .body .price {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-gold);
  margin-top: auto;
  font-family: var(--font-serif);
}
.related-card .body .link-arrow {
  font-size: 0.8rem;
  color: var(--color-gold);
  transition: transform 0.3s ease;
  display: inline-block;
}
.related-card:hover .link-arrow { transform: translateX(4px); }

/* ---- 相關產品區塊底部的 CTA 專屬間距 ---- */
.related-section .cta-group {
  margin-top: 2.5rem;
  margin-bottom: 3rem;
}

/* ---- Lightbox 樣式 (深色背景, 純箭頭) ---- */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  cursor: pointer;
}
.lightbox-overlay.active {
  display: flex;
}
.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.lightbox-content img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  cursor: default;
}
.lightbox-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 3.5rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.6);
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: color 0.3s ease;
  line-height: 1;
  z-index: 10;
}
.lightbox-btn:hover {
  color: rgba(255, 255, 255, 0.95);
}
.lightbox-btn.prev { left: 10px; }
.lightbox-btn.next { right: 10px; }

.lightbox-counter {
  position: absolute;
  bottom: -2.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

/* ---- 響應式微調 ---- */
@media (max-width: 767px) {
  .gallery-images { flex: 1 1 100%; }
  .gallery-info { flex: 1 1 100%; }
  .product-name { font-size: 1.3rem; }
  .product-price { font-size: 1.8rem; }
  .thumbnail-strip {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  /* ---- 手機版 CTA：上下排列，順序為「喜帖訂購流程」在上、「填寫喜帖資訊」在下 ---- */
  .cta-group {
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
  }
  .cta-group .btn-gold-solid,
  .cta-group .btn-outline-muted {
    width: auto;
    max-width: none;
    min-width: 0;
    flex: 0 0 auto;
    text-align: center;
  }
  /* 強制順序：喜帖訂購流程 在上、填寫喜帖資訊 在下 */
  .cta-group .btn-outline-muted { order: 1; }
  .cta-group .btn-gold-solid { order: 2; }

  .notes-block ul { flex-direction: column; gap: 0.2rem; }
  .lightbox-btn {
    font-size: 3rem;
    padding: 0.2rem 0.5rem;
  }
  .lightbox-btn.prev { left: 0; }
  .lightbox-btn.next { right: 0; }
  .lightbox-counter {
    bottom: -2rem;
    font-size: 0.75rem;
  }
}
@media (max-width: 400px) {
  .thumbnail-strip {
    gap: 4px;
  }
}