/* ABIS 3.5.7: only affected pages/sections. Keep mobile product card heights unchanged. */

/* The currency is wrapped by WooCommerce inside <bdi>. An inline-block with
   only inline margins can be visually lost to bidi/reflows. Reserve a real
   nonbreaking blank inside the symbol, independent of RTL or digit conversion.
   These selectors touch PRICE glyphs only; no shop grid/card layout changes. */
:is(.abis-hp-card__price,.abis-so__price,.abis-new-product__price,
    .abis-card__price,.abis-product-price__value,.abis-mini-product-card__price)
    .woocommerce-Price-currencySymbol {
  display:inline !important;
  margin:0 !important;
  padding:0 !important;
  white-space:nowrap;
}
:is(.abis-hp-card__price,.abis-so__price,.abis-new-product__price,
    .abis-card__price,.abis-product-price__value,.abis-mini-product-card__price)
    .woocommerce-Price-currencySymbol::before {
  content:"\00a0\00a0\00a0\00a0";
  white-space:pre;
}

/* Consistent home section spacing and page gutter. This intentionally avoids changing
   Elementor's arbitrary sections or hero banner configuration. */
body.home :is(.abis-so,.abis-dp-theme,.abis-pi-theme,.abis-new-section) {
  box-sizing:border-box;
  margin-block-start:0 !important;
  margin-block-end:35px !important;
}
body.home :is(.abis-dp-theme,.abis-pi-theme,.abis-new-section) {
  padding-inline:clamp(12px,2vw,38px);
}
body.home .abis-new-section.abis-new-articles {
  width:100%;
  max-width:none;
  margin-inline:0;
  padding-inline:clamp(12px,2vw,38px);
}
body.home .abis-new-articles__grid {
  width:100%;
  min-width:0;
  margin:0;
}
/* Consistent aspect ratio for the article images, including missing thumbnails. */
body.home .abis-new-article__image {
  display:grid;
  width:100%;
  aspect-ratio:16 / 10;
  overflow:hidden;
  border-radius:14px 14px 0 0;
}
body.home .abis-new-article__image img {
  display:block;
  width:100% !important;
  height:100% !important;
  aspect-ratio:16 / 10;
  object-fit:cover;
  object-position:center;
}

/* Restore 3.5.6 sizes for standard homepage cards. The existing shop styling
   stays exactly as in 3.5.7; only its price spacing receives a separate fix. */
@media (min-width:1025px) {
  body.woocommerce-shop .abis-shop-content ul.products:not(.abis-products--compact),
  body.tax-product_cat .abis-shop-content ul.products:not(.abis-products--compact),
  body.tax-product_brand .abis-shop-content ul.products:not(.abis-products--compact),
  body.tax-product_tag .abis-shop-content ul.products:not(.abis-products--compact) {
    grid-template-columns:repeat(5,minmax(0,1fr));
  }
  .abis-shop-content ul.products li.product.abis-product-card .abis-card__image-link {
    aspect-ratio:5 / 4;
  }
  .abis-shop-content ul.products li.product.abis-product-card .abis-card__body {
    padding:8px 10px 6px;
  }
  .abis-shop-content ul.products li.product.abis-product-card .abis-card__title {
    min-height:41px;
    font-size:14.4px !important;
    line-height:1.7 !important;
  }
  .abis-shop-content ul.products li.product.abis-product-card .abis-card__price {
    min-height:39px;
    font-size:15.5px;
  }
}
/* On narrow laptop widths five shop columns become too cramped with a sidebar. */
@media (min-width:1025px) and (max-width:1350px) {
  body.woocommerce-shop .abis-shop-content ul.products:not(.abis-products--compact),
  body.tax-product_cat .abis-shop-content ul.products:not(.abis-products--compact),
  body.tax-product_brand .abis-shop-content ul.products:not(.abis-products--compact),
  body.tax-product_tag .abis-shop-content ul.products:not(.abis-products--compact) {
    grid-template-columns:repeat(4,minmax(0,1fr));
  }
}
@media (max-width:767px) {
  body.home :is(.abis-dp-theme,.abis-pi-theme,.abis-new-section){
    padding-inline:10px;
  }
  /* Keep article row finger-scrollable and clipped INSIDE its own track. */
  body.home .abis-new-articles__grid {
    display:flex;
    overflow-x:auto;
    overflow-y:hidden;
    width:100%;
    max-width:100%;
    scroll-snap-type:x proximity;
  }
  body.home .abis-new-article {
    flex:0 0 min(78%,275px);
    scroll-snap-align:start;
  }
}

/* FAQ question/answer movement is animated via height WAAPI and remains fully
   operable when JS is off (native <details> behavior is the fallback). */
.abis-faq-item summary span {
  transition:transform .38s cubic-bezier(.22,.7,.23,1);
}
.abis-faq-item__answer {
  padding-block-start:4px;
}
.abis-faq-item.is-animating {
  overflow:hidden;
}
@media (prefers-reduced-motion:reduce) {
  .abis-faq-item summary span{transition:none;}
}

/* Each MOBILE brand section has its own vertical scroller, with two compact
   columns. The heading stays outside the scroll region; tablet/desktop unchanged. */
@media (max-width:540px) {
  .abis-directory-section {
    min-width:0;
    margin-block-end:35px;
  }
  .abis-directory-section .abis-directory-grid {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    align-items:stretch;
    gap:10px;
    max-height:min(62dvh,520px);
    min-width:0;
    padding:3px 3px 10px;
    overflow-x:hidden;
    overflow-y:auto;
    overscroll-behavior-y:contain;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:thin;
  }
  .abis-directory-section .abis-directory-brand {
    min-width:0;
    overflow-wrap:anywhere;
    padding:10px;
    border-radius:12px;
  }
  .abis-directory-section .abis-directory-brand__logo {
    height:67px;
    padding:5px;
    margin-block-end:8px;
  }
  .abis-directory-section .abis-directory-brand__logo img {
    width:auto;
    height:auto;
    max-height:58px;
  }
  .abis-directory-section .abis-directory-brand h3 {
    font-size:13px;
    line-height:1.6;
  }
  .abis-directory-section .abis-directory-brand__text {
    font-size:11px;
    line-height:1.75;
  }
  .abis-directory-section .abis-directory-brand > a {
    font-size:11px;
  }
}

/* Recommendation carousels use EXACT shared homepage cards (including the
   quantity overlay, AJAX add-to-cart and wishlist), not custom mini-cards. */
body.single-product .abis-product-recommendations__track.abis-home-track {
  display:flex;
  align-items:stretch;
  width:100%;
  min-width:0;
  max-width:100%;
  flex-wrap:nowrap;
  gap:14px;
  padding:3px 1px 12px;
  overflow-x:auto;
  overflow-y:hidden;
  scroll-snap-type:x proximity;
  scrollbar-width:none;
  overscroll-behavior-inline:contain;
  touch-action:pan-x pan-y;
}
body.single-product .abis-product-recommendations__track.abis-home-track::-webkit-scrollbar {
  display:none;
}
body.single-product .abis-product-recommendations__track > .abis-hp-card {
  box-sizing:border-box;
  flex:0 0 244px;
  width:244px;
  min-width:244px;
  max-width:244px;
  min-height:344px;
  float:none;
}
/* Desktop related-product cards retain the original 244px home-card geometry. */
@media(max-width:767px){
  body.single-product .abis-product-recommendations__track.abis-home-track {
    gap:10px;
  }
  body.single-product .abis-product-recommendations__track > .abis-hp-card {
    flex:0 0 min(47%,185px);
    min-width:min(47%,185px);
    max-width:185px;
    min-height:238px;
    padding:9px;
  }
  body.single-product .abis-product-recommendations__track > .abis-hp-card .abis-hp-card__image {
    height:125px;
    flex-basis:125px;
  }
}
.abis-faq-item.is-target-closed[open] summary span { transform:rotate(0deg); }


/* ABIS 3.5.9: compact, UNIFORM "پیشنهادهای داغ" cards on desktop.
   Both discount cards and the featured card are 240 × 338 px. The actual
   discounted shortcode wraps each regular card in .abis-dp-theme__item
   (display:contents), so :scope > .abis-hp-card is NOT a valid selector.
   Only this section is changed. Original 3.5.6 special offers and mobile
   layout remain unchanged. */
@media (min-width: 768px) {
  body.home .abis-dp-theme {
    --abis-hot-card-width:240px;
    --abis-hot-card-height:338px;
    --abis-hot-image-height:200px;
  }
  body.home .abis-dp-theme .abis-dp-theme__layout {
    grid-template-columns:minmax(0,1fr) var(--abis-hot-card-width);
    column-gap:18px;
    align-items:start;
  }
  body.home .abis-dp-theme .abis-dp-theme__featured {
    min-width:0;
    padding:0;
  }
  body.home .abis-dp-theme .abis-dp-theme__featured > h2 {
    font-size:clamp(19px,1.65vw,23px);
    margin-bottom:16px;
    white-space:nowrap;
  }
  body.home .abis-dp-theme .abis-dp-theme__featured > .abis-hp-card--featured {
    margin-top:8px;
  }
  body.home .abis-dp-theme .abis-dp-theme__track {
    align-items:stretch;
    gap:15px;
  }
  body.home .abis-dp-theme .abis-hp-card--discount,
  body.home .abis-dp-theme .abis-dp-theme__featured > .abis-hp-card--featured {
    box-sizing:border-box;
    flex:0 0 var(--abis-hot-card-width);
    width:var(--abis-hot-card-width);
    min-width:var(--abis-hot-card-width);
    max-width:var(--abis-hot-card-width);
    height:var(--abis-hot-card-height);
    min-height:var(--abis-hot-card-height);
    max-height:var(--abis-hot-card-height);
    padding:10px;
    overflow:hidden;
  }
  body.home .abis-dp-theme .abis-hp-card--discount .abis-hp-card__image,
  body.home .abis-dp-theme .abis-hp-card--featured .abis-hp-card__image {
    box-sizing:border-box;
    flex:0 0 var(--abis-hot-image-height);
    width:100%;
    height:var(--abis-hot-image-height);
    min-height:0;
    margin:0 0 7px;
    padding:8px;
  }
  body.home .abis-dp-theme .abis-hp-card__name {
    box-sizing:border-box;
    flex:0 0 auto;
    min-width:0;
    min-height:41px;
    max-height:46px;
    margin:0 0 5px!important;
    font-size:14px!important;
    line-height:1.58!important;
    overflow:hidden;
  }
  body.home .abis-dp-theme .abis-hp-card__bottom {
    min-width:0;
    min-height:35px;
    grid-template-columns:35px minmax(0,1fr);
    gap:7px;
  }
  body.home .abis-dp-theme .abis-hp-card__cart {
    width:35px!important;
    min-width:35px!important;
    height:35px!important;
    min-height:35px!important;
  }
  body.home .abis-dp-theme .abis-hp-card__price {
    min-width:0;
    font-size:13px;
  }
  /* Approved partners have a second visible price line. Give all cards in
     this section the same extra space rather than allowing one to grow. */
  body.abis-partner-account.home .abis-dp-theme {
    --abis-hot-card-height:359px;
  }
}
