/* ============================================================
   FILTER TABS — pure CSS radios drive both tabs and grid
   ============================================================ */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--char);
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--newsprint);
}

.tab {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.85rem clamp(0.7rem, 1.6vw, 1.4rem);
  border: 1px solid transparent;
  border-bottom: 0;
  margin-bottom: -1px;
  cursor: pointer;
  color: var(--ink-soft);
  transition: color 0.25s var(--spring), background-color 0.25s var(--spring);
  min-height: 44px;
  user-select: none;
}

.tab-num { font-size: 0.64rem; opacity: 0.7; }

.tab-name {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  font-size: clamp(0.82rem, 0.7rem + 0.5vw, 1rem);
  white-space: nowrap;
}

.tab-count {
  font-size: 0.64rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  opacity: 0.75;
}

.tab:hover { color: var(--char); background: rgba(35, 32, 30, 0.04); }

/* selected tab: printed block of pink with charcoal ink */
#f-all:checked ~ .tabs .tab[for="f-all"],
#f-tokyo:checked ~ .tabs .tab[for="f-tokyo"],
#f-prague:checked ~ .tabs .tab[for="f-prague"],
#f-maritime:checked ~ .tabs .tab[for="f-maritime"] {
  background: var(--pink);
  border-color: var(--char);
  color: var(--char);
}

/* keyboard focus ring on the tab that owns the focused radio */
#f-all:focus-visible ~ .tabs .tab[for="f-all"],
#f-tokyo:focus-visible ~ .tabs .tab[for="f-tokyo"],
#f-prague:focus-visible ~ .tabs .tab[for="f-prague"],
#f-maritime:focus-visible ~ .tabs .tab[for="f-maritime"] {
  outline: 3px solid var(--blue);
  outline-offset: -3px;
}

/* ---------- filtering ---------- */
#f-tokyo:checked ~ .collection .plate:not([data-cat="tokyo"]),
#f-prague:checked ~ .collection .plate:not([data-cat="prague"]),
#f-maritime:checked ~ .collection .plate:not([data-cat="maritime"]) {
  display: none;
}

/* a filtered-in plate arrives with a small print-like settle */
#f-tokyo:checked ~ .collection .plate[data-cat="tokyo"],
#f-prague:checked ~ .collection .plate[data-cat="prague"],
#f-maritime:checked ~ .collection .plate[data-cat="maritime"] {
  animation: settle 0.5s var(--spring) both;
}

@keyframes settle {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@media (max-width: 720px) {
  .tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 0;
    position: static;
  }
  .tab {
    border-top: 1px solid var(--hair);
    justify-content: space-between;
  }
  .tab:nth-child(odd) { border-right: 1px solid var(--hair); }
  .tab-name { white-space: normal; }
}
