/* Kodumarket Julge — product archive / shop / category pages
 *
 * Structure:
 *   .km-archive             — root wrap
 *     .km-arch-hero         — light hero with breadcrumb, H1, metrics
 *     .km-arch-grid         — 2-col: sidebar + main
 *       .km-arch-side       — 280px sidebar (sticky)
 *       .km-arch-main       — results
 *         .km-arch-toolbar  — count + sort
 *         .km-arch-chips    — active filter chips
 *         .km-arch-grid__products  — the WC product UL
 *         .km-arch-pagination
 *         .km-arch-empty    — empty state
 *
 * Product cards (.km-hp-card) inside the grid inherit styles from
 * home.css — we only tweak the archive-specific layout bits here.
 *
 * Loaded only on archives via functions.php.
 */

/* =========================================================================
   ROOT
   ========================================================================= */
.km-archive {
  width: 100%;
}

/* =========================================================================
   HERO — light treatment (header is also light on archives)
   ========================================================================= */
.km-arch-hero {
  background: #fff;
  border-bottom: 1px solid var(--km-line);
  padding: 32px 48px 40px;
}
.km-arch-hero__inner {
  max-width: 1680px;
  margin: 0 auto;
}

/* Breadcrumb (uses .km-breadcrumb styles from components.css) */
.km-arch-hero .km-breadcrumb {
  margin-bottom: 16px;
}

/* Title row: H1 on the left, description on the right.
 * align-items: flex-start keeps the H1 anchored to the top so a long
 * category description doesn't push the title down with empty space.
 * Description is clamped to 5 lines — full text remains accessible
 * via "Loe lähemalt" or simply by clicking the H1's category page. */
.km-arch-hero__title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
  margin-top: 8px;
}
.km-arch-hero__title {
  font-size: clamp(40px, 6vw, 72px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.95;
  margin: 0;
  flex: 1;
  text-wrap: balance;
  color: var(--km-ink);
}
.km-arch-hero__desc {
  max-width: 360px;
  font-size: 14px;
  color: var(--km-ink-3);
  line-height: 1.55;
  margin: 0;
  text-wrap: pretty;
  /* Cap to 5 lines of body copy so the hero stays compact even when
   * the category has a long editorial description. */
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Metrics row */
.km-arch-hero__metrics {
  display: flex;
  gap: 40px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.km-arch-hero__metric-num {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--km-ink);
  margin-bottom: 4px;
}
.km-arch-hero__metric-label {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--km-ink-4);
}

/* =========================================================================
   GRID: sidebar + main
   ========================================================================= */
.km-arch-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  align-items: start;
}

/* =========================================================================
   SIDEBAR
   ========================================================================= */
.km-arch-side {
  padding: 24px 24px 40px 48px;
  border-right: 1px solid var(--km-line);
  font-size: 13px;
  align-self: stretch;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
}
.km-arch-side::-webkit-scrollbar { width: 4px; }
.km-arch-side::-webkit-scrollbar-thumb { background: var(--km-line); border-radius: 2px; }

.km-arch-side__block {
  margin-bottom: 28px;
}
.km-arch-side__label {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--km-ink-4);
  margin-bottom: 12px;
}

/* Category list */
.km-arch-side__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.km-arch-side__item a {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--km-line);
  text-decoration: none;
  color: var(--km-ink-2);
  transition: color .12s, padding-left .12s;
}
.km-arch-side__item a:hover {
  color: var(--km-ink);
  padding-left: 4px;
}
.km-arch-side__item--active a {
  color: var(--km-ink);
  font-weight: 600;
}
.km-arch-side__item-n {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 10px;
  color: var(--km-ink-4);
}
.km-arch-side__item-name {
  font-size: 14px;
  line-height: 1.3;
}
.km-arch-side__item--active .km-arch-side__item-name { font-weight: 600; }
.km-arch-side__item-count {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--km-ink-4);
}

/* Price range */
.km-arch-side__price-inputs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 6px;
  align-items: center;
}
.km-arch-side__price input[type="number"] {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--km-line);
  border-radius: 8px;
  font: 500 12px/1 "Geist Mono", ui-monospace, monospace;
  color: var(--km-ink);
  background: #fff;
  letter-spacing: .04em;
  transition: border-color .12s;
  -moz-appearance: textfield;
}
.km-arch-side__price input[type="number"]::-webkit-outer-spin-button,
.km-arch-side__price input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.km-arch-side__price input[type="number"]:focus {
  outline: none;
  border-color: var(--km-ink);
}
.km-arch-side__price-sep {
  font-family: "Geist Mono", monospace;
  color: var(--km-ink-4);
  font-size: 14px;
}
.km-arch-side__price-btn {
  margin-top: 10px;
  width: 100%;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: var(--km-ink);
  color: #fff;
  font: 600 12px/1 "Geist", sans-serif;
  letter-spacing: .02em;
  cursor: pointer;
  transition: background .12s;
}
.km-arch-side__price-btn:hover { background: #000; }

/* Brand search input (shown only if 8+ brands) */
.km-arch-side__brand-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  margin-bottom: 8px;
  background: var(--km-surface-2, #F5F5F2);
  border: 1px solid var(--km-line);
  border-radius: 10px;
  transition: border-color .15s ease, background .15s ease;
}
.km-arch-side__brand-search:focus-within {
  border-color: var(--km-ink-3);
  background: #fff;
}
.km-arch-side__brand-search svg {
  width: 14px;
  height: 14px;
  color: var(--km-ink-4);
  flex-shrink: 0;
}
.km-arch-side__brand-search input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font: 400 13px/1.3 'Geist', -apple-system, sans-serif;
  color: var(--km-ink);
  min-width: 0;
  padding: 0;
}
.km-arch-side__brand-search input::placeholder {
  color: var(--km-ink-4);
}

/* Hidden brand (filtered out by JS search) */
.km-arch-side__brand[hidden] { display: none !important; }

/* Brand checkbox list */
.km-arch-side__brands {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}
/* Thin scrollbar for long brand lists */
.km-arch-side__brands::-webkit-scrollbar { width: 4px; }
.km-arch-side__brands::-webkit-scrollbar-thumb {
  background: var(--km-line);
  border-radius: 2px;
}
.km-arch-side__brand a {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 7px 0;
  text-decoration: none;
  color: var(--km-ink-2);
  transition: color .12s;
}
.km-arch-side__brand a:hover { color: var(--km-ink); }
.km-arch-side__checkbox {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--km-line);
  border-radius: 4px;
  display: grid;
  place-items: center;
  transition: background .12s, border-color .12s;
}
.km-arch-side__brand.is-active .km-arch-side__checkbox {
  background: var(--km-ink);
  border-color: var(--km-ink);
  color: #fff;
}
.km-arch-side__checkbox svg { width: 10px; height: 10px; stroke-width: 2.5; }
.km-arch-side__brand-name {
  font-size: 13px;
  line-height: 1.2;
}
.km-arch-side__brand.is-active .km-arch-side__brand-name { font-weight: 600; color: var(--km-ink); }
.km-arch-side__brand-count {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--km-ink-4);
}

/* Clear-all link */
.km-arch-side__clear {
  display: inline-block;
  margin-top: 8px;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--km-ink-3);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color .12s;
}
.km-arch-side__clear:hover { color: var(--km-sale); }

/* =========================================================================
   MAIN (results) — toolbar + grid + pagination
   ========================================================================= */
.km-arch-main {
  padding: 24px 48px 48px;
  min-width: 0;
}

/* Toolbar: count + sort */
.km-arch-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--km-line);
  flex-wrap: wrap;
}
.km-arch-toolbar__count {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 13px;
  color: var(--km-ink-3);
  letter-spacing: .02em;
}
.km-arch-toolbar__count strong {
  color: var(--km-ink);
  font-weight: 700;
}
.km-arch-toolbar__right {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* WooCommerce's built-in catalog_ordering form — restyle it */
.km-arch-toolbar__sort .woocommerce-ordering {
  margin: 0;
}
.km-arch-toolbar__sort select,
.km-arch-toolbar__sort .orderby {
  height: 40px;
  padding: 0 32px 0 14px;
  border: 1px solid var(--km-line);
  border-radius: 8px;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230A1628' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 10px center;
  background-size: 12px;
  font: 500 13px/1 "Geist", sans-serif;
  color: var(--km-ink);
  appearance: none;
  cursor: pointer;
  transition: border-color .12s;
}
.km-arch-toolbar__sort select:focus {
  outline: none;
  border-color: var(--km-ink);
}

/* Active filter chips */
.km-arch-chips {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.km-arch-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 12px;
  background: var(--km-surface-2);
  border-radius: 999px;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--km-ink);
  text-decoration: none;
  transition: background .12s;
}
.km-arch-chip:hover { background: var(--km-surface-3); color: var(--km-ink); }
.km-arch-chip svg { width: 12px; height: 12px; color: var(--km-ink-3); }
.km-arch-chip--clear {
  background: transparent;
  color: var(--km-ink-3);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 6px 8px;
}
.km-arch-chip--clear:hover { color: var(--km-sale); background: transparent; }

/* =========================================================================
   PRODUCT GRID — overrides WooCommerce's default .products UL
   ========================================================================= */
.km-arch-main .km-arch-grid__products,
.km-pdp .km-arch-grid__products {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 16px !important;
  width: 100% !important;
}
.km-arch-main .km-arch-grid__products.columns-4,
.km-pdp .km-arch-grid__products.columns-4 { grid-template-columns: repeat(4, 1fr) !important; }
.km-arch-main .km-arch-grid__products.columns-2,
.km-pdp .km-arch-grid__products.columns-2 { grid-template-columns: repeat(2, 1fr) !important; }

/* Products inside the grid: add position:relative so the absolute add-to-cart
   button from content-product.php anchors correctly. */
.km-hp-card--loop {
  position: relative;
}
.km-hp-card--loop .km-hp-card__link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  height: 100%;
}
.km-hp-card--loop:hover .km-hp-card__link { color: inherit; }
.km-hp-card--loop .km-hp-card__add {
  position: absolute;
  bottom: 18px;
  right: 18px;
  z-index: 2;
}

/* Out-of-stock badge variant */
.km-hp-card__badge--out {
  background: var(--km-ink-4) !important;
  left: auto;
  right: 10px;
}

/* Loading state for ajax add-to-cart */
.km-hp-card__add.loading {
  opacity: .6;
  pointer-events: none;
}
.km-hp-card__add.added::after {
  content: "✓";
  font-family: "Geist Mono", monospace;
  font-size: 14px;
}

/* =========================================================================
   PAGINATION
   ========================================================================= */
.km-arch-pagination {
  margin-top: 40px;
  display: flex;
  justify-content: center;
}
.km-arch-pagination__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.km-arch-pagination__item {
  display: inline-flex;
}
.km-arch-pagination a,
.km-arch-pagination span {
  min-width: 40px;
  height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--km-line);
  background: transparent;
  font: 500 13px/1 "Geist Mono", ui-monospace, monospace;
  color: var(--km-ink-2);
  text-decoration: none;
  transition: background .12s, color .12s, border-color .12s;
}
.km-arch-pagination a:hover {
  background: var(--km-surface-2);
  color: var(--km-ink);
  border-color: var(--km-ink-4);
}
.km-arch-pagination .current {
  background: var(--km-ink);
  color: #fff;
  border-color: var(--km-ink);
  font-weight: 700;
}
.km-arch-pagination .dots {
  border-color: transparent;
  color: var(--km-ink-4);
}

/* =========================================================================
   EMPTY STATE
   ========================================================================= */
.km-arch-empty {
  padding: 80px 24px;
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
}
.km-arch-empty__n {
  font-family: "Geist", sans-serif;
  font-size: 72px;
  font-weight: 300;
  color: var(--km-ink-4);
  line-height: 1;
  margin-bottom: 16px;
}
.km-arch-empty__title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--km-ink);
  margin-bottom: 12px;
}
.km-arch-empty__desc {
  font-size: 14px;
  color: var(--km-ink-3);
  line-height: 1.55;
  margin: 0 0 24px;
}

/* =========================================================================
   WC/GP OVERRIDE LAYER
   WooCommerce and GeneratePress inject product loop styles that beat our
   own on specificity. We explicitly neutralize them here.
   Scoped strictly to `.km-arch-grid__products .km-hp-card--loop` so we
   don't affect the front-page cards.
   ========================================================================= */
.km-arch-grid__products {
  list-style: none !important;
}
.km-arch-grid__products .km-hp-card--loop {
  /* Reset any width / margin injected by .woocommerce ul.products li.product */
  width: auto !important;
  float: none !important;
  margin: 0 !important;
  padding: 18px !important;
  background: #fff !important;
  border: 1px solid var(--km-line-soft) !important;
  border-radius: var(--km-r-lg) !important;
  box-sizing: border-box !important;
  text-align: left !important;
  clear: none !important;
  display: flex !important;
  flex-direction: column !important;
  position: relative !important;
}
.km-arch-grid__products .km-hp-card--loop:hover {
  transform: translateY(-2px);
  box-shadow: var(--km-shadow-md);
}
.km-arch-grid__products .km-hp-card--loop .km-hp-card__link {
  display: flex !important;
  flex-direction: column !important;
  text-decoration: none !important;
  color: var(--km-ink) !important;
  flex: 1;
  min-height: 0;
}
.km-arch-grid__products .km-hp-card__meta {
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-between !important;
  align-items: center !important;
  text-align: left !important;
  margin: 0 0 10px !important;
  font: 500 10px/1 "Geist Mono", ui-monospace, monospace !important;
  letter-spacing: .08em !important;
  text-transform: uppercase !important;
  color: var(--km-ink-4) !important;
}
.km-arch-grid__products .km-hp-card__img {
  aspect-ratio: 1 / 1 !important;
  background: var(--km-surface-2) !important;
  border-radius: 14px !important;
  padding: 20px !important;
  margin: 0 0 14px !important;
  position: relative !important;
  display: grid !important;
  place-items: center !important;
  overflow: hidden !important;
  width: auto !important;
  max-width: none !important;
}
.km-arch-grid__products .km-hp-card__img img {
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
}
.km-arch-grid__products .km-hp-card__title {
  font-size: 17px !important;
  font-weight: 500 !important;
  letter-spacing: -0.02em !important;
  line-height: 1.25 !important;
  margin: 0 0 4px !important;
  text-align: left !important;
  color: var(--km-ink) !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.km-arch-grid__products .km-hp-card__size {
  font: 500 11px/1.3 "Geist Mono", ui-monospace, monospace !important;
  color: var(--km-ink-4) !important;
  margin: 0 0 14px !important;
  text-align: left !important;
}
.km-arch-grid__products .km-hp-card__spacer {
  flex: 1 !important;
}
.km-arch-grid__products .km-hp-card__foot {
  display: flex !important;
  align-items: flex-end !important;
  justify-content: space-between !important;
  padding-top: 12px !important;
  border-top: 1px solid var(--km-line-soft) !important;
  gap: 12px !important;
  margin: 0 !important;
}
.km-arch-grid__products .km-hp-card__price {
  font-size: 22px !important;
  font-weight: 700 !important;
  letter-spacing: -0.03em !important;
  line-height: 1 !important;
  color: var(--km-ink) !important;
}
.km-arch-grid__products .km-hp-card__price:empty::after {
  /* Show a subtle "Hind puudub" placeholder when price_html is empty */
  content: "—";
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 13px;
  color: var(--km-ink-4);
  font-weight: 400;
}
.km-arch-grid__products .km-hp-card__badge {
  position: absolute !important;
  bottom: 10px !important;
  left: 10px !important;
  right: auto !important;
  top: auto !important;
  background: var(--km-ink) !important;
  color: #fff !important;
  font: 700 10px/1 "Geist Mono", ui-monospace, monospace !important;
  padding: 4px 8px !important;
  border-radius: 999px !important;
  letter-spacing: .04em !important;
  margin: 0 !important;
}
.km-arch-grid__products .km-hp-card__badge--out {
  background: var(--km-ink-4) !important;
  left: auto !important;
  right: 10px !important;
  bottom: 10px !important;
  top: auto !important;
}
.km-arch-grid__products .km-hp-card__add {
  position: absolute !important;
  bottom: 18px !important;
  right: 18px !important;
  z-index: 2 !important;
  width: 44px !important;
  height: 44px !important;
  padding: 0 !important;
  border-radius: 999px !important;
  background: var(--km-ink) !important;
  color: #fff !important;
  border: 0 !important;
  display: grid !important;
  place-items: center !important;
  min-width: 0 !important;
  line-height: 1 !important;
  text-decoration: none !important;
  font-size: 0 !important;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.km-arch-grid__products .km-hp-card__add:hover {
  transform: scale(1.08) !important;
  background: #000 !important;
  color: #fff !important;
}
.km-arch-grid__products .km-hp-card__add svg {
  width: 18px !important;
  height: 18px !important;
  stroke-width: 2 !important;
  display: block !important;
}

/* Kill WC's "Out of stock" visual clutter that sometimes overlays images */
.km-arch-grid__products .km-hp-card--loop .outofstock-badge,
.km-arch-grid__products .km-hp-card--loop .wc-forward,
.km-arch-grid__products .km-hp-card--loop .out-of-stock,
.km-arch-grid__products .km-hp-card--loop .stock,
.km-arch-grid__products .km-hp-card--loop .onsale:not(.km-hp-card__badge),
.km-arch-grid__products .km-hp-card--loop .added_to_cart,
.km-arch-grid__products .km-hp-card--loop .button:not(.km-hp-card__add) { display: none !important; }

/* Hide "Out of stock" overlay pseudo-elements that some themes add */
.km-arch-grid__products .km-hp-card--loop::before,
.km-arch-grid__products .km-hp-card--loop::after,
.km-arch-grid__products .km-hp-card__img::before,
.km-arch-grid__products .km-hp-card__img::after {
  content: none !important;
}
@media (max-width: 1200px) {
  .km-arch-grid__products,
  .km-arch-grid__products.columns-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
  .km-arch-hero { padding: 24px 24px 32px; }
  .km-arch-hero__title-row { flex-direction: column; align-items: flex-start; gap: 16px; }
  .km-arch-hero__desc { margin-bottom: 0; max-width: none; }

  .km-arch-grid { grid-template-columns: 1fr; }
  .km-arch-side {
    position: static;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--km-line);
    padding: 24px;
  }
  .km-arch-main { padding: 24px; }

  .km-arch-grid__products,
  .km-arch-grid__products.columns-4,
  .km-arch-grid__products.columns-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .km-arch-hero { padding: 20px 16px 24px; }
  .km-arch-hero__title { font-size: 34px; }
  .km-arch-hero__metrics { gap: 24px; margin-top: 20px; }
  .km-arch-hero__metric-num { font-size: 28px; }
  .km-arch-side { padding: 20px 16px; }
  .km-arch-main { padding: 20px 16px 40px; }
  .km-arch-toolbar { flex-direction: column; align-items: flex-start; gap: 12px; }
  .km-arch-toolbar__right { width: 100%; }
  .km-arch-toolbar__sort .woocommerce-ordering { width: 100%; }
  .km-arch-toolbar__sort select { width: 100%; }
  .km-arch-grid__products,
  .km-arch-grid__products.columns-4,
  .km-arch-grid__products.columns-3,
  .km-arch-grid__products.columns-2,
  .km-arch-main .km-arch-grid__products,
  .km-arch-main .km-arch-grid__products.columns-4,
  .km-arch-main .km-arch-grid__products.columns-3,
  .km-arch-main .km-arch-grid__products.columns-2 {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .km-arch-grid__products .km-hp-card,
  .km-arch-grid__products > * {
    min-width: 0;
    max-width: 100%;
  }

  /* ============================================================
     v1.7.23 — Subcategories: scroll-snap carousel on mobile.
     Visual treatment: large rounded chip cards with number + name
     + count. Active state highlighted in brand green.
     Full-bleed: extends past .km-arch-side's 16px side padding
     so peek sits flush against the viewport edge.
     ============================================================ */
  .km-arch-side__block--cats {
    margin-left: -16px;
    margin-right: -16px;
    margin-bottom: 24px;
    padding: 0;
    border-bottom: 1px solid var(--km-line);
    padding-bottom: 24px;
  }
  .km-arch-side__block--cats .km-arch-side__label {
    padding: 0 16px;
    margin-bottom: 14px;
  }
  .km-arch-side__list--cats {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x mandatory;
    scroll-padding-inline-start: 16px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    padding: 4px 16px 4px;
    margin: 0;
    list-style: none;
    scrollbar-width: none;
  }
  .km-arch-side__list--cats::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }
  .km-arch-side__list--cats .km-arch-side__item {
    flex: 0 0 auto;
    min-width: 0;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }
  .km-arch-side__list--cats .km-arch-side__item a {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 4px;
    align-items: start;
    padding: 14px 16px;
    border: 1px solid var(--km-line);
    border-bottom: 1px solid var(--km-line); /* override base no-bottom */
    border-radius: 16px;
    background: #fff;
    min-width: 168px;
    max-width: 240px;
    transition: border-color .15s, background .15s, color .15s, padding-left .15s ease;
  }
  /* Reset desktop hover that shifts padding-left */
  .km-arch-side__list--cats .km-arch-side__item a:hover {
    padding-left: 16px;
    border-color: var(--km-ink);
  }
  .km-arch-side__list--cats .km-arch-side__item--active a {
    background: var(--km-green-500);
    border-color: var(--km-green-500);
    color: var(--km-ink);
  }
  .km-arch-side__list--cats .km-arch-side__item--active a:hover {
    border-color: var(--km-green-700, #047857);
  }
  .km-arch-side__list--cats .km-arch-side__item-n {
    grid-row: 1;
    grid-column: 1;
    font-size: 10px;
    align-self: center;
  }
  .km-arch-side__list--cats .km-arch-side__item-name {
    grid-row: 1 / 3;
    grid-column: 2;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    color: inherit;
  }
  .km-arch-side__list--cats .km-arch-side__item-count {
    grid-row: 2;
    grid-column: 1;
    font-size: 10px;
    color: inherit;
    opacity: .65;
  }
  .km-arch-side__list--cats .km-arch-side__item--active .km-arch-side__item-n,
  .km-arch-side__list--cats .km-arch-side__item--active .km-arch-side__item-count {
    color: var(--km-ink);
    opacity: .7;
  }
}

/* ===========================================================
 * v1.7.47: Subcategory tile cards
 *
 * Renders below the category hero, above the products grid.
 * Visible only on parent categories (those with children).
 * Each tile = image + name + product count, links to subcategory.
 * Layout: 2 cols mobile → 3 cols tablet → 4 cols desktop.
 * Visual style follows the rest of the theme: subtle borders,
 * tight grid, monospace count labels.
 * =========================================================== */
.km-arch-subcats {
  padding: 0 32px 48px;
}
.km-arch-subcats__inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.km-arch-subcat-tile {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--km-line, rgba(10, 22, 40, .08));
  border-radius: 16px;
  background: var(--km-surface-1, #fff);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.km-arch-subcat-tile:hover {
  transform: translateY(-2px);
  border-color: var(--km-green-500, #10B981);
  box-shadow: 0 8px 24px rgba(10, 22, 40, .08);
}
.km-arch-subcat-tile__media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--km-surface-2, #F4F6F8);
  overflow: hidden;
}
.km-arch-subcat-tile__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}
.km-arch-subcat-tile:hover .km-arch-subcat-tile__media img {
  transform: scale(1.04);
}
.km-arch-subcat-tile__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 56px/1 "Geist", sans-serif;
  color: var(--km-green-500, #10B981);
  opacity: .35;
  letter-spacing: -0.02em;
}
.km-arch-subcat-tile__body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.km-arch-subcat-tile__title {
  margin: 0;
  font: 600 15px/1.3 "Geist", sans-serif;
  letter-spacing: -0.01em;
  color: var(--km-ink, #0A1628);
}
.km-arch-subcat-tile__count {
  font: 500 11px/1 "Geist Mono", ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--km-ink, #0A1628);
  opacity: .55;
}

/* Mobile: smaller tiles, 2 columns */
@media (max-width: 640px) {
  .km-arch-subcats {
    padding: 0 16px 32px;
  }
  .km-arch-subcats__inner {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .km-arch-subcat-tile__body {
    padding: 10px 12px 12px;
  }
  .km-arch-subcat-tile__title {
    font-size: 13px;
  }
  .km-arch-subcat-tile__count {
    font-size: 10px;
  }
  .km-arch-subcat-tile__placeholder {
    font-size: 36px;
  }
}

/* ===========================================================
 * v1.7.48: Sidebar search trigger
 *
 * Faux-input button that visually looks like a search field but
 * actually opens the main overlay (.km-search-overlay). Sits in
 * archive sidebar below Hind/Bränd. Saves us implementing a second
 * search input — overlay has all the smart features already.
 * =========================================================== */
.km-arch-side__search-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--km-line, rgba(10, 22, 40, .12));
  border-radius: 10px;
  background: var(--km-surface-2, #F4F6F8);
  color: var(--km-ink, #0A1628);
  font: 400 13px/1.2 "Geist", sans-serif;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.km-arch-side__search-trigger:hover {
  border-color: var(--km-green-500, #10B981);
  background: var(--km-surface-1, #fff);
  transform: translateY(-1px);
}
.km-arch-side__search-trigger:focus-visible {
  outline: 2px solid var(--km-green-500, #10B981);
  outline-offset: 2px;
}
.km-arch-side__search-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: .65;
}
.km-arch-side__search-trigger:hover .km-arch-side__search-icon {
  opacity: 1;
  color: var(--km-green-500, #10B981);
}
.km-arch-side__search-placeholder {
  flex: 1 1 auto;
  opacity: .55;
  font-size: 13px;
}
