/**
 * Product detail — mobile layout (beauty DTC pattern)
 * Small screens only; desktop uses style.css / product-detail.css
 */

@import url("https://fonts.googleapis.com/css2?family=Comfortaa:wght@600;700&family=Playfair+Display:ital,wght@0,500;0,600;0,700;1,500&display=swap");

:root {
  --pd-m-orange: #d74826;
  --pd-m-orange-press: #c03d1f;
  --pd-m-burgundy: #6b2d32;
  --pd-m-cream: #f5f0e8;
  --pd-m-cream-card: #faf7f2;
  --pd-m-sans: "DM Sans", system-ui, sans-serif;
  /* Editorial serif for titles (Tower 28–style); Comfortaa for wordmark-style top logo */
  --pd-m-serif: "Playfair Display", "Libre Baskerville", Georgia, serif;
  --pd-m-wordmark: "Comfortaa", system-ui, sans-serif;
}

.pd-sr-anchor {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.pd-shipping-hint {
  display: none;
}

.pd-add-mobile {
  display: none;
}

.pd-add-price {
  display: none;
}

.pd-carousel-dots {
  display: none;
}

.pd-gallery-badges {
  display: none;
}

.pd-gift-floating {
  position: fixed;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  right: 0.75rem;
  z-index: 10002;
  display: none;
  background: var(--pd-m-orange);
  color: #fff;
  font-family: var(--pd-m-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.65rem 2rem 0.65rem 1rem;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(232, 90, 43, 0.45);
  align-items: center;
  gap: 0.35rem;
}

.pd-gift-floating:not(.hidden) {
  display: flex;
}

.pd-gift-close {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 1.5rem;
  height: 1.5rem;
  border: none;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  border-radius: 50%;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

@media (max-width: 768px) {
  body.pd-page {
    font-family: var(--pd-m-sans);
    background: var(--pd-m-cream-card);
  }

  .product-detail-section {
    background: var(--pd-m-cream-card);
  }

  .product-detail-container {
    grid-template-columns: 1fr;
    gap: 0;
    max-width: 100%;
    padding: 0;
  }

  .product-images-panel {
    position: static;
    margin: 0;
    padding: 0;
  }

  #productContent .product-image-card {
    touch-action: pan-y;
  }

  /* 滑动主图时单独开合成层，减少跟手抖动 */
  #productContent .pd-main-media-stage {
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    backface-visibility: hidden;
  }

  #productContent .pd-main-media-clip {
    overflow: hidden;
    width: 100%;
    position: relative;
  }

  #productContent .pd-main-media-track {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
  }

  #productContent .pd-main-media-slide {
    flex: 0 0 100%;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #productContent .product-main-image,
  #productContent .product-main-video-frame {
    backface-visibility: hidden;
  }

  #productContent .pd-gallery-media-dragging {
    will-change: transform;
  }

  .product-image-card {
    background: #ffffff;
    border-radius: 0;
    min-height: 72vw;
    max-height: none;
    margin-bottom: 0;
    position: relative;
  }

  .pd-gallery-badges {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    z-index: 8;
    pointer-events: none;
  }

  .pd-save-pill {
    pointer-events: auto;
    background: rgba(237, 231, 246, 0.95);
    color: var(--pd-m-burgundy);
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    font-family: var(--pd-m-sans);
    border: 1px solid rgba(107, 45, 50, 0.1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    flex-shrink: 0;
    max-width: min(72%, 13.5rem);
  }

  .pd-trust-seals {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
    flex: 1;
    min-width: 0;
  }

  .pd-seal {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(107, 45, 50, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pd-m-burgundy);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  }

  .product-like-btn {
    display: none;
  }

  .product-main-image,
  .product-main-video-frame .product-main-video {
    width: 100%;
    max-height: 85vw;
    min-height: 52vw;
    object-fit: contain;
  }

  .product-main-video-frame:not(.hidden) {
    min-height: 52vw;
  }

  .pd-carousel-dots:not([hidden]) {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem 1rem 0.35rem;
    position: relative;
    z-index: 5;
    background: transparent;
  }

  .pd-carousel-dots[hidden] {
    display: none !important;
  }

  .pd-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: #c4bcb4;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
  }

  .pd-dot.active {
    background: var(--pd-m-orange);
    transform: scale(1.15);
  }

  .product-thumbnails {
    padding: 0.65rem 0.75rem 1rem;
    gap: 8px;
    background: #ffffff;
    border-top: 1px solid rgba(107, 45, 50, 0.06);
  }

  .product-thumbnail {
    min-width: 56px;
    width: 56px;
    height: 56px;
    border-width: 2px;
    border-color: rgba(107, 45, 50, 0.25);
    border-radius: 8px;
  }

  .product-thumbnail.active {
    border-color: var(--pd-m-burgundy);
    box-shadow: 0 0 0 1px var(--pd-m-burgundy);
  }

  .product-info-panel {
    padding: 1.15rem 1.1rem 1.5rem;
    background: #fff;
    border-radius: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-column-gap: 0.75rem;
    align-items: start;
  }

  .product-title {
    grid-column: 1;
    grid-row: 1;
    font-family: var(--pd-m-serif);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--pd-m-burgundy);
    line-height: 1.25;
    margin: 0;
    letter-spacing: -0.02em;
  }

  .product-price-section {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    text-align: right;
    align-self: start;
    justify-self: end;
  }

  .product-price-section .discount-badge {
    display: inline-block;
    margin-bottom: 4px;
    font-size: 0.625rem;
  }

  .discount-badge {
    background: rgba(107, 45, 50, 0.12) !important;
    color: var(--pd-m-burgundy) !important;
  }

  .product-price-section .price-container {
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
  }

  .current-price {
    font-family: var(--pd-m-serif);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--pd-m-burgundy);
  }

  .original-price {
    font-size: 0.75rem;
  }

  .product-rating {
    grid-column: 1 / -1;
    grid-row: 2;
    margin: 0.6rem 0 0;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .rating-stars:not(.rating-stars-composite) {
    background: transparent !important;
    padding: 0 !important;
    font-size: 0 !important;
    color: transparent !important;
    gap: 2px !important;
  }

  .rating-stars:not(.rating-stars-composite)::before {
    content: "★★★★★" !important;
    color: var(--pd-m-burgundy) !important;
    font-size: 0.95rem !important;
    letter-spacing: 0.02em;
  }

  .rating-stars.rating-stars-composite {
    background: transparent !important;
    padding: 0 !important;
    font-size: inherit !important;
    color: inherit !important;
    gap: 0.35rem !important;
  }

  .rating-stars.rating-stars-composite::before {
    content: none !important;
    display: none !important;
  }

  .rating-stars-stack {
    font-size: 0.95rem !important;
    letter-spacing: 0.06em !important;
  }

  .rating-stars-stack .rating-stars-bg {
    color: rgba(107, 28, 50, 0.28) !important;
  }

  .rating-stars-stack .rating-stars-fg {
    color: var(--pd-m-burgundy) !important;
  }

  .rating-stars-num {
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
    color: var(--pd-m-burgundy) !important;
  }

  .rating-text.rating-reviews-link {
    background: transparent !important;
    padding: 0 !important;
    font-size: 0.8125rem;
    color: var(--pd-m-burgundy);
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  .pd-short-description {
    display: block;
    grid-column: 1 / -1;
    grid-row: 3;
    margin: 0.85rem 0 1rem;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--pd-m-burgundy);
  }

  .product-color-selector,
  .product-size-selector {
    grid-column: 1 / -1;
  }

  .product-color-selector {
    margin-top: 0.5rem;
    padding-top: 0.35rem;
  }

  .product-add-to-cart-btn {
    grid-column: 1 / -1;
    background: var(--pd-m-orange);
    color: #fff;
    border-radius: 999px;
    padding: 0.95rem 1.25rem;
    font-family: var(--pd-m-sans);
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
    box-shadow: 0 4px 14px rgba(232, 90, 43, 0.35);
    flex-wrap: wrap;
  }

  .product-add-to-cart-btn:hover {
    background: var(--pd-m-orange-press);
  }

  .pd-cart-icon-desktop {
    display: none;
  }

  .pd-add-desktop {
    display: none;
  }

  .pd-add-mobile {
    display: inline;
  }

  .pd-add-label::after {
    content: " —";
  }

  .pd-add-price {
    display: inline;
    font-weight: 700;
  }

  .pd-add-price:empty {
    display: none;
  }

  .pd-shipping-hint {
    display: block;
    grid-column: 1 / -1;
    text-align: center;
    font-size: 0.75rem;
    color: var(--pd-m-burgundy);
    margin: 0 0 0.35rem;
    opacity: 0.9;
  }

  /* After scroll, bottom bar leaves room for add-to-cart on mobile */
  .floating-cart-bar .floating-add-to-cart-btn {
    background: var(--pd-m-orange);
  }

  /* Tighter description padding on mobile */
  .product-description-section {
    padding-left: 0;
    padding-right: 0;
  }

  .description-container {
    padding: 0 0.75rem;
  }
}
