/* Live product grid — hydrates .mq-home-product-grid.
   Card design mirrors the replica's Horizon-styled cards visually while
   being rendered from clean JS. */

/* ---- Collection tab switcher (above the home grid) ------------------
   Ported 1:1 from the reference React tabs component (see design spec):
   - Sliding hover pill (bg #0e0f1114 = ~8% opacity charcoal), 300ms ease-out
   - Sliding active underline (2px bar, bottom −6px), 300ms ease-out
   - Text: active #0e0e10, inactive #0e0f11 at 60% opacity, 300ms ease
   - Tab height 30px, padding 8px 12px, gap 6px, font-size 14px medium
*/
.mq-collection-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin: 8px 0 24px 0;
  padding-bottom: 12px;
}
.mq-collection-tabs__rail {
  position: relative;
}
.mq-collection-tabs__hover {
  position: absolute;
  top: 0;
  height: 30px;
  left: 0;
  width: 0;
  opacity: 0;
  background: #0e0f1114;
  border-radius: 6px;
  transition: left 0.3s ease-out, width 0.3s ease-out, opacity 0.2s ease-out;
  pointer-events: none;
  z-index: 0;
}
.mq-collection-tabs__underline {
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 0;
  height: 2px;
  background: #0e0f11;
  transition: left 0.3s ease-out, width 0.3s ease-out;
  pointer-events: none;
  z-index: 1;
}
.mq-collection-tabs__list {
  position: relative;
  display: flex;
  gap: 6px;
  align-items: center;
}
.mq-collection-tabs__tab {
  position: relative;
  z-index: 2;
  padding: 0 12px;
  height: 30px;
  border: 0;
  background: transparent;
  color: #0e0f1199; /* 60% opacity charcoal */
  cursor: pointer;
  font-family: var(--font-body--family);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease;
}
.mq-collection-tabs__tab.is-active {
  color: #0e0e10;
}
.mq-collection-tabs__tab:focus-visible {
  outline: 2px solid #0e0e10;
  outline-offset: 2px;
  border-radius: 6px;
}
.mq-collection-tabs__shop-all {
  color: #131917;
  text-decoration: none;
  font-family: var(--font-body--family);
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s ease;
}
.mq-collection-tabs__shop-all:hover { color: #F15A27; }
@media (prefers-reduced-motion: reduce) {
  .mq-collection-tabs__hover,
  .mq-collection-tabs__underline,
  .mq-collection-tabs__tab,
  .mq-collection-tabs__shop-all { transition: none; }
}
@media (max-width: 749px) {
  .mq-collection-tabs { margin-bottom: 20px; }
  /* a11y audit item 4: 30px tab height is under the 44px touch min. Bump
     min-height + vertical padding on mobile; text stays centered, sliding
     underline (positioned bottom:-6px on the rail) is unaffected. */
  .mq-collection-tabs__tab {
    font-size: 13px;
    padding: 7px 10px;
    height: auto;
    min-height: 44px;
  }
}


.mq-home-product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px 8px;
  width: 100%;
}
@media (max-width: 749px) {
  .mq-home-product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 12px;
  }
}

.mq-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: inherit;
  text-decoration: none;
  position: relative;
  border: 1px solid #e3e6e4;              /* subtle bounding border */
  border-radius: 4px;                     /* card radius token */
  background: #ffffff;
  padding: 10px 10px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.mq-card:hover {
  border-color: rgba(19, 25, 23, 0.22);
  box-shadow: 0 4px 14px rgba(19, 25, 23, 0.06);
}
.mq-card__media {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f7f7f5;
  border-radius: 4px;
}
.mq-card__media-link,
.mq-card__slides {
  position: absolute;
  inset: 0;
  display: block;
}

/* Mini-carousel slides: layered, only the .is-active one visible. Cross-
   fade on state change. */
.mq-card__slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.mq-card__slide.is-active { opacity: 1; }
/* Legacy hover-swap markup kept for Horizon reference blocks — hide the
   .mq-card__image--source stack pattern (not used by the new renderer). */
.mq-card__image--source {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
}

/* Badge stack — top-left, stacks vertically when there's more than one. */
.mq-card__badges {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
  pointer-events: none;
}
.mq-card__badges .mq-card__badge {
  position: static;                  /* stack participates in flex layout */
  top: auto; left: auto;
}

/* Prev/Next arrows — invisible until hover on the card. */
.mq-card__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 32px;
  height: 32px;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: #131917;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.15s ease;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px rgba(19, 25, 23, 0.12);
}
.mq-card__nav:hover { background: #ffffff; }
.mq-card__nav svg  { width: 16px; height: 16px; }
.mq-card__nav--prev { left: 8px; }
.mq-card__nav--next { right: 8px; }
.mq-card:hover .mq-card__nav,
.mq-card:focus-within .mq-card__nav { opacity: 1; }
@media (hover: none) {
  /* Touch: arrows visible constantly (no hover state to reveal them). */
  .mq-card__nav { opacity: 0.9; }
}
.mq-card__nav:focus-visible {
  outline: 2px solid #F15A27;
  outline-offset: 2px;
}

/* Slide dots — bottom center of the media area. */
.mq-card__dots {
  position: absolute;
  bottom: 8px;
  left: 0; right: 0;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 5px;
  pointer-events: none;                /* allow clicks on cards; dot itself re-enables */
}
.mq-card__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(19, 25, 23, 0.08);
  cursor: pointer;
  pointer-events: auto;
  transition: width 0.2s ease, background 0.15s ease;
}
.mq-card__dot.is-active {
  width: 16px;
  border-radius: 3px;
  background: #F15A27;
}
.mq-card__dot:focus-visible {
  outline: 2px solid #F15A27;
  outline-offset: 2px;
}

.mq-card__body {
  padding-top: 8px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.mq-card__body .mq-card__title  { flex: 1 1 auto; }
.mq-card__body .mq-card__prices { flex: 0 0 auto; text-align: right; }
.mq-card__title {
  font-family: var(--font-body--family);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 400;
  color: inherit;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mq-card__prices {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-family: var(--font-body--family);
  font-size: 16px;
  color: #131917;
}
.mq-card__price {
  font-weight: 700;
  letter-spacing: -0.01em;
}
.mq-card__price--sale {
  color: #F15A27;
}
.mq-card__price-compare {
  text-decoration: line-through;
  opacity: 0.5;
  font-size: 13px;
  font-weight: 500;
}

.mq-card__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 3px;
  font-family: var(--font-body--family);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  z-index: 1;
}
.mq-card__badge--sale {
  background: #F15A27;
  color: #ffffff;
}
.mq-card__badge--soldout {
  background: rgba(19, 25, 23, 0.85);
  color: #ffffff;
}
.mq-card--sold-out .mq-card__media {
  opacity: 0.7;
}

/* Color swatches — TOP-RIGHT overlay on the image, only rendered for
   products that have a Color-like option. Small circles on a translucent
   white pill. Cap at 4 with a "+N" indicator. */
.mq-card__swatches {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(19, 25, 23, 0.08);
}
.mq-card__swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(19, 25, 23, 0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.mq-card__swatch:hover {
  transform: scale(1.15);
}
.mq-card__swatch.is-active {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.9),
    0 0 0 2px #131917;
}
.mq-card__swatch:focus-visible {
  outline: 2px solid #F15A27;
  outline-offset: 2px;
}
.mq-card__swatch--unknown {
  background: repeating-linear-gradient(45deg,
    #eeeeee 0 4px, #dddddd 4px 8px);
}
.mq-card__swatch-more {
  font-family: var(--font-body--family);
  font-size: 10px;
  font-weight: 600;
  color: rgba(19, 25, 23, 0.7);
  line-height: 1;
  padding-left: 2px;
}

/* Card transitions honour reduced-motion. */
@media (prefers-reduced-motion: reduce) {
  .mq-card__slide { transition: none; }
  .mq-card__nav   { transition: none; }
  .mq-card__dot   { transition: none; }
}

/* Skeleton loading state */
.mq-card--skeleton { pointer-events: none; }
.mq-card__media--skeleton,
.mq-card__title-skel,
.mq-card__price-skel {
  background: linear-gradient(90deg, #eeeeee 0%, #f6f6f6 50%, #eeeeee 100%);
  background-size: 200% 100%;
  animation: mq-skel 1.4s ease-in-out infinite;
}
.mq-card__title-skel {
  height: 16px;
  margin: 8px 0 4px 0;
  border-radius: 3px;
  width: 80%;
}
.mq-card__price-skel {
  height: 14px;
  border-radius: 3px;
  width: 40%;
}
@keyframes mq-skel {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mq-card__media--skeleton,
  .mq-card__title-skel,
  .mq-card__price-skel { animation: none; background: #f0f0f0; }
  .mq-card__image { transition: none; }
}

/* Error block with retry */
.mq-grid-error {
  grid-column: 1 / -1;
  padding: 32px;
  text-align: center;
  border: 1px dashed rgba(19, 25, 23, 0.2);
  border-radius: 6px;
  color: rgba(19, 25, 23, 0.75);
  font-family: var(--font-body--family);
  font-size: 14px;
}
.mq-grid-error p { margin: 0 0 12px 0; }
.mq-grid-error__retry {
  padding: 8px 18px;
  border: 1px solid #131917;
  background: transparent;
  color: #131917;
  border-radius: 4px;
  font-family: var(--font-body--family);
  font-size: 13px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.mq-grid-error__retry:hover {
  background: #131917;
  color: #ffffff;
}
.mq-grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px;
  color: rgba(19, 25, 23, 0.6);
  font-family: var(--font-body--family);
  font-size: 14px;
}
