/*************************************************/
/*                      Header                   */
/*************************************************/

.header {
  position: fixed;
  top: 0;
  width: 100%;
  min-height: var(--header-height-1621); /* keep only a minimum */
  /*height: auto; /* let content decide */
  display: flex;
  justify-content: center;
  align-items: start;
  background-color: rgb(21, 55, 97);
  z-index: 1000;
}

/* right-side background */
.header::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: calc((100vw - min(1575px, 100%)) / 2);
  min-height: var(--header-height-1621); /* keep only a minimum */
  height: auto; /* let content decide */
  background-color: rgb(4, 47, 82);
}

.side-nav__button-container {
  width: 60px;
  height: 100%;
  display: flex;
  align-items: end;
  position: absolute;
  left: 0;
}

.side-nav__button {
  width: 40px;
  margin-bottom: 20px;
}

.side-nav__button.no-user {
  display: none;
}

.side-nav__button::part(base) {
  background-color: rgb(21, 55, 97);
}

.side-nav__icon {
  font-size: 1.5rem;
  margin-top: 10px;
  background-color: rgb(21, 55, 97);
  color: white;
}

.header-container {
  width: min(1562px, 100%);
  display: flex;
  align-items: stretch;
  flex-wrap: nowrap; /* ⭐ important */
}

.header-logo-container {
  display: flex;
  align-items: center;
  flex: 0 0 auto; /* content width */
  padding: 1.5rem 0rem;
  align-self: flex-start; /* prevent flex stretching */
  max-height: 100%;
  margin-left: 35px;
}

.header-logo-container a {
  text-decoration: none;
}

.header-logo-container img {
  height: 3.5rem;
  padding: 0 0.625rem; /* remove vertical margin */
}

.jasinska-group {
  color: white;
  border-left: 1px solid white;
  height: 3.5rem;
  min-width: fit-content;
  max-width: calc(100% - 50px);
  padding-left: 0.6rem;
  line-height: 1.6;
  font-size: 1.8rem;
}

.header-menu__button {
  display: none; /* ⭐ desktop default */
  height: 100%;
}

.header-menu__icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scaleY(1);
  color: white;
  font-size: 1.8rem;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
  transform-origin: center;
}

.icon--open {
  opacity: 1;
  transform: translate(-50%, -50%) scaleY(1);
}

.icon--close {
  opacity: 0;
  transform: translate(-50%, -50%) scaleY(0);
}

.header-menu__button.menuIsOpen .icon--open {
  opacity: 0;
  transform: translate(-50%, -50%) scaleY(0);
  transition-delay: 0.2s;
}

.header-menu__button.menuIsOpen .icon--close {
  opacity: 1;
  transform: translate(-50%, -50%) scaleY(1);
  transition-delay: 0.2s;
}

.header.menuIsOpen .header-nav-container {
  width: 100%;
  order: 99; /* pushes it below logo + button */
}

.header-nav-container {
  display: flex;
  flex-direction: column; /* UI above nav */
  flex: 1 1 auto; /* fill remaining space */
  margin-left: 1rem;
  background-color: rgb(4, 47, 82);
}

.header__ui {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 2.4rem;
  background-color: rgb(6, 32, 56);
}

.header-user {
  display: block;
  margin: 0.2rem 0.6rem 0.2rem 0.6rem;
  color: white;
}

.search {
  width: 16rem;
  height: 2.5rem;
  padding: 0.25rem 1rem 0.25rem 1rem;
}

.search__button::part(base) {
  /* to make sure the loop icon is centered - somewhere it was overruled */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.themeSwitch__button {
  background-color: rgb(6, 32, 56);
  display: block;
  height: 100%;
  width: 2.5rem;
  cursor: pointer;
  border: none;
}

.themeSwitch__button .light-dark {
  display: block;
  color: white;
}

.themeSwitch__button .light-dark:last-child {
  display: none;
}

.themeSwitch__button.sl-theme-dark .light-dark:first-child {
  display: none;
}

.themeSwitch__button.sl-theme-dark .light-dark:last-child {
  display: block;
  color: white;
}

.header__nav {
  height: 4.5rem;
  display: flex;
  align-items: center;
}

.header__nav ul {
  display: flex;
  flex-wrap: nowrap; /* ⭐ force one line */
  column-gap: 2rem;
  row-gap: 1rem;
  padding: 0 0.6rem;
  margin: 0;
  list-style: none;
}

.header__nav ul li {
  height: auto;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.header__nav ul li a {
  color: white;
  font-size: 1.3rem;
  text-decoration: none;
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 1.3rem 0.3rem 1.3rem 0.3rem;
}

/* hover background */
.header__nav ul li a:hover,
.header__nav ul li a.active {
  background-color: rgb(21, 55, 97);
}

/* animated bottom border */
.header__nav ul li a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0px;
  height: 4px;
  background-color: currentColor;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.header__nav ul li a:hover::after,
.header__nav ul li a.active::after {
  opacity: 1;
}

/***********************************************/
/*            Different screen sizes           */
/***********************************************/

@media (min-width: 1621px) {
  .header {
    height: var(--header-height-1621);
  }

  .header-nav-container {
    max-height: 1000px; /* some big number, larger than content */
    opacity: 1;
    transition:
      max-height 0.35s ease,
      opacity 0.25s ease;
  }

  .header__nav ul li {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

@media only screen and (min-width: 946px) and (max-width: 1620px) {
  .header {
    height: var(--header-height-946-1620);
  }

  .header-logo-container {
    flex-wrap: wrap; /* ⭐ allow second row */
    align-items: center;
    width: 18.8rem;
    padding-bottom: 0;
  }

  .jasinska-group {
    width: 100%; /* ⭐ forces new line */
    margin: 2rem 0 0 0;
    border-left: none;
    line-height: normal;
  }

  .header-menu__button {
    display: none;
  }

  .header-nav-container {
    min-height: var(--header-height-946-1620);
    max-height: 1000px; /* some big number, larger than content */
    opacity: 1;
    transition:
      max-height 0.35s ease,
      opacity 0.25s ease;
  }

  .header__nav {
    height: auto; /* allow two rows */
  }

  .header__nav ul {
    flex-wrap: wrap; /* ⭐ allow wrapping */
  }
  .header__nav ul li {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .header__nav ul li a {
    padding: 0.8rem 0.3rem 0.8rem 0.3rem;
  }
}

@media only screen and (min-width: 601px) and (max-width: 945px) {
  .header {
    height: var(--header-height-601-945);
  }

  .jasinska-group {
    border-left: 1px solid white;
    height: 3.5rem;
    min-width: fit-content;
    max-width: calc(100% - 50px);
    padding-left: 0.6rem;
    line-height: 1.6;
    font-size: 1.8rem;
  }
}

@media (max-width: 945px) {
  .header-container {
    flex-wrap: wrap;
  }

  .header-logo-container {
    flex-wrap: wrap; /* ⭐ allow second row */
    align-items: center;
    min-width: 18.8rem;
    width: calc(100% - 110px); /* ⭐ forces new line */
  }

  .jasinska-group {
    border-left: 1px solid white;
    height: 3.5rem;
    min-width: fit-content;
    max-width: calc(100% - 50px);
    padding-left: 0.6rem;
    line-height: 1.6;
    font-size: 1.8rem;
  }

  .header-menu__button {
    width: 2.5rem;
    height: 2.5rem;
    margin-top: 0.6rem; /* ⭐ 10px from top */
    margin-left: 0.6rem; /* spacing from logo */
    background-color: rgb(21, 55, 97);
    border: none;
    cursor: pointer;
    position: relative; /* ⭐ positioning context */
    display: block; /* simpler than flex here */
  }

  .header-nav-container {
    flex: 0 0 100%;
    width: 100%;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin-left: 0;
    transition:
      max-height 0.35s ease,
      opacity 0.25s ease;
  }

  .header__nav {
    height: auto; /* allow two rows */
  }

  .header__nav ul {
    flex-wrap: wrap; /* ⭐ allow wrapping */
  }

  .header.menuIsOpen {
    min-height: 18.8rem; /* adjust to content */
  }

  .header.menuIsOpen .header-nav-container {
    max-height: 18.8rem;
    opacity: 1;
  }

  .header.menuIsOpen .header__nav ul li {
    opacity: 1;
    transform: translateY(0);
  }

  .header__nav ul li:nth-child(1) {
    transition-delay: 0.05s;
  }
  .header__nav ul li:nth-child(2) {
    transition-delay: 0.1s;
  }
  .header__nav ul li:nth-child(3) {
    transition-delay: 0.15s;
  }
  .header__nav ul li:nth-child(4) {
    transition-delay: 0.2s;
  }
  .header__nav ul li:nth-child(5) {
    transition-delay: 0.25s;
  }
  .header__nav ul li:nth-child(6) {
    transition-delay: 0.3s;
  }
  .header__nav ul li:nth-child(7) {
    transition-delay: 0.35s;
  }
  .header__nav ul li:nth-child(8) {
    transition-delay: 0.4s;
  }

  @media (max-width: 600px) {
    .header {
      height: var(--header-height-600);
    }

    .search {
      display: none;
    }

    .jasinska-group {
      width: 100%; /* ⭐ forces new line */
      margin: 2rem 0 0 0;
      border-left: none;
      line-height: normal;
    }
  }
}
