/* Product hero owns the gallery, summary card, buy box and purchase-form geometry.
   Button colours/states live in product-actions.css; tabs/related/sticky live in
   single-product.css. Keeping these boundaries explicit prevents cascade drift. */

/* Hero shell ------------------------------------------------------------- */
.single-product-hero {
  display: grid;
  gap: var(--batya-space-3);
}

.single-product-hero__gallery,
.single-product-card {
  border: 0;
  border-radius: var(--batya-radius-card);
  background: var(--batya-card);
  box-shadow: none;
}

.single-product-hero__gallery {
  overflow: hidden;
}

/* Gallery: shared/mobile ------------------------------------------------- */
.single-product-hero__gallery .woocommerce-product-gallery {
  position: relative;
  margin: 0;
}

.single-product-hero__gallery .woocommerce-product-gallery__wrapper,
.single-product-hero__gallery .flex-viewport {
  background: var(--batya-card);
}

.single-product-hero__gallery .woocommerce-product-gallery__trigger,
.single-product-hero__gallery .zoomImg,
.single-product-hero__gallery .onsale {
  display: none !important;
}

.single-product-hero__gallery .woocommerce-product-gallery__image > a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: var(--batya-product-media-ratio);
  min-height: 0;
  padding: 10px 14px;
  box-sizing: border-box;
  cursor: pointer;
}

.single-product-hero__gallery .woocommerce-product-gallery__image > a > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Woo frontend CSS is disabled. Before FlexSlider wraps the slides, keep only
   the first image in layout so initialization cannot cause a large CLS jump. */
.single-product-hero__gallery .woocommerce-product-gallery > .woocommerce-product-gallery__wrapper {
  overflow: hidden;
}

.single-product-hero__gallery .woocommerce-product-gallery > .woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image:not(:first-child) {
  display: none;
}

/* Mobile/tablet thumbnail rail. Desktop becomes a vertical rail below. */
.single-product-hero__gallery .flex-control-thumbs {
  display: flex;
  align-items: stretch;
  gap: var(--batya-space-2);
  margin: 0;
  padding: 10px 12px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  list-style: none;
  scroll-snap-type: x proximity;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.single-product-hero__gallery .flex-control-thumbs::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.single-product-hero__gallery .flex-control-thumbs li {
  position: relative;
  flex: 0 0 54px;
  margin: 0;
  padding-bottom: 5px;
  scroll-snap-align: start;
}

.single-product-hero__gallery .flex-control-thumbs li::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 22px;
  height: 2px;
  border-radius: var(--batya-radius-pill);
  background: var(--batya-text);
  opacity: 0;
  transform: translateX(-50%) scaleX(.6);
  transition: opacity .16s ease, transform .16s ease;
}

.single-product-hero__gallery .flex-control-thumbs li.is-active::after {
  opacity: 1;
  transform: translateX(-50%) scaleX(1);
}

.single-product-hero__gallery .flex-control-thumbs img {
  width: 54px;
  height: auto;
  aspect-ratio: var(--batya-product-media-ratio);
  padding: 2px;
  border: 0;
  border-radius: var(--batya-radius-sm);
  background: var(--batya-surface);
  object-fit: contain;
  opacity: .62;
  cursor: pointer;
  transition: opacity .16s ease, background-color .16s ease, transform .16s ease;
}

.single-product-hero__gallery .flex-control-thumbs img:hover,
.single-product-hero__gallery .flex-control-thumbs img:focus-visible,
.single-product-hero__gallery .flex-control-thumbs img.flex-active {
  opacity: 1;
  background: var(--batya-card);
}

@media (hover: hover) and (pointer: fine) {
  .single-product-hero__gallery .flex-control-thumbs img:hover {
    transform: translateY(-1px);
  }
}

.single-product-hero__gallery .flex-control-thumbs.has-overflow {
  padding-right: 30px;
}

.single-product-hero__gallery .flex-control-thumbs.has-overflow.is-at-end {
  padding-right: 12px;
}

.single-product-hero__gallery .flex-control-thumbs.has-overflow:not(.is-at-end) {
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 26px), transparent 100%);
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 26px), transparent 100%);
}

.batya-thumb-scrollbar {
  display: none;
}

/* Summary card ---------------------------------------------------------- */
.single-product-card {
  padding: 16px;
}

.single-product-card.is-adding {
  opacity: 1;
}

.single-product-card__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--batya-space-2);
  margin-bottom: 10px;
}

.single-product-card__stock,
.single-product-card__sale,
.single-product-card__sku,
.single-product-card__chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: var(--batya-radius-pill);
  font-size: 12px;
  font-weight: var(--batya-weight-medium);
}

.single-product-card__stock.is-in-stock {
  background: var(--batya-success-bg);
  color: var(--batya-success-text);
}

.single-product-card__stock.is-out-stock {
  background: var(--batya-danger-bg);
  color: var(--batya-danger-text);
}

.single-product-card__sale {
  background: var(--batya-brand-soft);
  color: var(--batya-brand-dark);
  font-weight: var(--batya-weight-semibold);
}

.single-product-card__sku,
.single-product-card__chip {
  background: var(--batya-surface);
  color: var(--batya-text-soft);
}

.single-product-card__title {
  margin-bottom: 10px;
  font-size: clamp(1.45rem, 5vw, 2.3rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.single-product-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.single-product-card__excerpt {
  margin-bottom: 14px;
  color: var(--batya-text-soft);
  font-size: 14px;
  line-height: 1.5;
}

/* Buy box --------------------------------------------------------------- */
.single-product-buybox {
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--batya-border) 72%, transparent);
  border-radius: var(--batya-radius-card);
  background: color-mix(in srgb, var(--batya-surface) 88%, #fff);
}

.single-product-buybox__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 16px;
}

.single-product-buybox__head.is-stock-only {
  justify-content: flex-start;
}

.single-product-buybox__price.single-product-card__price {
  margin-bottom: 0;
}

.single-product-buybox__price .price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 7px;
  margin: 0;
  color: var(--batya-text);
  font-size: 1.8rem;
  font-weight: var(--batya-weight-semibold);
  line-height: 1.05;
  letter-spacing: -0.015em;
}

/* Woo outputs <del> before <ins>; visual order makes the current price primary. */
.single-product-buybox__price .price ins {
  order: -1;
  color: var(--batya-text);
  font-size: 1em;
  font-weight: var(--batya-weight-semibold);
  line-height: 1;
  text-decoration: none;
}

.single-product-buybox__price .price del {
  order: 2;
  color: var(--batya-text-faint);
  font-size: .56em;
  font-weight: var(--batya-weight-medium);
  line-height: 1;
  opacity: 1;
  text-decoration-color: currentColor;
  text-decoration-thickness: 1px;
}

.single-product-buybox__price .price ins .woocommerce-Price-amount,
.single-product-buybox__price .price del .woocommerce-Price-amount {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.single-product-buybox__availability {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  color: var(--batya-text-soft);
  font-size: 13px;
  font-weight: var(--batya-weight-medium);
  line-height: 1.3;
}

.single-product-buybox__availability-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--batya-text-faint);
}

.single-product-buybox__availability.is-in-stock {
  color: var(--batya-success-text);
}

.single-product-buybox__availability.is-in-stock .single-product-buybox__availability-dot {
  background: var(--batya-success-text);
}

.single-product-buybox__availability.is-out-stock {
  color: var(--batya-danger-text);
}

.single-product-buybox__availability.is-out-stock .single-product-buybox__availability-dot {
  background: var(--batya-danger-text);
}

/* Purchase form geometry ------------------------------------------------ */
.single-product-card__cta {
  margin-top: 14px;
}

/* Buy-box availability is the product-level stock source of truth. Hide only
   a direct duplicate printed by bundle plugins, not nested variation stock. */
.single-product-card__cta > .stock {
  display: none !important;
}

.single-product-card__cta form.cart {
  display: grid;
  gap: 10px;
  margin: 0;
}

.single-product-card__cta .quantity {
  display: inline-flex;
}

.single-product-card__cta .qty {
  width: 96px;
  min-height: 48px;
  height: 48px;
  padding: 0 12px;
  border: 1px solid var(--batya-border);
  border-radius: var(--batya-radius-control);
  background: var(--batya-surface);
  color: var(--batya-text);
  font-weight: var(--batya-weight-medium);
  font-variant-numeric: tabular-nums;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}

.single-product-card__cta .qty::-webkit-outer-spin-button,
.single-product-card__cta .qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.single-product-card__cta .qty:focus {
  outline: none;
}

.batya-mobile-qty-label,
.batya-qty-stepper__button {
  display: none;
}

.single-product-card__cta .single_add_to_cart_button {
  min-height: 48px;
  height: 48px;
}

/* Feedback + service ---------------------------------------------------- */
.single-product-card__feedback {
  display: none;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--batya-radius);
  font-size: 14px;
  font-weight: var(--batya-weight-medium);
}

.single-product-card__feedback.is-visible {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--batya-space-3);
}

.single-product-card__feedback.is-success {
  margin-top: 10px;
  padding: 0;
  background: transparent;
  color: var(--batya-success-text);
  font-size: 13px;
}

.single-product-card__feedback.is-error {
  background: var(--batya-danger-bg);
  color: var(--batya-danger-text);
}

.single-product-card__feedback-link {
  color: inherit;
  text-decoration: underline;
}

.single-product-buybox__pickup {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--batya-border) 86%, transparent);
}

.single-product-buybox__pickup-label,
.single-product-service__label {
  color: var(--batya-text-soft);
  font-size: 12px;
  font-weight: var(--batya-weight-medium);
  line-height: 1.3;
}

.single-product-buybox__pickup-address {
  color: var(--batya-text);
  font-size: 14px;
  font-weight: var(--batya-weight-semibold);
  line-height: 1.4;
}

.single-product-service {
  margin-top: 12px;
  padding: 12px 2px 0;
  border-top: 1px solid var(--batya-border);
}

.single-product-service__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin-top: 0;
}

.single-product-service__meta-item {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.single-product-service__value {
  color: var(--batya-text);
  font-size: 13px;
  font-weight: var(--batya-weight-medium);
  line-height: 1.4;
}

.single-product-service__phone {
  width: fit-content;
  font-weight: var(--batya-weight-semibold);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.single-product-service__phone:hover {
  color: var(--batya-brand-dark);
}

@media (max-width: 767px) {
  .single-product-buybox__head {
    align-items: flex-start;
  }

  .single-product-buybox__availability {
    width: 100%;
  }

  .single-product-service__meta {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 768px) {
  .single-product-card {
    padding: 20px;
  }

  .single-product-buybox {
    padding: 16px;
  }
}

/* Desktop hero ---------------------------------------------------------- */
@media (min-width: 992px) {
  .single-product-hero {
    grid-template-columns: minmax(440px, 500px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
  }

  .single-product-hero__summary {
    position: sticky;
    top: 88px;
    display: grid;
    gap: var(--batya-space-4);
  }

  .single-product-hero__summary.is-too-tall {
    position: static;
  }

  /* 66px rail + 10px gap leaves a ~424px 3:4 stage in the 500px gallery. */
  .single-product-hero__gallery .woocommerce-product-gallery:has(.flex-control-thumbs) {
    display: grid;
    grid-template-columns: 66px minmax(0, 1fr);
    grid-template-areas: "thumbs stage";
    gap: 10px;
    align-items: start;
    width: 100%;
  }

  .single-product-hero__gallery .flex-viewport {
    grid-area: stage;
    min-width: 0;
    width: 100% !important;
  }

  .single-product-hero__gallery .woocommerce-product-gallery__wrapper {
    grid-area: stage;
    min-width: 0;
  }

  .single-product-hero__gallery .woocommerce-product-gallery__image > a {
    width: 100%;
    padding: 8px;
  }

  /* Reserve the future thumbnail rail before FlexSlider initializes. */
  .single-product-hero__gallery .woocommerce-product-gallery:not(:has(.flex-control-thumbs)) .woocommerce-product-gallery__image > a {
    width: calc(100% - 76px);
    margin-inline: auto;
  }

  .single-product-hero__gallery .woocommerce-product-gallery:not(:has(.flex-control-thumbs)):has(.woocommerce-product-gallery__image:nth-child(2)) > .woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image:first-child > a {
    margin-left: 76px;
    margin-right: 0;
  }

  .single-product-hero__gallery .flex-control-thumbs,
  .single-product-hero__gallery .flex-control-thumbs.has-overflow,
  .single-product-hero__gallery .flex-control-thumbs.has-overflow.is-at-end {
    grid-area: thumbs;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    width: 66px;
    height: var(--batya-thumb-rail-height, 568px);
    max-height: var(--batya-thumb-rail-height, 568px);
    min-height: 0;
    margin: 0;
    padding: 0 8px 0 2px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-snap-type: y proximity;
    scroll-padding-block: 4px;
    -webkit-mask-image: none;
    mask-image: none;
    scrollbar-width: none;
    -ms-overflow-style: none;
    opacity: 0;
    transition: opacity .16s ease;
  }

  .single-product-hero__gallery .flex-control-thumbs::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .single-product-hero__gallery .is-batya-gallery-ready .flex-control-thumbs,
  .single-product-hero__gallery .woocommerce-product-gallery.is-batya-gallery-ready .flex-control-thumbs {
    opacity: 1;
  }

  .single-product-hero__gallery .flex-control-thumbs li {
    flex: 0 0 69px;
    width: 56px;
    height: 69px;
    padding: 0;
  }

  .single-product-hero__gallery .flex-control-thumbs li::after {
    z-index: 2;
    left: 2px;
    top: 0;
    bottom: auto;
    width: 52px;
    height: 69px;
    box-sizing: border-box;
    border: 2px solid var(--batya-brand);
    border-radius: var(--batya-radius-sm);
    background: transparent;
    opacity: 0;
    pointer-events: none;
    transform: none;
    transition: opacity .12s ease;
  }

  .single-product-hero__gallery .flex-control-thumbs li.is-active::after {
    opacity: 1;
    transform: none;
  }

  .single-product-hero__gallery .flex-control-thumbs img {
    display: block;
    width: 52px;
    height: 69px;
    margin-inline: 2px;
    padding: 2px;
    box-sizing: border-box;
    border: 1px solid transparent;
    border-radius: var(--batya-radius-sm);
    background: var(--batya-surface);
    object-fit: contain;
    opacity: .72;
    box-shadow: none;
    transform: translateZ(0);
    transition: opacity .16s ease, border-color .16s ease, background-color .16s ease;
  }

  .single-product-hero__gallery .flex-control-thumbs img:hover {
    opacity: 1;
    border-color: var(--batya-border-strong);
    background: var(--batya-card);
  }

  .single-product-hero__gallery .flex-control-thumbs img:focus-visible {
    opacity: 1;
    border-color: var(--batya-brand-border);
    background: var(--batya-card);
  }

  .single-product-hero__gallery .flex-control-thumbs li.is-active img,
  .single-product-hero__gallery .flex-control-thumbs img.flex-active {
    opacity: 1;
    border-color: transparent;
    background: var(--batya-card);
  }

  /* Custom scrollbar avoids Chromium's native overlay width changes. */
  .single-product-hero__gallery .batya-thumb-scrollbar {
    position: absolute;
    z-index: 3;
    top: 0;
    left: 58px;
    display: block;
    width: 8px;
    height: var(--batya-thumb-rail-height, 568px);
    opacity: 0;
    pointer-events: none;
    touch-action: none;
    transition: opacity .16s ease;
  }

  .single-product-hero__gallery .batya-thumb-scrollbar.has-overflow {
    opacity: .09;
    pointer-events: auto;
  }

  .single-product-hero__gallery .woocommerce-product-gallery:has(.flex-control-thumbs:hover) .batya-thumb-scrollbar.has-overflow,
  .single-product-hero__gallery .batya-thumb-scrollbar.has-overflow:hover {
    opacity: .32;
  }

  .single-product-hero__gallery .batya-thumb-scrollbar.is-dragging {
    opacity: .55 !important;
  }

  .single-product-hero__gallery .batya-thumb-scrollbar__thumb {
    position: absolute;
    left: 4px;
    top: 0;
    width: 1px;
    height: var(--batya-thumb-scroll-height, 32px);
    border-radius: var(--batya-radius-pill);
    background: rgba(90, 90, 90, .66);
    transform: translate3d(0, var(--batya-thumb-scroll-top, 0px), 0);
    cursor: grab;
    transition: background-color .14s ease;
  }

  .single-product-hero__gallery .batya-thumb-scrollbar:hover .batya-thumb-scrollbar__thumb,
  .single-product-hero__gallery .batya-thumb-scrollbar.is-dragging .batya-thumb-scrollbar__thumb {
    background: rgba(75, 75, 75, .78);
  }

  .single-product-hero__gallery .batya-thumb-scrollbar.is-dragging .batya-thumb-scrollbar__thumb {
    cursor: grabbing;
  }

  .single-product-card {
    padding: 24px;
  }

  .single-product-card__title {
    margin-bottom: 12px;
    font-size: clamp(2rem, 2.55vw, 2.25rem);
  }

  .single-product-card__chips {
    margin-bottom: 18px;
  }

  .single-product-buybox__price .price {
    font-size: 2rem;
  }

  .single-product-card__cta.has-inline-quantity form.cart,
  .single-product-card__cta.has-runtime-inline-quantity form.cart {
    grid-template-columns: 88px minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
  }

  .single-product-card__cta.has-inline-quantity .quantity,
  .single-product-card__cta.has-inline-quantity .qty,
  .single-product-card__cta.has-runtime-inline-quantity .quantity,
  .single-product-card__cta.has-runtime-inline-quantity .qty {
    width: 100%;
  }

  /* JS helper for plugin-rendered purchase forms. */
  .single-product-card__cta .batya-purchase-row {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
    width: 100%;
  }

  .single-product-card__cta .batya-purchase-row .quantity,
  .single-product-card__cta .batya-purchase-row .qty {
    width: 100%;
    margin: 0;
    float: none;
  }

  .single-product-card__cta .batya-purchase-row .qty,
  .single-product-card__cta .batya-purchase-row .single_add_to_cart_button {
    min-height: 48px;
    height: 48px;
    margin: 0;
  }

  .single-product-card__cta .batya-purchase-row .single_add_to_cart_button {
    width: 100%;
    float: none;
  }

  .single-product-card__cta.has-inline-quantity form.cart > .batya-purchase-row {
    grid-column: 1 / -1;
  }

  /* WPC Product Bundles renders quantity and submit as direct form siblings. */
  .single-product-card__cta[data-product-type="woosb"] form.cart {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
    width: 100%;
  }

  .single-product-card__cta[data-product-type="woosb"] form.cart > .quantity {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    margin: 0;
    float: none;
  }

  .single-product-card__cta[data-product-type="woosb"] form.cart > .quantity .qty {
    width: 100%;
    min-width: 0;
    height: 48px;
    min-height: 48px;
    margin: 0;
  }

  .single-product-card__cta[data-product-type="woosb"] form.cart > .single_add_to_cart_button {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    height: 48px;
    min-height: 48px;
    margin: 0;
    float: none;
  }
}

@media (min-width: 1200px) {
  .single-product-hero {
    grid-template-columns: 500px minmax(0, 1fr);
  }
}
