/***********************
        HEADER
***********************/

/* Hamburger Menu */

.nav-icon {
  display: none;
  width: 24px;
  height: 30px;
  position: absolute;
  right: 30px;
  top: 42px;
  margin: 0 auto;
  transform: rotate(0deg);
  transition: 0.2s all;
  cursor: pointer;
  z-index: 9;
}

.nav-icon span {
  display: block;
  position: absolute;
  height: 2px;
  width: 100%;
  background: var(--color-black);
  border-radius: 9px;
  opacity: 1;
  left: 0;
  transform: rotate(0deg);
  transition: 0.25s ease-in-out;
}

.nav-icon span:nth-child(1) {
  top: 0;
}

.nav-icon span:nth-child(2) {
  top: 10px;
}

.nav-icon span:nth-child(3) {
  top: 20px;
}

.nav-icon.open span:nth-child(1) {
  top: 18px;
  transform: rotate(135deg);
}

.nav-icon.open span:nth-child(2) {
  opacity: 0;
  left: -60px;
}

.nav-icon.open span:nth-child(3) {
  top: 18px;
  transform: rotate(-135deg);
}

header {
  position: fixed;
  top: 0px;
  z-index: 3;
  width: 100%;
  background: var(--color-white);
}

.navigation {
  padding: 5px 0px;
  justify-content: space-between;
}

.menu-container {
  display: flex;
  justify-content: right;
  align-items: center;
  padding: 5px 0px;
  transition: 0.4s all;
  width: 60%;
}

.nav {
  display: flex;
  margin-right: 20px;
}

.nav li {
  display: flex;
  list-style: none;
  padding: 10px;
  align-items: center;
}

.nav li a {
  color: var(--color-black);
  position: relative;
  font-family: var(--font-text);
  text-transform: uppercase;
}

.nav li a:hover {
  color: var(--color-primary);
}

.logo {
  display: flex;
  height: 60px;
  width: 120px;
  align-items: center;
}

.logo:hover {
  opacity: 0.9;
  transform: scale(0.95);
}

.logo img {
  width: 100%;
}

.sub-menu {
  box-shadow: 0px 4px 5px #00000017;
}

.menu-item-has-children {
  position: relative;
}

.menu-item-has-children ul {
  position: absolute;
  top: 60px;
  left: -50px;
  padding: 0px 10px;
  max-height: 0;
  background: var(--color-white);
  overflow: hidden;
  transition: 0.4s;
  min-width: 240px;
  border-radius: 10px;
}

.menu-item-has-children ul li {
  padding: 5px;
  margin: 10px 0px;
}

.menu-item-has-children ul li a {
  width: 100%;
  display: flex;
  color: var(--color-primary);
  align-items: center;
  padding-left: 0;
  font-size: 14px;
}

.menu-item-has-children ul li a:hover {
  color: var(--color-primary);
  padding-left: 15px;
}

.menu-item-has-children ul li a::before {
  content: "\e905";
  font-family: "mrz-iconset" !important;
  color: transparent;
  position: relative;
  display: flex;
  margin-right: 10px;
  transition: 0.3s all;
  width: 0px;
  font-size: 12px;
}

.menu-item-has-children ul li a:hover:before {
  color: var(--color-secondary);
  width: 10px;
}

.menu-item-has-children:after {
  content: "\e906";
  font-family: "mrz-iconset";
  margin-left: 8px;
  position: relative;
  height: 10px;
  padding: 2px;
  font-size: 10px;
  top: 3px;
  transition: transform 0.4s;
  transform-origin: 50% 45%;
  color: var(--color-secondary);
}

.menu-item-has-children:hover ul {
  max-height: 220px;
}

.menu-item-has-children:hover:after {
  transform: rotate(-180deg);
}

.mega-menu {
  position: relative;
}

.mega-menu .sub-menu {
  position: absolute;
  width: 900px;
  left: -900px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mega-menu:hover ul {
  max-height: 200px;
}

.menu-col {
  width: 25%;
  overflow: hidden;
  padding: 0px;
  text-align: center;
}

.menu-col:hover {
  background-color: var(--color-light);
  border-radius: 5px;
}

.menu-col img {
  width: 100%;
  object-fit: contain;
  border-radius: 5px;
}

.nav li a::after {
  content: "";
  height: 2px;
  width: 100%;
  background: transparent;
  position: absolute;
  bottom: -5px;
  display: block;
  right: -100%;
  transition: 0.3s all;
}

.nav li a:hover::after {
  left: 0;
  background: var(--color-primary);
}

.menu-item-has-children ul li a::after {
  display: none;
}

.header-info {
  position: absolute;
  right: 10%;
  top: 20px;
  display: flex;
  align-items: center;
}

.header-info .btn {
  min-width: 140px;
  padding: 10px 20px;
  font-size: 14px;
  justify-content: center;
}

header .btn {
  min-width: inherit;
}

header .btn::after {
  display: none;
}

.menu-start,
.menu-end {
  width: 25%;
}

.menu-end {
  display: flex;
  justify-content: right;
  align-items: center;
}

.menu-end a:nth-child(1) {
  margin-right: 10px;
}

/***********************
   MEGA MENU (desktop)
***********************/

/*
 * The dropdown items already carry their own <img> inside the link, because the
 * image markup is stored in each menu item's navigation label. So the link is
 * <a><img ...>Label</a> and all that is needed here is layout.
 *
 * The query deliberately mirrors the hamburger breakpoint in responsive.css
 * - (max-width: 768px), (orientation: landscape) and (max-height: 500px) -
 * so the slide-in mobile panel keeps the plain vertical dropdown.
 */
@media (min-width: 769px) and (min-height: 501px) {
  /* Let the panel position against the fixed <header>, not the menu item, so it
     can be centred on the viewport instead of hanging off one link. */
  .nav .menu-item-has-children {
    position: static;
  }

  .nav .menu-item-has-children > .sub-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(12px);

    /* Replaces the max-height trick: a fade avoids clipping the card. */
    max-height: none;
    min-width: 0;
    overflow: visible;
    opacity: 0;
    visibility: hidden;

    box-sizing: border-box;
    /* Hug the row of cards rather than reserving a fixed width, so the panel
       is the same shape whatever the item count. */
    width: max-content;
    max-width: calc(100vw - 80px);

    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;

    margin: 0;
    padding: 28px 20px;
    background: var(--color-white);
    border-radius: 24px;
    box-shadow: 0 18px 44px rgba(20, 22, 84, 0.14);

    /* Closing is delayed so a cursor that clips a corner on the way down does
       not lose the panel. Opening (below) has no delay. */
    transition: opacity 0.25s ease 0.15s, transform 0.25s ease 0.15s,
      visibility 0s linear 0.4s;
  }

  .nav .menu-item-has-children:hover > .sub-menu,
  .nav .menu-item-has-children:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s;
  }

  .nav .menu-item-has-children > .sub-menu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 20px;
  }

  .nav .menu-item-has-children > .sub-menu > li {
    flex: 1 1 200px;
    min-width: 0;
    max-width: 200px;
    margin: 0;
    padding: 0;
    display: block;
  }

  .nav .menu-item-has-children > .sub-menu > li > a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;

    width: 100%;
    padding: 0;

    color: var(--color-primary);
    font-family: var(--font-text);
    font-size: 13px;
    line-height: 1.35;
    letter-spacing: 0.02em;
    text-align: center;
    text-transform: uppercase;
  }

  .nav .menu-item-has-children > .sub-menu > li > a img {
    display: block;
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: 6px;
    transition: transform 0.28s ease;
  }

  /* The old list styling: a chevron pseudo-element and a padding nudge on
     hover. Neither belongs in a card of images. */
  .nav .menu-item-has-children > .sub-menu > li > a::before {
    content: none;
  }

  .nav .menu-item-has-children > .sub-menu > li > a:hover {
    padding-left: 0;
    color: var(--color-black);
  }

  .nav .menu-item-has-children > .sub-menu > li > a:hover img {
    transform: scale(1.04);
  }
}
