/* Product Detail Page Styles */

#product-detail {
  padding: var(--sectionPadding);
  background: var(--surface);
}

.product-detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  width: 100%;
  align-items: start;
}

@media (min-width: 50rem) {
  .product-detail-grid {
    grid-template-columns: 1.1fr 1fr; /* Image column slightly wider */
    gap: 5rem;
  }
}

/* Swipeable gallery: one image per slide. Products with a single image simply
   have nothing to scroll. */
.product-detail-img-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.5rem;
  display: flex;
  aspect-ratio: 600 / 651;
  max-width: 38.625rem; /* 600px photo + 0.5rem padding + 1px border each side */
  margin-inline: auto;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none; /* a scrollbar here would push the photo off centre */
  position: relative;
}

.product-detail-img-box::-webkit-scrollbar {
  display: none;
}

/* Show a sliver of the next photo so a second image is discoverable without JS.
   The inline padding is what lets the snapped slide still sit centred. Only
   products that actually have a second image get it. */
.product-detail-img-box:has(img + img) {
  padding-inline: 2rem;
  gap: 0.5rem;
}

.product-detail-img-box img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  scroll-snap-align: center;
  border-radius: clamp(4px, 1vw, 8px);
}

.product-detail-info-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.product-detail-roast {
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.product-detail-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-family: var(--fontHeading);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 1rem 0;
  color: var(--text);
}

.product-detail-price {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.product-detail-desc {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 1rem;
}

/* Keep the original gap before the size selector on the last paragraph */
.product-detail-desc:last-of-type {
  margin-bottom: 2rem;
}

/* Size Selector Dropdown */
.size-selector-group {
  width: 100%;
  max-width: 20rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.size-selector-group label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.size-selector-group select {
  font-size: 1rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
}

/* The widget injects the grind block just above Add to Cart, which sits below
   the specs table. Reorder the column so it reads directly under Select Size. */
.product-detail-info-box .commerce-options {
  max-width: 20rem;
  margin-bottom: 1.5rem;
  order: 1;
}

.product-detail-info-box .specs-table-wrapper {
  order: 2;
}

.product-detail-info-box .commerce-add {
  order: 3;
}

/* Specs Table */
.specs-table-wrapper {
  width: 100%;
  margin-bottom: 2.5rem;
  border-top: 1px solid var(--border);
}

.specs-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.specs-table tr {
  border-bottom: 1px solid var(--border);
}

.specs-table th, 
.specs-table td {
  padding: 0.85rem 0.5rem;
  font-size: 0.95rem;
}

.specs-table th {
  font-weight: 700;
  color: var(--text);
  width: 35%;
}

.specs-table td {
  color: var(--text-muted);
}

.product-detail-info-box .commerce-add {
  padding: 1rem 2.5rem;
  font-size: 1.05rem;
  width: 100%;
  max-width: 20rem;
  margin-bottom: 2rem;
}

/* Related Products Section */
#related-products {
  padding: var(--sectionPadding);
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
}

.related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem 2rem;
  width: 100%;
}

@media (min-width: 600px) {
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 50rem;
    margin: 0 auto;
  }
}
