/* Category listing page */

.category-page {
  background: #f7f6f3;
  min-height: 100vh;
}

.category-page__main {
  max-width: var(--layout-max, 1320px);
  margin: 0 auto;
  padding:
    clamp(1.25rem, 3.5vw, 2rem)
    max(var(--layout-gutter, clamp(0.9375rem, 2.85vw, 1.875rem)), env(safe-area-inset-right, 0))
    clamp(2rem, 5vw, 3.5rem)
    max(var(--layout-gutter, clamp(0.9375rem, 2.85vw, 1.875rem)), env(safe-area-inset-left, 0));
}

/* ── Two-column layout ───────────────────────────── */
.cat-layout {
  display: flex;
  gap: clamp(1rem, 2.5vw, 1.75rem);
  align-items: flex-start;
}

.cat-content {
  flex: 1;
  min-width: 0;
}

/* ── Mobile sidebar toggle btn ───────────────────── */
.cat-sidenav-toggle-btn {
  display: none;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  background: #fff;
  border: 1.5px solid #e0dbd5;
  border-radius: 8px;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #444;
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s;
}

.cat-sidenav-toggle-btn:hover {
  border-color: #c41e3a;
  color: #c41e3a;
}

.cat-sidenav-toggle-btn__chevron {
  margin-left: auto;
  font-size: 0.65rem;
  transition: transform 0.2s ease;
}

.cat-sidenav-toggle-btn[aria-expanded="true"] .cat-sidenav-toggle-btn__chevron {
  transform: rotate(180deg);
}

/* ── Side navigation panel ───────────────────────── */
.cat-sidenav {
  width: 242px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e8e4df;
  box-shadow: 0 2px 14px rgba(40, 28, 22, 0.05);
  overflow: hidden;
  position: sticky;
  /* Sit below the sticky site header (~5rem tall) so it doesn't tuck under it on scroll */
  top: 5.5rem;
  max-height: calc(100vh - 6.5rem);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
}

.cat-sidenav::-webkit-scrollbar {
  width: 4px;
}

.cat-sidenav::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 4px;
}

/* ── Header ──────────────────────────────────────── */
.cat-sidenav__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8a807a;
  background: #fbf9f7;
  border-bottom: 1px solid #eee7e1;
}

.cat-sidenav__header i {
  color: #c41e3a;
  font-size: 0.82rem;
}

/* ── Nav list ────────────────────────────────────── */
.cat-sidenav__list,
.cat-sidenav__sublist {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cat-sidenav__list {
  padding: 0.5rem 0;
}

.cat-sidenav__sublist[hidden] {
  display: none;
}

/* ── Shared link / toggle styles ─────────────────── */
.cat-sidenav__link,
.cat-sidenav__toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 1rem;
  border-top: none;
  border-right: none;
  border-bottom: none;
  border-left: 3px solid transparent;
  color: #444;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  background: none;
  cursor: pointer;
  text-align: left;
  line-height: 1.35;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.cat-sidenav__link:hover,
.cat-sidenav__toggle:hover {
  background: #faf7f4;
  color: #c41e3a;
  border-left-color: #f1cdd4;
}

.cat-sidenav__link.is-active {
  background: #fff5f7;
  color: #c41e3a;
  border-left-color: #c41e3a;
  font-weight: 700;
}

/* ── Depth indentation ───────────────────────────── */
.cat-sidenav__sublist > li > .cat-sidenav__link,
.cat-sidenav__sublist > li > .cat-sidenav__toggle,
.cat-sidenav__sublist > li > .cat-sidenav__split-row {
  padding-left: 1.85rem;
}

.cat-sidenav__sublist .cat-sidenav__sublist > li > .cat-sidenav__link,
.cat-sidenav__sublist .cat-sidenav__sublist > li > .cat-sidenav__toggle,
.cat-sidenav__sublist .cat-sidenav__sublist > li > .cat-sidenav__split-row {
  padding-left: 2.85rem;
}

.cat-sidenav__sublist .cat-sidenav__sublist .cat-sidenav__sublist > li > .cat-sidenav__link,
.cat-sidenav__sublist .cat-sidenav__sublist .cat-sidenav__sublist > li > .cat-sidenav__toggle {
  padding-left: 3.65rem;
}

/* ── Icons ───────────────────────────────────────── */
.cat-sidenav__icon {
  width: 1rem;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.8rem;
  color: #ab9f98;
  transition: color 0.15s;
}

.cat-sidenav__icon--img {
  width: 1.15rem;
  height: 1.15rem;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
}

.cat-sidenav__link:hover .cat-sidenav__icon,
.cat-sidenav__toggle:hover .cat-sidenav__icon,
.cat-sidenav__link.is-active .cat-sidenav__icon {
  color: #c41e3a;
}

/* ── Chevron on toggles ──────────────────────────── */
.cat-sidenav__chevron {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.6rem;
  color: #ccc;
  transition: transform 0.18s ease;
}

.cat-sidenav__toggle[aria-expanded="true"] .cat-sidenav__chevron {
  transform: rotate(90deg);
  color: #c41e3a;
}

/* ── Split row: link + separate expander ─────────── */
.cat-sidenav__split-row {
  display: flex;
  align-items: stretch;
  padding-left: 0; /* depth handled per-level above */
}

.cat-sidenav__split-row .cat-sidenav__link {
  flex: 1;
  padding-left: 0; /* split-row itself carries the indent */
  border-left: none;
}

/* Top-level split rows get the same 1rem left padding as link/toggle items */
.cat-sidenav__list > li > .cat-sidenav__split-row {
  padding-left: 1rem;
}

/* Override depth padding so the link text aligns with the row indent */
.cat-sidenav__list > li > .cat-sidenav__split-row .cat-sidenav__link {
  padding-left: 0;
}

.cat-sidenav__split-row .cat-sidenav__expander {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.85rem;
  background: none;
  border: none;
  cursor: pointer;
  border-left: 1px solid #f0ece7;
  transition: background 0.15s, color 0.15s;
}

.cat-sidenav__split-row .cat-sidenav__expander:hover {
  background: #faf7f4;
}

.cat-sidenav__split-row .cat-sidenav__expander[aria-expanded="true"] .cat-sidenav__chevron {
  transform: rotate(90deg);
  color: #c41e3a;
}

/* Active state for the split-row */
.cat-sidenav__split-row.is-active {
  border-left: 3px solid #c41e3a;
  background: #fff5f7;
}

.cat-sidenav__split-row.is-active .cat-sidenav__link {
  color: #c41e3a;
  font-weight: 700;
}

.cat-sidenav__split-row.is-active .cat-sidenav__icon {
  color: #c41e3a;
}

/* ── Section label (non-clickable heading) ───────── */
.cat-sidenav__section-label {
  display: block;
  padding: 0.6rem 1rem 0.25rem;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #bbb;
}

/* ── Divider (top-level list separator) ─────────── */
.cat-sidenav__divider {
  height: 1px;
  background: linear-gradient(to right, transparent, #d8d0c8 30%, #d8d0c8 70%, transparent);
  margin: 0.55rem 0.5rem;
}

/* ── Sublist item separators ─────────────────────── */
/* First-level sublist: very faint dotted rule */
.cat-sidenav__sublist > li + li {
  border-top: 1px dotted #ede9e4;
}

/* Second-level sublist (leaf items): even lighter, indented */
.cat-sidenav__sublist .cat-sidenav__sublist > li + li {
  border-top: 1px solid transparent;
  background-image: linear-gradient(to right, transparent 1.5rem, #f0ece8 1.5rem, #f0ece8 calc(100% - 0.75rem), transparent calc(100% - 0.75rem));
  background-repeat: no-repeat;
  background-size: 100% 1px;
  background-position: top;
}

/* ── Breadcrumb ──────────────────────────────────── */
.cat-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.55rem;
  margin-bottom: 1.1rem;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.8125rem;
  color: #888;
  list-style: none;
  padding: 0;
}

.cat-breadcrumb li:not(:last-child)::after {
  content: "›";
  margin-left: 0.55rem;
  color: #ccc;
}

.cat-breadcrumb a {
  color: #c41e3a;
  text-decoration: none;
}

.cat-breadcrumb a:hover {
  text-decoration: underline;
}

.cat-breadcrumb li:last-child {
  color: #555;
  font-weight: 600;
}

/* ── Page header ─────────────────────────────────── */
.cat-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
  margin-bottom: 1.35rem;
  padding-bottom: 0.85rem;
  border-bottom: 2px solid #c41e3a;
}

.cat-header__title {
  font-family: "Playfair Display", "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.5rem, 1.1rem + 1.5vw, 2rem);
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.02em;
  margin: 0;
}

.cat-header__count {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: #999;
  margin: 0;
}

/* ── Toolbar (sort + count) ──────────────────────── */
.cat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.cat-toolbar__left {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.8125rem;
  color: #888;
}

.cat-toolbar__right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.cat-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.38rem 0.8rem;
  border: 1.5px solid #e0dbd5;
  border-radius: 999px;
  background: #fff;
  color: #555;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, color 0.18s;
  white-space: nowrap;
  text-decoration: none;
}

.cat-filter-chip:hover {
  border-color: #c41e3a;
  color: #c41e3a;
}

.cat-filter-chip--active {
  border-color: #c41e3a;
  background: #c41e3a;
  color: #fff;
}

.cat-filter-chip--active:hover {
  background: #a91830;
  border-color: #a91830;
  color: #fff;
}

/* ── Subcategory filter pills ────────────────────── */
.cat-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
}

.cat-filter-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.36rem 0.85rem;
  border: 1.5px solid #e0dbd5;
  border-radius: 999px;
  background: #fff;
  color: #555;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.18s, background 0.18s, color 0.18s;
}

.cat-filter-pill:hover {
  border-color: #c41e3a;
  color: #c41e3a;
}

.cat-filter-pill--active {
  border-color: #c41e3a;
  background: #c41e3a;
  color: #fff;
}

.cat-filter-pill--active:hover {
  background: #a91830;
  border-color: #a91830;
  color: #fff;
}

.cat-sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.8125rem;
  color: #555;
}

.cat-sort__label {
  font-weight: 600;
  white-space: nowrap;
}

.cat-sort__select {
  padding: 0.42rem 0.85rem 0.42rem 0.65rem;
  border: 1.5px solid #e0dbd5;
  border-radius: 6px;
  background: #fff;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.8125rem;
  color: #333;
  cursor: pointer;
  appearance: auto;
  transition: border-color 0.18s;
}

.cat-sort__select:focus {
  outline: none;
  border-color: #c41e3a;
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

/* ── Product grid ────────────────────────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: clamp(0.85rem, 2vw, 1.35rem);
  align-items: start;
}

/* ── Empty state ─────────────────────────────────── */
.cat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 1.5rem 4rem;
  text-align: center;
}

.cat-empty__icon {
  font-size: 3.5rem;
  color: #e0dbd5;
  margin-bottom: 1.1rem;
  line-height: 1;
}

.cat-empty__title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 0.5rem;
}

.cat-empty__hint {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.9375rem;
  color: #777;
  margin: 0 0 1.5rem;
  max-width: 32ch;
  line-height: 1.5;
}

.cat-empty__cta {
  display: inline-block;
  padding: 0.7rem 1.75rem;
  border-radius: 6px;
  background: #c41e3a;
  color: #fff;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(196, 30, 58, 0.22);
  transition: background 0.18s;
}

.cat-empty__cta:hover {
  background: #a8182f;
}

/* ── Dark mode ───────────────────────────────────── */
[data-theme="dark"] .category-page {
  background: #111317;
}

[data-theme="dark"] .cat-sidenav {
  background: #1a1d22;
  border-color: #2a2d33;
}

[data-theme="dark"] .cat-sidenav__header {
  color: #8a8580;
  background: #15181c;
  border-bottom-color: #2a2d33;
}

[data-theme="dark"] .cat-sidenav__link,
[data-theme="dark"] .cat-sidenav__toggle {
  color: #a8a4a0;
}

[data-theme="dark"] .cat-sidenav__link:hover,
[data-theme="dark"] .cat-sidenav__toggle:hover {
  background: #222529;
  color: #e87a8a;
}

[data-theme="dark"] .cat-sidenav__link.is-active {
  background: #2a1820;
  color: #e87a8a;
  border-left-color: #c41e3a;
}

[data-theme="dark"] .cat-sidenav__split-row.is-active {
  background: #2a1820;
  border-left-color: #c41e3a;
}

[data-theme="dark"] .cat-sidenav__split-row.is-active .cat-sidenav__link {
  color: #e87a8a;
}

[data-theme="dark"] .cat-sidenav__divider {
  background: linear-gradient(to right, transparent, #2a2d33 30%, #2a2d33 70%, transparent);
}

[data-theme="dark"] .cat-sidenav__sublist > li + li {
  border-top-color: #252830;
}

[data-theme="dark"] .cat-sidenav__sublist .cat-sidenav__sublist > li + li {
  background-image: linear-gradient(to right, transparent 1.5rem, #232629 1.5rem, #232629 calc(100% - 0.75rem), transparent calc(100% - 0.75rem));
}

[data-theme="dark"] .cat-sidenav__section-label {
  color: #555;
}

[data-theme="dark"] .cat-sidenav__split-row .cat-sidenav__expander {
  border-left-color: #2a2d33;
}

[data-theme="dark"] .cat-sidenav__split-row .cat-sidenav__expander:hover {
  background: #222529;
}

[data-theme="dark"] .cat-sidenav-toggle-btn {
  background: #1a1d22;
  border-color: #2a2d33;
  color: #a8a4a0;
}

[data-theme="dark"] .cat-header__title,
[data-theme="dark"] .cat-empty__title {
  color: #f0ece2;
}

[data-theme="dark"] .cat-header__count,
[data-theme="dark"] .cat-toolbar__left,
[data-theme="dark"] .cat-empty__hint {
  color: #9e9890;
}

[data-theme="dark"] .cat-sort__select {
  background: #1e2024;
  border-color: #2e3035;
  color: #d0cdc8;
}

[data-theme="dark"] .cat-filter-chip {
  background: #1e2024;
  border-color: #2e3035;
  color: #a8a4a0;
}

[data-theme="dark"] .cat-filter-chip:hover {
  border-color: #e87a8a;
  color: #e87a8a;
}

[data-theme="dark"] .cat-filter-chip--active {
  background: #c41e3a;
  border-color: #c41e3a;
  color: #fff;
}

/* ── Responsive ──────────────────────────────────── */

/* Tablet — sidebar narrower */
@media (max-width: 960px) {
  .cat-sidenav {
    width: 210px;
  }
}

@media (max-width: 820px) {
  .cat-sidenav {
    width: 190px;
  }
  .cat-sidenav__sublist > li > .cat-sidenav__link,
  .cat-sidenav__sublist > li > .cat-sidenav__toggle,
  .cat-sidenav__sublist > li > .cat-sidenav__split-row {
    padding-left: 1.4rem;
  }
  .cat-sidenav__sublist .cat-sidenav__sublist > li > .cat-sidenav__link,
  .cat-sidenav__sublist .cat-sidenav__sublist > li > .cat-sidenav__toggle,
  .cat-sidenav__sublist .cat-sidenav__sublist > li > .cat-sidenav__split-row {
    padding-left: 2.1rem;
  }
  .cat-sidenav__sublist .cat-sidenav__sublist .cat-sidenav__sublist > li > .cat-sidenav__link,
  .cat-sidenav__sublist .cat-sidenav__sublist .cat-sidenav__sublist > li > .cat-sidenav__toggle {
    padding-left: 2.8rem;
  }
}

/* Mobile — sidebar becomes full-width collapsible panel */
@media (max-width: 720px) {
  .cat-layout {
    flex-direction: column;
    gap: 0;
  }

  .cat-sidenav-toggle-btn {
    display: flex;
  }

  .cat-sidenav {
    width: 100%;
    position: static;
    max-height: none;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    overflow: hidden;
  }

  .cat-sidenav[hidden] {
    display: none;
  }

  /* The "Browse Categories" toggle button already labels the panel on mobile. */
  .cat-sidenav__header {
    display: none;
  }
}

@media (max-width: 520px) {
  .cat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .cat-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

@media (max-width: 320px) {
  .cat-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Pagination ──────────────────────────────────────────── */
.cat-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 2.5rem;
  padding-bottom: 0.5rem;
}

.cat-pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.6rem;
  border-radius: 6px;
  border: 1.5px solid #ddd8d0;
  background: #fff;
  color: #3d4456;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  user-select: none;
}

.cat-pagination__btn:hover:not([aria-disabled="true"]):not(.cat-pagination__btn--active) {
  border-color: #c41e3a;
  color: #c41e3a;
  background: #fff5f7;
}

.cat-pagination__btn--active {
  background: #c41e3a;
  border-color: #c41e3a;
  color: #fff;
  cursor: default;
  font-weight: 700;
}

.cat-pagination__btn[aria-disabled="true"] {
  opacity: 0.38;
  cursor: default;
  pointer-events: none;
}

.cat-pagination__dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  color: #9ca3af;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
}

/* ── Feature pills (shop) ─────────────────────────────────── */
.feature-pills { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.25rem; }
.feature-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .8rem; border: 1px solid #e3dccb; border-radius: 999px;
  background: #fff; color: #3a342b; text-decoration: none;
  font-size: .85rem; font-weight: 600; transition: border-color .15s, background .15s, color .15s;
}
.feature-pill:hover { border-color: #c9a227; color: #1f1b16; }
.feature-pill--active { background: #1f1b16; color: #fff; border-color: #1f1b16; }
.feature-pill__img { width: 1.15rem; height: 1.15rem; border-radius: 50%; object-fit: cover; }
.feature-pill i { font-size: .85rem; }
.feature-pill--clear { background: #f4f1ea; color: #777; border-style: dashed; }
