/* Pass 4 CLS — reserve geometry; no visual redesign */
/* Keep under ~8KB for Zone FTP */

#header {
  min-height: 120px;
  box-sizing: border-box;
}
@media (min-width: 992px) {
  #header {
    min-height: 192px;
  }
}

/* Logo sizes are breakpoint-scoped — do not leave mobile max-width 140 as a base rule */
@media (max-width: 767.98px) {
  #header img.logo,
  .header-bottom__logo .logo {
    width: 140px !important;
    max-width: 140px !important;
    height: 36px !important;
    max-height: 36px !important;
    min-width: 0 !important;
    aspect-ratio: 140 / 36;
    object-fit: contain !important;
  }

  #header .header-bottom__logo .navbar-brand {
    min-height: 0 !important;
    max-width: 140px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  #header .header-bottom__row {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
  }

  #header .header-bottom__logo {
    display: flex !important;
    align-items: center !important;
    flex: 1 1 0% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  #header .ps-mainmenu--desktop {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
  }
}

/* Desktop: logo + search on one row (settled compact ~200×51) */
@media (min-width: 768px) {
  #header img.logo,
  .header-bottom__logo .logo {
    width: 200px !important;
    max-width: 200px !important;
    height: 51px !important;
    max-height: 51px !important;
    aspect-ratio: 200 / 51;
    object-fit: contain !important;
  }

  #header .header-bottom__logo .navbar-brand {
    min-height: 51px !important;
    max-width: none !important;
    width: auto !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  #header .header-bottom .container-md {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  #header .header-bottom__logo {
    display: flex !important;
    align-items: center !important;
    flex: 0 0 auto !important;
    order: 1 !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    margin-inline-end: 0 !important;
    padding: 0 !important;
  }

  #header #_desktop_ps_searchbar {
    display: flex !important;
    flex: 1 1 auto !important;
    order: 2 !important;
    margin-left: 0 !important;
    min-width: 0 !important;
  }

  #header .ps-searchbar--mobile,
  #header #_mobile_ps_customersignin,
  #header #_mobile_ps_shoppingcart,
  #header .header-bottom__row > .d-md-none {
    display: none !important;
  }
}

/* Homepage product stage: reserve image box before late theme/font paint */
body#index article.product-miniature.hl-pc .product-miniature__image-container,
body#index article.product-miniature.hl-pc .thumbnail-container {
  height: var(--hl-pc-img-h, 150px);
  max-height: var(--hl-pc-img-h, 150px);
  box-sizing: border-box;
}

body#index .hl-home-hero__dir-media {
  min-height: 86px;
  height: 86px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

body#index .hl-home-hero__dir-media img {
  width: 88px;
  height: 88px;
  max-width: 88px;
  max-height: 88px;
  object-fit: contain;
  display: block;
}

body#index .hl-home-quick__media,
body#index .hl-home-quick__media img {
  aspect-ratio: 1 / 1;
}

/* Desktop mid: trust+cats without flex reorder (DOM order). Reserve settled height. */
@media (min-width: 768px) {
  body#index .hl-home-shell__mid {
    min-height: 340px;
  }
  body#index .hl-home-hero {
    min-height: 260px;
  }
  body#index .hl-home-trust__list {
    min-height: 52px;
  }
  body#index .hl-home-quick__link {
    min-height: 96px;
  }
}

/* Belt-and-suspenders: skip link must not take layout before async theme.css */
.skip-link.visually-hidden-focusable,
.back-to-top-link.visually-hidden-focusable {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
  pointer-events: none;
}
.skip-link.visually-hidden-focusable:focus,
.skip-link.visually-hidden-focusable:focus-visible,
.back-to-top-link.visually-hidden-focusable:focus,
.back-to-top-link.visually-hidden-focusable:focus-visible {
  position: fixed !important;
  left: 12px !important;
  top: 12px !important;
  z-index: 100000 !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: .5rem 1rem !important;
  overflow: visible !important;
  clip: auto !important;
  clip-path: none !important;
  white-space: normal !important;
  pointer-events: auto;
}

/* Mobile header: prevent late CSS/font from growing chrome and shoving #wrapper */
@media (max-width: 991.98px) {
  #header.header.js-sticky-header,
  #header.header {
    min-height: 100px;
    box-sizing: border-box;
  }

  #header .header-bottom {
    min-height: 0;
    box-sizing: border-box;
  }

  /* Cart count badge: stable footprint 0 → 1 → 99 */
  #header .cart-products-count,
  #_mobile_cart .cart-products-count,
  .header .cart-preview .cart-products-count {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    min-height: 1.25rem;
    box-sizing: border-box;
  }
}

/* Listing image stage: attrs + fixed stage; avoid auto height jump */
body#category #js-product-list article.product-miniature.hl-pc .product-miniature__image-container,
body#category #js-product-list article.product-miniature.hl-pc .thumbnail-container,
body#search article.product-miniature.hl-pc .product-miniature__image-container {
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

body#category #js-product-list article.product-miniature.hl-pc .product-miniature__image,
body#search article.product-miniature.hl-pc .product-miniature__image {
  aspect-ratio: auto;
}

/* Price/CTA strip: keep bottom block from growing after price paint */
body#category #js-product-list article.product-miniature.hl-pc .product-miniature__bottom {
  min-height: 72px;
  box-sizing: border-box;
}

html[data-hl-cat-view="list"] body#category #js-product-list article.product-miniature.hl-pc .product-miniature__bottom,
body#category #js-product-list .products.hl-view-list article.product-miniature.hl-pc .product-miniature__bottom {
  min-height: 0;
}

/* PDP gallery stage */
body#product .product__images .product__carousel .carousel-inner {
  aspect-ratio: 1 / 1;
  background: #fff;
}

body#product .product__images .product__carousel .carousel-item {
  aspect-ratio: 1 / 1;
}

body#product .product__images .product__carousel .carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Filter toolbar: fixed control height from first paint */
body#category .hl-catfilter {
  min-height: 44px;
}

body#category .hl-catfilter__row,
body#category .hl-catfilter__bar {
  min-height: 40px;
}

/* Font CLS: match Mulish metrics so system-ui does not reflow #wrapper.
 * Actual Mulish faces are declared in head critical-paint (font-display:optional). */
@font-face {
  font-family: "HL Mulish Fallback";
  src: local("Segoe UI"), local("Arial");
  size-adjust: 105%;
  ascent-override: 92%;
  descent-override: 24%;
  line-gap-override: 0%;
}

body,
.h1, .h2, .h3, .h4, .h5, .h6,
h1, h2, h3, h4, h5, h6 {
  font-family: Mulish, "HL Mulish Fallback", system-ui, -apple-system, sans-serif;
}

/* Material Icons: optional avoids late-icon CLS (parent theme.css uses swap) */
@font-face {
  font-family: "Material Icons";
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url("../../../hummingbird/assets/fonts/MaterialIcons-Regular-2d8017489da689caedc1.woff2") format("woff2");
}

.material-icons,
.header-block__icon,
.menu-toggle .material-icons {
  width: 1em;
  height: 1em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Category CLS: images fill reserved 1:1 stage (never height:auto) */
body#category #js-product-list .product-miniature__image,
body#category #js-product-list .product-miniature__image-container img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block !important;
}

/* Desktop columns: keep Bootstrap cols from fighting grid before theme settles */
@media (min-width: 768px) {
  body#category .columns-container.container,
  body.page-category .columns-container.container {
    max-width: var(--hl-container-max, 1400px) !important;
    width: min(var(--hl-container-max, 1400px), calc(100% - var(--hl-container-gutter, 40px))) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  body#category .breadcrumb,
  body.page-category .breadcrumb {
    padding: 5px 0 0 !important;
    margin: 0 0 2px !important;
  }

  body#category #left-column,
  body.page-category #left-column {
    padding: 0 0 0 25px !important;
    margin: -15px 0 0 !important;
  }

  /* Desktop header fixed box — prevents home/cat/pdp content shove */
  #header.header {
    height: 192px !important;
    min-height: 192px !important;
    max-height: 192px !important;
    overflow: visible !important;
  }

  body#category .columns-container > .row,
  body.page-category .columns-container > .row {
    display: grid !important;
    grid-template-columns: clamp(220px, 14.5vw, 244px) minmax(0, 1fr);
    column-gap: clamp(24px, 2vw, 28px);
    align-items: start;
    width: 100% !important;
    margin: 0 !important;
  }

  body#category .columns-container > .row > [class*="col-"],
  body.page-category .columns-container > .row > [class*="col-"] {
    width: auto !important;
    max-width: none !important;
    flex: none !important;
    float: none !important;
  }

  body#category #js-product-list {
    min-height: 640px;
  }
}

@media (max-width: 767.98px) {
  body#category #js-product-list {
    min-height: 720px;
  }
}

/* Defeat custom.css card rules that still leak into list (specificity belt) */
@media (min-width: 768px) {
  body#category #js-product-list .products.hl-view-list article.product-miniature,
  html[data-hl-cat-view="list"] body#category #js-product-list article.product-miniature {
    display: block !important;
    flex-direction: unset !important;
    height: 125px !important;
    min-height: 125px !important;
    max-height: 125px !important;
    margin: 0 !important;
    width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    transform: none !important;
  }

  body#category #js-product-list .products.hl-view-list .product-miniature__inner,
  html[data-hl-cat-view="list"] body#category #js-product-list .product-miniature__inner {
    display: grid !important;
    grid-template-columns: 84px minmax(0, 1fr) 212px !important;
    gap: 0 16px !important;
    align-items: center !important;
    min-height: 125px !important;
    height: 125px !important;
    max-height: 125px !important;
    overflow: hidden !important;
  }
}

/* Home: do not reserve growing min-heights — match fold CSS settled geometry only */
body#index .hl-home-shell {
  min-height: 0 !important;
}

/* Mobile: lock columns start after fixed header so #wrapper shove ~0.036 dies */
@media (max-width: 991.98px) {
  #header.header {
    margin-bottom: 0 !important;
  }
  #wrapper.wrapper {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }
  body#category .columns-container.container,
  body.page-category .columns-container.container,
  body#product .columns-container.container {
    margin-top: 0 !important;
  }
}
