/* REX 2.7.5 — isolated, final Discus single-product layout */
body.single-product .rex-product-template,
body.single-product .rex-product-template > .wp-block-woocommerce-legacy-template,
body.single-product .rex-product-template .wp-block-woocommerce-legacy-template,
body.single-product .rex-product-template .woocommerce,
body.single-product div.product.rex-single-product-discus.rex-sp-product{
  width:100%!important;
  max-width:none!important;
  margin:0!important;
  padding:0!important;
  display:block!important;
  float:none!important;
}
body.single-product .rex-sp-shell{
  width:min(1400px,calc(100% - 48px))!important;
  margin-inline:auto!important;
  padding:14px 0 70px!important;
  display:flex!important;
  flex-direction:column!important;
  direction:rtl!important;
}
body.single-product .rex-sp-shell > .rex-sp-breadcrumbs{order:0!important}
body.single-product .rex-sp-shell > .rex-sp-hero-layout{order:10!important}
body.single-product .rex-sp-shell > .rex-sp-sections{order:20!important}
body.single-product .rex-sp-shell > .rex-sp-reviews{order:30!important}
body.single-product .rex-sp-shell > .rex-sp-related{order:40!important}

/* Desktop hero: compact purchase column + dominant gallery. */
body.single-product .rex-sp-hero-layout{
  width:100%!important;
  display:flex!important;
  flex-direction:row!important;
  align-items:flex-start!important;
  gap:26px!important;
  direction:ltr!important;
}
body.single-product .rex-sp-hero-summary{
  order:1!important;
  flex:0 0 31%!important;
  width:31%!important;
  max-width:390px!important;
  min-width:300px!important;
  margin:0!important;
  padding:14px 0 0!important;
  direction:rtl!important;
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
}
body.single-product .rex-sp-hero-gallery{
  order:2!important;
  flex:1 1 69%!important;
  width:auto!important;
  max-width:none!important;
  min-width:0!important;
  margin:0!important;
  direction:rtl!important;
}
body.single-product .rex-sp-hero-gallery .rex-sp-gallery{
  width:100%!important;
  max-width:none!important;
  margin:0!important;
  gap:10px!important;
}
body.single-product .rex-sp-hero-gallery .rex-sp-gallery__stage{
  width:100%!important;
  max-width:none!important;
  aspect-ratio:1.36/1!important;
  min-height:0!important;
  height:auto!important;
  padding:6px!important;
  border-radius:18px!important;
  overflow:hidden!important;
  border:1px solid rgba(210,178,120,.30)!important;
  background:#031016!important;
}
body.single-product .rex-sp-hero-gallery .rex-sp-gallery__item{
  width:100%!important;
  height:100%!important;
  min-height:0!important;
  border-radius:13px!important;
  overflow:hidden!important;
}
body.single-product .rex-sp-hero-gallery .rex-sp-gallery__image,
body.single-product .rex-sp-hero-gallery .rex-sp-gallery__item iframe{
  width:100%!important;
  height:100%!important;
  min-height:0!important;
  padding:0!important;
  object-fit:cover!important;
  object-position:center!important;
  border-radius:13px!important;
}
body.single-product .rex-sp-hero-gallery .rex-sp-gallery__thumbs{
  display:flex!important;
  flex-wrap:nowrap!important;
  gap:8px!important;
  overflow-x:auto!important;
  padding:0!important;
  scrollbar-width:none!important;
}
body.single-product .rex-sp-hero-gallery .rex-sp-gallery__thumbs::-webkit-scrollbar{display:none!important}
body.single-product .rex-sp-hero-gallery .rex-sp-gallery__thumb{
  flex:0 0 82px!important;
  width:82px!important;
  height:70px!important;
  min-height:70px!important;
  padding:3px!important;
  border-radius:10px!important;
}
body.single-product .rex-sp-hero-gallery .rex-sp-gallery__thumb img{
  width:100%!important;
  height:62px!important;
  object-fit:cover!important;
  border-radius:7px!important;
}

/* Keep purchase content visually dense like the approved reference. */
body.single-product .rex-sp-summary__inner{gap:9px!important;width:100%!important}
body.single-product .rex-sp-summary__secondary{font-size:1.65rem!important;line-height:1.15!important}
body.single-product .rex-sp-summary__title{font-size:1.55rem!important;line-height:1.45!important}
body.single-product .rex-sp-summary__price{font-size:1.5rem!important;margin-top:2px!important}
body.single-product .rex-sp-summary__stock{margin-bottom:2px!important}
body.single-product .rex-sp-purchase-card{margin-top:7px!important;gap:11px!important}
body.single-product .rex-discus-cart{gap:11px!important}
body.single-product .rex-discus-variations{gap:10px!important}
body.single-product .rex-discus-variation-value .rex-variation-chips{
  display:flex!important;
  flex-wrap:wrap!important;
  justify-content:flex-start!important;
  gap:8px!important;
  direction:ltr!important;
}
body.single-product .rex-discus-variation-value .rex-variation-chip{
  flex:0 0 62px!important;
  width:62px!important;
  min-width:62px!important;
  min-height:44px!important;
}
body.single-product .rex-discus-buy-row{
  display:grid!important;
  grid-template-columns:112px minmax(0,1fr)!important;
  gap:9px!important;
  direction:ltr!important;
}
body.single-product .rex-discus-buy-row .quantity{width:112px!important;height:50px!important;min-height:50px!important}
body.single-product .rex-discus-buy-row .single_add_to_cart_button{height:50px!important;min-height:50px!important}

/* Detail section remains: left stack = Specs + Care, right = wider About. */
body.single-product .rex-sp-sections{
  width:100%!important;
  display:grid!important;
  grid-template-columns:minmax(0,37%) minmax(0,63%)!important;
  gap:20px!important;
  align-items:start!important;
  direction:ltr!important;
  margin-top:30px!important;
}
body.single-product .rex-sp-sections__left{
  grid-column:1!important;
  display:grid!important;
  grid-template-columns:1fr!important;
  gap:18px!important;
  align-content:start!important;
  direction:rtl!important;
  order:1!important;
}
body.single-product .rex-sp-sections__right{
  grid-column:2!important;
  display:block!important;
  align-self:start!important;
  direction:rtl!important;
  order:2!important;
}
body.single-product .rex-sp-sections__left .rex-sp-info-grid,
body.single-product .rex-sp-sections__left .rex-sp-info-grid--compact{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  grid-auto-flow:row!important;
  gap:9px!important;
}
body.single-product .rex-sp-sections__right .rex-sp-panel--about{width:100%!important;height:auto!important;min-height:0!important;align-self:start!important;display:block!important}

/* Tablet/mobile: DOM and CSS both enforce the intended reading/purchase order. */
@media(max-width:900px){
  body.single-product .rex-sp-shell{
    width:min(720px,calc(100% - 24px))!important;
    padding-top:8px!important;
    display:flex!important;
    flex-direction:column!important;
  }
  body.single-product .rex-sp-shell > .rex-sp-breadcrumbs{order:0!important}
  body.single-product .rex-sp-shell > .rex-sp-hero-layout{order:10!important}
  body.single-product .rex-sp-shell > .rex-sp-sections{order:20!important}
  body.single-product .rex-sp-shell > .rex-sp-reviews{order:30!important}
  body.single-product .rex-sp-shell > .rex-sp-related{order:40!important}
  body.single-product .rex-sp-hero-layout{
    display:flex!important;
    flex-direction:column!important;
    gap:14px!important;
    direction:rtl!important;
  }
  body.single-product .rex-sp-hero-gallery{
    order:1!important;
    width:100%!important;
    max-width:none!important;
    min-width:0!important;
    flex:0 0 auto!important;
  }
  body.single-product .rex-sp-hero-summary{
    order:2!important;
    width:100%!important;
    max-width:none!important;
    min-width:0!important;
    flex:0 0 auto!important;
    padding:0!important;
  }
  body.single-product .rex-sp-hero-gallery .rex-sp-gallery__stage{aspect-ratio:1.12/1!important}
  body.single-product .rex-sp-sections{
    display:flex!important;
    flex-direction:column!important;
    gap:14px!important;
    direction:rtl!important;
    margin-top:20px!important;
  }
  body.single-product .rex-sp-sections__left{order:1!important;width:100%!important;display:grid!important}
  body.single-product .rex-sp-sections__right{order:2!important;width:100%!important;display:block!important}
  body.single-product .rex-sp-sections__right .rex-sp-panel--about{height:auto!important;min-height:0!important}
}

@media(max-width:640px){
  body.single-product .rex-product-template main,
  body.single-product .rex-product-template,
  body.single-product .wp-block-woocommerce-legacy-template,
  body.single-product .woocommerce,
  body.single-product div.product.rex-sp-product{display:block!important;position:static!important}
  body.single-product .rex-sp-shell{
    width:calc(100% - 18px)!important;
    margin-inline:auto!important;
    padding:4px 0 42px!important;
    display:flex!important;
    flex-direction:column!important;
  }
  body.single-product .rex-sp-breadcrumbs{order:0!important;margin-bottom:8px!important}
  body.single-product .rex-sp-hero-layout{order:10!important;display:flex!important;flex-direction:column!important}
  body.single-product .rex-sp-hero-gallery{order:1!important}
  body.single-product .rex-sp-hero-summary{order:2!important}
  body.single-product .rex-sp-sections{order:20!important}
  body.single-product .rex-sp-reviews{order:30!important}
  body.single-product .rex-sp-related{order:40!important}

  body.single-product .rex-sp-hero-gallery .rex-sp-gallery__stage{
    aspect-ratio:1/1.04!important;
    width:100%!important;
    min-height:0!important;
    padding:4px!important;
    border-radius:12px!important;
  }
  body.single-product .rex-sp-hero-gallery .rex-sp-gallery__item,
  body.single-product .rex-sp-hero-gallery .rex-sp-gallery__image{border-radius:9px!important}
  body.single-product .rex-sp-hero-gallery .rex-sp-gallery__thumb{flex-basis:58px!important;width:58px!important;height:56px!important;min-height:56px!important}
  body.single-product .rex-sp-hero-gallery .rex-sp-gallery__thumb img{height:48px!important}
  body.single-product .rex-sp-gallery__count{display:flex!important}

  body.single-product .rex-sp-summary__inner{text-align:center!important;align-items:stretch!important}
  body.single-product .rex-sp-summary__eyebrow,
  body.single-product .rex-sp-summary__stock{align-self:center!important}
  body.single-product .rex-sp-summary__secondary,
  body.single-product .rex-sp-summary__title,
  body.single-product .rex-sp-summary__price{text-align:center!important}
  body.single-product .rex-sp-summary__price .price{justify-content:center!important}
  body.single-product .rex-sp-purchase-card{width:100%!important}
  body.single-product .rex-discus-variation-label{text-align:center!important;justify-content:center!important}
  body.single-product .rex-discus-variation-value .rex-variation-chips{justify-content:center!important}
  body.single-product .rex-discus-variation-value .rex-variation-chip{flex:1 1 calc(25% - 8px)!important;width:auto!important;min-width:62px!important;max-width:88px!important}

  body.single-product .rex-discus-variable-actions,
  body.single-product .rex-discus-cart--simple{display:flex!important;flex-direction:column!important;gap:10px!important}
  body.single-product .rex-discus-branch-stock{order:1!important;width:100%!important}
  body.single-product .rex-discus-buy-row{order:2!important;grid-template-columns:108px minmax(0,1fr)!important;width:100%!important}
  body.single-product .rex-sp-summary__wishlist{order:3!important;width:100%!important}

  body.single-product .rex-sp-sections__left .rex-sp-info-grid,
  body.single-product .rex-sp-sections__left .rex-sp-info-grid--compact{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body.single-product .rex-sp-related__grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}


/* REX 2.8.13 — character-threshold auto-wide cards; wide items are rendered last in each section. */
body.single-product .rex-sp-sections__left .rex-sp-info-grid > .rex-sp-info-card--wide,
body.single-product .rex-sp-sections__left .rex-sp-info-grid--compact > .rex-sp-info-card--wide{
  grid-column:1 / -1!important;
  width:100%!important;
  max-width:none!important;
}
body.single-product .rex-sp-info-card--wide .rex-sp-info-card__content{
  flex:1 1 auto!important;
  min-width:0!important;
}
body.single-product .rex-sp-info-card--wide .rex-sp-info-card__value{
  overflow-wrap:anywhere!important;
  word-break:normal!important;
}

/* REX 2.8.14 — justified product description: align both edges cleanly in RTL. */
body.single-product .rex-sp-panel__content--about,
body.single-product .rex-sp-panel__content--about p,
body.single-product .rex-sp-panel__content--about li,
body.single-product .rex-sp-panel__content--about blockquote{
  text-align:justify!important;
  text-align-last:right!important;
  text-justify:inter-word!important;
  direction:rtl!important;
  unicode-bidi:plaintext;
  white-space:normal!important;
  word-break:normal!important;
  overflow-wrap:break-word!important;
}
body.single-product .rex-sp-panel__content--about h1,
body.single-product .rex-sp-panel__content--about h2,
body.single-product .rex-sp-panel__content--about h3,
body.single-product .rex-sp-panel__content--about h4,
body.single-product .rex-sp-panel__content--about h5,
body.single-product .rex-sp-panel__content--about h6{
  text-align:right!important;
  text-align-last:right!important;
}

/* REX 2.9.9 — WooCommerce may append a legacy \"View cart\" link after AJAX add-to-cart.
   REX uses its own cart popup, so the duplicate inline CTA must never appear on product pages. */
.rex-single-product-discus a.added_to_cart.wc-forward,
body.single-product a.added_to_cart.wc-forward {
  display: none !important;
}

/* REX 3.8.14 — smart product context for MY REX Support */
.rex-product-support-context{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-top:18px;padding:18px 20px;border:1px solid rgba(88,202,213,.12);border-radius:18px;background:linear-gradient(145deg,rgba(3,22,29,.78),rgba(2,12,17,.88));direction:rtl}.rex-product-support-context>div{display:grid;gap:4px}.rex-product-support-context>div>span{color:#58cad5;font-size:10px;font-weight:900;letter-spacing:.08em}.rex-product-support-context>div>strong{color:#f2eee4;font-size:15px}.rex-product-support-context>div>p{margin:0;color:#a9b4b6;font-size:11px;line-height:1.8}.rex-product-support-context>a{display:inline-flex;align-items:center;justify-content:center;min-height:42px;padding:0 15px;border:1px solid rgba(88,202,213,.24);border-radius:12px;background:rgba(88,202,213,.07);color:#77dbe4!important;font-size:11px;font-weight:900;text-decoration:none!important;white-space:nowrap}@media(max-width:640px){.rex-product-support-context{align-items:stretch;flex-direction:column;padding:15px}.rex-product-support-context>a{width:100%}}


/* REX 3.8.23 — hard unavailable state for variable products. */
.rex-sp-product .rex-product-unavailable-state{display:flex!important;align-items:center!important;gap:11px!important;margin:8px 0 4px!important;padding:12px 14px!important;border:1px solid rgba(224,119,119,.22)!important;border-radius:13px!important;background:rgba(110,30,30,.10)!important;color:#eab0b0!important}
.rex-sp-product .rex-product-unavailable-state>span{display:grid!important;flex:0 0 30px!important;width:30px!important;height:30px!important;place-items:center!important;border-radius:50%!important;background:rgba(224,119,119,.12)!important;font-size:19px!important;font-weight:900!important}
.rex-sp-product .rex-product-unavailable-state>div{display:grid!important;gap:2px!important;min-width:0!important}.rex-sp-product .rex-product-unavailable-state strong{color:#f0c2c2!important;font-size:.86rem!important}.rex-sp-product .rex-product-unavailable-state small{color:rgba(237,237,214,.68)!important;font-size:.72rem!important;line-height:1.8!important}
.rex-sp-product .rex-discus-buy-row--unavailable{grid-template-columns:1fr!important}.rex-sp-product .rex-add-to-cart-unavailable[disabled]{width:100%!important;min-height:50px!important;opacity:.5!important;filter:saturate(.45)!important;cursor:not-allowed!important;pointer-events:none!important;box-shadow:none!important;transform:none!important}


/* --------------------------------------------------------------------------
   REX 3.8.29 — live direct-child fish gallery fallback
   Canonical layout is emitted by rex_theme_render_discus_hero_column_authority().
   -------------------------------------------------------------------------- */
@media(min-width:901px){
  body.rex-has-discus-single .rex-single-product-discus>.rex-sp-gallery{direction:ltr!important}
}


/* REX 3.9.95 — About-fish panel must size to its own content, never to the Specs/Care column. */
@media(min-width:901px){
  body.single-product .rex-sp-sections{align-items:start!important;}
  body.single-product .rex-sp-sections__right{display:block!important;align-self:start!important;height:auto!important;min-height:0!important;}
  body.single-product .rex-sp-sections__right .rex-sp-panel--about{display:block!important;height:auto!important;min-height:0!important;max-height:none!important;align-self:start!important;}
  body.single-product .rex-sp-sections__right .rex-sp-panel__content--about{flex:none!important;height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important;}
}
