/* Header/toolbar tweaks that intentionally depart from the captured WordPress
   styles. Loaded after wp-inline.css, which is where the theme's own inline
   rules landed. */

/* ================================================================
   Contact items (right side)
   ================================================================ */

/* The theme hid these icons (`.toolbar .fa-phone{display:none}` and the same
   for the address icon, both in wp-inline.css). Show them: phone gets a
   handset, email an envelope (the markup used fa-map-marker, a location pin,
   which is why it read as an address line). */
body header .toolbar .fa-phone,
body header .toolbar .fa-envelope,
body header .toolbar .fa-globe {
  display: inline-block;
  font-size: 12px;
  line-height: 1;
  opacity: .85;
}

/* Font Awesome's handset points bottom-left; mirror it so it leans into the
   number it labels instead of away from it. */
body header .toolbar .fa-phone { transform: scaleX(-1); }

/* One spacing rule for the whole bar, so icon-to-text and item-to-item gaps
   are consistent. The markup uses <i> + <span>, with no stray whitespace text
   nodes to add unpredictable extra space. */
body header .toolbar ul li > a,
body header .toolbar ul li > button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  line-height: 1;
}
body header .toolbar ul.company_info > li { margin: 0; }
body header .toolbar ul.company_info > li + li { margin-left: 20px; }

/* Mobile: the phone + email items sit in one float:right row with a fixed
   20px gap and no wrapping — on narrow viewports that overflows past the
   edge instead of wrapping. Stack them as a plain left-aligned column
   instead, same fix applied to the group switcher row above it so nothing
   pushes wider than the viewport. */
@media (max-width: 767px) {
  body header .toolbar .row {
    flex-direction: column;
    align-items: flex-start;
    padding-left: 10px;
  }
  body header .toolbar .left_bar,
  body header .toolbar .col-md-6.col-sm-6.col-12:last-child {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
  }
  body header .toolbar ul.company_info {
    /* .pull-right{float:right!important} (theme utility CSS) outranks a
       plain float:none here since it's !important — match it. */
    float: none !important;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    /* The theme's cached `.right-none.pull-right{margin:0 auto}` rule
       (autoptimize CSS) still wins on margin-left/margin-right since this
       rule only ever set margin-top — auto margins on a column flex
       item's cross axis center it horizontally instead of stacking it
       left-aligned like .toolbar .row above it. */
    margin: 8px 0 0 0;
  }
  body header .toolbar ul.company_info > li + li {
    margin-left: 0;
  }
}

/* ================================================================
   Group switcher (top-left)
   ================================================================ */

/* .left-none carries `overflow:hidden` from the theme, which clips the
   absolutely-positioned drawer out of existence. This is what has to be
   `visible` for the switcher to open at all. */
body header .toolbar ul.group_nav {
  margin: 0;
  padding: 0;
  overflow: visible;
}
body header .toolbar li.group_switcher {
  display: block;
  position: relative;
  float: left;
  /* Align the globe with the logo's visible left edge below it. Measured on a
     1440px viewport: the logo artwork starts at x=160, the toolbar row at
     x=125 (the theme pulls .toolbar rows left with margin-left:-10px), hence
     the 35px nudge. */
  margin: 0 0 0 35px;
}
@media (max-width: 991px) {
  body header .toolbar li.group_switcher { margin-left: 0; }
}

/* wp-inline.css lowercases every toolbar button (`header .toolbar button{
   text-transform:lowercase}`) — the links got a later `text-transform:inherit`
   override but buttons didn't, so the label has to opt out explicitly. Type
   otherwise matches the phone/email items. */
body header .toolbar .group_switcher_trigger {
  padding: 0;
  background: none;
  border: 0;
  color: #fff;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 30px;
  text-transform: none;
  cursor: pointer;
}
body header .toolbar .group_switcher_trigger:hover { color: #fff; }
body header .toolbar .group_switcher_caret {
  font-size: 11px;
  opacity: .7;
  transition: transform .15s;
}

/* the drawer: hidden until hover or keyboard focus lands inside the item.
   Wide, square-cornered panel — one column per company. */
body header .toolbar .group_drawer {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 9000;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 760px;
  max-width: calc(100vw - 40px);
  margin: 0;
  padding: 0;
  list-style: none;
  background: #fff;
  border-radius: 0;
  border-top: 3px solid #c7081b;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .24);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .15s, transform .15s, visibility .15s;
}
body header .toolbar li.group_switcher:hover .group_drawer,
body header .toolbar li.group_switcher:focus-within .group_drawer {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
body header .toolbar li.group_switcher:hover .group_switcher_caret,
body header .toolbar li.group_switcher:focus-within .group_switcher_caret {
  transform: rotate(180deg);
}

/* Row 1 is this site, full width; row 2 is the three sister sites, one per
   column, separated by hairlines rather than gaps. */
body header .toolbar .group_drawer > li {
  display: block;
  float: none;
  margin: 0;
  width: auto;
  border-left: 1px solid #e4e4e7;
}
body header .toolbar .group_drawer > li:first-child { border-left: 0; }
body header .toolbar .group_drawer > li.is-current {
  grid-column: 1 / -1;
  border-left: 0;
  border-bottom: 1px solid #e4e4e7;
}

/* the full-width row reads horizontally: mark | name over blurb | status */
body header .toolbar .group_drawer > li.is-current > span {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 18px;
  padding: 16px 20px;
}
body header .toolbar .group_drawer > li.is-current .group_logo {
  grid-column: 1;
  grid-row: 1 / span 2;
  margin-bottom: 0;
}
body header .toolbar .group_drawer > li.is-current .group_name {
  grid-column: 2;
  grid-row: 1;
  margin-bottom: 2px;
}
body header .toolbar .group_drawer > li.is-current .group_blurb {
  grid-column: 2;
  grid-row: 2;
  margin-bottom: 0;
}
body header .toolbar .group_drawer > li.is-current .group_host {
  grid-column: 3;
  grid-row: 1 / span 2;
  white-space: nowrap;
}

/* the whole column is the hit area */
body header .toolbar .group_drawer > li > a,
body header .toolbar .group_drawer > li > span {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  height: 100%;
  padding: 20px 20px 18px;
  border-radius: 0;
  color: #27272a;
  text-decoration: none;
  text-transform: none;
  white-space: normal;
  transition: background-color .15s;
}
body header .toolbar .group_drawer > li > a:hover { background: #fafafa; }
body header .toolbar .group_drawer > li.is-current > span {
  background: #fafafa;
  cursor: default;
}

/* logo sits in a fixed-height box so the three marks line up regardless of
   their aspect ratios (wordmark, square badge, circular icon) */
body header .toolbar .group_drawer .group_logo {
  display: flex;
  align-items: center;
  height: 34px;
  margin-bottom: 12px;
  padding: 0;
}
/* Definite height, not max-height: molaiequipment.svg declares only a viewBox
   with no width/height, so with `height:auto` it has no intrinsic size to scale
   from and collapses to nothing. */
body header .toolbar .group_drawer .group_logo img {
  height: 34px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}

body header .toolbar .group_drawer .group_name {
  display: block;
  margin-bottom: 6px;
  padding: 0;
  color: #18181b;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0;
}
body header .toolbar .group_drawer .group_blurb {
  display: block;
  flex: 1 1 auto;
  margin-bottom: 12px;
  padding: 0;
  color: #52525b;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.55;
}
body header .toolbar .group_drawer .group_host {
  display: block;
  padding: 0;
  color: #c7081b;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
}
body header .toolbar .group_drawer > li > a:hover .group_host { text-decoration: underline; }

/* current site: muted, and the host slot reads "You are here" */
body header .toolbar .group_drawer .is-current .group_host {
  color: #71717a;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .06em;
}

/* This `display:none` never actually took effect — the theme's own
   `ul li.li_mobile_show{display:inline-block!important}` (autoptimize CSS)
   is !important and beats it, so the switcher stays visible and the drawer
   opens on tap via :focus-within same as desktop hover. Given that, make
   the 3-column grid (sized for a 760px desktop panel) stack into a single
   vertical column instead of squeezing to fit the viewport. */
@media (max-width: 767px) {
  body header .toolbar .group_drawer {
    grid-template-columns: 1fr;
    width: calc(100vw - 40px);
  }
  body header .toolbar .group_drawer > li {
    border-left: 0;
    border-top: 1px solid #e4e4e7;
  }
  body header .toolbar .group_drawer > li:first-child { border-top: 0; }
  body header .toolbar .group_drawer > li.is-current {
    grid-column: 1;
    border-top: 0;
  }
  /* The current-site card uses its own auto/1fr/auto grid (logo beside
     name+blurb beside "You are here") sized for the wide desktop panel.
     In the single-column mobile layout, drop it back to the same stacked
     flex layout as every other card so it reads logo → name → blurb →
     host in order instead of a cramped sideways row. */
  body header .toolbar .group_drawer > li.is-current > span {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 20px 20px 18px;
  }
  body header .toolbar .group_drawer > li.is-current .group_logo {
    grid-column: auto;
    grid-row: auto;
    margin-bottom: 12px;
  }
  body header .toolbar .group_drawer > li.is-current .group_name {
    grid-column: auto;
    grid-row: auto;
    margin-bottom: 6px;
  }
  body header .toolbar .group_drawer > li.is-current .group_blurb {
    grid-column: auto;
    grid-row: auto;
    margin-bottom: 12px;
  }
  body header .toolbar .group_drawer > li.is-current .group_host {
    grid-column: auto;
    grid-row: auto;
    white-space: normal;
  }
}

/* Logos whose mark is baked onto a brand background (molai.ae's cream,
   molaiequipment's slate) get a padded tile in that same colour, so the trimmed
   image edge reads as a deliberate rectangle instead of ragged whitespace. */
body header .toolbar .group_drawer .group_logo--tile {
  padding: 5px 9px;
  border-radius: 0;
}
body header .toolbar .group_drawer .group_logo--tile img { height: 24px; }
