/*
 * Archive Redesign v1 — Horizontal filters + full-width grid
 * Scope: WooCommerce shop/category/tag archives only.
 * Loads after archive-woocommerce-base.css (Storefront's woocommerce.css is dequeued).
 * Updated: 2026-04-13
 */

/* ══════════════════════════════════════════════════
   DESIGN TOKENS
   ══════════════════════════════════════════════════ */
:root {
  /* ── Font family ── */
  --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* ── Spacing scale (4px base) ── */
  --space-2xs: 4px;
  --space-xs:  8px;
  --space-sm:  12px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* ── Type scale ── */
  --text-xs:   0.8125rem;  /* 13px — meta, breadcrumbs */
  --text-sm:   0.875rem;   /* 14px — filter chips, small labels */
  --text-base: 1rem;       /* 16px — body, card titles */
  --text-lg:   1.125rem;   /* 18px — lead, prices, subcat labels */
  --text-xl:   1.75rem;    /* 28px — section headings */
  --text-2xl:  2.5rem;     /* 40px — page H1 */

  /* ── Colours ── */
  --color-text:       #1a1a1a;
  --color-text-soft:  #555;
  --color-text-muted: #888;
  --color-price:      #1a1a1a;
  --color-price-sale: #cc0000;
  --color-price-old:  #888;
  --color-accent:     #ef0000;
  --color-border:     #e5e5e5;
  --color-surface:    #faf7f2;
  --color-surface-alt: #faf7f2;
}

/* ── Breadcrumbs ── */
.storefront-breadcrumb {
  margin-bottom: 0;
  padding-bottom: 0;
}
.storefront-breadcrumb .col-full {
  /* Full-bleed up to 100em, with a fluid gutter so content doesn't hug
     viewport edges on tablet/laptop widths. Aligns with header band inner. */
  max-width: 100em;
  padding-left: clamp(16px, 3vw, 40px);
  padding-right: clamp(16px, 3vw, 40px);
}
.woocommerce-breadcrumb::before {
  display: none !important;
  content: none !important;
}
.woocommerce-breadcrumb {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0.01em;
  /* Single line + horizontal scroll on overflow so long crumb chains like
     "Matthuset.se > Mattor > Handknutet, Handloomade & Kelim" don't wrap to
     2 lines and steal vertical space above the H1. Scrollbar hidden — the
     fade-right mask hints "swipe for more". */
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
}
.woocommerce-breadcrumb::-webkit-scrollbar {
  display: none;
}
.woocommerce-breadcrumb a {
  color: var(--color-text-soft);
  text-decoration: none;
}
.woocommerce-breadcrumb a:hover {
  color: var(--color-text);
}
/* Separator styling — override default "/" */
.woocommerce-breadcrumb span.breadcrumb-separator {
  margin: 0 0.4em;
  color: var(--color-text-muted);
}

/* ── Fix overflow-x for sticky ── */
.woocommerce.archive .site,
.woocommerce-page.archive .site,
.tax-product_cat .site,
.tax-product_tag .site,
.search .site {
  overflow-x: clip;
}

/* ── Search results: full-width layout matching archives ── */
.search .site-content > .col-full {
  max-width: 92em;
}

.search .content-area,
.search #primary,
.search.right-sidebar .content-area,
.search.left-sidebar .content-area {
  width: 100% !important;
  float: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.search #secondary,
.search .widget-area {
  display: none !important;
}

/* Kill Storefront's float-based search grid (style.css ~line 1307) */
.search.search-results .product.type-product.status-publish {
  max-width: none !important;
  float: none !important;
  padding: 0 !important;
  width: auto !important;
}

/* Search results page header — match the category-page hero typography
   (`.cat-banner h1`): no surface band, breadcrumb-flow title, --text-2xl.
   The keyword still gets the accent color to anchor what the user searched. */
.search .page-header {
  background: none;
  padding: 0;
  margin: var(--space-lg) 0 var(--space-md);
}

.search .page-header .page-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin: 0;
}

.search .page-header .page-title span {
  color: var(--color-accent);
}

@media (max-width: 767px) {
  .search .page-header .page-title {
    font-size: 1.75rem;
  }
}

/* ── Hide duplicate WooCommerce products header ── */
header.woocommerce-products-header {
  display: none;
}

/* ══════════════════════════════════════════════════
   CAT BANNER / HERO
   ══════════════════════════════════════════════════ */
.cat-banner {
  background: none;
  margin: 0;
  padding: 0;
}
.cat-banner h1 {
  position: static;
  color: var(--color-text);
  background: none;
  padding: 0;
  margin: var(--space-lg) 0 var(--space-2xs);
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.cat-banner .term-description {
  position: static;
  color: var(--color-text-soft);
  background: none;
  padding: 0 0 var(--space-md);
  font-size: var(--text-base);
  line-height: 1.6;
  max-width: 65ch;
}
.cat-banner .term-description p:first-child {
  font-size: var(--text-lg);
  line-height: 1.5;
}

/* Category details / special text — centered block below pagination */
.archive-description-after {
  margin: var(--space-3xl) auto 0;
  max-width: 70ch;
  text-align: center;
  color: var(--color-text-soft);
  font-size: var(--text-base);
  line-height: 1.7;
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-border);
}
.archive-description-after > div + div {
  margin-top: var(--space-lg);
}
.archive-description-after .term-description,
.archive-description-after .product-cat-details {
  max-width: none;
  margin: 0;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}
.archive-description-after p {
  margin: 0 0 var(--space-sm);
}
.archive-description-after p:last-child {
  margin-bottom: 0;
}
.archive-description-after h2,
.archive-description-after h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin: var(--space-lg) 0 var(--space-sm);
  letter-spacing: -0.01em;
}

@media (max-width: 767px) {
  .archive-description-after {
    margin-top: var(--space-2xl);
    padding-top: var(--space-lg);
    font-size: var(--text-sm);
  }
}

/* Hide "Filtrera efter" nav menu widget — all breakpoints */
#secondary .widget_nav_menu {
  display: none !important;
}

/* ══════════════════════════════════════════════════
   LAYOUT: full-width + horizontal filter bar
   ══════════════════════════════════════════════════ */

/* FOUC prevention: hide sidebar in original DOM position,
   show once JS moves it into #main. Archive/search/product only — never on homepage. */
body:not(.page-template-template-homepage) .col-full.test > #secondary.widget-area {
  display: none;
}
#main > #secondary.widget-area {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  background: #fff;
  width: 100%;
}

@media (min-width: 768px) {
  /* Archive/search/product layout — never applies on homepage */
  body:not(.page-template-template-homepage) .col-full.test {
    display: flex;
    flex-direction: column;
    /* Full-bleed up to 100em, with a fluid gutter so content doesn't hug
       viewport edges on tablet/laptop widths. Aligns with header band inner. */
    max-width: 100em;
    padding-left: clamp(16px, 3vw, 40px);
    padding-right: clamp(16px, 3vw, 40px);
  }

  /* ── Filter bar (after JS moves it into #main) ── */
  #main > #secondary.widget-area {
    position: sticky;
    top: 0;
    z-index: 20;
  }

  /* Hide "Filtrera efter" nav menu widget */
  #secondary .widget_nav_menu {
    display: none;
  }

  /* Each filter widget: inline */
  #secondary .widget {
    margin: 0;
    display: flex;
    align-items: center;
  }
  #secondary .widget_layered_nav form {
    display: flex;
    align-items: center;
    margin: 0;
  }

}

/* ── Hide native filter UI at every width — our `.mh-filter-dropdown` is
   the visible UI everywhere; the underlying <select> + SelectWoo wrapper
   would otherwise render as a duplicate filter row on mobile.
   (These were previously inside the `@media (min-width: 768px)` block,
   leaving the native UI visible alongside the custom chips on mobile.) ── */
#secondary select {
  display: none !important;
}
#secondary .woocommerce-widget-layered-nav-dropdown .select2,
#secondary .woocommerce-widget-layered-nav-dropdown .select2-container {
  display: none !important;
}

/* ── Custom filter dropdowns (applies at all widths; mobile tweaks below) ── */
.mh-filter-dropdown {
  position: relative;
}

.mh-filter-btn {
  appearance: none;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  padding: 7px 32px 7px 14px;
  font-size: var(--text-sm, 0.875rem);
  font-weight: 500;
  color: #333;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  background-size: 10px 6px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.4;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  font-family: inherit;
}
.mh-filter-btn:hover {
  border-color: #999;
  background-color: #faf7f2;
  color: #333;
}
.mh-filter-btn[aria-expanded="true"] {
  border-color: #333;
  background-color: #faf7f2;
}
.mh-filter-btn.mh-filter-active {
  border-color: #333;
  color: #333;
  font-weight: 600;
  background-color: var(--color-surface, #faf7f2);
}

/* "Rensa filter" text button. !important on background/color/border is
   needed because the Storefront customizer prints inline `button { ... }`
   rules in <head> AFTER all enqueued stylesheets — without these the
   button picks up the customizer brand button color (green) and inherits
   a white text-on-green look that fights the design. */
.mh-filter-reset {
  appearance: none !important;
  border: none !important;
  background: none !important;
  background-color: transparent !important;
  box-shadow: none !important;
  font-size: var(--text-xs, 0.8125rem) !important;
  font-weight: 500 !important;
  color: var(--color-text-muted, #888) !important;
  cursor: pointer;
  padding: 7px 10px !important;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-transform: none !important;
  font-family: inherit;
  letter-spacing: normal;
  line-height: 1.4;
}
.mh-filter-reset:hover,
.mh-filter-reset:focus {
  background: none !important;
  background-color: transparent !important;
  color: var(--color-text, #1a1a1a) !important;
  outline: none;
}

.mh-filter-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  z-index: 100;
  min-width: 180px;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px 0;
}
.mh-filter-panel.mh-filter-open {
  display: block;
}

.mh-filter-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mh-filter-option {
  padding: var(--space-xs, 8px) var(--space-md, 16px);
  font-size: var(--text-xs, 0.8125rem);
  color: #333;
  cursor: pointer;
  transition: background 0.1s ease;
  white-space: nowrap;
}
.mh-filter-option:hover {
  background: var(--color-surface, #faf7f2);
}
.mh-filter-option.mh-filter-selected {
  font-weight: 600;
  color: #333;
}

/* ══════════════════════════════════════════════════
   PRODUCT GRID — CSS Grid, responsive columns
   ══════════════════════════════════════════════════ */

ul.products {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  width: 100%;
}

/* ── Subcategory row (JS-separated from product grid) ── */
ul.mh-subcategories {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  width: 100%;
  margin-bottom: var(--space-xl);
  list-style: none;
  padding: 0;
}

/* Kill Storefront's float-layout ::before pseudo-element — it becomes a ghost grid item */
ul.products::before,
ul.products::after,
ul.mh-subcategories::before,
ul.mh-subcategories::after {
  display: none !important;
  content: none !important;
}

/* Pagination */
.woocommerce-pagination {
  text-align: left;
  margin: var(--space-xl) 0 0;
  float: none;
}
.woocommerce-pagination .page-numbers li .page-numbers.current {
  background-color: #333;
  border-color: #333;
  color: #fff;
}
.woocommerce-pagination .page-numbers li .page-numbers {
  border-radius: 4px;
}

/* Hide sorting bar */
.storefront-sorting {
  display: none;
}

/* ── Product items ── */
ul.products li.product {
  transition: none;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  text-align: left;
  overflow: visible;
  display: flex;
  flex-direction: column;
  box-shadow: none;
  transform: none;
}
ul.products li.product:hover {
  transform: none;
  box-shadow: none;
}

/* ── Section headings (subcats / products) ── */
.mh-section-heading {
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
  margin: 0 0 var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border, #e5e5e5);
  width: 100%;
}
.mh-section-heading--products {
  margin-top: var(--space-xl);
}

/* ── Subcategory cards ──
   Two .product selectors (same trick as the IMG override below) to outrank any
   legacy ul.products li.product rule that resets border-radius on the homepage.
   Defensive: also re-state the radius scoped to the homepage section so any
   cascade tie with `.home ul.products li.product`-style legacy rules can't
   strip the rounded corner. */
ul.products li.product.product-category,
.page-template-template-homepage .storefront-product-categories ul.products li.product.product-category,
.home .storefront-product-categories ul.products li.product.product-category {
  background: var(--color-surface-alt, #faf7f2);
  border: 1px solid var(--color-border, #ececec);
  border-radius: 18px;
  overflow: hidden;
  transition: border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}
ul.products li.product-category a {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  height: 100%;
}
/* Two .product selectors here to beat the legacy ul.products li.product.product-category img
   rule in archive-woocommerce-base.css:292 which sets margin-bottom: 1.618em.
   transform-origin: center bottom pins the bottom edge so the hover scale only
   grows upward (clipped by the LI's overflow:hidden) — no apparent baseline drop. */
ul.products li.product.product-category a img {
  border-radius: 0;
  margin: 0;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  transform-origin: center bottom;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
ul.products li.product-category:hover a img {
  transform: scale(1.04);
}
ul.products li.product-category a:hover h2,
ul.products li.product-category a:hover .woocommerce-loop-category__title {
  color: var(--color-accent, #b8860b);
}
ul.products li.product-category h2,
ul.products li.product-category .woocommerce-loop-category__title {
  font-size: var(--text-base);
  font-weight: 600;
  padding: 16px 18px 18px;
  margin: 0;
  color: var(--color-text);
  line-height: 1.3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  /* Let long category names ("Heltäckningsmattor") wrap inside the card
     instead of getting clipped at the right edge. overflow-wrap: anywhere
     applies to the anonymous text node that flex layout places next to the
     count <mark>; min-width: 0 lets the flex line shrink below content. */
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
ul.products li.product-category h2 mark.count,
ul.products li.product-category .woocommerce-loop-category__title mark.count {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.1);
  font-weight: 500;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-left: auto;
  padding: 2px 10px;
  border-radius: 999px;
  line-height: 1.5;
  min-width: 32px;
  text-align: center;
}

/* ── Product cards ── */
ul.products li.product a.woocommerce-LoopProduct-link {
  display: block;
  overflow: hidden;
  border-radius: 8px;
}
ul.products li.product:not(.product-category) a img {
  border-radius: 8px;
  margin-bottom: 0;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  transform-origin: center bottom;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
ul.products li.product:hover a img {
  transform: scale(1.04);
}
ul.products li.product:hover h2,
ul.products li.product:hover h3,
ul.products li.product:hover .woocommerce-loop-product__title {
  color: var(--color-accent, #b8860b);
}
ul.products li.product h2,
ul.products li.product h3 {
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1.4;
  margin: 0;
  padding: var(--space-md) 0 0;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
ul.products li.product span.excerpt {
  display: none;
}
ul.products li.product > a {
  display: flex;
  flex-direction: column;
  flex: 1;
  text-decoration: none;
}

/* ── Price block ── */
ul.products li.product .price,
ul.products li.product .price-block {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: var(--space-xs) 0 0;
  padding: 0;
  color: var(--color-price);
  line-height: 1.3;
}

/* Default price */
ul.products li.product .price-block .default_price {
  display: block;
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-price);
}

/* Sale: original price — muted grey strikethrough */
ul.products li.product .price-block .old_price {
  display: block;
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-price-old);
  text-decoration: line-through;
}

/* Sale: current price — brand accent */
ul.products li.product .price-block .sale_price {
  display: block;
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-price-sale);
}

/* WooCommerce default price markup (del/ins) */
ul.products li.product .price del {
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-price-old);
  opacity: 1;
}
ul.products li.product .price ins {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-price-sale);
  text-decoration: none;
}

/* "fr." prefix — small, muted, inline with price */
ul.products li.product .price-block .mh-price-from {
  display: inline;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.2em;
}

/* ── Meta (color count etc.) ── */
ul.products li.product .mh-color-count {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  margin-top: var(--space-2xs);
  letter-spacing: 0.02em;
}

/* ══════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════ */

/* Tablet: 3 columns */
@media (min-width: 768px) and (max-width: 1199px) {
  ul.products,
  ul.mh-subcategories {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

/* Mobile */
@media (max-width: 767px) {
  /* Tighten the area between the mobile nav band and the breadcrumb. The
     desktop layout has a deeper visual rest above the H1; on mobile we want
     content to start closer to the header. Targets the .col-full.test that
     wraps the archive's breadcrumb + #primary + #main. */
  .woocommerce.archive #content.site-content > .col-full.test,
  .woocommerce-page.archive #content.site-content > .col-full.test,
  .tax-product_cat #content.site-content > .col-full.test,
  .tax-product_tag #content.site-content > .col-full.test,
  .search #content.site-content > .col-full.test {
    padding-top: 0 !important;
    margin-top: 0 !important;
  }
  .woocommerce.archive .storefront-breadcrumb,
  .woocommerce-page.archive .storefront-breadcrumb,
  .tax-product_cat .storefront-breadcrumb,
  .tax-product_tag .storefront-breadcrumb,
  .search .storefront-breadcrumb {
    padding-top: var(--space-sm);
    margin-top: 0;
  }

  .cat-banner h1 {
    font-size: 1.75rem;
    margin: var(--space-sm) 0 var(--space-2xs);
  }

  ul.products,
  ul.mh-subcategories {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }

  /* Mobile: horizontal scroll filters */
  #main > #secondary.widget-area {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: var(--space-xs);
    padding: var(--space-sm) 0;
  }
  #secondary .widget_nav_menu {
    display: none;
  }
  #secondary .widget {
    flex-shrink: 0;
    margin: 0;
  }
  #secondary select {
    display: none;
  }

  .mh-filter-btn {
    font-size: 13px;
    padding: 8px 30px 8px 14px;
    min-height: 36px;
  }
  /* Mobile bottom-sheet. The handheld footer bar has been removed (PR2),
     so this now sits flush with the viewport bottom (bottom: 0) and uses
     env(safe-area-inset-bottom) padding for iOS home-indicator clearance.
     z-index sits above the body::before backdrop (9998). */
  .mh-filter-panel {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    border-radius: 16px 16px 0 0 !important;
    max-height: 70vh !important;
    min-width: unset !important;
    z-index: 10000 !important;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18) !important;
    padding: 8px 0 calc(12px + env(safe-area-inset-bottom)) !important;
    overflow-y: auto !important;
  }
  /* Translucent backdrop when a filter panel is open — dims the page so the
     bottom-sheet has visual separation. Body class added below. */
  body:has(.mh-filter-panel.mh-filter-open)::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 9998;
    pointer-events: none;
  }
  /* Inside the bottom-sheet, option rows get larger touch targets. */
  .mh-filter-panel .mh-filter-option {
    padding: 14px 20px;
    font-size: 15px;
    border-bottom: 1px solid #f0eeea;
  }
  .mh-filter-panel .mh-filter-option:last-child {
    border-bottom: 0;
  }

  /* Tighter card text on mobile */
  ul.products li.product h2,
  ul.products li.product h3 {
    font-size: var(--text-sm);
    padding-top: var(--space-sm);
  }

  ul.products li.product .price,
  ul.products li.product .price-block {
    font-size: var(--text-base);
  }
  ul.products li.product .price-block .default_price,
  ul.products li.product .price-block .sale_price {
    font-size: var(--text-base);
  }

  /* Card content allowlist — kill any plugin-injected badges/extras that
     overlap the canonical four items (thumb, title, price, color count).
     Targets the elements WC hooks inject via woocommerce_after_shop_loop_item_*
     (brand tags, attribute previews, calc readouts) which clip + overlap
     inside a narrow mobile card. */
  ul.products li.product { overflow: hidden; }
  ul.products li.product > a > *:not(img):not(.woocommerce-loop-product__title):not(h2):not(h3) {
    display: none !important;
  }
  ul.products li.product > *:not(a):not(.price-block):not(.price):not(.mh-color-count):not(.onsale):not(.added_to_cart):not(.star-rating):not(.button.add_to_cart_button) {
    display: none !important;
  }
  ul.products li.product .star-rating,
  ul.products li.product .button.add_to_cart_button,
  ul.products li.product .added_to_cart,
  ul.products li.product .button.product_type_simple,
  ul.products li.product .button.product_type_variable {
    display: none !important;
  }
}

/* ══════════════════════════════════════════════════
   HOMEPAGE SECTIONS
   Storefront outputs <section class="storefront-product-section ..."> for
   New In / We Recommend / Fan Favorites etc. Give them breathing room.
   ══════════════════════════════════════════════════ */
.page-template-template-homepage .storefront-product-section {
  margin-top: var(--space-3xl);
  margin-bottom: var(--space-3xl);
}
/* First section sits below the campaign carousel — give it an extra-generous
   gap (1.5× the section rhythm) so the dense campaign block has clear visual
   separation from the categories header. */
.page-template-template-homepage .storefront-product-section:first-of-type {
  margin-top: calc(var(--space-3xl) * 1.5);
}

.page-template-template-homepage .storefront-product-section .section-title {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-lg);
}

@media (max-width: 767px) {
  /* Mirror the desktop first-of-type override on mobile too — without this,
     the uniform `margin-top: var(--space-2xl)` below would clobber the
     extra gap above. */
  .page-template-template-homepage .storefront-product-section:first-of-type {
    margin-top: calc(var(--space-2xl) * 1.5);
  }

  .page-template-template-homepage .storefront-product-section {
    margin-top: var(--space-2xl);
    margin-bottom: var(--space-2xl);
  }
}

/* ── Brand cards (Shop by Brand) ── */
.mh-brand-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  list-style: none;
  padding: 0;
  margin: 0;
}
.mh-brand-grid::before,
.mh-brand-grid::after {
  display: none !important;
  content: none !important;
}
.mh-brand-card {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mh-brand-card__link {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3 / 2;
  padding: var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.mh-brand-card__link:hover {
  border-color: var(--color-text);
  background: #fff;
  transform: translateY(-1px);
}
.mh-brand-card__name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  text-align: center;
  line-height: 1.25;
  letter-spacing: -0.005em;
}
.mh-brand-card img {
  max-width: 100%;
  max-height: 70%;
  object-fit: contain;
}

@media (max-width: 767px) {
  .mh-brand-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }
  .mh-brand-card__name {
    font-size: var(--text-sm);
  }
}
