/* ===============================================================
   COASTAL FORESTER — PRODUCT PAGE CSS v3
   Mobile-first. Sticky only on desktop 1024px+
   =============================================================== */

/* ── Page wrapper ── */
.product-page {
  padding-top: 80px;
  background-color: var(--surface);
  padding-bottom: 120px;
}

/* ── Breadcrumb ── */
.product-breadcrumb {
  max-width: 1536px;
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
}
.product-breadcrumb a,
.product-breadcrumb span {
  font-family: var(--font-body);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(28,28,25,0.45);
  transition: color 0.2s;
}
.product-breadcrumb a:hover { color: var(--primary); }
.product-breadcrumb .sep { margin: 0 0.6rem; }
.product-breadcrumb .current { color: var(--on-surface); }

/* ── Main grid — MOBILE: single column stack ── */
.product-main {
  max-width: 1536px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* ── IMAGE COLUMN ── */
/* Mobile: never sticky, just flows naturally */
.product-images {
  width: 100%;
  position: relative !important;
  top: auto !important;
}

.product-image-main {
  width: 100%;
  aspect-ratio: 4/5;
  background-color: var(--surface-container-low);
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(28,28,25,0.10);
  margin-bottom: 1rem;
  position: relative;
}

.product-image-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: relative;
  transition: opacity 0.35s ease;
}

.product-image-main::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('../images/grain.png');
  opacity: 0.04;
  pointer-events: none;
}

/* Thumbnail strip */
.product-image-thumbs {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.5rem;
}
.product-image-thumbs::-webkit-scrollbar { display: none; }

.product-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 80px;
  border-radius: 0.75rem;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.25s, opacity 0.25s;
  opacity: 0.55;
}
.product-thumb.active { border-color: var(--primary); opacity: 1; }
.product-thumb:hover { opacity: 0.85; }
.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── DETAILS COLUMN ── */
.product-details {
  width: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--surface);
}

.product-eyebrow {
  font-family: var(--font-body);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--secondary);
  margin-bottom: 1rem;
}

.product-title {
  font-family: var(--font-headline);
  font-size: clamp(1.75rem, 6vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.product-price {
  font-family: var(--font-headline);
  font-size: 1.5rem;
  font-style: italic;
  color: var(--primary);
  margin-bottom: 1.5rem;
}

.product-divider {
  height: 1px;
  background: rgba(24,36,25,0.10);
  margin-bottom: 1.5rem;
}

.product-description {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.85;
  color: rgba(28,28,25,0.75);
  margin-bottom: 2rem;
}

/* Meta list */
.product-meta-list {
  list-style: none;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.product-meta-list li {
  display: flex;
  gap: 1rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
}
.product-meta-list li .meta-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(28,28,25,0.40);
  min-width: 72px;
}
.product-meta-list li .meta-value {
  color: var(--on-surface);
  line-height: 1.5;
}

/* Size selector */
.product-size-label {
  font-family: var(--font-body);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(28,28,25,0.50);
  margin-bottom: 0.75rem;
}

.product-sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 2rem;
}

.size-btn {
  padding: 0.55rem 1.1rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(24,36,25,0.18);
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.72rem;
  cursor: pointer;
  color: var(--on-surface);
  transition: all 0.2s;
}
.size-btn:hover { border-color: var(--primary); background: var(--surface-container-low); }
.size-btn.selected { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.size-btn.sold-out { opacity: 0.3; cursor: not-allowed; text-decoration: line-through; }

/* Actions row */
.product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.quantity-wrap {
  display: flex;
  align-items: center;
  border: 1px solid rgba(24,36,25,0.18);
  border-radius: 0.75rem;
  overflow: hidden;
  height: 52px;
  flex-shrink: 0;
}
.qty-btn {
  width: 44px;
  height: 52px;
  background: transparent;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--on-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.qty-btn:hover { background: var(--surface-container-low); }
.qty-input {
  width: 40px;
  height: 52px;
  border: none;
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: transparent;
  color: var(--on-surface);
  -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.add-to-cart-btn {
  flex: 1;
  min-width: 140px;
  height: 52px;
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  border-radius: 0.75rem;
  font-family: var(--font-body);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.25s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.add-to-cart-btn:hover { background: var(--primary-container); }
.add-to-cart-btn:active { transform: scale(0.98); }
.add-to-cart-btn .material-symbols-outlined { font-size: 18px; }

.wishlist-btn {
  width: 52px;
  height: 52px;
  border-radius: 0.75rem;
  border: 1px solid rgba(24,36,25,0.18);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-surface);
  transition: all 0.2s;
  flex-shrink: 0;
}
.wishlist-btn:hover { border-color: var(--primary); background: var(--surface-container-low); }
.wishlist-btn .material-symbols-outlined { font-size: 20px; }

.product-shipping-note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: rgba(28,28,25,0.45);
  margin-bottom: 0.5rem;
}
.product-shipping-note .material-symbols-outlined { font-size: 16px; }

/* Accordion */
.product-accordion {
  border-top: 1px solid rgba(24,36,25,0.10);
  margin-top: 2rem;
}
.accordion-item {
  border-bottom: 1px solid rgba(24,36,25,0.10);
}
.accordion-trigger {
  width: 100%;
  background: none;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 0;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--on-surface);
  text-align: left;
}
.accordion-icon {
  font-family: 'Material Symbols Outlined';
  font-size: 18px;
  color: var(--primary);
  transition: transform 0.3s;
  flex-shrink: 0;
}
.accordion-item.open .accordion-icon { transform: rotate(45deg); }
.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.3s;
  font-family: var(--font-body);
  font-size: 0.875rem;
  line-height: 1.85;
  color: rgba(28,28,25,0.70);
}
.accordion-item.open .accordion-body {
  max-height: 400px;
  padding-bottom: 1.25rem;
}

/* ── Related products ── */
.related-section {
  background-color: var(--surface-container-low);
  padding: 5rem 0;
}
.related-inner {
  max-width: 1536px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.related-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 3rem;
}
.related-header h2 {
  font-family: var(--font-headline);
  font-size: clamp(1.5rem, 3.5vw, 2.5rem);
  letter-spacing: -0.02em;
}
.related-header a {
  font-family: var(--font-body);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(28,28,25,0.50);
  border-bottom: 1px solid rgba(24,36,25,0.20);
  padding-bottom: 2px;
  transition: color 0.2s;
}
.related-header a:hover { color: var(--primary); }

.related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.related-card {
  cursor: pointer;
  display: block;
  text-decoration: none;
}
.related-card__img-wrap {
  aspect-ratio: 4/5;
  border-radius: 1.25rem;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(28,28,25,0.06);
  margin-bottom: 1rem;
  transition: box-shadow 0.3s;
}
.related-card:hover .related-card__img-wrap {
  box-shadow: 0 12px 36px rgba(28,28,25,0.12);
}
.related-card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.65s ease;
}
.related-card:hover .related-card__img-wrap img { transform: scale(1.05); }
.related-card__name {
  font-family: var(--font-headline);
  font-size: 1rem;
  margin-bottom: 0.25rem;
}
.related-card__price {
  font-family: var(--font-body);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  opacity: 0.55;
}

/* ── Back to collection ── */
.back-to-collection {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 0;
  background: var(--surface);
}
.back-to-collection a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(28,28,25,0.45);
  border-bottom: 1px solid rgba(24,36,25,0.20);
  padding-bottom: 2px;
  transition: color 0.2s;
  text-decoration: none;
}
.back-to-collection a:hover { color: var(--primary); }
.back-to-collection .material-symbols-outlined { font-size: 16px; }

/* ── Sticky mobile ATC bar ── */
.sticky-atc {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: rgba(252,249,244,0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(24,36,25,0.08);
  padding: 1rem 1.5rem;
  align-items: center;
  gap: 1rem;
}
.sticky-atc__info { flex: 1; }
.sticky-atc__name {
  font-family: var(--font-headline);
  font-size: 0.95rem;
  line-height: 1.2;
}
.sticky-atc__price {
  font-family: var(--font-body);
  font-size: 0.65rem;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.sticky-atc__btn {
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  border-radius: 0.75rem;
  padding: 0.85rem 1.5rem;
  font-family: var(--font-body);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.sticky-atc__btn:hover { background: var(--primary-container); }

/* ── MOBILE only ── */
@media (max-width: 1023px) {
  .sticky-atc { display: flex; }

  .product-page { padding-bottom: 100px; }

  /* Force image to never be sticky on mobile */
  .product-images {
    position: static !important;
    top: 0 !important;
    transform: none !important;
    will-change: auto !important;
  }

  .product-main {
    display: flex !important;
    flex-direction: column !important;
  }

  /* Image always renders first */
  .product-images { order: 1; }
  .product-details { order: 2; }
}

/* ── DESKTOP 1024px+ ── */
@media (min-width: 1024px) {
  .product-breadcrumb { padding: 2rem 3rem 0; }

  .product-main {
    display: grid !important;
    grid-template-columns: 55fr 45fr;
    gap: 5rem;
    padding: 3rem 3rem 6rem;
    flex-direction: unset;
    align-items: start;
  }

  /* Sticky ONLY on desktop */
  .product-images {
    position: sticky !important;
    top: 100px !important;
  }

  .product-thumb {
    width: 84px;
    height: 105px;
  }

  .related-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem 2.5rem;
  }

  .related-inner { padding: 0 3rem; }
}
