/* Catalog: /browse/ and /search/ (static/js/catalog.js), plus card bits the
   static listing shares.  Tokens only -- dark mode comes from tokens.css. */

.vh {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Placement only: compare.css owns how the button looks. */
.ds-card .pin-compare { justify-self: start; }

.catalog { margin-top: 1rem; }

/* ------------------------------------------------------------ top bar --- */

.cat-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1.1rem; }
.cat-search { flex: 1 1 320px; min-width: 0; margin: 0; }
.cat-search input { font-size: 1rem; padding: .6rem .8rem; }
.cat-sortbar { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; }
.cat-sort { display: flex; gap: .4rem; align-items: center; font-size: .82rem; color: var(--ink-muted); }
.cat-sort select { width: auto; padding-block: .42rem; }
.cat-dir { min-width: 5.6rem; justify-content: center; font-family: var(--font-mono); font-size: .8rem; }
.cat-dir:disabled { opacity: .55; cursor: default; }
.cat-dir:disabled:hover { background: var(--bg); }
.cat-toggle { display: none; }

/* --------------------------------------------------------------- body --- */

.cat-body { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1.6rem; align-items: start; }

/* Sticky below the sticky site header (56px), so the top of the filter
   column is always reachable without scrolling the page back up. */
.cat-filters {
  position: sticky; top: calc(56px + 1rem); max-height: calc(100vh - 56px - 2rem); overflow-y: auto;
  padding-right: .35rem; overscroll-behavior: contain;
}
.cat-group { border: 0; padding: 0; margin: 0 0 1.1rem; min-width: 0; }
.cat-group legend {
  padding: 0; margin-bottom: .4rem; font-size: .74rem; font-weight: 650;
  text-transform: uppercase; letter-spacing: .05em; color: var(--ink-subtle);
}
.cat-hint { text-transform: none; letter-spacing: 0; font-weight: 450; }
.cat-opts { display: grid; gap: .05rem; }
.cat-scroll {
  max-height: 13.5rem; overflow-y: auto; border: 1px solid var(--border);
  border-radius: var(--radius); padding: .25rem .35rem; background: var(--bg);
}
.cat-opt {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .5rem; align-items: center;
  padding: .16rem .3rem; border-radius: 4px; font-size: .85rem; color: var(--ink); cursor: pointer;
}
.cat-opt:hover { background: var(--bg-muted); }
.cat-opt input { margin: 0; accent-color: var(--accent); width: 14px; height: 14px; }
.cat-opt-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-opt-l .ico { font-family: var(--font-mono); font-weight: 700; font-size: .7rem;
                  opacity: .75; margin-right: .3rem; }
.cat-opt .n { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-subtle); }
.cat-opt.is-zero { color: var(--ink-subtle); }
.cat-opt.is-on { color: var(--accent); font-weight: 550; }
.cat-find { margin-bottom: .35rem; font-size: .82rem !important; padding: .32rem .55rem !important; }

.cat-minmax { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
              gap: .4rem; align-items: center; color: var(--ink-subtle); }
.cat-minmax input { font-size: .85rem; padding: .34rem .5rem; font-family: var(--font-mono); }
.cat-minmax input[aria-invalid="true"] { border-color: var(--bad); }

/* Dual year slider: two native range inputs stacked on one track, so each
   thumb stays a real, labelled, keyboard-operable control. */
.cat-dual { position: relative; height: 1.6rem; --lo: 0%; --hi: 100%; }
.cat-dual::before, .cat-dual::after {
  content: ""; position: absolute; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px;
}
.cat-dual::before { left: 0; right: 0; background: var(--border); }
.cat-dual::after { left: var(--lo); right: calc(100% - var(--hi)); background: var(--accent); }
.cat-dual input[type=range] {
  position: absolute; inset: 0; width: 100%; margin: 0; background: none; pointer-events: none;
  -webkit-appearance: none; appearance: none; z-index: 1; height: 1.6rem;
}
.cat-dual input[type=range]::-webkit-slider-runnable-track { background: none; height: 1.6rem; }
.cat-dual input[type=range]::-moz-range-track { background: none; }
.cat-dual input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; cursor: pointer;
  width: 16px; height: 16px; margin-top: calc(.8rem - 8px); border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.cat-dual input[type=range]::-moz-range-thumb {
  pointer-events: auto; cursor: pointer; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.cat-dual input[type=range]:focus-visible { outline: none; }
.cat-dual input[type=range]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.cat-dual input[type=range]:focus-visible::-moz-range-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.cat-yearout { display: flex; justify-content: space-between; font-family: var(--font-mono); }

/* ------------------------------------------------------------ results --- */

.cat-results { min-width: 0; }
.cat-status { display: flex; gap: .8rem; align-items: baseline; flex-wrap: wrap; margin-bottom: .45rem; }
.cat-count { margin: 0; color: var(--ink-muted); }
.cat-clear, .cat-recent-clear {
  font: inherit; font-size: .82rem; background: none; border: 0; padding: 0;
  color: var(--accent); cursor: pointer;
}
.cat-clear:hover, .cat-recent-clear:hover { text-decoration: underline; color: var(--accent-hover); }
.cat-active { margin-bottom: .7rem; }
.cat-active .cat-x { cursor: pointer; font: inherit; font-size: .78rem; }
.cat-active .cat-x:hover { border-color: var(--accent); }
.cat-kbd { margin: 0 0 .8rem; }
.cat-kbd kbd {
  font-size: .72rem; padding: 0 .3rem; border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: 3px; background: var(--bg-subtle); color: var(--ink-muted);
}
.ds-card.kb-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cat-more-wrap { margin-top: 1rem; text-align: center; }
.cat-more { justify-content: center; }

.cat-recent {
  display: flex; flex-wrap: wrap; gap: .3rem .7rem; align-items: baseline;
  padding: .6rem .8rem; margin-bottom: 1rem; font-size: .84rem;
  background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius);
}
.cat-recent-h { font-size: .74rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em;
                color: var(--ink-subtle); margin: 0; }
.cat-recent-list { display: contents; list-style: none; }
.cat-recent-list li { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-recent-list li + li::before { content: "·"; color: var(--ink-subtle); margin-right: .7rem; }
.cat-recent-clear { margin-left: auto; }

/* -------------------------------------------------------------- mobile --- */

@media (max-width: 820px) {
  .cat-body { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cat-toggle { display: inline-flex; }
  .cat-filters {
    display: none; position: static; max-height: none; overflow: visible; padding: .9rem 1rem .2rem;
    margin-bottom: 1rem; background: var(--bg-subtle); border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .catalog.filters-open .cat-filters { display: block; }
  .cat-filters .cat-group { margin-bottom: 1rem; }
  .cat-sortbar { width: 100%; }
  .cat-sort { flex: 1; min-width: 0; }
  .cat-sort select { flex: 1; min-width: 0; width: 100%; }
  .cat-kbd { display: none; }
  .cat-recent-list li + li::before { content: none; }
  .cat-recent-list { display: grid; gap: .15rem; width: 100%; padding: 0; margin: 0; }
  .cat-recent-clear { margin-left: 0; }
}
