/* Filter bar. SITE STANDARD for filtering a listing: News & Insights now,
 * Professionals and search results next.
 *
 * Same box as the capability tab bar: full bleed white, 52 tall, --hlb-rule
 * under it, content on the container edge. News & Insights comp: FILTER BY
 * label, then boxed fields split by hairlines, each with a down arrow.
 *
 * Fields are native select and date inputs, restyled. Native keeps keyboard,
 * screen reader and phone pickers right for free.
 *
 * Type: label navy 12.65:1. Field text --hlb-slate at rest (5.40:1, the
 * comp's gray is 2.58 and fails), ink once a value is chosen (is-set).
 *
 * :root in front of control rules lifts them over Uncode's form styling
 * without !important.
 */

.hlb-filter-bar {
  --hlb-filter-bar-height: 52px;
  --hlb-filter-bar-hover:  #F5F7FA;

  position: relative;
  z-index: 2;
  margin: 0;
  background: var(--hlb-white);
  border-bottom: 1px solid var(--hlb-rule);
}

.hlb-filter-bar__inner {
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: calc(var(--hlb-container) + (var(--hlb-gutter) * 2));
  min-height: var(--hlb-filter-bar-height);
  margin: 0 auto;
  padding: 0 var(--hlb-gutter);
}

.hlb-filter-bar .hlb-filter-bar__label {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  margin: 0;
  padding: 0 32px 0 0;
  font: 400 13px/1 var(--hlb-font-display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hlb-navy);
}

.hlb-filter-bar__field {
  position: relative;
  display: flex;
  flex: 1 1 0;
  align-items: center;
  min-width: 0;
  border-left: 1px solid var(--hlb-rule);
  transition: background-color var(--hlb-speed) var(--hlb-ease);
}

.hlb-filter-bar__field--category {
  flex-grow: 0.75;
}

.hlb-filter-bar__field--date {
  flex: 0 1 210px;
  gap: 10px;
  padding-left: 20px;
}

.hlb-filter-bar__field--to {
  border-right: 1px solid var(--hlb-rule);
}

.hlb-filter-bar__field:hover,
.hlb-filter-bar__field:focus-within {
  background-color: var(--hlb-filter-bar-hover);
}

/* Controls. */
:root .hlb-filter-bar .hlb-filter-bar__control {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 100%;
  min-height: var(--hlb-filter-bar-height);
  margin: 0;
  padding: 0 44px 0 20px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent none;
  box-shadow: none;
  font: 400 12px/1 var(--hlb-font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--hlb-slate);
  cursor: pointer;
  transition: color var(--hlb-speed) var(--hlb-ease);
}

:root .hlb-filter-bar .hlb-filter-bar__field.is-set .hlb-filter-bar__control {
  color: var(--hlb-ink);
}

:root .hlb-filter-bar .hlb-filter-bar__control:focus {
  outline: none;
}

:root .hlb-filter-bar .hlb-filter-bar__control:focus-visible {
  outline: 2px solid var(--hlb-navy);
  outline-offset: -2px;
}

/* The open list is the OS's. Keep it plain and readable. */
:root .hlb-filter-bar .hlb-filter-bar__control option {
  font-family: var(--hlb-font-body);
  letter-spacing: 0;
  text-transform: none;
  color: var(--hlb-ink);
}

/* Down arrow, per the comp. Nudges on hover, same idea as the button arrow. */
.hlb-filter-bar__arrow {
  position: absolute;
  top: 50%;
  right: 18px;
  width: 10px;
  height: 16px;
  margin-top: -8px;
  pointer-events: none;
  fill: none;
  stroke: var(--hlb-blue);
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .28s cubic-bezier(.22, .61, .36, 1);
}

.hlb-filter-bar__field:hover .hlb-filter-bar__arrow,
.hlb-filter-bar__field:focus-within .hlb-filter-bar__arrow {
  transform: translateY(3px);
}

/* Dates: visible label, then the native field. */
.hlb-filter-bar .hlb-filter-bar__date-label {
  flex: 0 0 auto;
  margin: 0;
  font: 400 12px/1 var(--hlb-font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hlb-navy);
  cursor: pointer;
}

:root .hlb-filter-bar .hlb-filter-bar__date {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 14px 0 0;
  font: 400 13px/1 var(--hlb-font-body);
  letter-spacing: 0;
  text-transform: none;
}

.hlb-filter-bar__date::-webkit-calendar-picker-indicator {
  opacity: 0.6;
  cursor: pointer;
  transition: opacity var(--hlb-speed) var(--hlb-ease);
}

.hlb-filter-bar__field:hover .hlb-filter-bar__date::-webkit-calendar-picker-indicator {
  opacity: 1;
}

/* Apply: no-JS only. With JS the bar applies on change. */
.hlb-filter-bar__submit {
  align-self: center;
  min-width: 0;
  margin-left: 16px;
}

.hlb-filter-bar.is-enhanced .hlb-filter-bar__submit {
  display: none;
}

/* Tablet and down: fields stack under the label, full bleed rows. */
@media (max-width: 1099px) {
  .hlb-filter-bar__inner {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0;
  }

  .hlb-filter-bar .hlb-filter-bar__label {
    grid-column: 1 / -1;
    padding: 18px var(--hlb-gutter) 14px;
  }

  .hlb-filter-bar__field {
    border-top: 1px solid var(--hlb-rule);
    border-left: 0;
  }

  .hlb-filter-bar__field--sector,
  .hlb-filter-bar__field--to {
    border-left: 1px solid var(--hlb-rule);
  }

  .hlb-filter-bar__field--category {
    grid-column: 1 / -1;
  }

  .hlb-filter-bar__field--to {
    border-right: 0;
  }

  :root .hlb-filter-bar .hlb-filter-bar__field:not(.hlb-filter-bar__field--sector) > .hlb-filter-bar__control:not(.hlb-filter-bar__date) {
    padding-left: var(--hlb-gutter);
  }

  .hlb-filter-bar__field--from {
    padding-left: var(--hlb-gutter);
  }

  .hlb-filter-bar__submit {
    grid-column: 1 / -1;
    justify-self: start;
    margin: 16px var(--hlb-gutter);
  }
}

@media (max-width: 599px) {
  .hlb-filter-bar__field--practice,
  .hlb-filter-bar__field--sector {
    grid-column: 1 / -1;
  }

  .hlb-filter-bar__field--sector {
    border-left: 0;
  }

  :root .hlb-filter-bar .hlb-filter-bar__field--sector > .hlb-filter-bar__control {
    padding-left: var(--hlb-gutter);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hlb-filter-bar__arrow {
    transition: none;
  }

  .hlb-filter-bar__field:hover .hlb-filter-bar__arrow,
  .hlb-filter-bar__field:focus-within .hlb-filter-bar__arrow {
    transform: none;
  }
}
