/**
 * @file
 * Date range filters on every Views exposed form, laid out on one line.
 *
 * Claro (and most themes) put a date range in a boxed fieldset with the from
 * and to inputs stacked under their own headings, which makes it far taller
 * than the filters beside it. This drops the box, keeps the legend as an
 * ordinary filter label, and puts "from [date] to [date]" in a row, so the
 * filters wrap into even rows instead of one row with a tall block in it.
 *
 * Only fieldsets holding a date input are touched; checkbox groups and other
 * fieldsets keep their theme styling.
 */

/* Line filters up along their inputs, since the range has no outer margin. */
.views-exposed-form:has(fieldset input[type="date"], fieldset .form-date) {
  align-items: flex-end;
}

.views-exposed-form fieldset:has(input[type="date"], .form-date) {
  margin-block: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

/* The legend reads as the filter's label, like a select's label beside it. */
.views-exposed-form fieldset:has(input[type="date"], .form-date) > legend {
  display: contents;
}

.views-exposed-form fieldset:has(input[type="date"], .form-date) > legend > span,
.views-exposed-form fieldset:has(input[type="date"], .form-date) .fieldset__label {
  display: block;
  margin: 0 0 0.25rem;
  padding: 0;
  color: var(--color-fg, inherit);
  font-size: var(--font-size-label, 0.889rem);
  font-weight: bold;
  line-height: 1.125rem;
}

/* The from and to parts side by side. */
.views-exposed-form fieldset:has(input[type="date"], .form-date) > .fieldset__wrapper,
.views-exposed-form fieldset:has(input[type="date"], .form-date) > .fieldset-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
}

/* Each part: its "from" / "to" heading inline before the input. */
.views-exposed-form fieldset:has(input[type="date"], .form-date) .form-datetime-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.views-exposed-form fieldset:has(input[type="date"], .form-date) .form-datetime-wrapper > .form-item__label,
.views-exposed-form fieldset:has(input[type="date"], .form-date) .form-datetime-wrapper > h4 {
  margin: 0;
  font-size: var(--font-size-label, 0.889rem);
  font-weight: normal;
}

.views-exposed-form fieldset:has(input[type="date"], .form-date) .form-datetime-wrapper .form-item,
.views-exposed-form fieldset:has(input[type="date"], .form-date) .form-items-inline {
  margin: 0;
}
