/* The final pagination belongs below both desktop columns, and below the
   in-flow sidebar when JavaScript is disabled on narrow screens. */
.filtered form.filters + ol.pagination { clear: both; }

.filters .tag-suggestions[hidden] { display: none; }
.filters .tag-suggestions {
  max-height: 16em;
  overflow-y: auto;
  border: 1px solid #999;
  margin: 0.5em 0;
  padding: 0;
}
.filters .tag-suggestions li { padding: 0.4em; cursor: pointer; }
.filters .tag-suggestions [aria-selected="true"],
.filters .tag-suggestions li:hover { background: #ddd; color: #111; }
.filters .pending-tags li { overflow-wrap: anywhere; margin: 0.5em 0; }

.filters .filter-section { margin: 0; }
.filters .tag-section { margin: 0; }
.filters .filter-section > .section-heading {
  display: block;
  position: relative;
  padding: 0.25em 0 0.25em 14px;
  min-height: 1.786em;
  box-sizing: border-box;
  list-style: none;
  cursor: pointer;
  color: #2a2a2a;
}
.filters .section-heading::-webkit-details-marker { display: none; }
.filters .section-heading::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.65em;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid currentColor;
}
.filters .filter-section[open] > .section-heading::before {
  top: 0.8em;
  border-top: 6px solid currentColor;
  border-right: 4px solid transparent;
  border-bottom: 0;
  border-left: 4px solid transparent;
}
.filters summary:focus-visible { outline: 1px dotted currentColor; }
.filters .help-trigger {
  display: inline-flex;
  align-items: center;
  vertical-align: baseline;
  width: auto;
  min-height: 0;
  margin: 0 0 0 0.2em;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  line-height: 1;
  font-size: 0.85em;
  cursor: help;
}
/* Help is a button, not a disclosure: it must never get a triangle. */
.filters .help-trigger::before, .filters .help-trigger::after { content: none; }
.filters .help-trigger .symbol { vertical-align: baseline; font-weight: bold; }
.filters .help-trigger .symbol span { padding: 0 0.35em; }
.filters .help-trigger:hover .symbol { background: #2a547c; color: #fff; }
.filters .help-trigger:focus-visible { outline: 1px dotted currentColor; }
.filters .heading h4 { display: inline; }
.filters .filter-help-popup {
  position: fixed;
  box-sizing: border-box;
  inset: 0;
  margin: auto;
  width: min(28em, 85vw);
  max-width: calc(100vw - 16px);
  height: fit-content;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1em;
  border: 1px solid #999;
  background: #fff;
  color: #2a2a2a;
  font-weight: normal;
  box-shadow: 0 0.25em 1em rgb(0 0 0 / 25%);
}
.filters .filter-help-popup::backdrop { background: rgb(0 0 0 / 15%); }

/* Progressive enhancement: without JS, the sidebar stays in document flow. */
@media only screen and (max-width: 42em) {
  .filters-enhanced #work-filters {
    display: none;
  }

  body.filters-open {
    overflow: hidden;
  }

  body.filters-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 45%);
    z-index: 499;
  }

  .filters-enhanced.filters-open #work-filters {
    display: block;
    position: fixed;
    inset: 0 0 0 auto;
    box-sizing: border-box;
    width: min(90vw, 24rem);
    max-width: 100%;
    height: 100%;
    margin: 0;
    padding: 1em;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    z-index: 500;
  }

  .filters-open #work-filters .close {
    display: inline-block;
    padding: 0.5em;
  }
}
