.product-main__container {
  padding-top: var(--product-main-padding-top, 40px);
  padding-bottom: var(--product-main-padding-bottom, 60px);
}

.product-main__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(24px, var(--product-main-gap, 48px), 64px);
  align-items: start;
}

.product-gallery { position: relative; min-width: 0; }
.product-gallery-main { width: 100%; aspect-ratio: 1/1; overflow: hidden; background: var(--surface); }
.product-gallery-main img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.3s ease; }
.product-thumbs { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; }
.product-thumbs::-webkit-scrollbar { display: none; }
.product-thumb { width: 72px; height: 72px; flex-shrink: 0; overflow: hidden; cursor: pointer; border: 2px solid transparent; transition: border-color 0.2s; background: var(--surface); scroll-snap-align: start; }
.product-thumb.active { border-color: var(--foreground); }
.product-thumb:hover { border-color: var(--border-dark); }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-info { display: flex; flex-direction: column; gap: 0; min-width: 0; padding-top: 0.5rem; }
.product-title { font-weight: 600; line-height: 1.15; margin: 0 0 12px; color: var(--foreground); letter-spacing: var(--font-heading-letter-spacing, 0); overflow-wrap: anywhere; }
.product-title--small { font-size: calc(1.375rem * var(--font-heading-scale, 1)); }
.product-title--medium { font-size: calc(1.625rem * var(--font-heading-scale, 1)); }
.product-title--large { font-size: calc(2rem * var(--font-heading-scale, 1)); }
.product-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 24px; }
.product-price__current { font-size: calc(1.75rem * var(--font-heading-scale, 1)); font-weight: 600; color: var(--foreground); line-height: 1.15; }
.product-price__compare { font-size: 1.125rem; color: var(--text-secondary); text-decoration: line-through; }
.product-price__badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; background: var(--foreground); color: var(--background); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; line-height: 1; white-space: nowrap; }
.product-description { margin-bottom: 28px; color: var(--text-secondary); line-height: 1.7; }
.product-variant-picker { margin: 0 0 22px; }
.product-option-group { margin-bottom: 20px; }
.product-option-group:last-child { margin-bottom: 0; }
.product-option-label { display: block; font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; margin-bottom: 10px; color: var(--foreground); }
.product-option-label span { margin-left: 6px; font-weight: 400; color: var(--text-secondary); }
.product-option-values { display: flex; flex-wrap: wrap; gap: 10px; }
.product-option-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 64px; min-height: 40px; padding: 0.625rem 1.125rem; border: 1px solid var(--border); border-radius: var(--buttons-radius, 4px); font-size: 14px; font-weight: 500; line-height: 1.15; color: var(--foreground); background: var(--background); cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease; }
.product-option-btn:hover { border-color: var(--foreground); }
.product-option-btn.selected { border-color: var(--foreground); background: var(--foreground); color: var(--background); }
.product-option-btn.unavailable { opacity: 0.45; text-decoration: line-through; text-decoration-thickness: 1px; text-decoration-color: currentColor; }
.product-option-btn:disabled { cursor: not-allowed; }
.product-option-btn--image { justify-content: flex-start; gap: 8px; padding: 0.5rem 0.625rem; min-width: 120px; min-height: 42px; }
.product-option-btn__media { display: inline-flex; width: 25px; height: 25px; border-radius: 4px; overflow: hidden; flex-shrink: 0; background: var(--surface); border: 1px solid var(--border); }
.product-option-btn__thumb { width: 25px; height: 25px; object-fit: cover; display: block; }
.product-option-btn__thumb--empty { background: var(--surface); }
.product-option-btn__label { display: inline-block; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-option-btn--image.selected .product-option-btn__media { border-color: var(--background); }
.product-option-select-wrap { position: relative; max-width: 100%; }
.product-option-select { width: 100%; min-height: 44px; appearance: none; border: 1px solid var(--border); border-radius: var(--inputs-radius, 4px); background: var(--background); color: var(--foreground); padding: 0.625rem 2.5rem 0.625rem 0.875rem; font: inherit; cursor: pointer; }
.product-option-select:hover,
.product-option-select:focus { border-color: var(--foreground); outline: none; }
.product-option-select-icon { position: absolute; top: 50%; right: 0.875rem; transform: translateY(-50%); pointer-events: none; color: var(--text-secondary); }
/* Variant cards */
.variant-cards { display: flex; flex-wrap: wrap; gap: 10px; }
.variant-card { position: relative; width: 120px; border: 1.5px solid transparent; border-radius: 4px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; background: var(--background); overflow: hidden; }
.variant-card:hover { border-color: var(--border-dark); }
.variant-card.selected { border-color: var(--foreground); box-shadow: 0 0 0 1px var(--foreground); }
.variant-card-img-wrap { position: relative; width: 100%; aspect-ratio: 1/1; background: var(--surface); overflow: hidden; }
.variant-card-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.variant-card-body { padding: 6px 8px 8px; }
.variant-card-title { font-size: 12px; font-weight: 500; color: var(--foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.variant-card-price { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.variant-card-badge { position: absolute; top: 0; right: 0; background: var(--foreground); color: var(--background); font-size: 9px; font-weight: 600; padding: 2px 6px; line-height: 1.3; z-index: 1; }
.variant-card-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.variant-card-placeholder svg { width: 28px; height: 28px; color: var(--border-dark); }
.product-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.product-form__fallback-row { display: flex; align-items: stretch; gap: 12px; }
.product-qty { display: inline-flex; align-items: center; border: 1px solid var(--border); height: 52px; margin-bottom: 6px; width: max-content; max-width: 100%; }
.product-qty button { width: 48px; height: 100%; display: flex; align-items: center; justify-content: center; background: none; border: none; cursor: pointer; font-size: 18px; color: var(--text-secondary); transition: color 0.15s; }
.product-qty button:hover { color: var(--foreground); }
.product-qty input { width: 52px; height: 100%; text-align: center; border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border); font-size: 14px; font-weight: 600; color: var(--foreground); background: transparent; -moz-appearance: textfield; }
.product-qty input::-webkit-outer-spin-button,
.product-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.product-atc { width: 100%; height: 52px; display: flex; align-items: center; justify-content: center; background: transparent; color: var(--foreground); font-size: 14px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; border: 1.5px solid var(--border-dark); cursor: pointer; transition: all 0.2s; }
.product-atc:hover { border-color: var(--foreground); }
.product-atc:disabled { opacity: 0.4; cursor: not-allowed; }
.product-buy-now { width: 100%; height: 52px; display: flex; align-items: center; justify-content: center;  background: var(--scheme-btn-bg, var(--primary, #0a0a0a));
    color: var(--scheme-btn-label, var(--primary-text, #ffffff)); font-size: 14px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; border: none; cursor: pointer; transition: opacity 0.2s; }
.product-buy-now:hover { opacity: 0.85; }
.product-buy-now:disabled { opacity: 0.4; cursor: not-allowed; }
.product-cart-feedback { display: none; font-size: 13px; padding: 10px 14px; margin-top: 0; }
.product-trust { display: flex; flex-direction: column; gap: 10px; padding: 16px 0; border-top: 1px solid var(--border); }
.product-meta-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.product-meta-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.product-accordion { border-top: 1px solid var(--border); }
.product-accordion summary { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--foreground); list-style: none; }
.product-accordion summary::-webkit-details-marker { display: none; }
.product-accordion summary svg { width: 16px; height: 16px; min-width: 16px; min-height: 16px; flex-shrink: 0; transition: transform 0.2s; color: var(--text-secondary); }
.product-accordion[open] summary svg { transform: rotate(180deg); }
.product-accordion .accordion-body { padding-bottom: 16px; font-size: 14px; line-height: 1.7; color: var(--text-secondary); }

@media (min-width: 990px) {
  .product-main__layout {
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  }

  .product-main__layout--media-right {
    grid-template-columns: minmax(360px, 0.92fr) minmax(0, 1.08fr);
  }

  .product-main__layout--media-right .product-gallery {
    order: 2;
  }

  .product-main__layout--media-right .product-info {
    order: 1;
  }

  .product-info {
    position: sticky;
    top: 96px;
  }

  /* Sticky gallery: with both columns sticky, whichever is shorter pins while
     the longer one (usually the info column with its accordions) scrolls. */
  .product-main__layout--sticky-media .product-gallery {
    position: sticky;
    top: 96px;
  }

  /* Buy actions under the pinned image — revealed by the same trigger as the
     sticky bar, so a buyer deep in the description can act without scrolling. */
  .product-gallery-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  }

  .product-gallery-actions.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .product-gallery-actions .product-atc,
  .product-gallery-actions .product-buy-now {
    width: auto;
    flex: 1;
    height: 48px;
    /* Neutralize the base `transition: all` so inherited visibility doesn't
       lag the container's reveal. */
    transition: none;
  }
}

/* Mobile already has the sticky bottom bar — never show both. */
@media (max-width: 989px) {
  .product-gallery-actions {
    display: none;
  }
}

@media (max-width: 989px) {
  .product-main__container {
    padding-top: min(var(--product-main-padding-top, 40px), 28px);
    padding-bottom: min(var(--product-main-padding-bottom, 60px), 40px);
  }

  .product-main__layout {
    gap: 24px;
  }

  .product-gallery-main {
    margin-left: -1rem;
    width: calc(100% + 2rem);
  }

  .product-thumbs {
    margin-left: -1rem;
    margin-right: -1rem;
    padding: 0 1rem 2px;
  }

  .product-info {
    padding-top: 0;
  }

  .product-title--small,
  .product-title--medium,
  .product-title--large {
    font-size: clamp(calc(1.5rem * var(--font-heading-scale, 1)), calc((1.35rem + 1vw) * var(--font-heading-scale, 1)), calc(2rem * var(--font-heading-scale, 1)));
  }

  .product-price__current {
    font-size: clamp(calc(1.375rem * var(--font-heading-scale, 1)), calc((1.2rem + 1vw) * var(--font-heading-scale, 1)), calc(1.75rem * var(--font-heading-scale, 1)));
  }

  .variant-cards {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .variant-cards::-webkit-scrollbar {
    display: none;
  }

  .variant-card {
    width: 128px;
    flex: 0 0 128px;
    scroll-snap-align: start;
  }
}

@media (max-width: 640px) {
  .product-main__layout {
    gap: 20px;
  }

  .product-gallery-main {
    aspect-ratio: 1 / 1;
  }

  .product-thumb {
    width: 64px;
    height: 64px;
  }

  .product-price {
    margin-bottom: 20px;
  }

  .product-option-group {
    margin-bottom: 18px;
  }

  .product-option-btn {
    min-width: 44px;
    min-height: 44px;
    height: auto;
    padding: 0.75rem 0.875rem;
  }
  .product-option-btn--image {
    min-width: 128px;
    min-height: 44px;
    padding: 0.5rem 0.625rem;
  }

  .product-form__fallback-row {
    flex-direction: column;
  }

  .product-qty {
    width: 100%;
    justify-content: space-between;
  }

  .product-qty input {
    flex: 1;
    min-width: 0;
  }

  .product-buy-now,
  .product-atc {
    min-height: 52px;
    height: auto;
    padding: 0.875rem 1rem;
    white-space: normal;
    text-align: center;
  }

  .product-trust {
    padding-top: 14px;
  }

  .product-meta-item {
    align-items: flex-start;
    line-height: 1.45;
  }
}

/* ── Sticky buy bar ── */
.product-sticky-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90; /* above sticky header (50), below drawers/modals (100+) */
  background: var(--background);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.08);
  transform: translateY(110%);
  visibility: hidden;
  transition: transform 0.25s ease, visibility 0.25s ease;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.product-sticky-bar.is-visible {
  transform: translateY(0);
  visibility: visible;
}

.product-sticky-bar__inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.product-sticky-bar__media {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface);
}

.product-sticky-bar__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-sticky-bar__meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.product-sticky-bar__title {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-sticky-bar__price {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
}

.product-sticky-bar__actions {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.product-sticky-bar__actions .product-atc,
.product-sticky-bar__actions .product-buy-now {
  width: auto;
  min-width: 150px;
  height: 46px;
  min-height: 46px;
  padding: 0 20px;
  white-space: nowrap;
  /* The base buttons transition `all`, which would make their inherited
     visibility lag behind the bar's own show/hide transition. */
  transition: none;
}

/* Keep the floating WhatsApp button clear of the bar */
.whatsapp-widget {
  transition: bottom 0.25s ease;
}

body.has-sticky-buy-bar .whatsapp-widget {
  bottom: 92px;
}

@media (max-width: 640px) {
  .product-sticky-bar__media,
  .product-sticky-bar__title {
    display: none;
  }

  .product-sticky-bar__inner {
    gap: 10px;
  }

  .product-sticky-bar__actions {
    flex: 1;
    min-width: 0;
  }

  .product-sticky-bar__actions .product-atc,
  .product-sticky-bar__actions .product-buy-now {
    flex: 1;
    min-width: 0;
    height: 46px;
    min-height: 46px;
    padding: 0 10px;
    font-size: 13px;
  }
}
