/* Index page: the artifact catalogue. Same editorial-newsroom language as the
   leaves. Cards use a subtle 1px neutral border and calm spacing — no colored
   left-border stripes, no cookie-cutter icon-title-desc grid. Hierarchy comes
   from type/size/weight, not decoration. The first card in the grid gets a
   quietly larger treatment so the grid isn't perfectly uniform. */

.chrome__main {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--space-10) var(--space-5) var(--space-8);
}

/* ---------------------------------------------------------------- Header */

.idx-head {
  margin: 0 0 var(--space-8);
  max-width: 40em;
}

.idx-title {
  margin: 0 0 var(--space-3);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 640;
  line-height: 1.04;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.idx-lede {
  margin: 0;
  font-size: 18px;
  line-height: 1.55;
  color: var(--muted-2);
  text-wrap: pretty;
}

/* --------------------------------------------------------------- Toolbar */

.idx-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin: 0 0 var(--space-5);
  flex-wrap: wrap;
}

.idx-search-wrap {
  flex: 1 1 280px;
  max-width: 460px;
}

.idx-search {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-4);
  font: 400 15px var(--font);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.idx-search::placeholder {
  color: var(--muted);
}

.idx-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}

.idx-count {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ Grid */

.idx-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
}

.card {
  min-width: 0;
}

.card__link {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  height: 100%;
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.card__link:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.card__type {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
}

.card__date {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.card__title {
  margin: 0;
  font-size: 19px;
  font-weight: 620;
  line-height: 1.24;
  letter-spacing: -0.017em;
  color: var(--ink);
  text-wrap: balance;
}

.card__person {
  margin: 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted-2);
}

.card__desc {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--muted);
  text-wrap: pretty;
}

.card__foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-1);
}

.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* First card: a quietly larger, primary treatment (hierarchy, not uniformity).
   Spans two columns on wide grids and reads at a bigger title size. */
@media (min-width: 700px) {
  .idx-grid .card:first-child {
    grid-column: span 2;
  }
  .idx-grid .card:first-child .card__link {
    background: var(--surface);
  }
  .idx-grid .card:first-child .card__title {
    font-size: 26px;
    letter-spacing: -0.024em;
  }
  .idx-grid .card:first-child .card__desc {
    font-size: 16px;
  }
}

/* --------------------------------------------------------- Empty states */

.empty {
  padding: var(--space-10) var(--space-6);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.empty h2 {
  margin: 0 0 var(--space-2);
  font-size: 20px;
  font-weight: 620;
  color: var(--ink);
}

.empty p {
  margin: 0 auto;
  max-width: 40em;
  color: var(--muted);
  font-size: 15px;
}

.empty--filtered {
  margin-top: var(--space-4);
}

/* 404 empty state — a designed page, not an afterthought. */
.empty--404 {
  max-width: 520px;
  margin: var(--space-10) auto;
  border-style: solid;
  border-color: var(--line);
}

.empty__eyebrow {
  margin: 0 0 var(--space-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.empty__title {
  margin: 0 0 var(--space-3);
  font-size: 28px;
  font-weight: 640;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}

.empty__body {
  margin: 0 0 var(--space-5);
  color: var(--muted-2);
}

/* ---------------------------------------------------------- Responsive */

@media (max-width: 768px) {
  .chrome__main {
    padding: var(--space-6) var(--space-4);
  }
}

@media (max-width: 640px) {
  .idx-grid {
    grid-template-columns: 1fr;
  }
  .idx-grid .card:first-child {
    grid-column: auto;
  }
  .idx-grid .card:first-child .card__title {
    font-size: 20px;
  }
}

/* ------------------------------------------------ Filter trigger (FILT-3/4) */

.idx-filter-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-4);
  font: 500 14px var(--font);
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease, color 0.14s ease;
}

.idx-filter-trigger:hover {
  border-color: var(--line-strong);
  background: var(--subtle);
  color: var(--ink);
}

.idx-filter-trigger--active {
  border-color: var(--ink);
  color: var(--ink);
}

.idx-filter-trigger__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--surface);
  background: var(--ink);
  border-radius: 999px;
}

/* --------------------------------------------------- Filter drawer (FILT-3) */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.drawer__scrim {
  position: absolute;
  inset: 0;
  background: rgba(9, 9, 11, 0.32);
}

.drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 92vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  animation: drawer-in 0.18s ease;
}

@keyframes drawer-in {
  from {
    transform: translateX(24px);
    opacity: 0.6;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--line);
}

.drawer__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.drawer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 15px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.drawer__close:hover {
  color: var(--ink);
  background: var(--subtle);
}

.drawer__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--space-4) var(--space-5);
}

.facet {
  margin: 0;
  padding: var(--space-4) 0;
  border: none;
  border-top: 1px solid var(--line);
}

.facet:first-child {
  border-top: none;
  padding-top: 0;
}

.facet__legend {
  padding: 0;
  margin: 0 0 var(--space-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.facet__opts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.facet__label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 36px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.facet__label:hover {
  background: var(--subtle);
}

.facet__input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  flex: none;
}

.facet__name {
  flex: 1 1 auto;
  font-size: 14px;
  color: var(--ink-soft);
}

.facet__count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.drawer__foot {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--line);
}

.drawer__clear {
  font: 500 14px var(--font);
  color: var(--muted-2);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.drawer__clear:hover {
  color: var(--ink);
}

.drawer__apply {
  margin-left: auto;
  min-height: 44px;
  padding: 0 var(--space-5);
  font: 500 14px var(--font);
  color: var(--surface);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.drawer__apply:hover {
  background: var(--ink-soft);
}

/* ------------------------------------------- Mobile collapsing search (RESP-2) */

@media (max-width: 640px) {
  .idx-toolbar {
    gap: var(--space-3);
  }
  .idx-search-wrap {
    flex-basis: 100%;
    max-width: none;
    order: 3;
  }
  .idx-count {
    order: 1;
  }
  .idx-filter-trigger {
    order: 2;
    margin-left: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .drawer__panel {
    animation: none;
  }
}
