/* HL category layout polish + catside + drawer (fluid, no zoom/scale) */

:root {
  --hl-cs-red: #d71920;
  --hl-cs-text: #18191a;
  --hl-cs-muted: #6b7280;
  --hl-cs-line: #ececec;
  --hl-cs-soft: #f5f6f7;
  --hl-cs-hover: #f0f1f3;
  --hl-cs-active: transparent;
  --hl-cs-current: #8b1a1a;
  --hl-catside-w: clamp(220px, 14.5vw, 244px);
  --hl-cat-gap: clamp(24px, 2vw, 28px);
}

.hl-catside,
.hl-catside *,
.hl-catintro,
.hl-catintro *,
.hl-catdrawer,
.hl-catdrawer * {
  box-sizing: border-box;
}

/* ===== Left-column + catside grid (listings + PDP; never 404) ===== */
@media (min-width: 768px) {
  body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) #wrapper {
    padding-top: 0;
  }

  /* Parent theme leaves ~40px under breadcrumb — main empty band */
  body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) .breadcrumb__wrapper {
    margin-bottom: 10px;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
  }

  body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) .breadcrumb {
    margin-bottom: 0;
    margin-top: 0;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) .columns-container > .row {
    display: grid !important;
    grid-template-columns: var(--hl-catside-w) minmax(0, 1fr);
    column-gap: var(--hl-cat-gap);
    align-items: start;
    --bs-gutter-x: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) #left-column,
  body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) #left-column.left-column {
    grid-column: 1;
    width: auto !important;
    max-width: 100% !important;
    flex: unset !important;
    /* Match settled custom.css (async) — avoid padding 0→25px / margin 0→-15px CLS */
    padding: 0 0 0 25px !important;
    margin: -15px 0 0 0 !important;
    overflow: visible !important;
    min-width: 0;
    display: block !important;
  }

  body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) #center-column,
  body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) #content-wrapper,
  body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) #center-column.center-column {
    grid-column: 2;
    width: auto !important;
    max-width: 100% !important;
    flex: unset !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: 0;
  }

  body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) #right-column {
    display: none !important;
  }
}

/* Hide blog widgets from catside left column */
body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) #left-column .ets_block_latest,
body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) #left-column .ets_block_categories,
body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) #left-column .ets_block_search,
body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) #left-column .ets_block_archive,
body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) #left-column .ets_blog_ltr_mode {
  display: none !important;
}

#left-column .ps-categorytree.category-tree,
#left-column .left-block__title {
  display: none !important;
}

/* ===== Category intro ===== */
.hl-catintro {
  margin-bottom: 0;
}

.hl-catintro__main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  margin-bottom: 1.15rem;
}

.hl-catintro__copy {
  min-width: 0;
}

.hl-catintro__copy .h1,
.hl-catintro__copy h1 {
  margin: 0 0 .55rem !important;
  font-size: clamp(1.45rem, 1.2rem + .6vw, 1.75rem) !important;
  line-height: 1.2 !important;
}

.hl-catintro__copy .category__description,
.hl-catintro__copy #category-description {
  position: relative;
  margin: 0 0 .45rem !important;
  font-size: .92rem;
  line-height: 1.5;
  max-width: none;
  width: 100%;
}

.hl-catintro .btn-read-more-cat {
  display: inline-flex !important;
  flex-direction: column;
  align-items: flex-start !important;
  width: auto !important;
  margin: .15rem 0 .25rem !important;
  padding: .35rem 0 !important;
  letter-spacing: .14em;
}

.hl-catintro__media {
  min-width: 0;
  max-width: 180px;
  justify-self: start;
}

.hl-catintro__media picture,
.hl-catintro__media img,
.hl-catintro__media .category__cover-image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 180px;
  height: auto;
  object-fit: contain;
  margin: 0;
}

.hl-catintro__chips {
  margin: 0 0 1.15rem;
}

.hl-catintro__chips .subcategories,
.hl-catintro__chips #subcategories,
.hl-catintro__chips ul {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  justify-content: flex-start !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

.hl-catintro__chips li,
.hl-catintro__chips .subcategory-item {
  width: auto !important;
  max-width: 100% !important;
  margin: 0 !important;
  flex: 0 0 auto !important;
}

.hl-catintro__chips a,
.hl-catintro__chips .subcategory__name,
.hl-catintro__chips .subcategory-name {
  display: inline-flex !important;
  align-items: center;
  min-height: 34px;
  padding: .35rem .9rem !important;
  border: 1px solid var(--hl-cs-line) !important;
  border-radius: 8px !important;
  background: #fff !important;
  font-size: .8rem !important;
  font-weight: 600 !important;
  color: var(--hl-cs-text) !important;
  text-decoration: none !important;
}

.hl-catintro__chips a:hover {
  border-color: #f0c8ca !important;
  background: var(--hl-cs-hover) !important;
  color: var(--hl-cs-red) !important;
}

/* Hide bulky subcategory images in chip row if classic markup still has them */
.hl-catintro__chips .subcategory-image,
.hl-catintro__chips .subcategory-img-wrapper {
  display: none !important;
}

@media (min-width: 900px) {
  .hl-catintro__main.has-portrait-cover {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: clamp(24px, 2.5vw, 36px);
    align-items: center;
  }

  .hl-catintro__main.has-portrait-cover .hl-catintro__media {
    justify-self: end;
    width: clamp(140px, 16vw, 180px);
  }

  /* Wide banner covers don't help listing layout — hide on desktop intro */
  .hl-catintro__main.has-banner-cover .hl-catintro__media,
  .hl-catintro__media.is-banner {
    display: none;
  }
}

@media (max-width: 899.98px) {
  .hl-catintro__media {
    max-width: 120px;
    max-height: 120px;
  }

  .hl-catintro__media img {
    max-height: 120px;
  }
}

@media (max-width: 575.98px) {
  /* Decorative cover shouldn't push products far down on phones */
  .hl-catintro__media {
    display: none;
  }
}

/* Toolbar */
@media (min-width: 768px) {
  body.page-category .products-selection,
  body.page-category #js-product-list-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin: 0 0 1.1rem;
    padding: .35rem 0;
    font-size: .88rem;
  }

  body.page-category .products-selection .sort-by-row,
  body.page-category #js-product-list-top .sort-by-row,
  body.page-category .products-sort-order,
  body.page-category .products-selection select,
  body.page-category #js-product-list-top select {
    width: clamp(260px, 35vw, 440px);
    max-width: 100%;
    min-width: 0;
  }
}

@media (max-width: 767.98px) {
  body.page-category .products-selection,
  body.page-category #js-product-list-top {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 1rem;
  }

  body.page-category .products-selection select,
  body.page-category #js-product-list-top select,
  body.page-category .sort-by-row {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Product grid columns live in hl-site-layout.css (5–6 on category) */

/* ===== Desktop sidebar ===== */
.hl-catside--desktop {
  display: none;
  background: transparent;
  border: 0;
  padding: 0;
  box-shadow: none;
  position: sticky;
  top: var(--hl-catside-sticky-top, 88px);
  max-height: none;
  overflow: visible;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (min-width: 1100px) {
  .hl-catside--desktop {
    display: block;
    /* Local air under breadcrumb — do not shift #center-column */
    padding-top: 12px;
  }
  .hl-catdrawer-trigger { display: none !important; }
}

.hl-catside__section + .hl-catside__section {
  margin-top: .75rem;
  padding-top: .7rem;
  border-top: 1px solid var(--hl-cs-line);
}

.hl-catside__heading {
  margin: 0 0 .35rem;
  padding: 0 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--hl-cs-muted);
}

.hl-catside__list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
}

.hl-catside__item {
  margin: 0 0 2px;
  max-width: 100%;
}

.hl-catside__item[hidden],
.hl-catside__item.is-extra[hidden] {
  display: none !important;
}

.hl-catside__row {
  display: flex;
  align-items: stretch;
  min-height: 44px;
  max-width: 100%;
  border-radius: 8px;
  position: relative;
  box-sizing: border-box;
}

.hl-catside__list--d2 .hl-catside__row,
.hl-catside__list--d3 .hl-catside__row {
  min-height: 36px;
}

.hl-catside__list--roots .hl-catside__link {
  min-height: 38px;
}

.hl-catside__link {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px 6px 6px;
  text-decoration: none !important;
  color: var(--hl-cs-text) !important;
  border-radius: 8px;
  transition: background .15s ease;
  box-sizing: border-box;
}

.hl-catside__link--compact {
  width: 100%;
  padding: 6px 8px;
}

.hl-catside__link:hover {
  background: var(--hl-cs-hover);
}

.hl-catside__thumb {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 7px;
  background: var(--hl-cs-soft);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hl-catside__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.hl-catside__thumb.is-fallback {
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}

.hl-catside__thumb.is-fallback::after {
  content: "";
  width: 38%;
  height: 38%;
  border-radius: 3px;
  background: rgba(0, 0, 0, .08);
}

.hl-catside__label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.hl-catside__list--d2 .hl-catside__label,
.hl-catside__list--d3 .hl-catside__label {
  font-size: 13px;
  font-weight: 500;
  color: #30343b;
}

.hl-catside__list--roots .hl-catside__label {
  font-size: 13px;
  font-weight: 600;
}

.hl-catside__list--d2 {
  padding: 2px 0 6px 12px;
}

.hl-catside__list--d3 {
  padding-left: 10px;
}

/* Soft +/- disclose control (replaces chevron) */
.hl-catside__toggle {
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--hl-cs-muted);
  cursor: pointer;
  border-radius: 10px;
}

.hl-catside__toggle:hover {
  color: var(--hl-cs-red);
}

.hl-catside__disclose {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid #e4e6ea;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.hl-catside__toggle:hover .hl-catside__disclose {
  border-color: #f0c8ca;
  background: var(--hl-cs-hover);
}

.hl-catside__disclose::before,
.hl-catside__disclose::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: currentColor;
  border-radius: 1px;
  transform: translate(-50%, -50%);
  transition: opacity .15s ease, transform .15s ease;
}

.hl-catside__disclose::before {
  width: 10px;
  height: 1.5px;
}

.hl-catside__disclose::after {
  width: 1.5px;
  height: 10px;
}

.hl-catside__item.is-open > .hl-catside__row > .hl-catside__toggle {
  color: var(--hl-cs-red);
}

.hl-catside__item.is-open > .hl-catside__row > .hl-catside__toggle .hl-catside__disclose {
  border-color: #f0c8ca;
  background: var(--hl-cs-active);
}

.hl-catside__item.is-open > .hl-catside__row > .hl-catside__toggle .hl-catside__disclose::after {
  opacity: 0;
  transform: translate(-50%, -50%) scaleY(0);
}

.hl-catside__item.is-current > .hl-catside__row {
  background: var(--hl-cs-active);
}

.hl-catside__item.is-current > .hl-catside__row::before {
  content: none;
}

.hl-catside__item.is-current .hl-catside__label {
  font-weight: 700;
  color: var(--hl-cs-current);
}

.hl-catside__children[hidden] {
  display: none !important;
}

.hl-catside__more {
  display: block;
  width: 100%;
  margin: 4px 0 0;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--hl-cs-red);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  border-radius: 6px;
}

.hl-catside__more:hover {
  background: var(--hl-cs-hover);
}

.hl-catside__more[hidden] {
  display: none !important;
}

.hl-catside__solo {
  display: inline-block;
  margin-top: .35rem;
  font-size: 13px;
  font-weight: 700;
  color: var(--hl-cs-red) !important;
}