/* Search, filter pills, the count and the sort: the same on /library and /inbox (public/filters.js).
   The website's filter pills in groups, each with what it would give; a sheet on the phone. */
#q { display: block; width: 100%; min-height: 46px; padding: 8px 12px 8px 40px; font: inherit; color: var(--site-text); background: var(--site-bg) no-repeat 13px center / 18px;
     background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%236b7886" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><line x1="16.5" y1="16.5" x2="21" y2="21"/></svg>');
     border: 1px solid var(--site-border); border-radius: 10px; -webkit-appearance: none; appearance: none; }
#q:focus { outline: 0; border-color: var(--site-muted); }
.filters button, .bar button { font: inherit; color: inherit; background: none; border: 0; border-radius: 0; padding: 0; min-height: 0; cursor: pointer; }
.filters button:focus-visible, .bar button:focus-visible, .bar select:focus-visible { outline: 2px solid var(--site-accent); outline-offset: 2px; }
.filters { margin: 14px 0 4px; }
.fgroup { display: grid; grid-template-columns: 84px 1fr; gap: 5px 8px; padding: 3px 0; }
.flabel { font-size: .75rem; line-height: 32px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--site-muted); }
.pills { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.filters .pill { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 .7rem; border: 1px solid var(--site-border); border-radius: 999px;
  font-size: .75rem; line-height: 1.2; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--site-muted);
  transition: color .15s ease, border-color .15s ease; }
.filters .pill:hover { color: var(--site-heading); }
.pill .n { font-weight: 400; letter-spacing: 0; opacity: .8; }
.filters .pill[aria-pressed="true"] { color: var(--site-accent); border-color: var(--site-accent); }
.filters .pill:disabled { opacity: .4; cursor: default; color: var(--site-muted); }
.filters .pill.more { border-style: dashed; }
.icon { display: inline-block; flex: none; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.i-pdf { --icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linejoin="round"><path d="M6 2h8l5 5v15H6z"/><path d="M14 2v5h5"/></svg>'); }
.i-note { --icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z"/></svg>'); }
.i-marks { --icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 11l-6 6v4h9l3-3"/><path d="M22 12l-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4"/></svg>'); }

/* the count, what is on, the sort */
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--site-border); scroll-margin-top: calc(var(--nav-h) + 8px + env(safe-area-inset-top, 0px)); }
#count { margin: 0 auto 0 0; font-size: .9rem; color: var(--site-muted); font-variant-numeric: tabular-nums; }
#filters-open { display: none; }
.sort { display: inline-flex; align-items: center; gap: 2px; margin: 0; font-size: .9rem; color: var(--site-muted); }
#sort { width: auto; margin: 0; font: inherit; font-size: 16px; min-height: 40px; max-width: 165px; padding: 0 2px; text-align-last: right; color: var(--site-heading); background: none; border: 0; cursor: pointer; }
#active { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
#active:empty { display: none; }
#active .chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 .65rem; border: 1px solid var(--site-accent); border-radius: 999px; color: var(--site-accent);
  font-size: .75rem; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
#active .chip::after { content: "\00d7"; font-size: 1rem; font-weight: 400; line-height: 1; }
#clear { min-height: 30px; padding: 0 .3rem; font-size: .85rem; color: var(--site-muted); text-decoration: underline; }

/* a heading per year, tier, status: stays in view, under the navbar when that is showing */
li.group { position: sticky; top: calc(var(--nav-h) + 1px + env(safe-area-inset-top, 0px)); z-index: 2; display: flex; justify-content: space-between; padding: 14px 0 5px; border-top: 0; border-bottom: 1px solid var(--site-border);
  background: var(--site-bg); font-size: .75rem; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--site-heading); transition: top 320ms ease-in-out; }
li.group .n { font-weight: 400; color: var(--site-muted); }
body.nav-hidden li.group { top: env(safe-area-inset-top, 0px); }
li.none { padding: 32px 0; border: 0; color: var(--site-muted); text-align: center; }
.sheet-head, .sheet-foot, .scrim { display: none; }

/* phone width: search and list first; the filters open as a sheet over the blurred page */
@media (max-width: 639.98px) {
  #filters-open { display: inline-flex; order: -1; min-height: 40px; align-items: center; gap: 6px; padding: 0 .85rem; border: 1px solid var(--site-border); border-radius: 999px; color: var(--site-muted);
    font-size: .75rem; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
  #filters-open.on { color: var(--site-accent); border-color: var(--site-accent); }
  #count { font-size: .85rem; }
  #sort { max-width: 150px; }
  .sort { font-size: 0; }   /* the select says what it sorts by; the word stays for screen readers */
  .filters { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; max-height: 86dvh; margin: 0; padding: 4px 16px 0; overflow-y: auto; overscroll-behavior: contain; background: var(--site-bg);
    border-radius: 16px 16px 0 0; box-shadow: 0 -8px 32px rgba(0, 0, 0, .22); transform: translateY(105%); visibility: hidden; transition: transform 240ms ease, visibility 240ms; }
  body.filters-open .filters { transform: none; visibility: visible; transition: transform 240ms ease; }   /* visible at once: it takes the focus */
  body.filters-open { overflow: hidden; }
  .scrim { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .28); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
  body.filters-open .scrim { display: block; }
  .sheet-head { display: flex; align-items: center; justify-content: space-between; }
  .sheet-head h2 { margin: 0; font-size: 1.15rem; font-weight: 600; color: var(--site-heading); }
  #filters-close { width: 44px; height: 44px; margin-right: -10px; font-size: 1.6rem; line-height: 1; color: var(--site-muted); }
  .fgroup { display: block; padding: 8px 0; }
  .flabel { display: block; line-height: 1.8; }
  .filters .pill { min-height: 40px; }
  .sheet-foot { display: block; position: sticky; bottom: 0; padding: 10px 0 max(14px, env(safe-area-inset-bottom, 0px)); background: var(--site-bg); }
  #filters-show { width: 100%; min-height: 46px; border-radius: 999px; font-weight: 600; background: var(--site-link); color: var(--site-bg); }
}
@media (prefers-reduced-motion: reduce) { .filters, li.group { transition: none !important; } }
