/**
 * @file
 * Site header.
 */

.site-header {
  position: sticky;
  top: var(--drupal-displace-offset-top, 0);
  z-index: 500;
  display: flex;
  flex-direction: column;
}

.site-header--static {
  position: relative;
  top: auto;
}

/* Secondary (utility) bar – on small screens the bottom section of the open
   menu panel: utility links as rows, then the language switch. */
.site-header__secondary {
  order: 2;
  display: none;
  background: var(--imtm-color-surface-light);
  border-top: 1px solid var(--imtm-color-surface);
}

.site-header--open .site-header__secondary {
  display: block;
}

.site-header__secondary-inner {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 0.5rem;
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
}

/* Primary bar. */
.site-header__primary {
  order: 1;
  background-color: var(--imtm-color-white);
  box-shadow: 0 3px 3px rgba(0, 0, 0, 0.05);
}

.site-header__primary-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  min-height: var(--imtm-header-height-mobile);
  padding-top: var(--imtm-space-1);
  padding-bottom: var(--imtm-space-1);
}

.site-header__branding {
  margin-right: var(--imtm-space-3);
}

.site-header__logo {
  display: block;
}

.site-header__logo-image {
  height: 35px;
  width: auto;
  transition: height 0.5s ease;
}

.site-header__toggle {
  order: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  margin-right: -0.5rem;
  color: var(--imtm-color-text);
  background: transparent;
  border: 0;
  border-radius: 0.25rem;
}

.site-header__toggle:focus-visible {
  outline: 2px solid var(--imtm-focus-color);
  outline-offset: -2px;
}

/* Hamburger drawn with one bar and two pseudo-elements; turns into a cross. */
.site-header__toggle-icon,
.site-header__toggle-icon::before,
.site-header__toggle-icon::after {
  display: block;
  width: 26px;
  height: 3px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.25s ease, background-color 0.25s ease;
}

.site-header__toggle-icon {
  position: relative;
}

.site-header__toggle-icon::before,
.site-header__toggle-icon::after {
  position: absolute;
  left: 0;
  content: "";
}

.site-header__toggle-icon::before {
  top: -8px;
}

.site-header__toggle-icon::after {
  top: 8px;
}

.site-header--open .site-header__toggle-icon {
  background-color: transparent;
}

.site-header--open .site-header__toggle-icon::before {
  transform: translateY(8px) rotate(45deg);
}

.site-header--open .site-header__toggle-icon::after {
  transform: translateY(-8px) rotate(-45deg);
}

.site-header__nav {
  order: 3;
  flex-basis: 100%;
}

/* Open menu: the header fills the viewport and scrolls on its own. */
@media (max-width: 991.98px) {
  .site-header--open {
    position: fixed;
    top: var(--drupal-displace-offset-top, 0);
    right: 0;
    bottom: 0;
    left: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--imtm-color-white);
  }

  .site-header--open .site-header__primary {
    flex-grow: 1;
    box-shadow: none;
  }
}

@media (min-width: 992px) {
  .site-header__secondary {
    order: 0;
    display: block;
    height: 35px;
    line-height: 34px;
    background: var(--imtm-color-blue);
    border-top: 0;
  }

  .site-header__secondary-inner {
    flex-direction: row;
    gap: 4px;
    justify-content: flex-end;
    padding-top: 0;
    padding-bottom: 0;
  }

  .site-header {
    /* Read by the main menu to align its links inside the bar. */
    --site-header-bar-height: 100px;
    --site-header-link-offset: 3rem;
  }

  .site-header--small {
    --site-header-bar-height: 60px;
    --site-header-link-offset: 1.25rem;
  }

  .site-header__primary-inner {
    flex-wrap: nowrap;
    justify-content: flex-start;
    height: var(--site-header-bar-height);
    padding-top: 0;
    padding-bottom: 0;
    transition: height 0.5s ease;
  }

  .site-header__toggle {
    display: none;
  }

  .site-header__nav {
    flex-basis: auto;
    align-self: stretch;
    margin-left: auto;
  }

  .site-header__logo-image {
    height: 63px;
  }

  .site-header--small .site-header__logo-image {
    height: 35px;
  }
}
