/* The filter row (the count, Filters, Sort, layout switch, chips), its Filters panel and Sort menu.
   Values follow the header, filters and sort boards. The row sits in a sticky frosted band under the
   header (--header-h is set from the header's height). */

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

/* The sticky band. It spans the page width; its content lines up with the page margins. */
.filter-band {
  position: sticky;
  top: var(--header-h, 0px);
  z-index: 20;
  margin: 0 calc(var(--margin) * -1);
  padding: 12px var(--margin);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}

.fbar { display: flex; flex-direction: column; gap: 12px; }
.fbar__row { display: flex; align-items: center; gap: 12px; }
.fbar__count { margin: 0 auto 0 0; font-size: 14px; color: var(--text-quiet); }
.fbar__wrap { position: relative; }
.fbar__layout { display: inline-flex; gap: 2px; padding: 4px; background: var(--tone-1); border-radius: var(--radius); }
.fbar__layout button { width: 36px; height: 36px; border: 0; border-radius: var(--radius); background: transparent; color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.fbar__layout button:hover { background: var(--tone-2); }
.fbar__layout button.on { background: var(--inverse-bg); color: var(--inverse-text); }
.fbar__layout svg { stroke: currentColor; }
.fbar__chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fbar__chips[hidden] { display: none; }

.f-btn {
  height: 44px; padding: 0 16px; border: 0; border-radius: var(--radius);
  display: flex; align-items: center; gap: 10px;
  background: var(--tone-1); color: var(--text); font: 600 15px/1 var(--font-ui); cursor: pointer;
  transition: background var(--t-hover) var(--ease-out);
}
.f-btn:hover { background: var(--tone-2); }
.f-btn[aria-expanded="true"] { background: var(--inverse-bg); color: var(--inverse-text); }
.f-btn svg { stroke: currentColor; }
.f-btn .sub { font-weight: 500; color: var(--text-quiet); }
.f-btn[aria-expanded="true"] .sub { color: inherit; opacity: .75; }
.f-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.f-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }

.f-chip { height: 36px; padding: 0 10px 0 14px; border: 0; border-radius: var(--radius); background: var(--active-tint); color: var(--active-text); font: 600 14px/1 var(--font-ui); display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.f-chip svg { stroke: currentColor; }
.f-chip:hover { filter: brightness(.97); }
.f-chip:focus-visible { outline: none; box-shadow: var(--focus); }
.f-clear { border: 0; background: none; padding: 0 4px; font: 600 14px/1 var(--font-ui); color: var(--text); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }

/* Panel and menu share one surface: glass at 96% so the grid does not show through. */
.f-panel, .f-menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 25;
  background: rgba(250, 249, 246, .96);
  -webkit-backdrop-filter: blur(28px) saturate(140%); backdrop-filter: blur(28px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 0 0 1px rgba(26, 26, 26, .06), 0 24px 48px rgba(26, 26, 26, .16);
  border-radius: 10px; color: var(--text);
}
[data-theme="dark"] .f-panel, [data-theme="dark"] .f-menu { background: rgba(30, 30, 30, .96); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 0 0 1px rgba(255, 255, 255, .06), 0 24px 48px rgba(0, 0, 0, .5); }

.f-panel { width: 460px; max-width: calc(100vw - 32px); max-height: calc(100vh - var(--header-h, 0px) - 120px); display: flex; flex-direction: column; overflow: hidden; }
.f-panel:focus { outline: none; }
.f-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 12px; flex-shrink: 0; }
.f-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.f-x { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.f-x:hover { background: var(--tone-1); }
.f-x svg { stroke: currentColor; }
.f-body { overflow: auto; flex: 1 1 auto; min-height: 0; }
.f-sec { padding: 16px 24px; border-top: 1px solid var(--tone-1); display: flex; flex-direction: column; gap: 12px; }
.f-sec h3 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.f-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.f-opt { height: 36px; padding: 0 12px; border: 0; border-radius: var(--radius); background: var(--tone-1); color: var(--text); font: 500 14px/1 var(--font-ui); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.f-opt:hover { background: var(--tone-2); }
.f-opt .n { color: var(--text-quiet); }
.f-opt svg { stroke: currentColor; }
.f-opt[aria-pressed="true"] { background: var(--active-tint); color: var(--active-text); font-weight: 600; }
.f-opt[aria-pressed="true"] .n { color: var(--active-text); }
.f-opt:focus-visible { outline: none; box-shadow: var(--focus); }
.f-find input { width: 100%; height: 40px; padding: 0 12px; border: 0; border-radius: var(--radius); background: var(--tone-1); color: var(--text); font: 500 14px/1 var(--font-ui); }
.f-find input:focus { background: var(--field-active); box-shadow: inset 0 0 0 2px var(--text); outline: 0; }
.f-foot { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-top: 1px solid var(--tone-1); flex-shrink: 0; background: inherit; }
.f-link { border: 0; background: none; padding: 0; font: 600 14px/1 var(--font-ui); color: var(--text); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.f-go { height: 44px; padding: 0 18px; border: 0; border-radius: var(--radius); background: var(--inverse-bg); color: var(--inverse-text); font: 600 15px/1 var(--font-ui); cursor: pointer; }
.f-go:focus-visible { outline: none; box-shadow: var(--focus); }

.f-menu { width: 240px; padding: 6px; display: flex; flex-direction: column; }
.f-item { height: 42px; padding: 0 12px; border: 0; border-radius: var(--radius); background: transparent; color: var(--text); font: 500 15px/1 var(--font-ui); display: flex; align-items: center; justify-content: space-between; text-align: left; cursor: pointer; }
.f-item:hover { background: var(--tone-1); }
.f-item[aria-checked="true"] { background: var(--tone-1); font-weight: 600; }
.f-item svg { stroke: currentColor; }
.f-item:focus-visible { outline: none; box-shadow: var(--focus); }

@media (max-width: 760px) {
  .filter-band { padding: 10px var(--margin); }
  .fbar__row { flex-wrap: wrap; row-gap: 10px; }
  .fbar__count { flex: 1 0 100%; margin: 0; }
  /* On a phone the panel spans the band (the band, being frosted glass, is what it is positioned against). */
  .fbar__wrap[data-wrap="filters"] { position: static; }
  .f-panel { left: var(--margin); right: var(--margin); top: calc(100% - 6px); width: auto; max-width: none; max-height: calc(100vh - var(--header-h, 0px) - 150px); }
  .f-menu { right: auto; left: 0; }
}
