/* ============================================================================
   Browse page — filters sidebar + results header + pagination + filter chips
   ============================================================================ */

.browse-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: start;
}
@media (max-width: 900px) {
  .browse-layout { grid-template-columns: 1fr; gap: 24px; }
}

.filters {
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  padding-right: 6px;
  padding-bottom: 16px;
}
.filter-group {
  padding-bottom: 18px;
  margin-bottom: 18px;
  box-shadow: 0 var(--hairline) 0 var(--border-1);
}
.filter-group:last-child { box-shadow: none; }
.filter-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}
.filter-group select {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-1);
  box-shadow: inset 0 0 0 var(--hairline) var(--border-1);
  border: 0;
  border-radius: var(--r-3);
  color: var(--text-0);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: box-shadow var(--dur-fast) ease;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10' fill='none' stroke='%238C8577' stroke-width='1.5'><path d='M2 4 L5 7 L8 4'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}
.filter-group select:hover { box-shadow: inset 0 0 0 var(--hairline) var(--border-2); }
.filter-group select:focus { box-shadow: inset 0 0 0 var(--hairline) var(--border-3), var(--shadow-glow); }

.year-range {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 6px;
  align-items: center;
}
.year-range-sep { font-size: 13px; opacity: 0.5; }


/* ─── Chip filter row ──────────────────────────────────────────────── */

.chip-row { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-block;
  padding: 5px 10px;
  border-radius: var(--r-full);
  box-shadow: inset 0 0 0 var(--hairline) var(--border-1);
  background: transparent;
  color: var(--text-2);
  font-size: 11px;
  text-decoration: none;
  transition: box-shadow var(--dur-fast) ease, color var(--dur-fast) ease,
              background-color var(--dur-fast) ease;
}
@media (hover: hover) {
  .chip:hover { box-shadow: inset 0 0 0 var(--hairline) var(--border-2); color: var(--text-0); }
}
.chip.is-active {
  background: var(--accent);
  color: #FFFFFF;
  box-shadow: inset 0 0 0 var(--hairline) var(--accent);
  font-weight: var(--w-medium);
}


/* ─── Star radio (narrative / visual / craft thresholds) ──────────── */

.stars-filter { display: flex; flex-wrap: wrap; gap: 3px; }
.star-radio {
  display: inline-block;
  cursor: pointer;
}
.star-radio input { display: none; }
.star-radio span {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 9px;
  border-radius: var(--r-3);
  box-shadow: inset 0 0 0 var(--hairline) var(--border-1);
  color: var(--text-3);
  transition: box-shadow var(--dur-fast) ease, color var(--dur-fast) ease,
              background-color var(--dur-fast) ease;
}
@media (hover: hover) {
  .star-radio:hover span { box-shadow: inset 0 0 0 var(--hairline) var(--border-2); color: var(--text-2); }
}
.star-radio input:checked + span {
  background: var(--accent);
  color: #FFFFFF;
  box-shadow: inset 0 0 0 var(--hairline) var(--accent);
}


/* ─── Checkbox ─────────────────────────────────────────────────────── */

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  transition: color var(--dur-fast) ease;
}
@media (hover: hover) {
  .check:hover { color: var(--text-0); }
}
.check input {
  appearance: none;
  width: 14px;
  height: 14px;
  box-shadow: inset 0 0 0 var(--hairline) var(--border-2);
  border-radius: 3px;
  background: var(--bg-0);
  cursor: pointer;
  transition: background-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
  position: relative;
}
.check input:checked {
  background: var(--accent);
  box-shadow: inset 0 0 0 var(--hairline) var(--accent);
}
.check input:checked::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 4px;
  width: 4px;
  height: 7px;
  border: solid #FFFFFF;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}


/* ─── Results header + view switch + search indicator + empty state ── */

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  margin-bottom: 18px;
  box-shadow: 0 var(--hairline) 0 var(--border-1);
  flex-wrap: wrap;
  gap: var(--s-3);
}
.results-header h1 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: var(--w-normal);
  letter-spacing: -0.025em;
  color: var(--text-0);
}
.view-switch {
  display: flex;
  background: var(--bg-1);
  box-shadow: inset 0 0 0 var(--hairline) var(--border-1);
  border-radius: var(--r-3);
  padding: 2px;
}
.view-btn {
  padding: 5px 12px;
  background: transparent;
  border: 0;
  color: var(--text-3);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  border-radius: 4px;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.view-btn.is-active {
  background: var(--bg-0);
  color: var(--text-0);
  box-shadow: var(--shadow-1);
}

.search-indicator {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 14px;
}
.search-indicator em { color: var(--text-0); font-weight: var(--w-medium); font-family: inherit; font-size: 1em; font-style: normal; }

.empty-state {
  padding: 80px 40px;
  text-align: center;
  color: var(--text-3);
}
.empty-icon {
  display: inline-block;
  font-size: 48px;
  color: var(--text-4);
  margin-bottom: 16px;
  font-family: var(--font-serif);
}


/* ─── Accordion filter sections (collapsible) ─────────────────────── */

.filter-accordion {
  box-shadow: 0 calc(-1 * var(--hairline)) 0 var(--border-1);
  padding-top: 14px;
  margin-top: 14px;
}
.filter-accordion summary {
  cursor: pointer;
  padding: 4px 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.filter-accordion summary::-webkit-details-marker { display: none; }
.filter-accordion summary::after {
  content: "+";
  font-family: var(--font-mono);
  color: var(--text-3);
  transition: transform var(--dur-base) var(--ease);
}
.filter-accordion[open] summary::after { transform: rotate(45deg); }
@media (hover: hover) {
  .filter-accordion summary:hover { color: var(--text-0); }
}
.filter-accordion[open] { padding-bottom: 8px; }
.filter-accordion-body { padding-top: 10px; }


/* ─── Active filter chips bar (above results) ─────────────────────── */

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--bg-1);
  box-shadow: inset 0 0 0 var(--hairline) var(--border-1);
  border-radius: var(--r-3);
  align-items: center;
}
.active-filters-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-right: 4px;
}
.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  background: var(--accent-faint);
  box-shadow: inset 0 0 0 var(--hairline) var(--accent-line);
  border-radius: var(--r-full);
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  transition: background-color var(--dur-fast) ease;
}
@media (hover: hover) {
  .active-filter-chip:hover { background: color-mix(in oklch, var(--accent) 14%, transparent); }
}
.active-filter-chip .x {
  opacity: 0.7;
  font-weight: var(--w-semi);
  font-size: 12px;
  line-height: 1;
  padding: 0 2px;
}
.active-filter-chip:hover .x { opacity: 1; }


/* ─── Results containers (cards + rows views) ────────────────────── */

.results-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  align-items: stretch;
}
.results-rows { display: flex; flex-direction: column; }

/* The cards/rows containers set `display: grid|flex` explicitly, which
   overrides the native `hidden` attribute (it only maps to `display: none`
   at the browser's UA-level default, which specific rules defeat). Force
   display:none when [hidden] is present so the view-switch toggle works. */
.results-cards[hidden],
.results-rows[hidden] { display: none; }

@media (max-width: 760px) {
  .results-cards { grid-template-columns: 1fr; }
}


/* ─── Pagination ──────────────────────────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 32px 0 8px;
  margin-top: 24px;
}
.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 var(--hairline) var(--border-1);
  border: 0;
  border-radius: var(--r-3);
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 12px;
  text-decoration: none;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease,
              box-shadow var(--dur-fast) ease;
}
@media (hover: hover) {
  .page-btn:hover {
    box-shadow: inset 0 0 0 var(--hairline) var(--border-2);
    color: var(--text-0);
    background: var(--bg-1);
  }
}
.page-btn.is-current {
  background: var(--accent);
  color: #FFFFFF;
  box-shadow: inset 0 0 0 var(--hairline) var(--accent);
  font-weight: var(--w-semi);
}
.page-btn.is-disabled {
  opacity: 0.35;
  pointer-events: none;
}
.page-ellipsis {
  padding: 0 4px;
  color: var(--text-4);
  font-family: var(--font-mono);
}
.page-info {
  margin-left: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
