/**
 * @file
 * The header components.
 */

/**
 * Global header rules
 */
.header {
  max-width: 1750px;
  background-color: var(--color-neutral--4);
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 1.5rem 2rem;
  box-shadow: 0px 10px 20px -10px rgba(0,0,0,0.05);
}

ul.menu a.is-active {
  color: var(--color-primary--1);
}

/**
 * Site Brand
 */
.header__brand {
  position: relative;
  display: flex;
  align-items: center;
}

.header__brand .site-logo {
  display: inline-block;
  max-width: 110px;
}

/**
 * Menu
 */
.header__menu {
  position: fixed;
  right: 100%;
  left: 0;
  top: 67.7px;
  bottom: 0;
  transition: 0.3s ease;
  background: var(--color-neutral--4);
  z-index: 10;
  overflow-y: scroll;
}

.user-logged-in .header__menu {
  top: 113px;
}

.header.js-active .header__menu {
  right: 0;
}

.header__menu ul.menu {
  margin: 0;
}

.header__menu .menu--level-0 {
  padding: 1.5rem 1.5rem 0;
}

.header__menu .menu__link {
  color: var(--color-primary--1);
  width: 100%;
  padding: 0.5rem;
  font-size: 1rem;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  user-select: none;
  text-transform: uppercase;
  font-family: var(--font-montserrat);
  font-weight: 700;
  line-height: 170%;
}

.header__menu .menu__link:hover {
  text-decoration: none;
}

.menu--level-1 .menu__item .menu__link {
  display: inline-block;
  width: auto;
}

.header__menu .contact__menu {
  display: inline-flex;
  padding: 10px 23px!important;
  background: var(--color-primary--2);
  color: var(--color-white);
  font-weight: 800;
  text-transform: uppercase;
  text-decoration: none;
  border-top-left-radius: 2px;
  border-top-right-radius: 2px;
  border-bottom-left-radius: 2px;
  border-bottom-right-radius: 16px;
  transition: all 0.25s ease;
  width: fit-content;
}

.header__menu .contact__menu:hover {
  background: var(--color-primary--1);
  text-decoration: none;
}


/* Expanded */
.menu__main .menu--level-1 {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 0;
  overflow: visible;
  position: relative;
}

.menu__main .menu__item--expanded.js-active .menu--level-1 {
  height: max-content;
  overflow: unset;
  background-color: var(--color-primary--2);
  padding: 1rem 0;
  border-radius: 2px;
}

.header__menu .menu--level-1 .menu__link {
  color: var(--color-white);
  text-transform: unset;
  padding: 0 1rem;
  font-weight: 500;
}

.menu__main .menu__item--expanded.js-active > .menu__link::after {
  transform: rotate(90deg);
}

/**
 * Custom Element
 */
.menu__link.menu__link-cta {
  display: inline-block;
  padding: 0.5rem 1rem;
  width: fit-content;
  border: 1px solid var(--color-neutral--2);
  color: var(--color-neutral--2);
  font-weight: 700;
  border-radius: 40px;
  transition: background-color 0.2s;
  margin-top: 0.5rem;
}

.menu__link.menu__link-cta:hover {
  background-color: var(--color-primary--4);
}

.menu__link.menu__link-cta::after {
  content: none;
}

.header__menu .menu--level-0 > .menu__item > .menu__link.menu__link-cta {
  cursor: pointer;
}

/**
 * Mobile menu button
 */
.menu-toggle {
  position: absolute;
  right: 1rem;
  top: 50%;
  width: 22px;
  height: 16px;
  transform: translateY(-50%);
}

.menu-toggle__button {
  border: none;
  width: 22px;
  height: 16px;
  padding: 0;
  text-indent: 100px;
  background-color: transparent;
  white-space: nowrap;
  overflow: hidden;
  z-index: 1;
  position: absolute;
  left: 0;
  top: 0;
}

.menu-toggle span {
  position: absolute;
  left: 1px;
  display: block;
  width: 20px;
  height: 2px;
  background-color: #000;
  transition: all ease .25s;
  border-radius: 0;
}

.menu-toggle span:nth-child(1) { top: 1px; }
.menu-toggle span:nth-child(2) { top: 7px; }
.menu-toggle span:nth-child(3) { top: 13px; }

.menu-toggle:hover span:nth-child(1),
.header.js-active .menu-toggle span:nth-child(1),
.menu-toggle:hover span:nth-child(3),
.header.js-active .menu-toggle span:nth-child(3) {
  width: 20px;
}

.header.js-active .menu-toggle span:nth-child(1) {
  top: 7px;
  transform: rotate(45deg);
}

.header.js-active .menu-toggle span:nth-child(2) {
  width: 0;
  left: 22px;
}

.header.js-active .menu-toggle span:nth-child(3) {
  top: 7px;
  transform: rotate(-45deg);
}

/**
 * Media queries
 */
@media all and (min-width: 975px) {
  .user-logged-in .header__menu {
    top: 168px;
  }
}

@media all and (min-width: 1000px) {
  .menu-toggle {
    display: none;
  }

  .menu--level-1 .menu__item .menu__link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--color-primary--1);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.menu--level-1 .menu__item .menu__link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

  .header {
    display: flex;
    position: relative;
    top: inherit;
    left: inherit;
    right: inherit;
    box-shadow: none;
    padding: 0;
    height: 99px;
    gap: 0.5rem;
    margin: 0 auto;
    width: 100%;
    justify-content: space-between;
  }

  .header__brand,
  .region-header,
  .header__brand .block-system-branding-block,
  .header__brand .site-logo {
    height: 100%;
  }

  .header__brand .site-logo {
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
  }

  .header__brand .site-logo img {
    max-height: 100%;
  }

  .header__menu,
  .menu__main,
  .region-header-menu,
  .menu--main,
  .header__menu .menu--level-0,
  .header__menu .menu__item {
    height: 100%;
  }

  .header__menu {
    display: flex;
    position: relative;
    right: inherit;
    left: inherit;
    bottom: inherit;
    top: inherit;
    transition: none;
    background: inherit;
    overflow-y: inherit;
    gap: 1rem;
    justify-content: space-between;
  }

  .header.js-active .header__menu {
    transform: none;
  }

  .user-logged-in .header__menu {
    top: inherit;
  }

  .header__menu .menu--level-0 {
    display: flex;
    align-items: center;
    padding: 0;
    gap: 3rem;
  }

  .header__menu .menu__item {
    display: flex;
    align-items: center;
    position: relative;
  }

  .header__menu .menu--level-0 > .menu__item > .menu__link {
    height: auto;
    padding: 0 0.5rem;
    margin-bottom: 0;
  }

  .header__menu .menu--level-1 .menu__link {
    padding: 0.5rem 1rem;
  }

  .menu__main .menu__link::after {
    content: none;
  }

  /* Hover underline level-0 non-catégorie */
  .header__menu .menu--level-0 > .menu__item:not(.menu__item--expanded) > .menu__link::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
    height: 2px;
    background-color: var(--color-primary--1);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
  }
    .header__menu .menu--level-0 > .menu__item:not(.menu__item--expanded) > .contact__menu::after {
    display: none;
  }

  .header__menu .menu--level-0 > .menu__item:not(.menu__item--expanded):hover > .menu__link::after {
    transform: scaleX(1);
    transform-origin: left;
  }

  /* Expanded dropdown */
  .menu--level-1::before {
    content: '';
    display: block;
    position: absolute;
    top: -29px;
    left: 10px;
    width: 62px;
    height: 42px;
    background-image: url(../../images/menu/arrow-dropdown-menu.svg);
    background-repeat: no-repeat;
    background-size: contain;
  }

  .menu__main .menu--level-1 {
    display: none;
    position: absolute;
    top: 95px;
    width: 245px;
    height: max-content;
    padding: 1rem;
    background-color: var(--color-primary--2);
    border-radius: 2px;
  }

  .menu__main .menu__item--expanded:hover .menu--level-1 {
    display: flex;
    margin-left: -10px;
  }

  .menu__main .menu--level-1 .menu__link {
    padding: 0.1rem 0;
  }

  .header__menu .menu--level-1 .menu__item:last-child .menu__link::before {
    content: none;
  }

  .menu__link.menu__link-cta {
    height: fit-content;
    margin: auto 0 auto 1rem;
  }
}

@media all and (min-width: 1200px) {
  .header {
    gap: 1rem;
    height: 108px;
  }

  .header__brand {
    min-width: 100px;
  }

  .header__brand .site-logo {
    max-width: 143px;
  }

  .header__menu {
    gap: 2rem;
  }
}

@media all and (min-width: 1350px) {
  .header__menu .menu__link {
    padding: 0 1rem;
  }

}