/*
 * Utility Bar (Site Parts) - .header-top rules from header.css, re-scoped
 * off `.header-top` (not `#header`) so this block renders the same anywhere.
 * `.header-version-2` is set locally in -render.php - the block editor
 * iframe never gets the global `html.header-version-2` class.
 * `.is-enterprise` overrides stay in enterprise.css - not duplicated here.
 */

.header-top {
  font-size: 0.875em;
  background: var(--utility-bar-bg, var(--wpt-top-bar-colour));
}

.header-top .wpt-container-fluid {
  padding: 0 80px;
}

.header-top.header-version-2 .wpt-container-fluid {
  padding: 0 28px;
}

.header-top .wpt-container-fluid > .wpt-row {
  display: flex;
  justify-content: space-between;
  min-height: var(--utility-bar-height, 36px);
}

.header-top-left,
.header-top-right {
  display: flex;
}

.header-top-right {
  justify-content: flex-end;
}

.header-top-left > div,
.header-top-right > div {
  display: block;
}

.header-top #social_media_links {
  padding: 0;
  margin: 0;
  list-style: none;
  display: flex;
}

.header-top.header-version-2 #social_media_links {
  padding: 0 0 0 10px !important;
}

/*
 * Legacy global stylesheets still target .address-block/#phone_number/
 * #social_media_links unscoped:
 * - phone/address/social stay unwrapped so they still match those rules.
 * - !important below beats their hardcoded, sometimes ID-qualified colours.
 */
.header-top .address-block,
.header-top #phone_number,
.header-top #social_media_links a,
.header-top .utility-bar-item {
  display: block;
  padding: 10px 7px;
  min-width: 30px;
  text-align: center;
}

.header-top .address-block,
.header-top .address-block a,
.header-top #phone_number,
.header-top #social_media_links a,
.header-top .utility-bar-item,
.header-top .utility-bar-item a {
  color: var(--utility-bar-text, #fff) !important;
  text-decoration: none !important;
}

.header-top.header-version-2 .address-block,
.header-top.header-version-2 #phone_number,
.header-top.header-version-2 #social_media_links,
.header-top.header-version-2 .utility-bar-item {
  border-left: 1px solid rgba(255, 255, 255, 0.3);
  padding: 0 20px;
  display: flex;
  line-height: 0;
  height: 100%;
  align-items: center;
}

/* Position 1 is always a lone item in .header-top-left - no divider needed. */
.header-top.header-version-2 .header-top-left .address-block,
.header-top.header-version-2 .header-top-left #phone_number,
.header-top.header-version-2 .header-top-left #social_media_links,
.header-top.header-version-2 .header-top-left .utility-bar-item {
  border-left: none;
}

.header-top.header-version-2 .address-block i {
  margin-right: 10px;
  font-size: 1.3em;
}

.header-top.header-version-2 .header-top-right {
  text-transform: uppercase;
  align-items: center;
}

.header-top.header-version-2 .header-top-right,
.header-top.header-version-2 .header-top-right a {
  font-size: 12px;
  letter-spacing: 0.1em;
}

.header-top.header-version-2 #social_media_links a {
  font-size: 16px;
}

/*
 * fa-tripadvisor doesn't recolour via color/currentColor - mask the brand SVG
 * instead, same technique as header.css/footer.css, but parameterized off our
 * text colour var (header.css's version is hardcoded to #fff).
 */
.header-top.header-version-2 #social_media_links .fa-tripadvisor:before {
  content: "";
  background-size: 50% 50%;
  background-repeat: no-repeat;
  -webkit-mask-image: url(../../../assets/images/tripadvisor.svg);
  mask-image: url(../../../assets/images/tripadvisor.svg);
  mask-repeat: no-repeat;
  display: block;
  width: 20px;
  height: 16px;
  background-color: var(--utility-bar-text, #fff);
}

.header-top.header-version-2 #phone_number i.fa-phone:before {
  content: "\f879";
  font-size: 15px;
  margin-right: 5px;
}

.header-top a#phone_number {
  padding: 10px 20px;
}

.header-top .address-block a:hover {
  opacity: 0.7;
}

/*
 * header.css sets `line-height: 0 !important` on these items, which only ever
 * worked while they sat on one line. Any address long enough to wrap then
 * paints both lines on top of each other, at any viewport width - so restore
 * a real line-height. IDs here because the legacy rules are ID-qualified and
 * an ID outranks any number of classes.
 */
.utility-bar.header-top .address-block,
.utility-bar.header-top .utility-bar-item,
.utility-bar.header-top #phone_number,
.utility-bar.header-top #social_media_links {
  line-height: normal !important;
}

/*
 * A phone number must never break across lines, and the icon row has a fixed
 * natural width - so hold both at their own size and let the address, the one
 * item that reads fine on two lines, absorb the squeeze as the bar narrows.
 */
.utility-bar.header-top #phone_number {
  white-space: nowrap;
}

.utility-bar.header-top #phone_number,
.utility-bar.header-top #social_media_links {
  flex-shrink: 0;
}

/*
 * Mobile/tablet: stack each populated position as its own full-width row.
 * 900px is the theme's desktop boundary (header.css hides #header below it).
 * Stacking the whole range rather than only phone widths is deliberate - in
 * between, version-2's `height: 100%` stretches wrapped items to the full
 * multi-line bar height, which leaves large empty gaps.
 * Scoped to `.utility-bar` so the legacy header bar (same `.header-top`, no
 * `.utility-bar`) keeps its current behaviour, and so these outrank the
 * unscoped `.header-top*` rules in assets/css/global/header.css.
 * Keep last in this file - some rules here only tie on specificity with the
 * version-2 block above and win on source order alone.
 */
@media (max-width: 900px) {
  .utility-bar.header-top .wpt-container-fluid {
    padding: 0 16px;
  }

  .utility-bar.header-top .wpt-container-fluid > .wpt-row,
  .utility-bar.header-top .header-top-left,
  .utility-bar.header-top .header-top-right {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
  }

  /*
   * !important on display/padding is not defensive - header.css and the
   * version-2 block above set both with !important, so a plain reset loses
   * at any specificity.
   */
  .utility-bar.header-top .header-top-left > *,
  .utility-bar.header-top .header-top-right > * {
    display: flex !important;
    width: 100%;
    height: auto;
    align-items: center;
    justify-content: center;
    border-left: none;
    padding: 8px 0 !important;
  }

  /*
   * Keep the address a block so its pin icon flows inline with the first line
   * of centred text. As a flex row the wrapped text takes the remaining width
   * and strands the icon against the left edge.
   */
  .utility-bar.header-top .address-block {
    display: block !important;
  }

  /*
   * Phone and social repeat the reset with an ID in the selector - their
   * legacy border/padding rules are ID-qualified, and an ID outranks any
   * number of classes. `.address-block` is covered by the rule above.
   */
  .utility-bar.header-top #phone_number,
  .utility-bar.header-top #social_media_links {
    border-left: none;
    padding: 8px 0 !important;
  }
}
