/* A selected brand should only show its native checkmark, not a filled card. */
body.jolfa-commerce-theme .commerce-filter-options--brands .commerce-brand-filter,
body.jolfa-commerce-theme .commerce-filter-options--brands .commerce-brand-filter:hover,
body.jolfa-commerce-theme .commerce-filter-options--brands .commerce-brand-filter:focus-within,
body.jolfa-commerce-theme .commerce-filter-options--brands .commerce-brand-filter:has(input:checked),
body.jolfa-commerce-theme .commerce-filter-options--brands .commerce-brand-filter.is-selected,
html[data-theme="dark"] body.jolfa-commerce-theme .commerce-filter-options--brands .commerce-brand-filter:has(input:checked){
  background:var(--surface,#fff)!important;
  color:var(--text,#1c2738)!important;
  border-color:var(--border,#e3e7ee)!important;
  box-shadow:none!important;
}
body.jolfa-commerce-theme .commerce-brand-filter:has(input:checked) .commerce-brand-filter__name,
body.jolfa-commerce-theme .commerce-brand-filter:has(input:checked) .commerce-brand-filter__count{color:var(--text,#1c2738)!important}
body.jolfa-commerce-theme .commerce-filter-options--brands .commerce-brand-filter input[type="checkbox"]{accent-color:var(--primary,#6e49a5);flex-shrink:0}
/* No page-level discovery chips: curated navigation now lives in the mega menu. */
.commerce-mega-group__links .commerce-mega-group__smart-link{
  display:flex;align-items:center;gap:7px;min-width:0;
}
.commerce-mega-group__smart-link>i{width:14px;flex:0 0 14px;font-size:.75rem;color:var(--primary,#7651a6)}
.commerce-mega-group__smart-link>span{min-width:0;overflow-wrap:anywhere}
/* White image stage in both themes. Keep the existing carousel animation. */
html[data-theme="dark"] .jolfa-media-viewer,html[data-theme="light"] .jolfa-media-viewer,
.jolfa-media-viewer{background:#fff!important;color:#253247!important;backdrop-filter:none!important}
.jolfa-media-viewer__stage{background:#fff!important}
.jolfa-media-viewer__bar,.jolfa-media-viewer__tools{background:#fff!important;color:#253247!important}
.jolfa-media-viewer__close,.jolfa-media-viewer__control{
  color:#253247!important;background:#f7f8fa!important;border:1px solid #dce3eb!important;
}
.jolfa-media-viewer__close:hover,.jolfa-media-viewer__control:hover{background:#eef1f7!important}
.jolfa-media-viewer__img{background:#fff!important;box-shadow:0 18px 40px rgba(20,30,55,.09)!important}
.jolfa-media-viewer__nav{background:#fff!important;color:#253247!important;border:1px solid #e4e9f0!important}
.jolfa-media-viewer__zoom-hint{color:#48556a!important;background:rgba(255,255,255,.94)!important}
.jolfa-media-viewer__counter{color:#4a5568!important}
/* At in-between viewport widths (including docked developer tools), fixed
   column minimums from legacy CSS can exceed the viewport. Never allow that. */
body.product-detail-page .commerce-product-page--reference-redesign{
  width:min(1540px,calc(100% - 28px))!important;max-width:100%!important;min-width:0!important;
  box-sizing:border-box!important;
}
body.product-detail-page .commerce-product-page--reference-redesign,
body.product-detail-page .commerce-product-page--reference-redesign *,
body.product-detail-page .commerce-product-page--reference-redesign *::before,
body.product-detail-page .commerce-product-page--reference-redesign *::after{box-sizing:border-box}
body.product-detail-page .commerce-product-page--reference-redesign .commerce-product-main,
body.product-detail-page .commerce-product-page--reference-redesign .commerce-product-gallery,
body.product-detail-page .commerce-product-page--reference-redesign .commerce-product-info,
body.product-detail-page .commerce-product-page--reference-redesign .commerce-buy-box{
  min-width:0!important;max-width:100%!important;
}
body.product-detail-page .commerce-product-page--reference-redesign .commerce-product-gallery__main,
body.product-detail-page .commerce-product-page--reference-redesign .commerce-product-gallery__main>img{
  max-width:100%!important;min-width:0!important;
}
body.product-detail-page .commerce-product-page--reference-redesign .commerce-product-title-fa,
body.product-detail-page .commerce-product-page--reference-redesign .commerce-product-title-en,
body.product-detail-page .commerce-product-page--reference-redesign .commerce-key-specs strong{
  overflow-wrap:anywhere!important;
}
@media(min-width:1181px){
  body.product-detail-page .commerce-product-page--reference-redesign .commerce-product-main{
    grid-template-columns:minmax(0,.82fr) minmax(0,1.08fr) minmax(0,1.12fr)!important;
    grid-template-areas:"buy info gallery"!important;
    width:100%!important;gap:clamp(9px,1.15vw,18px)!important;
  }
  body.product-detail-page .commerce-product-page--reference-redesign .commerce-product-gallery__main{
    height:clamp(290px,33vw,460px)!important;min-height:0!important;
  }
}
@media(min-width:821px) and (max-width:1180px){
  body.product-detail-page .commerce-product-page--reference-redesign .commerce-product-main{
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
    grid-template-areas:"info gallery" "buy buy"!important;
    gap:12px!important;width:100%!important;
  }
  body.product-detail-page .commerce-product-page--reference-redesign .commerce-buy-box{
    grid-area:buy!important;position:static!important;width:100%!important;
  }
  body.product-detail-page .commerce-product-page--reference-redesign .commerce-product-gallery__main{
    height:clamp(270px,40vw,430px)!important;min-height:0!important;
  }
}
@media(max-width:820px){
  body.product-detail-page .commerce-product-page--reference-redesign{width:calc(100% - 20px)!important}
  body.product-detail-page .commerce-product-page--reference-redesign .commerce-product-main{
    display:grid!important;grid-template-columns:minmax(0,1fr)!important;
    grid-template-areas:"gallery" "info" "buy"!important;
    gap:12px!important;width:100%!important;
  }
  body.product-detail-page .commerce-product-page--reference-redesign .commerce-product-gallery__main{
    height:clamp(220px,68vw,430px)!important;min-height:0!important;
  }
}
@media(max-width:520px){
  body.product-detail-page .commerce-product-page--reference-redesign{width:calc(100% - 16px)!important}
  body.product-detail-page .commerce-product-page--reference-redesign .commerce-product-gallery,
  body.product-detail-page .commerce-product-page--reference-redesign .commerce-product-info,
  body.product-detail-page .commerce-product-page--reference-redesign .commerce-buy-box{
    padding-inline:clamp(10px,3vw,16px)!important;
  }
}
@media(prefers-reduced-motion:reduce){.jolfa-media-viewer__img.is-viewer-entering{animation:none!important}}


/* JolfaIT V39: compact brand controls; selected = subtle violet card, not a solid bar. */
body.jolfa-commerce-theme .commerce-filter-options--brands{
 display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:7px!important;
 padding:8px 1px 13px!important;margin:4px 0 5px!important;overflow:visible!important;
}
body.jolfa-commerce-theme .commerce-filter-options--brands .commerce-brand-filter,
body.jolfa-commerce-theme .commerce-filter-options--brands .commerce-brand-filter.is-selected,
body.jolfa-commerce-theme .commerce-filter-options--brands .commerce-brand-filter:hover,
body.jolfa-commerce-theme .commerce-filter-options--brands .commerce-brand-filter:focus-within{
 display:flex!important;align-items:center!important;gap:10px!important;box-sizing:border-box!important;
 min-height:47px!important;padding:10px 13px!important;margin:0!important;
 border:1px solid color-mix(in srgb,var(--border,#e2e6ef) 65%,transparent)!important;
 border-radius:13px!important;background:var(--surface,#fff)!important;
 box-shadow:none!important;color:var(--text)!important;
 transition:background .17s ease,border-color .17s ease!important;
}
body.jolfa-commerce-theme .commerce-filter-options--brands .commerce-brand-filter:hover{background:var(--surface-soft)!important}
body.jolfa-commerce-theme .commerce-filter-options--brands .commerce-brand-filter:has(input:checked),
html[data-theme="dark"] body.jolfa-commerce-theme .commerce-filter-options--brands .commerce-brand-filter:has(input:checked){
 background:color-mix(in srgb,var(--primary,#6c3f8c) 8%,var(--surface,#fff))!important;
 border-color:color-mix(in srgb,var(--primary,#6c3f8c) 14%,var(--border,#e2e6ef))!important;
 box-shadow:none!important;
}
body.jolfa-commerce-theme .commerce-filter-options--brands input[type="checkbox"]{
 appearance:auto!important;accent-color:var(--primary,#67449c)!important;
 width:17px!important;height:17px!important;flex:0 0 17px!important;margin:0!important;
}
body.jolfa-commerce-theme .commerce-filter-options--brands .commerce-brand-filter__name{
 color:var(--text)!important;font-weight:650!important;line-height:1.55!important;min-width:0;
}
body.jolfa-commerce-theme .commerce-filter-options--brands .commerce-brand-filter__count{
 margin-inline-start:auto!important;background:var(--surface-soft)!important;color:var(--muted)!important;
 border-radius:9px!important;padding:3px 9px!important;min-width:26px;text-align:center;
}
html[data-theme="dark"] body.jolfa-commerce-theme .commerce-filter-options--brands .commerce-brand-filter{
 color:var(--text)!important;
}
@media(max-width:600px){body.jolfa-commerce-theme .commerce-filter-options--brands .commerce-brand-filter{min-height:48px!important}}
