/* Product Detail Page */

/* ── Header ── */
.product-header {
  background-color: var(--brand-cream);
  border-bottom: var(--border-thin) solid var(--product-color);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 999;
}

.product-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}

/* Back link stays left */
.product-header-inner .back-link {
  justify-self: start;
}

/* Logo column auto-centres */
.product-header-inner .header-logo-link {
  justify-self: center;
}

/* Cart button sits at the end of the third column,
   overriding the absolute positioning used in the nav context */
.product-header-inner .cart-nav-btn {
  position: static;
  justify-self: end;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--brand-ink);
  text-decoration: none;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--product-color);
}

.header-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

/* .header-spacer no longer needed — grid handles centring */

/* ── Main layout ── */
.product-main {
  min-height: calc(100vh - 130px);
  background-color: var(--brand-cream);
  padding: 3rem 2rem 5rem;
}

.product-detail-container {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}

/* ── Image column ── */
.product-detail-image-wrap {
  position: sticky;
  top: 90px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  /* retro-frame class provides the double border */
  background-color: var(--brand-cream-light);
}

/* The ::before from retro-frame sits inside; make sure the image doesn't clip it */
.product-detail-image-wrap.retro-frame {
  padding: 0;
}

.product-detail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Info column ── */
.product-detail-category {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--product-color-soft);
  margin: 0 0 0.4rem;
  font-weight: 400;
}

.product-detail-name {
  font-family: var(--font-display);
  font-size: 1.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--product-color);
  line-height: 1.15;
  margin: 0;
}

.product-detail-meta-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.product-detail-price {
  font-family: var(--font-display);
  font-size: 1.7rem;
  letter-spacing: 0.04em;
  color: var(--product-color-deep);
}

.product-detail-badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  background-color: var(--brand-cream-light);
  border: 1px solid var(--product-color);
  border-radius: 20px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.8rem;
  color: var(--product-color-soft);
  letter-spacing: 0.04em;
}

.product-detail-description {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--brand-ink);
  margin: 0 0 1.75rem;
}

/* ── Allergen callout ── */
.allergen-callout {
  background-color: var(--brand-cream-light);
  border: 1px solid color-mix(in srgb, var(--product-color) 40%, transparent);
  border-left: 4px solid var(--product-color);
  border-radius: var(--radius-inner);
  padding: 1rem 1.25rem;
  margin-bottom: 1.75rem;
}

.allergen-callout-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--product-color);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.allergen-callout p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--product-color-soft);
  margin: 0;
}

/* ── Nutrition table ── */
.nutrition-section {
  margin-bottom: 1.75rem;
}

.nutrition-title {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--product-color);
  margin: 0 0 0.75rem;
}

.nutrition-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.nutrition-table th,
.nutrition-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  color: var(--brand-ink);
}

.nutrition-table thead th {
  background-color: var(--brand-cream);
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--product-color-deep);
}

.nutrition-table tbody tr:last-child td {
  border-bottom: none;
}

.nutrition-table tbody tr:nth-child(even) td {
  background-color: var(--brand-cream-light);
}

/* ── Storage line ── */
.storage-line {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--product-color-soft);
  margin: 0 0 2rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.storage-line::before {
  content: '◆';
  font-size: 0.55rem;
  color: var(--product-color);
}

/* ── CTA area ── */
.product-detail-cta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.detail-quantity-row {
  display: flex;
  align-items: center;
  gap: 0;
  border: var(--border-thin) solid var(--product-color);
  border-radius: var(--radius-inner);
  overflow: hidden;
  flex-shrink: 0;
}

.detail-qty-btn {
  background-color: var(--brand-cream);
  border: none;
  width: 44px;
  height: 50px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--product-color-deep);
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-qty-btn:hover {
  background-color: color-mix(in srgb, var(--product-color) 12%, var(--brand-cream));
}

.detail-qty-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.detail-qty-display {
  min-width: 44px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--product-color-deep);
  border-left: 1px solid var(--product-color);
  border-right: 1px solid var(--product-color);
}

.detail-add-btn {
  flex: 1;
  padding: 0 1.5rem;
  height: 50px;
  background-color: var(--product-color);
  color: var(--brand-cream);
  border: var(--border-thin) solid var(--product-color-deep);
  border-radius: var(--radius-inner);
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
}

.detail-add-btn:hover {
  background-color: var(--product-color-deep);
  transform: translateY(-1px);
}

.detail-add-btn:active {
  transform: translateY(0);
}

.continue-shopping-link {
  display: inline-block;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--product-color-soft);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.continue-shopping-link:hover {
  color: var(--product-color);
  text-decoration: underline;
}

/* ── Mobile responsive ── */
@media (max-width: 768px) {
  .product-main {
    padding: 2rem 1.5rem 8rem;
  }

  .product-detail-container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .product-detail-image-wrap {
    position: relative; /* keep ::before positioning context; drop sticky only */
    aspect-ratio: 4 / 3;
  }

  .product-detail-name {
    font-size: 1.4rem;
  }

  .product-detail-price {
    font-size: 1.3rem;
  }

  .product-header-inner {
    grid-template-columns: auto 1fr auto;
  }

  .product-detail-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--brand-cream);
    border-top: var(--border-thin) solid var(--product-color);
    padding: 0.75rem 1rem;
    margin: 0;
    z-index: 500;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    gap: 0.625rem 0.75rem;
    flex-wrap: wrap;
  }

  .detail-qty-btn,
  .detail-qty-display {
    height: 46px;
  }

  .detail-qty-btn {
    width: 40px;
  }

  .detail-qty-display {
    min-width: 40px;
  }

  .detail-add-btn {
    height: 46px;
    font-size: 0.8rem;
    padding: 0 0.75rem;
  }

  /* View Cart drops to its own full-width row below stepper + Add to Cart */
  .product-detail-cta .view-cart-btn {
    height: 42px;
  }

  .product-detail-cta .view-cart-btn.visible {
    flex-basis: 100%;
    width: 100%;
  }

  /* Cart nav button in header is redundant — the CTA bar has View Cart */
  .product-header-inner .cart-nav-btn {
    display: none;
  }
}

@media (max-width: 480px) {
  .product-main {
    padding: 1.5rem 1rem 8rem;
  }

  .product-detail-name {
    font-size: 1.2rem;
  }

  .product-header {
    padding: 0.875rem 1rem;
  }

  .header-logo {
    width: 100px;
  }
}
