/* King Store responsive header scale
 * One sizing system for desktop, tablet and mobile.
 * Interactive controls keep >=44px touch/click targets while glyphs stay visually smaller.
 */

:root{
  --ksh-touch:44px;
  --ksh-icon:20px;
  --ksh-gap:10px;
  --ksh-pad:16px;
}

/* Shared controls */
#masthead .ast-header-account-link,
#masthead .cart-container,
#masthead .ks-header-search-trigger{
  min-width:var(--ksh-touch)!important;
  min-height:var(--ksh-touch)!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  box-sizing:border-box!important;
}

#masthead .ast-header-account-link svg,
#masthead .ast-header-woo-cart svg{
  width:var(--ksh-icon)!important;
  height:var(--ksh-icon)!important;
}

#masthead .ks-header-search-trigger svg{
  width:20px!important;
  height:20px!important;
}

/* Desktop */
@media (min-width:1101px){
  #ast-desktop-header .ast-primary-header-bar,
  #ast-desktop-header .ast-builder-grid-row{
    min-height:84px!important;
    padding-block:0!important;
  }

  #ast-desktop-header .site-logo-img img,
  #ast-desktop-header .custom-logo-link img{
    width:auto!important;
    height:auto!important;
    max-width:88px!important;
    max-height:68px!important;
    object-fit:contain;
  }

  #ast-desktop-header .main-header-menu>.menu-item>.menu-link{
    min-height:44px;
    padding-inline:13px!important;
    font-size:14px!important;
    line-height:1.35!important;
    display:flex;
    align-items:center;
  }

  #ast-desktop-header .site-header-primary-section-right{
    gap:4px;
    align-items:center;
  }

  /* Account and search are icon-only controls, so they can be fixed 44px targets. */
  #ast-desktop-header .ast-header-account-link,
  #ast-desktop-header .ks-header-search-trigger{
    width:44px!important;
    height:44px!important;
    min-width:44px!important;
    min-height:44px!important;
    padding:0!important;
    flex:0 0 44px!important;
  }

  /* Cart contains price + bag + count badge. It must never be constrained to 44px. */
  #ast-desktop-header .cart-container{
    width:auto!important;
    height:44px!important;
    min-width:max-content!important;
    min-height:44px!important;
    padding:0 2px!important;
    flex:0 0 auto!important;
    justify-content:flex-start!important;
    overflow:visible!important;
  }

  #ast-desktop-header .ast-header-account,
  #ast-desktop-header .ast-header-woo-cart,
  #ast-desktop-header .ks-header-search-slot{
    flex:0 0 auto!important;
    min-width:0!important;
    margin:0!important;
  }

  #ast-desktop-header .site-header-primary-section-right{
    gap:8px!important;
    column-gap:8px!important;
    align-items:center!important;
    flex-wrap:nowrap!important;
  }

  #ast-desktop-header .ast-site-header-cart,
  #ast-desktop-header .ast-site-header-cart-li,
  #ast-desktop-header .ast-site-header-cart .ast-addon-cart-wrap{
    width:auto!important;
    min-width:max-content!important;
    max-width:none!important;
  }

  #ast-desktop-header .ast-site-header-cart .ast-addon-cart-wrap{
    display:inline-flex!important;
    align-items:center!important;
    justify-content:flex-start!important;
    gap:8px!important;
    flex-wrap:nowrap!important;
    overflow:visible!important;
  }

  #ast-desktop-header .ast-woo-header-cart-info-wrap{
    display:inline-flex!important;
    align-items:center!important;
    flex:0 0 auto!important;
    min-width:max-content!important;
  }

  #ast-desktop-header .ast-woo-header-cart-total,
  #ast-desktop-header .ast-woo-header-cart-total .woocommerce-Price-amount{
    font-size:14px!important;
    line-height:1.25!important;
    margin:0!important;
    white-space:nowrap!important;
  }

  #ast-desktop-header .ast-icon-shopping-bag{
    position:relative!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    flex:0 0 24px!important;
    width:24px!important;
    height:24px!important;
    margin:0!important;
    overflow:visible!important;
  }

  #ast-desktop-header .ast-icon-shopping-bag > .ast-icon,
  #ast-desktop-header .ast-icon-shopping-bag svg{
    width:20px!important;
    height:20px!important;
  }

  .ks-header-search-slot:not(.ks-mobile-header-search-slot){
    margin-inline-start:0!important;
    width:44px!important;
    min-width:44px!important;
    flex:0 0 44px!important;
  }
}

/* Tablet + mobile header stack. Site custom search/language system switches at 1100px. */
@media (max-width:1100px){
  :root{
    --ksh-icon:18px;
    --ksh-pad:14px;
  }

  #ast-mobile-header .ast-primary-header-bar,
  #ast-mobile-header .ast-builder-grid-row{
    min-height:68px!important;
    padding-block:0!important;
  }

  #ast-mobile-header .ast-builder-grid-row{
    padding-inline:var(--ksh-pad);
  }

  #ast-mobile-header .site-logo-img img,
  #ast-mobile-header .custom-logo-link img{
    width:auto!important;
    height:auto!important;
    max-width:72px!important;
    max-height:54px!important;
    object-fit:contain;
  }

  #ast-mobile-header [data-section="section-header-mobile-trigger"] .ast-button-wrap>.menu-toggle{
    width:44px!important;
    height:44px!important;
    min-width:44px!important;
    min-height:44px!important;
    padding:9px!important;
    margin:0!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    box-sizing:border-box!important;
    border:0!important;
    border-radius:10px!important;
    background:transparent!important;
  }

  #ast-mobile-header [data-section="section-header-mobile-trigger"] .mobile-menu-toggle-icon,
  #ast-mobile-header [data-section="section-header-mobile-trigger"] .ahfb-svg-iconset,
  #ast-mobile-header [data-section="section-header-mobile-trigger"] svg{
    width:26px!important;
    height:26px!important;
    max-width:26px!important;
    max-height:26px!important;
  }

  #ks-mobile-language-switcher{
    margin-inline-end:8px!important;
  }

  #ks-mobile-language-switcher .ks-lang-toggle{
    min-width:68px!important;
    height:44px!important;
    min-height:44px!important;
    padding:0 10px!important;
    gap:6px!important;
    border-radius:10px!important;
    box-sizing:border-box!important;
  }

  #ks-mobile-language-switcher .ks-lang-globe svg{
    width:16px!important;
    height:16px!important;
  }

  #ks-mobile-language-switcher .ks-lang-chevron svg{
    width:12px!important;
    height:12px!important;
  }

  #ks-mobile-language-switcher .ks-lang-current{
    font-size:12px!important;
    line-height:1!important;
  }

  .ks-mobile-header-search-slot{
    padding:8px 12px 10px!important;
  }

  .ks-mobile-header-search-popover .ks-header-search-form input[type="search"]{
    height:44px!important;
    min-height:44px!important;
    padding-inline-start:14px!important;
    padding-inline-end:44px!important;
    font-size:14px!important;
    line-height:1.4!important;
    border-radius:9px!important;
  }

  html[dir="rtl"] .ks-mobile-header-search-popover .ks-header-search-form input[type="search"]{
    padding-inline-start:14px!important;
    padding-inline-end:44px!important;
  }

  .ks-mobile-header-search-popover .ks-search-field-icon{
    width:18px!important;
    height:18px!important;
  }
}

@media (max-width:767px){
  #ast-mobile-header .ast-primary-header-bar,
  #ast-mobile-header .ast-builder-grid-row{
    min-height:64px!important;
    padding-block:0!important;
  }

  #ast-mobile-header .ast-builder-grid-row{
    padding-inline:12px;
  }

  #ast-mobile-header .site-logo-img img,
  #ast-mobile-header .custom-logo-link img{
    max-width:64px!important;
    max-height:48px!important;
  }

  #ks-mobile-language-switcher{
    margin-inline-end:6px!important;
  }

  #ks-mobile-language-switcher .ks-lang-toggle{
    min-width:64px!important;
    padding:0 9px!important;
  }

  .ks-mobile-header-search-slot{
    padding:8px 10px 9px!important;
  }
}

@media (max-width:360px){
  #ast-mobile-header .ast-builder-grid-row{
    padding-inline:9px;
  }

  #ast-mobile-header .site-logo-img img,
  #ast-mobile-header .custom-logo-link img{
    max-width:58px!important;
    max-height:44px!important;
  }

  #ks-mobile-language-switcher .ks-lang-toggle{
    min-width:60px!important;
    padding:0 8px!important;
    gap:5px!important;
  }
}


/* Desktop utility controls: one vertical alignment model for account, cart and search. */
@media (min-width:1101px){
  #ast-desktop-header .site-header-primary-section-right{
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    align-self:stretch!important;
  }

  #ast-desktop-header .site-header-primary-section-right > .ast-builder-layout-element,
  #ast-desktop-header .site-header-primary-section-right > .ks-header-search-slot{
    align-self:stretch!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
  }

  #ast-desktop-header .ast-header-account-wrap,
  #ast-desktop-header .ast-header-account-inner-wrap,
  #ast-desktop-header .ast-site-header-cart,
  #ast-desktop-header .ast-site-header-cart-li,
  #ast-desktop-header .ks-header-search-slot{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    height:100%!important;
    line-height:1!important;
  }

  #ast-desktop-header .ast-header-account-link,
  #ast-desktop-header .cart-container,
  #ast-desktop-header .ks-header-search-trigger{
    align-self:center!important;
    vertical-align:middle!important;
  }

  /* Astra adds svg-baseline on the account icon; remove baseline alignment completely. */
  #ast-desktop-header .ast-header-account-link .ahfb-svg-iconset,
  #ast-desktop-header .ast-header-account-link .svg-baseline{
    width:20px!important;
    height:20px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    line-height:0!important;
    vertical-align:middle!important;
    position:static!important;
    margin:0!important;
  }

  #ast-desktop-header .ast-header-account-link .account-icon{
    width:20px!important;
    height:20px!important;
    display:block!important;
    position:static!important;
    margin:0!important;
    transform:none!important;
  }

  #ast-desktop-header .ast-site-header-cart .ast-addon-cart-wrap,
  #ast-desktop-header .ast-woo-header-cart-info-wrap,
  #ast-desktop-header .ast-icon-shopping-bag,
  #ast-desktop-header .ks-header-search-trigger{
    align-self:center!important;
  }

  #ast-desktop-header .ks-header-search-trigger svg,
  #ast-desktop-header .ast-icon-shopping-bag svg{
    display:block!important;
    margin:0!important;
    vertical-align:middle!important;
  }
}


/* Desktop utility vertical rhythm: remove native Astra component offsets. */
@media (min-width:1101px){
  #ast-desktop-header .ast-header-account-wrap,
  #ast-desktop-header .ast-header-account-inner-wrap,
  #ast-desktop-header .ast-header-account,
  #ast-desktop-header .ast-header-woo-cart,
  #ast-desktop-header .ast-site-header-cart,
  #ast-desktop-header .ast-site-header-cart-li,
  #ast-desktop-header .cart-container,
  #ast-desktop-header .ks-header-search-slot,
  #ast-desktop-header .ks-header-search-trigger{
    margin-top:0!important;
    margin-bottom:0!important;
  }

  #ast-desktop-header .ast-header-account-wrap,
  #ast-desktop-header .ast-header-account-inner-wrap{
    padding-top:0!important;
    padding-bottom:0!important;
  }

  #ast-desktop-header .ast-header-account-link,
  #ast-desktop-header .ks-header-search-trigger{
    line-height:0!important;
  }

  #ast-desktop-header .ast-header-account-link .ahfb-svg-iconset,
  #ast-desktop-header .ast-header-account-link svg,
  #ast-desktop-header .ks-header-search-trigger svg{
    line-height:0!important;
    vertical-align:middle!important;
  }
}
