/* =============================================
   Product Detail Page Styles — 优品农源
   ============================================= */

/* ── Product Hero ── */
.product-hero {
  padding-block-start: calc(var(--nav-height) + var(--space-3xl));
  padding-block-end: var(--space-4xl);
  background:
    radial-gradient(ellipse 60% 40% at 80% 20%, oklch(78% 0.08 115 / 0.12), transparent),
    var(--color-warm-bg);
}

.product-hero__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5xl);
  align-items: start;
}

.product-hero__gallery {
  position: sticky;
  top: calc(var(--nav-height) + var(--space-xl));
  border-radius: var(--radius-2xl);
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-hero__gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-hero__badge {
  position: absolute;
  top: var(--space-lg);
  left: var(--space-lg);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  z-index: 1;
}

.product-hero__badge--hot {
  background: oklch(72% 0.18 30);
  color: #fff;
}

.product-hero__badge--new {
  background: var(--color-primary);
  color: #fff;
}

.product-hero__info {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.product-hero__category {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary-dark);
  margin-block-end: var(--space-xs);
}

.product-hero__name {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--fw-black);
  line-height: var(--lh-tight);
  margin-block-end: var(--space-sm);
}

.product-hero__origin {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.product-hero__origin-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
}

.product-hero__price-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--color-border-light);
  border-bottom: 1px solid var(--color-border-light);
}

.product-hero__price {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--fw-black);
  color: var(--color-price);
}

.product-hero__price-unit {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--fw-regular);
  color: var(--color-text-muted);
}

.product-hero__market-price {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: line-through;
}

.product-hero__score {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  background: oklch(88% 0.08 115 / 0.2);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-primary-dark);
}

/* ── Product description ── */
.product-hero__desc {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: var(--lh-relaxed);
}

.product-hero__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.product-hero__tag {
  padding: var(--space-xs) var(--space-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  transition: border-color 0.2s var(--ease-out-quart);
}

.product-hero__tag:hover {
  border-color: var(--color-primary-lighter);
}

.product-hero__actions {
  display: flex;
  gap: var(--space-md);
  padding-block-start: var(--space-sm);
}

/* ── Tabs navigation ── */
.product-tabs {
  position: sticky;
  top: var(--nav-height);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border-light);
  z-index: 5;
}

.product-tabs__nav {
  display: flex;
  gap: 0;
}

.product-tabs__btn {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.2s var(--ease-out-quart), border-color 0.2s var(--ease-out-quart);
}

.product-tabs__btn:hover {
  color: var(--color-text);
}

.product-tabs__btn--active {
  color: var(--color-primary-dark);
  border-bottom-color: var(--color-primary);
}

/* ── Tab sections ── */
.product-detail-section {
  padding-block: var(--space-4xl);
}

.product-detail-section:nth-child(odd) {
  background: var(--color-surface);
}

.product-detail-section h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  margin-block-end: var(--space-2xl);
}

/* ── Specs table ── */
.specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.specs-grid__item {
  display: flex;
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--color-border-light);
}

.specs-grid__item:nth-last-child(-n+2) {
  border-bottom: none;
}

.specs-grid__label {
  flex-shrink: 0;
  width: 120px;
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text-secondary);
}

.specs-grid__value {
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: var(--lh-relaxed);
}

/* ── Quality gauge cards ── */
.quality-gauges {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}

.quality-gauge {
  text-align: center;
  padding: var(--space-xl);
  background: var(--color-bg);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  transition: transform 0.3s var(--ease-out-quart), box-shadow 0.3s var(--ease-out-quart);
}

.quality-gauge:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.quality-gauge__ring {
  position: relative;
  width: 88px;
  height: 88px;
  margin: 0 auto var(--space-md);
}

.quality-gauge__ring svg {
  transform: rotate(-90deg);
}

.quality-gauge__value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--fw-black);
  color: var(--color-primary-dark);
}

.quality-gauge__label {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  margin-block-end: var(--space-xs);
}

.quality-gauge__detail {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ── Trace timeline (detail) ── */
.trace-detail-timeline {
  position: relative;
  padding-left: 40px;
}

.trace-detail-timeline::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: linear-gradient(to bottom, var(--color-primary), oklch(78% 0.10 115));
}

.trace-detail-step {
  position: relative;
  padding-block-end: var(--space-2xl);
}

.trace-detail-step:last-child {
  padding-block-end: 0;
}

.trace-detail-step__dot {
  position: absolute;
  left: -40px;
  top: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  z-index: 1;
  box-shadow: 0 0 0 6px oklch(78% 0.10 115 / 0.15);
}

.trace-detail-step:last-child .trace-detail-step__dot {
  background: var(--color-primary-darker);
  box-shadow: 0 0 0 6px oklch(70% 0.08 115 / 0.1);
}

.trace-detail-step__header {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
  margin-block-end: var(--space-xs);
}

.trace-detail-step__title {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
}

.trace-detail-step__date {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.trace-detail-step__desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--lh-relaxed);
}

/* ── Nutrition table ── */
.nutrition-table {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.nutrition-table__row {
  display: flex;
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--color-border-light);
  align-items: baseline;
}

.nutrition-table__row:last-child {
  border-bottom: none;
}

.nutrition-table__label {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text-secondary);
}

.nutrition-table__value {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
}

/* ── Product story ── */
.product-story {
  max-width: 720px;
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: var(--lh-loose);
}

.product-story p + p {
  margin-block-start: var(--space-lg);
}

.product-story em {
  font-style: normal;
  color: var(--color-primary-dark);
  font-weight: var(--fw-semibold);
}

/* ── CTA card ── */
.product-cta-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
  padding: var(--space-2xl) var(--space-3xl);
  background:
    radial-gradient(ellipse 30% 50% at 0% 50%, oklch(60% 0.10 148 / 0.15), transparent),
    var(--color-primary-dark);
  border-radius: var(--radius-2xl);
  color: #fff;
}

.product-cta-card__left {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.product-cta-card__price {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--fw-black);
  color: #fff;
}

.product-cta-card__price span {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--fw-regular);
  opacity: 0.7;
}

.product-cta-card__note {
  font-size: var(--text-sm);
  opacity: 0.7;
}

.product-cta-card__actions {
  display: flex;
  gap: var(--space-md);
}

/* ── Related products ── */
.related-products {
  padding-block: var(--space-4xl);
}

.related-products h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  margin-block-end: var(--space-2xl);
  text-align: center;
}

/* ── Responsive ── */
@media (max-width: 968px) {
  .product-hero__grid {
    grid-template-columns: 1fr;
    gap: var(--space-3xl);
  }

  .product-hero__gallery {
    position: static;
    aspect-ratio: 1;
    max-width: 480px;
    margin: 0 auto;
  }

  .product-hero__name {
    font-size: var(--text-2xl);
  }

  .specs-grid {
    grid-template-columns: 1fr;
  }

  .specs-grid__item:nth-last-child(2) {
    border-bottom: 1px solid var(--color-border-light);
  }

  .quality-gauges {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-cta-card {
    flex-direction: column;
    text-align: center;
  }

  .product-cta-card__left {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .quality-gauges {
    grid-template-columns: 1fr;
  }

  .product-tabs__nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .product-tabs__btn {
    white-space: nowrap;
    padding: var(--space-md) var(--space-lg);
  }

  .product-hero__actions {
    flex-direction: column;
  }

  .product-hero__actions .btn {
    width: 100%;
    text-align: center;
  }
}
