/* ==========================================================================
   Product Template
   - Robust responsive layout
   - Full-width hero support (mc-hero)
   - Swiper product gallery
   ========================================================================== */

/* ---------- Design tokens (local fallbacks) ---------- */
:root {
  --product-gap-1: 12px;
  --product-gap-2: 16px;
  --product-gap-3: 24px;
  --product-gap-4: 32px;

  --product-border: var(--color-border, #E4E7EC);
  --product-surface: var(--color-surface, #F6F7F9);
  --product-text-muted: rgba(0, 0, 0, 0.75);

  --product-radius-md: var(--radius-md, 8px);
  --product-radius-lg: var(--radius-lg, 12px);

  /* Gallery slide viewport ratio */
  --product-gallery-ratio: 4 / 3;
}

/* ---------- Utilities ---------- */
.section--tight { padding: 24px 0; }
.muted { opacity: 0.75; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* ---------- Breadcrumbs (general) ---------- */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  font-size: 0.95rem;
  line-height: 1.35;
  opacity: 0.85;
}

.breadcrumbs a {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  transition: text-decoration-color 0.2s ease;
}

.breadcrumbs a:hover,
.breadcrumbs a:focus-visible {
  text-decoration-color: var(--mc-green);
}

/* When breadcrumbs sit inside the hero, make them readable on dark backgrounds */
.product-hero--full .breadcrumbs {
  opacity: 0.9;
  color: rgba(255, 255, 255, 0.85);
}

.product-hero--full .breadcrumbs a {
  color: rgba(255, 255, 255, 0.92);
}

/* ---------- Product hero (full-width) ---------- */
.product-hero--full .mc-hero {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  padding: 0;
  min-height: clamp(280px, 32vw, 520px);
}

/* Inner spacing lives here (not on .mc-hero) */
.product-hero--full .mc-hero__inner {
  padding: clamp(24px, 4vw, 56px) 0;
  max-width: 70ch;
}

/* CTA row inside hero */
.product-hero__ctas {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

/* Badges inside hero */
.product-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 16px 0 0 0;
}

.product-badge {
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.18);
  font-size: 0.9rem;
  line-height: 1.2;
  max-width: 100%;
  color: rgba(255, 255, 255, 0.92);
}

/* If badges appear outside the hero, keep them sensible on light backgrounds */
.section .product-badge {
  border-color: var(--product-border);
  background: var(--product-surface);
  color: inherit;
}

/* ---------- Legacy split hero layout (only if used somewhere) ---------- */
.product-hero__inner {
  display: grid;
  gap: var(--product-gap-4);
  grid-template-columns: 1fr;
  align-items: start;
}

.product-hero__title { margin: 0 0 12px 0; }
.product-hero__tagline { margin: 0 0 20px 0; max-width: 60ch; }

/* If mc-hero is embedded as a "tile" inside a column */
.product-hero__media .mc-hero {
  padding: 0;
  border-radius: var(--product-radius-lg);
}

/* ==========================================================================
   (Optional) Grid gallery fallback
   If you ever want a non-Swiper grid, add class: .product-gallery--grid
   ========================================================================== */

.product-gallery--grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.product-gallery--grid .product-gallery__img {
  height: auto; /* grid uses natural height */
  border-radius: var(--product-radius-lg);
  border: 1px solid var(--product-border);
}

/* ---------- Spec summary (definition list) ---------- */
.spec-summary {
  display: grid;
  gap: 12px;
  margin: 0;
}

.spec-summary__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  border-bottom: 1px solid var(--product-border);
  padding-bottom: 12px;
}

.spec-summary dt { font-weight: 700; }

.spec-summary dd {
  margin: 0;
  opacity: 0.88;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* ---------- Spec groups ---------- */
.spec-group { margin-top: 28px; }
.spec-group__title { margin: 0 0 12px 0; }

/* ---------- Spec table (robust radius + scroll on small screens) ---------- */
.spec-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--product-radius-lg);
}

.spec-table {
  width: 100%;
  border-spacing: 0;
  border: 1px solid var(--product-border);
  border-radius: var(--product-radius-lg);
  overflow: hidden;
  background: #fff;
  min-width: 520px;
}

.spec-table th,
.spec-table td {
  padding: 12px 14px;
  border-top: 1px solid var(--product-border);
  vertical-align: top;
  text-align: left;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.spec-table tr:first-child th,
.spec-table tr:first-child td {
  border-top: none;
}

.spec-table th {
  width: 42%;
  background: var(--product-surface);
  font-weight: 700;
}

.spec-table tbody tr:nth-child(even) td {
  background: rgba(0,0,0,0.01);
}

/* ---------- Downloads ---------- */
.download-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.download-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--product-border);
  border-radius: var(--product-radius-md);
  text-decoration: none;
  background: var(--product-surface);
  color: inherit;
  min-height: 44px;
}

.download-link:hover,
.download-link:focus-visible {
  filter: brightness(0.98);
  outline: none;
}

/* ---------- Related product grid/cards ---------- */
.product-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.product-card {
  border: 1px solid var(--product-border);
  border-radius: var(--product-radius-lg);
  padding: 16px;
  text-decoration: none;
  background: var(--product-surface);
  color: inherit;
  min-height: 44px;
}

.product-card:hover,
.product-card:focus-visible {
  filter: brightness(0.98);
  outline: none;
}

/* ---------- CTA panel ---------- */
.product-cta__inner {
  border: 1px solid var(--product-border);
  border-radius: var(--product-radius-lg);
  padding: 24px;
  background: var(--product-surface);
}

/* ---------- Responsive breakpoints ---------- */
@media (min-width: 640px) {
  .section--tight { padding: 28px 0; }

  .spec-summary__row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
  }

  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  /* Optional grid fallback layout if used */
  .product-gallery--grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  /* Slightly more cinematic slide ratio on desktop (optional) */
  :root { --product-gallery-ratio: 16 / 10; }
}

@media (min-width: 1024px) {
  .product-hero__inner {
    grid-template-columns: 1.1fr 0.9fr;
    gap: 40px;
  }

  .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ---------- Print niceties ---------- */
@media print {
  .download-link,
  .product-hero__ctas {
    display: none !important;
  }
}
/* ===== Swiper gallery width fix (force full-width slides) ===== */
.product-gallery-swiper {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.product-gallery-swiper .swiper-wrapper {
  align-items: stretch;
}

.product-gallery-swiper .swiper-slide {
  flex: 0 0 100% !important; /* key: full width */
  width: 100% !important;    /* key: full width */
  max-width: 100%;
}

/* Keep your viewport ratio + image fit */
.product-gallery-swiper .swiper-slide {
  aspect-ratio: var(--product-gallery-ratio, 4 / 3);
  background: #fff;
  border: 1px solid var(--product-border, #E4E7EC);
  border-radius: var(--product-radius-lg, 12px);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.product-gallery-swiper .swiper-slide img.product-gallery__img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}
/* ==========================================
   Product Layout Grid
========================================== */

.product-layout__grid {
  display: grid;
  grid-template-columns:
    var(--mc-product-split-main, 1.6fr)
    var(--mc-product-split-side, 1fr);
  gap: 2.5rem;
  align-items: start;
}

.product-layout__main {
  min-width: 0; /* prevents overflow */
}

.product-layout__side {
  position: relative;
}

.product-layout__section {
  margin-bottom: 3rem;
}

/* Mobile stacking */
@media (max-width: 960px) {
  .product-layout__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .product-layout__side {
    margin-top: 1rem;
  }
}
