/* ==========================================================================
   Site header
   ========================================================================== */

.site-header {
  position: absolute;
  z-index: 1000;
  top: 0;
  width: 100%;
  background-color: transparent;
  transform: translateY(0);

  transition:
    transform 220ms ease,
    background-color 140ms ease,
    box-shadow 140ms ease;
}

/* WordPress-Adminleiste berücksichtigen */

.admin-bar .site-header {
  top: 32px;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;

  width: min(calc(100% - 48px), var(--mh-content-width));
  min-height: var(--mh-header-height);
  margin-inline: auto;
  padding-block: 14px;

  transition:
    min-height 260ms ease,
    padding 180ms ease;
}

/* Logo */

.site-logo {
  display: block;
  flex: 0 0 auto;
  line-height: 0;
}

.site-logo__image {
  display: block;
  width: auto;
  height: 110px;
  max-width: 300px;
  object-fit: contain;

  transition:
    width 180ms ease,
    height 180ms ease,
    max-width 180ms ease;
}

/* ==========================================================================
   Kompakter Zustand
   ========================================================================== */

.site-header.is-compact {
  position: fixed;
  background-color: var(--mh-yellow);
  box-shadow: 0 8px 28px rgb(0 89 93 / 16%);
}

.site-header.is-compact .site-header__inner {
  min-height: 68px;
  padding-block: 6px;
}

.site-header.is-compact .site-logo__image {
  height: 54px;
  max-width: 145px;
}

/* Header beim Herunterscrollen ausblenden */

.site-header.is-hidden {
  transform: translateY(calc(-100% - 40px));
}

/* ==========================================================================
   Tablet und Mobile
   ========================================================================== */

@media (max-width: 900px) {
  .site-header__inner {
    position: relative;
    flex-wrap: wrap;
    gap: 20px;

    width: min(calc(100% - 32px), var(--mh-content-width));
  }

  .site-logo {
    flex-basis: auto;
  }

  .site-logo__image {
    height: 80px;
    max-width: 220px;
  }

  .site-header.is-compact .site-header__inner {
    min-height: 62px;
    padding-block: 6px;
  }

  .site-header.is-compact .site-logo__image {
    height: 46px;
    max-width: 125px;
  }
}

/* ==========================================================================
   Smartphone
   ========================================================================== */

@media (max-width: 640px) {
  .site-header__inner {
    width: calc(100% - 32px);
    min-height: 72px;
    padding-block: 8px;
    flex-wrap: nowrap;
    gap: 12px;
  }

  .site-logo__image {
    height: 58px;
    max-width: 125px;
  }

  .site-header.is-compact .site-header__inner {
    min-height: 60px;
    padding-block: 6px;
  }

  .site-header.is-compact .site-logo__image {
    height: 44px;
    max-width: 105px;
  }
}

@media screen and (max-width: 782px) {
  .admin-bar .site-header {
    top: 46px;
  }
}

/*
 * Unter 601px scrollt die WordPress-Adminleiste mit der Seite weg.
 * Der sticky Header braucht deshalb keinen oberen Abstand mehr.
 */

@media screen and (max-width: 600px) {
  .admin-bar .site-header {
    top: 46px;
  }

  .admin-bar .site-header.is-compact {
    top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header,
  .site-header__inner,
  .site-logo__image {
    transition: none;
  }
}
