/*
 * Silent Heroes — Category filter (blog/archive)
 * Chips row + "Pozostałe" dropdown.
 */

.sh-cat-filter {
  margin: 0 0 32px;
  position: sticky;
  top: 64px;
  z-index: 20;
  background: var(--sh-offwhite);
  padding: 12px 0;
  border-bottom: 1px solid var(--sh-border-soft);
}

.sh-cat-filter-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.sh-cat-filter-list > li,
.sh-cat-dropdown ul > li {
  margin: 0; /* override globalnego li + li { margin-top } z base.css */
}

.sh-cat-dropdown ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Reset button defaults — żeby chip jako <button> renderował się tak samo jak chip jako <a>. */
button.sh-chip {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}

.sh-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--sh-border);
  border-radius: 6px;
  background: var(--sh-white);
  color: var(--sh-ink);
  font-family: var(--sh-font-sans);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.sh-chip:hover,
.sh-chip:focus-visible {
  background: var(--sh-offwhite-2);
  border-color: var(--sh-gray-300);
  color: var(--sh-color-text-strong);
}

.sh-chip.is-active {
  background: var(--sh-red);
  border-color: var(--sh-red);
  color: var(--sh-offwhite);
}

.sh-chip.is-active:hover {
  background: var(--sh-red-dark);
  border-color: var(--sh-red-dark);
}

.sh-chip-caret {
  transition: transform 0.2s ease;
}

.sh-chip-more[aria-expanded="true"] .sh-chip-caret {
  transform: rotate(180deg);
}

/* ===== Dropdown ===== */

.sh-cat-filter-more {
  position: relative;
}

.sh-cat-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 280px;
  max-width: 320px;
  background: var(--sh-white);
  border: 1px solid var(--sh-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(17, 17, 17, 0.12);
  padding: 12px;
  z-index: 30;
  max-height: 70vh;
  overflow-y: auto;
}

.sh-cat-dropdown[hidden] {
  display: none;
}

.sh-cat-dropdown-group + .sh-cat-dropdown-group {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--sh-border-soft);
}

.sh-cat-dropdown-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sh-muted);
  padding: 4px 12px 6px;
}

.sh-cat-dropdown-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sh-cat-dropdown-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--sh-ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  transition: background 0.12s ease, color 0.12s ease;
}

.sh-cat-dropdown-link:hover,
.sh-cat-dropdown-link:focus-visible {
  background: var(--sh-offwhite-2);
  color: var(--sh-color-text-strong);
}

.sh-cat-dropdown-link.is-active {
  background: var(--sh-red);
  color: var(--sh-offwhite);
}

.sh-cat-dropdown-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--sh-muted);
  font-variant-numeric: tabular-nums;
}

.sh-cat-dropdown-link.is-active .sh-cat-dropdown-count {
  color: var(--sh-offwhite);
  opacity: 0.85;
}

/* ===== Mobile ===== */

@media (max-width: 768px) {
  .sh-cat-filter {
    margin: 0 -16px 24px;
    padding: 10px 16px;
    border-radius: 0;
  }
  .sh-cat-filter-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .sh-cat-filter-list::-webkit-scrollbar {
    display: none;
  }
  .sh-chip {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 12px;
  }
  /* Dropdown jako pełna szerokość po prawej stronie chipa */
  .sh-cat-dropdown {
    position: fixed;
    top: auto;
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: none;
    min-width: 0;
    max-height: 60vh;
    box-shadow: 0 -8px 32px rgba(17, 17, 17, 0.2);
  }
}
