/* ====================================================
   IseMoody – Single Product Page Mobile Fix
   Loaded only on single product pages at priority 99.
   ==================================================== */

@media (max-width: 768px) {

  /* ── Background: match cart page (background-attachment:fixed breaks on mobile) ── */
  body.single-product {
    background:
      radial-gradient(ellipse at 15% 10%,  rgba(184, 134, 11, 0.13) 0%, transparent 45%),
      radial-gradient(ellipse at 85% 5%,   rgba(201, 162, 39, 0.09) 0%, transparent 40%),
      radial-gradient(ellipse at 50% 55%,  rgba(212, 168, 75, 0.06) 0%, transparent 55%),
      radial-gradient(ellipse at 8%  80%,  rgba(184, 134, 11, 0.08) 0%, transparent 40%),
      radial-gradient(ellipse at 92% 88%,  rgba(201, 162, 39, 0.07) 0%, transparent 40%),
      #fafaf9 !important;
    background-attachment: scroll !important;
  }

  /* ── Overflow containment ───────────────────────── */
  html,
  body.single-product {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  .single-product {
    overflow-x: hidden !important;
  }

  .single-product .container {
    padding: 0 16px !important;
    box-sizing: border-box !important;
    max-width: 100% !important;
    overflow-x: visible !important;
  }

  /* ── Main layout: stack gallery above summary ───── */
  .product-layout-new__inner {
    flex-direction: column !important;
    gap: 0 !important;
    padding: 0 !important;
    margin-bottom: 40px !important;
  }

  /* Add spacing only where needed */
  .product-layout-new__summary { margin-top: 12px !important; }
  .product-accordion-wrapper--sibling { margin-top: 0 !important; }
  .product-trust-bullets--sibling { margin-top: 0 !important; }

  .product-layout-new__gallery,
  .product-layout-new__summary {
    width: 100% !important;
    overflow: visible !important;
  }

  /* Summary: remove sticky (doesn't make sense stacked) */
  .product-layout-new__summary {
    position: static !important;
    top: auto !important;
  }

  /* ── Gallery: same flex structure as desktop, scaled for mobile ── */

  .product-layout-new__gallery .woocommerce-product-gallery {
    padding-left: 68px !important;
  }

  /* Thumbnail sidebar */
  .product-layout-new__gallery .woocommerce-product-gallery .flex-control-thumbs {
    display: flex !important;
    flex-direction: column !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 56px !important;
    min-width: 56px !important;
    max-width: 56px !important;
    height: auto !important;
    max-height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    gap: 6px !important;
    padding-right: 0 !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .product-layout-new__gallery .woocommerce-product-gallery .flex-control-thumbs::-webkit-scrollbar {
    display: none !important;
  }

  .product-layout-new__gallery .woocommerce-product-gallery .flex-control-thumbs li {
    display: block !important;
    flex: 0 0 56px !important;
    width: 56px !important;
    height: 56px !important;
    margin: 0 !important;
    opacity: 1 !important;
  }

  .product-layout-new__gallery .woocommerce-product-gallery .flex-control-thumbs img {
    display: block !important;
    width: 56px !important;
    height: 56px !important;
    object-fit: cover !important;
    border-radius: 5px !important;
  }

  .product-layout-new__gallery .woocommerce-product-gallery__trigger {
    display: none !important;
  }

  /* ── Title & price ──────────────────────────────── */
  .product-title-price-inline {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
  }

  .product-summary-new h1.product_title {
    font-size: clamp(1.6rem, 7vw, 2.4rem) !important;
    line-height: 1.15 !important;
  }

  .product-summary-new .price {
    font-size: 1.1rem !important;
  }

  /* ── Short description ──────────────────────────── */
  .product-short-description-new {
    font-size: 0.92rem !important;
    line-height: 1.7 !important;
  }

  /* ── Out of stock badge ─────────────────────────── */
  .product-summary-new .stock.out-of-stock {
    font-size: 0.68rem !important;
    padding: 9px 16px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* ── Add to cart box ────────────────────────────── */
  .product-atc-box-wrapper {
    margin-bottom: 16px !important;
  }

  .product-summary-new form.cart {
    margin-bottom: 16px !important;
  }

  .product-summary-new .single_add_to_cart_button {
    padding: 15px 20px !important;
    font-size: 0.68rem !important;
  }

  /* Quantity + button row */
  .product-summary-new form.cart .quantity {
    width: auto !important;
  }

  /* ── Trust bullets ──────────────────────────────── */
  .product-trust-bullets {
    padding: 12px 16px !important;
    gap: 8px !important;
  }

  .product-trust-bullets li {
    font-size: 0.82rem !important;
    padding: 6px 0 !important;
  }

  /* ── Tagline italic ─────────────────────────────── */
  .product-tagline-italic {
    margin: 16px 0 0 !important;
  }

  .product-tagline-italic p {
    font-size: 1rem !important;
  }

  /* ── Accordion: show after summary on mobile ────── */
  .product-layout-new__inner {
    display: flex !important;
    flex-direction: column !important;
  }

  .product-layout-new__gallery         { order: 1 !important; }
  .product-layout-new__summary         { order: 2 !important; }
  .product-accordion-wrapper--sibling  { order: 3 !important; width: 100% !important; }
  .product-trust-bullets--sibling      { order: 4 !important; width: 100% !important; }

  /* ── Hide related product cards with no image (broken/missing thumbnail) ── */
  .single-product .related.products ul.products li.product:not(:has(.product-card__image img)),
  .single-product .related.products ul.products li.product:has(.product-card__image img[src=""]) {
    display: none !important;
  }

  /* ── Related products ───────────────────────────── */
  .single-product .related.products {
    padding: 0 !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .single-product .related.products > h2 {
    font-size: clamp(1.6rem, 7vw, 2.2rem) !important;
    margin-bottom: 24px !important;
  }

  /* 2-column grid */
  .single-product .related.products ul.products {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }

  .single-product .related.products ul.products li.product {
    flex: unset !important;
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    margin: 0 !important;
  }

  /* Card */
  .single-product .related.products ul.products li.product .product-card {
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    background: rgba(255, 255, 255, 0.55) !important;
    border: none !important;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08) !important;
  }

  /* Related products flip-card: handled by inline <style id="ise-related-grid"> in wp_head */
}
