
/* ============================================================
   CATEGORY LISTING â€” hero + left filter sidebar
   Client reference: rebelhorn.com/collections/*
   Copy/imagery per slug come from `category_pages` (/secure/category-pages),
   so nothing here assumes a particular category.
   ============================================================ */

/* ---- Hero ---- */
.cat-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 32rem;
  background: rgb(var(--c-dark));
  overflow: hidden;
}
/* No image assigned: the band would be a black slab, so it collapses to a
   light header instead of pretending to be a hero. */
.cat-hero--plain { min-height: 0; background: rgb(var(--c-bg)); padding-top: var(--space-7); }
.cat-hero--plain .cat-hero__eyebrow { color: rgb(var(--c-fg) / 0.55); }
.cat-hero--plain .cat-hero__title { color: rgb(var(--c-fg)); }
.cat-hero--plain .breadcrumb { color: rgb(var(--c-fg) / 0.55); }
.cat-hero--plain .breadcrumb a:hover { color: rgb(var(--c-fg)); }

.cat-hero__media { position: absolute; inset: 0; }
.cat-hero__media img { width: 100%; height: 100%; object-fit: cover; }
/* Scrim: the client's art is light on the left, where the copy sits. */
.cat-hero__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgb(0 0 0 / 0.55) 0%, rgb(0 0 0 / 0.25) 45%, rgb(0 0 0 / 0.05) 100%);
}
.cat-hero--center .cat-hero__media::after {
  background: linear-gradient(180deg, rgb(0 0 0 / 0.2) 0%, rgb(0 0 0 / 0.55) 100%);
}
.cat-hero__inner {
  position: relative;
  z-index: var(--z-overlay);
  width: 100%;
  padding-block: var(--space-7);
}
.cat-hero--center { align-items: center; text-align: center; }
.cat-hero--center .breadcrumb { justify-content: center; }

.cat-hero__eyebrow {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--on-dark-75);
}
.cat-hero__title { margin: 0; color: rgb(var(--c-on-dark)); }

@media (min-width: 750px) {
  .cat-hero { min-height: 38rem; }
  .cat-hero__inner { padding-block: var(--space-8); }
}

/* ---- Toolbar (filter toggle + count) ---- */
.section--flush { padding-top: var(--space-5); }
.cat-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-3);
  border-bottom: var(--hairline) solid var(--line);
}
.cat-bar__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.9rem 1.8rem;
  border: var(--hairline) solid var(--line-strong);
  background: none;
  font-size: var(--text-base);
  font-weight: var(--fw-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgb(var(--c-fg));
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.cat-bar__toggle:hover,
.cat-bar__toggle:focus-visible { background: rgb(var(--c-fg)); color: rgb(var(--c-bg)); }
.cat-bar__toggle svg { width: 1.8rem; height: 1.8rem; }
.cat-bar__badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.9rem;
  height: 1.9rem;
  padding-inline: 0.5rem;
  border-radius: 999px;
  background: rgb(var(--c-accent));
  font-size: var(--text-xs);
  color: rgb(var(--c-on-dark));
}
.cat-bar__count { margin: 0; font-size: var(--text-base); color: var(--fg-55); }

/* ---- Active filter chips ---- */
.cat-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.6rem 1.2rem;
  border: var(--hairline) solid var(--line-strong);
  border-radius: 999px;
  font-size: var(--text-sm);
  color: rgb(var(--c-fg));
  text-decoration: none;
}
.cat-chip svg { width: 1.2rem; height: 1.2rem; }
.cat-chip:hover { background: rgb(var(--c-surface-2)); }
.cat-chip--clear { border-color: transparent; color: rgb(var(--c-accent)); text-decoration: underline; }

/* ---- Layout: sidebar + results ---- */
.cat-layout { padding-top: var(--space-5); }
.cat-results { min-width: 0; }

/*
 * Two states, so the panel is usable whether or not JavaScript runs.
 *
 * `.is-static` is the SERVER-RENDERED default: a plain block in the flow. With
 * JS off, that is the whole story — the filters are simply visible on the page
 * and the GET form still submits. filters.js swaps this for `.is-drawer` on
 * load, which is where the fixed overlay behaviour lives.
 *
 * The panel used to render with `hidden` and rely on JS to remove it; with JS
 * disabled on a phone that left the filters permanently unreachable.
 */
.cat-filters.is-static {
  margin-bottom: var(--space-6);
  border: var(--hairline) solid var(--line);
  padding: var(--space-4) var(--space-5);
}
.cat-filters.is-static .cat-filters__overlay,
.cat-filters.is-static .cat-filters__head .iconbtn { display: none; }

.cat-filters.is-drawer {
  position: fixed;
  inset: 0;
  z-index: var(--z-drawer);
  pointer-events: none;
  margin: 0;
  border: 0;
  padding: 0;
}
.cat-filters.is-drawer[hidden] { display: none; }
.cat-filters.is-drawer .cat-filters__overlay { display: block; }
.cat-filters__overlay {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.45);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.cat-filters.is-drawer .cat-filters__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(34rem, 88vw);
  height: 100%;
  background: rgb(var(--c-bg));
  transform: translateX(-100%);
  transition: transform var(--dur) var(--ease);
}
.cat-filters.is-open { pointer-events: auto; }
.cat-filters.is-open .cat-filters__overlay { opacity: 1; }
.cat-filters.is-open .cat-filters__panel { transform: translateX(0); }

.cat-filters__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: var(--hairline) solid var(--line);
}
.cat-filters__title { margin: 0; font-size: var(--text-xl); font-weight: var(--fw-bold); }
.cat-filters__body { flex: 1; overflow-y: auto; padding: 0 var(--space-5); }
.cat-filters__foot {
  padding: var(--space-4) var(--space-5);
  border-top: var(--hairline) solid var(--line);
  text-align: center;
}
.cat-filters__clear {
  display: inline-block;
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--fg-55);
}

/* ---- Facet groups ---- */
.facet { border-bottom: var(--hairline) solid var(--line); }
.facet:last-child { border-bottom: 0; }
.facet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-4);
  font-size: var(--text-base);
  font-weight: var(--fw-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}
.facet__head::-webkit-details-marker { display: none; }
.facet__chev {
  width: 0.9rem;
  height: 0.9rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--dur-fast) var(--ease);
}
.facet[open] .facet__chev { transform: rotate(-135deg) translate(-2px, -2px); }
.facet__body { display: grid; gap: var(--space-3); padding-bottom: var(--space-4); }
.facet__count { margin-left: auto; font-size: var(--text-sm); color: var(--fg-50); }

.facet__link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-md);
  color: rgb(var(--c-fg));
  text-decoration: none;
}
.facet__link:hover { color: rgb(var(--c-accent)); }
.facet__link.is-active { font-weight: var(--fw-bold); color: rgb(var(--c-accent)); }

/* Size chips */
.facet__body--chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.size-opt { cursor: pointer; }
.size-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.size-opt span {
  display: inline-grid;
  place-items: center;
  min-width: 4.4rem;
  padding: 0.7rem 1rem;
  border: var(--hairline) solid var(--line-strong);
  font-size: var(--text-base);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.size-opt:hover span { background: rgb(var(--c-surface-2)); }
.size-opt.is-on span,
.size-opt input:focus-visible + span { background: rgb(var(--c-fg)); border-color: rgb(var(--c-fg)); color: rgb(var(--c-bg)); }

/* Price range */
.facet__body--range { display: flex; align-items: flex-end; gap: var(--space-2); }
.range-field { display: grid; gap: var(--space-1); font-size: var(--text-sm); color: var(--fg-55); }
.range-field input {
  width: 100%;
  padding: 0.8rem 1rem;
  border: var(--hairline) solid var(--line-strong);
  background: none;
  font-size: var(--text-base);
  color: rgb(var(--c-fg));
}
.range-sep { padding-bottom: 1rem; color: var(--fg-50); }

/*
 * Desktop: the same panel becomes a static column beside the grid. The drawer
 * mechanics (fixed/transform/overlay) are unwound rather than duplicated, so
 * there is one set of markup for both presentations.
 */
@media (min-width: 990px) {
  .cat-layout {
    display: grid;
    grid-template-columns: 26rem minmax(0, 1fr);
    gap: var(--space-7);
    align-items: start;
  }
  .cat-layout--nofilters { display: block; }

  /* Toggle collapses the column; without the toggle the sidebar is always in. */
  .cat-layout.is-collapsed { grid-template-columns: minmax(0, 1fr); }
  /* Matches the specificity of the .cat-filters.is-static/.is-drawer rules
     below, which would otherwise re-show the collapsed column. */
  .cat-layout.is-collapsed .cat-filters,
  .cat-layout.is-collapsed .cat-filters.is-static,
  .cat-layout.is-collapsed .cat-filters.is-drawer { display: none; }

  .cat-filters,
  .cat-filters.is-static,
  .cat-filters.is-drawer,
  .cat-filters.is-drawer[hidden] {
    display: block;
    position: sticky;
    top: 12rem;
    inset: auto;
    z-index: 1;
    pointer-events: auto;
    margin: 0;
    border: 0;
    padding: 0;
  }
  .cat-filters__overlay,
  .cat-filters.is-drawer .cat-filters__overlay { display: none; }
  .cat-filters__panel,
  .cat-filters.is-drawer .cat-filters__panel {
    width: auto;
    height: auto;
    transform: none;
    background: none;
  }
  .cat-filters__head { padding: 0 0 var(--space-3); }
  .cat-filters__body { padding: 0; overflow: visible; }
  .cat-filters__foot { padding: var(--space-4) 0 0; }
  /* The submit button is for the mobile drawer; on desktop each control
     auto-submits, so a second "Show N products" click is redundant. */
  .js .cat-filters__foot .button { display: none; }
  .cat-filters__head .iconbtn { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cat-filters__panel,
  .cat-filters__overlay,
  .facet__chev { transition-duration: 0.01ms; }
}
