/* components/filter-chips.css — active-filter chips (components/filter-chips.js).
 *
 * Compact chips ("LONG ×  30m ×", brief §11) in a horizontal `overflow-x`
 * scroller: the row never widens the page (MOBILE_PLAN.md §2.8's scroll-x
 * pattern — components/scroll-x.js adds the edge fade when wrapped around
 * this row). The × button keeps a compact glyph and grows an invisible 44 px
 * hit area under `(pointer: coarse), (max-width: 767.98px)` (brief §6,
 * pattern 1), so the visuals do not change and the taps still land.
 *
 * Colour, type, spacing, radius and motion come only from tokens.css.
 * No literal colours anywhere here.
 */

.filter-chips {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

/* The horizontal scroller (the §2.8 scroll-x pattern). */
.filter-chips-scroll {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
  scrollbar-width: none;
}

.filter-chips-scroll::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  flex: 0 0 auto;
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-2);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-pill);
  background: var(--panel);
  color: var(--ink);
  font-size: var(--fs-label);
  line-height: 1.4;
  white-space: nowrap;
}

.filter-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 18em;
}

.filter-chip-remove {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-label);
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-1);
  min-width: 18px;
  min-height: 18px;
  position: relative;
}

.filter-chip-remove:hover {
  color: var(--ink);
}

.filter-chip-remove:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

/* Invisible hit extension (brief §6, pattern 1): 44 px target, same visuals.
   The row grows to --hit-min only while it holds a chip (an empty row
   collapses to nothing) so the scroller — whose overflow-x:auto computes
   overflow-y to auto as well — does not clip the extension's hit area. The
   chip's trailing padding is half the hit area less the × button's half box,
   which keeps the whole extension inside the pill: the hit area can never
   widen the row's scroll width past the last chip. */
@media (pointer: coarse), (max-width: 767.98px) {
  .filter-chips-scroll:not(:empty) {
    min-height: var(--hit-min);
  }

  .filter-chip {
    padding-right: calc(var(--hit-min) / 2 - 9px);
  }

  .filter-chip-remove::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: max(100%, var(--hit-min));
    height: max(100%, var(--hit-min));
    transform: translate(-50%, -50%);
    pointer-events: auto;
  }
}

.filter-chips-clear {
  flex: 0 0 auto;
  min-height: var(--hit-min);
}
