/*
  Bar search. Loaded after bar.css, which supplies the shell, the header and
  .bar-rhs's 912px row basis. Spacing is the 16px base unit throughout.
*/

/* One full-width column: core caps a content column at 440px. */
.bar-search .bar-search__content {
  max-width: none;
}

/* Below 640px bar.css gives the row no basis, and a form-only page then
   shrink-wraps it. The basis goes on the row, not the column. */
@media (max-width: 639px) {
  .bar-search .bar-rhs {
    flex: 1 1 100%;
  }
}

.bar-search-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bar-search-form__pair {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 400px) {
  .bar-search-form__pair {
    flex-direction: row;
  }
  .bar-search-form__pair > * {
    flex: 1 1 50%;
    min-width: 0;
  }
}

.bar-search-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 1rem;
  margin-bottom: 1rem;
}

.bar-search-heading > .bar-heading {
  margin-bottom: 0;
}

/* Two classes: bar.css indents every .bar-page list. */
.bar-search .bar-search-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Sized from the column, not the viewport: the sidebar arriving at 1024px
   narrows it. 140px keeps every card under the 220px CDN thumbnail. */
@media (min-width: 640px) {
  .bar-search .bar-search-results {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

.bar-search-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
}

/* Centred whether one or both of the links render. */
.bar-search-pagination__status {
  flex: 1 1 auto;
  text-align: center;
}

/* Lands below the pinned site header (core header.js sets the variable; 40px
   is its measured height, for a fragment scroll before the script runs). */
.bar-search-results-section {
  scroll-margin-top: calc(var(--header-pinned-height, 40px) + 1rem);
}

/* Style and Recommended for: one collapsible checkbox group each. Filled and
   bordered like the core select beside them; the values are core's `input` /
   `input-dark` swatch, spelled out because this file has no Sass config. */
.bar-search-filter {
  background-color: #ffffff;
  border: 1px solid #969696;
  border-radius: 0.25rem;
}

html[data-theme="dark"] .bar-search-filter {
  background-color: #2a2a2a;
  border-color: #4a4a4a;
}

.bar-search-filter > summary {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.8125rem 1rem;
  cursor: pointer;
  list-style: none;
}

.bar-search-filter > summary::-webkit-details-marker {
  display: none;
}

/* Caret drawn in currentColor so it follows the theme. */
.bar-search-filter > summary::after {
  content: '';
  margin-left: auto;
  align-self: center;
  border: 6px solid transparent;
  border-top-color: currentColor;
  border-bottom: 0;
}

.bar-search-filter[open] > summary::after {
  transform: rotate(180deg);
}

.bar-search-filter__name {
  font-weight: 700;
  white-space: nowrap;
}

.bar-search-filter__chosen {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.8;
}

.bar-search-filter__options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem 1rem;
  margin: 0;
  padding: 0 1rem 1rem;
  border: 0;
  min-width: 0;
}

@media (min-width: 640px) {
  .bar-search-filter__options {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }
}

/* Every checkbox on this page (the filter groups and "Include closed bars")
   matches the account register page's "Keep up to date!" box: a 20px square
   on the input swatch, filled blue with a tick when checked. Values are the
   register page's corridor.css ones, spelled out. Core's focus ring stays. */
.bar-search .dg-component-checkbox-wrapper .dg-component-checkbox__box {
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-color: #969696;
  border-radius: 0.25rem;
  background-color: #ffffff;
}

html[data-theme="dark"] .bar-search .dg-component-checkbox-wrapper .dg-component-checkbox__box {
  border-color: #4a4a4a;
  background-color: #2a2a2a;
}

.bar-search .dg-component-checkbox:checked + .dg-component-checkbox__label .dg-component-checkbox__box {
  border-color: #1779ba;
  background-color: #1779ba;
  box-shadow: none;
}

html[data-theme="dark"] .bar-search .dg-component-checkbox:checked + .dg-component-checkbox__label .dg-component-checkbox__box {
  border-color: #4da3ff;
  background-color: #4da3ff;
  box-shadow: none;
}

.bar-search .dg-component-checkbox:checked + .dg-component-checkbox__label .dg-component-checkbox__box .dg-component-checkbox__checkmark {
  display: block;
  width: 0.75rem;
  height: 0.625rem;
  color: #ffffff;
  opacity: 1;
  transform: none;
}

html[data-theme="dark"] .bar-search .dg-component-checkbox:checked + .dg-component-checkbox__label .dg-component-checkbox__box .dg-component-checkbox__checkmark {
  color: #1a1a1a;
}
