/* ZSG WooCommerce catalog / product category archive. */
.zsg-catalog {
  --zsg-catalog-red: #e30014;
  --zsg-catalog-red-dark: #b90010;
  --zsg-catalog-ink: #15191d;
  --zsg-catalog-muted: #6d7680;
  --zsg-catalog-line: #dde2e6;
  --zsg-catalog-soft: #f3f5f6;
  --zsg-catalog-panel: #fff;
  background: #f7f8f9;
  color: var(--zsg-catalog-ink);
  padding: 24px 0 72px;
}

.zsg-catalog *,
.zsg-catalog *::before,
.zsg-catalog *::after { box-sizing: border-box; }

.zsg-catalog__container { width: min(100% - 32px, 1320px); margin: 0 auto; }
.zsg-catalog__breadcrumbs { margin-bottom: 18px; color: #747d86; font-size: 13px; }
.zsg-catalog-breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 0; padding: 0; list-style: none; }
.zsg-catalog-breadcrumbs__item { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.zsg-catalog-breadcrumbs a { color: #525b64; text-decoration: none; font-weight: 650; }
.zsg-catalog-breadcrumbs a:hover { color: var(--zsg-catalog-red); }
.zsg-catalog-breadcrumbs [aria-current="page"] { color: #858e96; }
.zsg-catalog-breadcrumbs__separator { color: #a6adb4; font-size: 15px; line-height: 1; }

.zsg-catalog__header { margin-bottom: 24px; }
.zsg-catalog__eyebrow,
.zsg-catalog-section-head__eyebrow {
  margin: 0 0 8px;
  color: var(--zsg-catalog-red);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.zsg-catalog__title { margin: 0; font-size: clamp(30px, 3.2vw, 48px); line-height: 1.04; font-weight: 850; letter-spacing: -.035em; }

.zsg-catalog-section-head { margin-bottom: 14px; }
.zsg-catalog-section-head h2 { margin: 0; font-size: clamp(21px, 2vw, 28px); line-height: 1.15; font-weight: 820; letter-spacing: -.025em; }
.zsg-catalog-section-head--split { display: flex; align-items: end; justify-content: space-between; gap: 20px; }

.zsg-catalog-quick { margin-bottom: 28px; }
.zsg-catalog-quick__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.zsg-catalog-quick__item {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--zsg-catalog-line);
  border-radius: 12px;
  background: #fff;
  color: #252a2f;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 720;
  transition: border-color .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.zsg-catalog-quick__item svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; }
.zsg-catalog-quick__item:hover,
.zsg-catalog-quick__item:focus-visible,
.zsg-catalog-quick__item.is-current { border-color: rgba(227,0,20,.35); color: var(--zsg-catalog-red); background: #fffafb; box-shadow: 0 8px 22px rgba(17,20,23,.05); }
.zsg-catalog-quick__item:hover svg,
.zsg-catalog-quick__item:focus-visible svg { transform: translateX(3px); }

.zsg-catalog__layout { display: grid; grid-template-columns: 286px minmax(0, 1fr); gap: 28px; align-items: start; }
.zsg-catalog-sidebar__inner { position: sticky; top: 20px; overflow: hidden; border: 1px solid var(--zsg-catalog-line); border-radius: 16px; background: #fff; box-shadow: 0 10px 30px rgba(17,20,23,.04); }
.zsg-catalog-sidebar__head { padding: 18px 18px 15px; border-bottom: 1px solid #e8ebed; }
.zsg-catalog-sidebar__head h2 { margin: 0; font-size: 18px; line-height: 1.2; font-weight: 820; }
.wc-category-tree { padding: 8px; }
.wc-category-tree ul { margin: 0; padding: 0; list-style: none; }
.wc-category-tree__children[hidden] { display: none !important; }
.wc-category-tree__item { position: relative; }
.wc-category-tree__row { min-height: 44px; display: grid; grid-template-columns: minmax(0, 1fr) 40px; align-items: center; border-radius: 10px; }
.wc-category-tree__item:not(.has-children) > .wc-category-tree__row { grid-template-columns: minmax(0, 1fr); }
.wc-category-tree__link { min-width: 0; display: flex; align-items: center; min-height: 44px; padding: 8px 10px 8px calc(10px + (var(--wc-tree-depth, 0) * 12px)); border-radius: 9px; color: #2c3136; text-decoration: none; font-size: 14px; line-height: 1.32; font-weight: 620; }
.wc-category-tree__toggle { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 9px; background: transparent; color: #707982; cursor: pointer; }
.wc-category-tree__toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; }
.wc-category-tree__toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.wc-category-tree__row:hover { background: #f6f7f8; }
.wc-category-tree__link:hover { color: var(--zsg-catalog-red); }
.wc-category-tree__item.is-ancestor > .wc-category-tree__row > .wc-category-tree__link { color: #32373c; font-weight: 760; }
.wc-category-tree__item.is-current > .wc-category-tree__row { background: #fff4f5; }
.wc-category-tree__item.is-current > .wc-category-tree__row::before { content: ""; position: absolute; left: 0; width: 3px; height: 24px; border-radius: 4px; background: var(--zsg-catalog-red); }
.wc-category-tree__item.is-current > .wc-category-tree__row > .wc-category-tree__link { color: var(--zsg-catalog-red); font-weight: 820; }

.zsg-catalog-before-loop { margin-bottom: 14px; }
.zsg-catalog-before-loop:empty { display: none; }
.zsg-catalog-toolbar { min-height: 58px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding: 10px 12px 10px 16px; border: 1px solid var(--zsg-catalog-line); border-radius: 14px; background: #fff; }
.zsg-catalog-toolbar__count { margin: 0; color: var(--zsg-catalog-muted); font-size: 13px; line-height: 1.45; }
.zsg-catalog-toolbar__ordering { display: flex; align-items: center; gap: 10px; margin: 0; }
.zsg-catalog-toolbar__ordering label { margin: 0; color: #525b64; font-size: 13px; font-weight: 700; }
.zsg-catalog-toolbar__ordering select { min-height: 40px; max-width: 260px; padding: 0 38px 0 12px; border: 1px solid #d9dee2; border-radius: 10px; background-color: #fff; color: #252a2f; font-size: 13px; }

.zsg-catalog-products__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.zsg-catalog-products__grid > .zsg-product-card { min-width: 0; }
.zsg-catalog-products__grid .zsg-product-card { min-height: 424px; }
.zsg-catalog-products__grid .zsg-product-card__media { height: 208px; }

.zsg-catalog-pagination { margin-top: 28px; }
.zsg-catalog-pagination .woocommerce-pagination { margin: 0; }
.zsg-catalog-pagination .woocommerce-pagination ul.page-numbers { display: flex; list-style: none; list-style-type: none; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 0; border: 0; }
.zsg-catalog-pagination .woocommerce-pagination ul.page-numbers li { margin: 0; border: 0; list-style: none; list-style-type: none; }
.zsg-catalog-pagination .page-numbers a,
.zsg-catalog-pagination .page-numbers span { min-width: 44px; min-height: 44px; display: grid; place-items: center; padding: 8px 12px; border: 1px solid var(--zsg-catalog-line); border-radius: 10px; background: #fff; color: #343a40; text-decoration: none; font-size: 13px; font-weight: 750; }
.zsg-catalog-pagination .page-numbers .current { border-color: var(--zsg-catalog-red); background: var(--zsg-catalog-red); color: #fff; }
.zsg-catalog-pagination .page-numbers a:hover { border-color: rgba(227,0,20,.35); color: var(--zsg-catalog-red); }

.zsg-catalog-description,
.zsg-catalog-recent { margin-top: 54px; padding: 28px; border: 1px solid var(--zsg-catalog-line); border-radius: 18px; background: #fff; box-shadow: 0 10px 30px rgba(17,20,23,.035); }
.zsg-catalog-description__content { color: #4b535b; font-size: 15px; line-height: 1.75; }
.zsg-catalog-description__content > :first-child { margin-top: 0; }
.zsg-catalog-description__content > :last-child { margin-bottom: 0; }
.zsg-catalog-description__content.is-collapsible:not(.is-expanded) { position: relative; max-height: 245px; overflow: hidden; }
.zsg-catalog-description__content.is-collapsible:not(.is-expanded)::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 78px; background: linear-gradient(180deg, rgba(255,255,255,0), #fff 84%); pointer-events: none; }
.zsg-catalog-description__toggle { min-height: 44px; margin-top: 14px; padding: 0 16px; border: 1px solid rgba(227,0,20,.25); border-radius: 10px; background: #fff; color: var(--zsg-catalog-red); font-size: 13px; font-weight: 800; cursor: pointer; }
.zsg-catalog-description__toggle [data-less] { display: none; }
.zsg-catalog-description__toggle[aria-expanded="true"] [data-more] { display: none; }
.zsg-catalog-description__toggle[aria-expanded="true"] [data-less] { display: inline; }

.zsg-catalog-recent__track { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.zsg-catalog-recent__item { min-width: 0; }
.zsg-catalog-recent .zsg-product-card { min-height: 410px; }
.zsg-catalog-recent .zsg-product-card__media { height: 195px; }

.zsg-catalog__mobile-tools,
.zsg-catalog-drawer { display: none; }

.zsg-catalog a:focus-visible,
.zsg-catalog button:focus-visible,
.zsg-catalog select:focus-visible { outline: 3px solid rgba(227,0,20,.26); outline-offset: 3px; }

@media (max-width: 1120px) {
  .zsg-catalog__layout { grid-template-columns: 250px minmax(0, 1fr); gap: 20px; }
  .zsg-catalog-quick__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .zsg-catalog-products__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .zsg-catalog-recent__track { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .zsg-catalog-quick__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  body.zsg-catalog-drawer-open { overflow: hidden; }
  /* Keep the smart mobile header fully visible before the catalog drawer is positioned.
     Disabling its transform transition here prevents a transient overlap when the
     drawer is opened while the header was hidden by the scroll behavior. */
  body.zsg-catalog-drawer-open .site-header {
    transform: none !important;
    transition: none !important;
    will-change: auto;
  }
  .zsg-catalog { padding: 18px 0 52px; }
  .zsg-catalog__container { width: min(100% - 24px, 1320px); }
  .zsg-catalog__breadcrumbs { overflow-x: auto; white-space: nowrap; scrollbar-width: none; margin-bottom: 14px; }
  .zsg-catalog__breadcrumbs::-webkit-scrollbar { display: none; }
  .zsg-catalog__header { margin-bottom: 20px; }
  .zsg-catalog__title { font-size: clamp(28px, 9vw, 38px); }
  .zsg-catalog-quick { margin-bottom: 20px; }
  .zsg-catalog-quick__grid { display: flex; gap: 8px; overflow-x: auto; margin: 0 -12px; padding: 0 12px 5px; scroll-snap-type: x proximity; scrollbar-width: none; }
  .zsg-catalog-quick__grid::-webkit-scrollbar { display: none; }
  .zsg-catalog-quick__item { flex: 0 0 min(76vw, 280px); min-height: 52px; scroll-snap-align: start; }
  .zsg-catalog__layout { display: block; }
  .zsg-catalog-sidebar { display: none; }
  .zsg-catalog__mobile-tools { display: flex; margin-bottom: 12px; }
  .zsg-catalog__category-open { min-height: 46px; display: inline-flex; align-items: center; gap: 9px; padding: 0 15px; border: 1px solid var(--zsg-catalog-line); border-radius: 11px; background: #fff; color: #24292e; font-size: 14px; font-weight: 780; cursor: pointer; }
  .zsg-catalog__category-open svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
  .zsg-catalog-toolbar { align-items: stretch; flex-direction: column; min-height: 0; padding: 12px; }
  .zsg-catalog-toolbar__count { order: 2; }
  .zsg-catalog-toolbar__ordering { order: 1; width: 100%; justify-content: space-between; }
  .zsg-catalog-toolbar__ordering select { width: 100%; max-width: none; }
  .zsg-catalog-products__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .zsg-catalog-products__grid .zsg-product-card { min-height: 388px; }
  .zsg-catalog-products__grid .zsg-product-card__media { height: 174px; }
  .zsg-catalog-description,
  .zsg-catalog-recent { margin-top: 38px; padding: 20px 16px; border-radius: 15px; }
  .zsg-catalog-recent__track { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 6px; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .zsg-catalog-recent__track::-webkit-scrollbar { display: none; }
  .zsg-catalog-recent__item { flex: 0 0 min(72vw, 286px); scroll-snap-align: start; }

  /* The runtime value is the real viewport bottom edge of the current header.
     142px is only a safe no-flash fallback for the two-row mobile header. */
  .zsg-catalog-drawer { position: fixed; top: var(--zsg-catalog-drawer-top, 142px); right: 0; bottom: 0; left: 0; z-index: 9975; display: block; visibility: hidden; pointer-events: none; }
  .zsg-catalog-drawer[aria-hidden="false"] { visibility: visible; pointer-events: auto; }
  .zsg-catalog-drawer__overlay { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: rgba(15,18,21,.48); opacity: 0; transition: opacity .2s ease; }
  .zsg-catalog-drawer[aria-hidden="false"] .zsg-catalog-drawer__overlay { opacity: 1; }
  .zsg-catalog-drawer__panel { position: absolute; top: 0; bottom: 0; left: 0; width: min(88vw, 390px); overflow-y: auto; padding: max(16px, env(safe-area-inset-top)) 12px max(22px, env(safe-area-inset-bottom)); background: #fff; box-shadow: 18px 0 46px rgba(0,0,0,.16); transform: translateX(-102%); transition: transform .24s cubic-bezier(.22,.8,.28,1); }
  .zsg-catalog-drawer[aria-hidden="false"] .zsg-catalog-drawer__panel { transform: translateX(0); }
  .zsg-catalog-drawer__head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: -4px -2px 0; padding: 8px 8px 14px; border-bottom: 1px solid #e7eaed; background: #fff; }
  .zsg-catalog-drawer__head h2 { margin: 0; font-size: 21px; font-weight: 830; }
  .zsg-catalog-drawer__close { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 1px solid #e0e4e7; border-radius: 11px; background: #fff; color: #22272c; cursor: pointer; }
  .zsg-catalog-drawer__close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
  .wc-category-tree--drawer { padding: 10px 0; }
}

@media (max-width: 390px) {
  .zsg-catalog__container { width: min(100% - 18px, 1320px); }
  .zsg-catalog-toolbar__ordering { align-items: stretch; flex-direction: column; gap: 6px; }
  .zsg-catalog-products__grid { gap: 8px; }
  .zsg-catalog-products__grid .zsg-product-card__body { padding: 12px; }
  .zsg-catalog-products__grid .zsg-product-card__media { height: 158px; }
  .zsg-catalog-products__grid .zsg-product-card__title { font-size: 13px; }
  .zsg-catalog-products__grid .zsg-product-card__price { font-size: 13px; }
}

@media (max-width: 340px) {
  .zsg-catalog-products__grid { grid-template-columns: 1fr; }
  .zsg-catalog-products__grid .zsg-product-card__media { height: 210px; }
}

@media (prefers-reduced-motion: reduce) {
  .zsg-catalog *,
  .zsg-catalog *::before,
  .zsg-catalog *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* External category-tree plugin is optional at runtime: catalog remains usable without an empty sidebar. */
.zsg-catalog__layout--no-sidebar {
  grid-template-columns: minmax(0, 1fr);
}


/* Revision 8: Side Cart owns add-to-cart success feedback.
   Suppress only WooCommerce success messages inside the captured before-loop hook. */
.zsg-catalog-before-loop .woocommerce-message {
  display: none !important;
}

/* Avoid leaving an empty 14px gap when the success message is the only hook output. */
.zsg-catalog-before-loop:has(> .woocommerce-message:only-child),
.zsg-catalog-before-loop:has(> .woocommerce-notices-wrapper:only-child > .woocommerce-message:only-child) {
  display: none;
}
