/**
 * Filter bars, shared by the website and the internal area (loaded after screen.css and
 * admin.css): a light grey box with labelled groups, white buttons with a thin grey border,
 * the chosen one dark blue.
 *
 *   .filter-bar         the box (the admin lists use .admin-list-toolbar, same look)
 *   .filter-bar-group   label + controls (.admin-list-toolbar-group)
 *   .filter-bar-label   small blue capitals, optionally with an icon (.admin-list-toolbar-label)
 *   .filter-bar-search  group on the far right, e.g. the search (.admin-list-search-group)
 *   .filter-btn         button or link (.admin-list-filter-btn)
 *   .filter-segmented   buttons that touch, only the outer corners are round (.admin-list-segmented)
 *   .filter-step        square arrow button (also .statistics-step)
 *   .filter-select      selection field in a bar
 *   .is-disabled        an arrow without a target (a <span>, not a link)
 *   .active             the chosen button
 *
 * Website (.filter-bar): larger (36px, on touch screens 44px); the year of the gallery and the
 * press page comes from yearStepper() in php/include/filterbar.php.
 */
:root {
  --filter-height: 1.85rem;
}

/* the box */
.filter-bar,
.admin-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  background: var(--color-ultralightgray);
  border: 1px solid var(--color-lightgray);
  border-radius: var(--border-radius);
}
/* lists: the box merges into the list below (corners and exceptions: admin.css) */
.admin-list-toolbar {
  border-bottom: none;
}
/* label + controls */
.filter-bar-group,
.admin-list-toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.filter-bar-label,
.admin-list-toolbar-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-darkblue);
  white-space: nowrap;
  user-select: none;
}
/* a group can be a <form> (the search): without the padding forms get from screen.css */
form.filter-bar-group {
  padding: 0;
  margin-top: 0;
  margin-bottom: 0;
}
/* nor the clearfix of forms: in a flex group it is an empty first item, the gap after it
   pushed the label to the right */
form.filter-bar-group::before,
form.filter-bar-group::after {
  display: none;
}
/* a <label> (e.g. of the search field) without the form layout of screen.css */
label.filter-bar-label {
  clear: none;
  display: inline;
  float: none;
  width: auto;
  margin: 0;
  padding: 0;
  text-align: left;
}
.filter-bar-label .icon,
.admin-list-toolbar-label .icon {
  margin-right: 0.3em;
}
/* e.g. the search: on the far right */
.filter-bar-search,
.admin-list-search-group {
  margin-left: auto;
  order: 999;
}

.filter-btn,
.admin-list-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  box-sizing: border-box;
  height: var(--filter-height);
  /* only vertical: bars set the horizontal overlap (margin-left: -1px) themselves */
  margin-top: 0;
  margin-bottom: 0;
  padding: 0 0.65rem;
  /* reset the global float/width of buttons in forms */
  float: none;
  width: auto;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: normal;
  line-height: 1;
  color: var(--color-black);
  background: var(--color-white);
  border: 1px solid var(--color-lightgray);
  border-radius: var(--border-radius);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.filter-btn:hover,
.filter-btn:focus,
.admin-list-filter-btn:hover,
.admin-list-filter-btn:focus {
  color: var(--color-black);
  background: var(--color-white);
  border-color: var(--color-darkblue);
  text-decoration: none;
}
.filter-btn:focus-visible,
.admin-list-filter-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-darkblue-transparent-light);
}
.filter-btn.active,
.filter-btn.active:hover,
.filter-btn.active:focus,
.admin-list-filter-btn.active,
.admin-list-filter-btn.active:hover,
.admin-list-filter-btn.active:focus {
  background: var(--color-darkblue);
  color: var(--color-white);
  border-color: var(--color-darkblue);
}
.filter-btn.is-disabled,
.filter-btn.is-disabled:hover,
.admin-list-filter-btn.is-disabled,
.admin-list-filter-btn.is-disabled:hover {
  color: var(--color-lightgray);
  border-color: var(--color-lightgray);
  cursor: default;
}

/* arrows: as wide as high */
.filter-step,
.statistics-step {
  width: var(--filter-height);
  padding: 0;
}
.filter-step .icon,
.statistics-step .icon {
  vertical-align: 0;
}

/* selection field: looks like the buttons, the arrow of the browser stays (one class only, so
   the corners and overlap of .filter-segmented below win) */
.filter-select {
  box-sizing: border-box;
  float: none;
  width: auto;
  height: var(--filter-height);
  margin-top: 0;
  margin-bottom: 0;
  padding: 0 0.4rem 0 0.65rem;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--color-black);
  background-color: var(--color-white);
  border: 1px solid var(--color-lightgray);
  border-radius: var(--border-radius);
  cursor: pointer;
}
.filter-select:hover {
  border-color: var(--color-darkblue);
}
.filter-select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-darkblue-transparent-light);
}
/* the year field sits in <span class="filter-select-wrap">, which draws the arrow (Lucide
   chevron-down as mask): an element of its own turns while the menu is open, like the arrow of
   the category dropdown (.admin-multiselect, admin.css); the arrow image of a <select> could
   only be swapped. Grey, blue while focused or open (website: black, below) */
.filter-select-wrap {
  position: relative;
  display: inline-flex;
}
.filter-select-wrap > .filter-select {
  -webkit-appearance: none;
  appearance: none;
  background-image: none;
  padding-right: 1.8rem;
}
.filter-select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.4rem;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  background-color: var(--color-gray);
  -webkit-mask: url(/img/icons/chevron-down.svg) center / contain no-repeat;
  mask: url(/img/icons/chevron-down.svg) center / contain no-repeat;
  transition: transform 0.15s;
  /* clicks reach the field below */
  pointer-events: none;
}
.filter-select-wrap:focus-within::after {
  background-color: var(--color-darkblue);
}
/* browsers without :open keep the arrow pointing down */
@supports selector(select:open) {
  .filter-select-wrap:has(> select:open)::after {
    background-color: var(--color-darkblue);
    transform: rotate(180deg);
  }
}

/* one of several: the elements touch, only the outer corners are round */
.filter-segmented,
.admin-list-segmented {
  display: inline-flex;
}
/* (in the admin bars only the filter buttons join: the date field of the statistics has its own shape) */
.filter-segmented > *,
.admin-list-segmented .admin-list-filter-btn {
  position: relative;
  border-radius: 0;
}
/* also against ".admin-list-toolbar select" (rounded corners) in the year group of the admin lists */
.filter-segmented > .filter-select-wrap > .filter-select {
  border-radius: 0;
}
.filter-segmented > * + *,
.admin-list-segmented .admin-list-filter-btn + .admin-list-filter-btn {
  margin-left: -1px;
}
.filter-segmented > :first-child,
.admin-list-segmented .admin-list-filter-btn:first-child {
  border-radius: var(--border-radius) 0 0 var(--border-radius);
}
.filter-segmented > :last-child,
.admin-list-segmented .admin-list-filter-btn:last-child {
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
}
/* the blue or hovered border lies above the grey ones next to it */
.filter-segmented > :hover,
.filter-segmented > :focus,
.filter-segmented > :focus-within,
.admin-list-segmented .admin-list-filter-btn:hover,
.admin-list-segmented .admin-list-filter-btn:focus {
  z-index: 1;
}
.filter-segmented > .active,
.admin-list-segmented .admin-list-filter-btn.active {
  z-index: 2;
}

/* Website: larger than in the dense admin lists */
.filter-bar {
  --filter-height: 2.25rem;
  gap: 0.5rem 1.25rem;
  margin: 0 0 1.5em;
}
.filter-bar .filter-btn,
.filter-bar .filter-select {
  font-size: 1rem;
}
/* the year: bold, room for four digits and the arrow */
.filter-bar .filter-select-wrap > .filter-select {
  min-width: 6.5rem;
  padding-right: 2rem;
  font-weight: bold;
}
/* the arrow black like the arrows next to it and as big as their icons, also while open */
.filter-bar .filter-select-wrap {
  font-size: 1rem;
}
.filter-bar .filter-select-wrap::after,
.filter-bar .filter-select-wrap:focus-within::after {
  width: 1.125em;
  height: 1.125em;
  margin-top: -0.5625em;
  background-color: var(--color-black);
}
@supports selector(select:open) {
  .filter-bar .filter-select-wrap:has(> select:open)::after {
    background-color: var(--color-black);
  }
}
.filter-bar input[type="search"] {
  box-sizing: border-box;
  float: none;
  width: 14rem;
  min-width: 0;
  height: var(--filter-height);
  margin-top: 0;
  margin-bottom: 0;
  padding: 0 0.65rem;
  font: inherit;
  font-size: 1rem;
  background-color: var(--color-white);
  border: 1px solid var(--color-lightgray);
}
.filter-bar input[type="search"]:focus {
  outline: none;
  border-color: var(--color-darkblue);
  box-shadow: 0 0 0 2px var(--color-darkblue-transparent-light);
}
/* touch screens: 44px to tap */
@media (pointer: coarse) {
  .filter-bar {
    --filter-height: 2.75rem;
  }
}
/* phones: the search takes a line of its own, the field as wide as possible */
@media (max-width: 640px) {
  .filter-bar-search {
    flex: 1 1 100%;
    margin-left: 0;
  }
  .filter-bar-search .filter-segmented {
    flex: 1;
  }
  .filter-bar input[type="search"] {
    flex: 1;
    width: auto;
  }
}
