/**
 * Re-creates the Better Exposed Filters rules from the Drupal 7 style.css.
 *
 * The Drupal 7 widget wrapped its options in <ul class="bef-tree"> and tagged
 * each level with .bef-tree-depth-N. Drupal 10's BEF nests the same way — 38
 * lists, 1217 items, identical to D7 — but the <ul> elements carry no class and
 * the container is .bef-nested instead. These selectors target the Drupal 10
 * markup while keeping the original behaviour.
 *
 * The view-scoping classes (.view-case-by-article and friends) come from
 * nus_preprocess_views_view().
 */

/* Scrollable filter box. D7: .view-case-main-view .form-type-select > .form-checkboxes */
.view-case-main-view .bef-checkboxes {
  height: 150px;
  overflow: auto;
  border: 1px solid #999;
}

.view-case-main-view-adv .bef-checkboxes {
  height: 500px;
  overflow: auto;
  border: 1px solid #999;
}

/* Hanging indent so wrapped labels line up past the checkbox.
   D7 used `text-indent: -22px; margin-left: 30px`, which relied on its own
   markup; in Drupal 10 that pulls the checkbox itself left and it lands on top
   of the first word. Flexbox gets the same result without the overlap.

   Both of those values are still in style.css and they work as a pair: the box
   is pushed in 30px and the first line — the checkbox — is pulled back 22px, so
   the checkbox lands 8px inside the scroll pane. Zeroing text-indent without
   also replacing the margin left the whole row sitting at the full 30px, i.e.
   22px right of where D7 puts it. Measured on both sites: the checkbox starts
   8px inside the pane on D7, and did so at 30px here. */
.view-case-main-view .bef-checkboxes .form-item,
.view-case-main-view-adv .bef-checkboxes .form-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding-top: 5px;
  text-indent: 0;
  margin-left: 8px;
}

.view-case-main-view .bef-checkboxes .form-item > input[type="checkbox"],
.view-case-main-view-adv .bef-checkboxes .form-item > input[type="checkbox"] {
  flex: 0 0 auto;
  margin-top: 3px;
}

.view-case-main-view .bef-checkboxes .form-item > label,
.view-case-main-view-adv .bef-checkboxes .form-item > label {
  flex: 1 1 auto;
}

/* Basic search hides the article children. D7: .bef-tree-depth-1 { display: none } */
.view-case-main-view .bef-nested > ul > li ul {
  display: none;
}

/* Browse by convention hides the parent checkboxes, leaving them as headings.
   D7: .view-case-by-article .bef-tree > li > div input[type="checkbox"] */
.view-case-by-article .bef-nested > ul > li > .form-item > input[type="checkbox"] {
  display: none;
}

/* Line up multi-line options. D7: ... .views-widget-filter-tid ul.bef-tree —
   note that rule targets only the outer list, so the nested article lists keep
   their default bullets. Hence the child combinator here. */
.view-case-by-article .bef-nested > ul {
  list-style-type: none;
  margin-left: -40px;
}

.view-case-main-view .bef-nested li,
.view-case-main-view-adv .bef-nested li {
  list-style-type: none;
  list-style-image: none;
  margin-left: -30px;
  margin-top: 5px;
}

/* ---- Browse pages: vertical placement of the left-hand filter column ----
   Measured in Chrome on both sites (px from the top of the page, convention
   page): the first option sits at 309 on D7 and 292 here, and each option is
   41px tall on D7 against 46 here — so the list started 17px high and then
   drifted a further 5px per row, while the pager beside it sat 20px low.

   1. Start offset. D7 wrapped the filter in
        .views-exposed-widget  { padding: .5em 1em 0 0 }      (7px top, 14px right)
        .views-exposed-widget > .views-widget { margin-top: 15px }
      Drupal 11's Better Exposed Filters renders a <fieldset> + <legend> instead,
      so neither rule has an element to land on (style.css still carries the
      .views-widget one, unmatched). Same numbers, applied to the fieldset and
      its wrapper. The 1em on the right matters too: it narrows the column by
      14px, which is what decides where long options wrap — without it
      "CMI Uniform Rules for Sea Waybills" broke after "for" here and after
      "Rules" on D7. The legend is empty on these pages but still carried a 5px
      margin-bottom from views-exposed-d7.css, which is the 5px the list was
      already getting, so it is zeroed here to keep the total at exactly 7 + 15. */
.view-case-by-article .view-filters .views-exposed-form > fieldset,
.view-case-by-countries .view-filters .views-exposed-form > fieldset,
.view-case-by-date .view-filters .views-exposed-form > fieldset {
  padding: 0.5em 1em 0 0;
}

.view-case-by-article .view-filters .views-exposed-form > fieldset > legend,
.view-case-by-countries .view-filters .views-exposed-form > fieldset > legend,
.view-case-by-date .view-filters .views-exposed-form > fieldset > legend {
  margin-bottom: 0;
}

.view-case-by-article .view-filters .fieldset-wrapper,
.view-case-by-countries .view-filters .fieldset-wrapper,
.view-case-by-date .view-filters .fieldset-wrapper {
  margin-top: 15px;
}

/* 2. Row height. Drupal 7 core has
        label.option { display: inline; font-weight: normal }
      Bootstrap's base "label { display: inline-block; margin-bottom: 5px }" is
      what applies here, and an inline-block label keeps its bottom margin, so
      every option grew by 5px. Only display is restored: the weight is set to
      bold by the theme's own rules on both sites, and not restating "normal"
      avoids fighting them. Scoped to the filter column; nothing else uses it. */
.view-case-by-article .view-filters label.option,
.view-case-by-countries .view-filters label.option,
.view-case-by-date .view-filters label.option {
  display: inline;
}
