#nav {
  width: 100%;
  position: fixed;
  top: 0;
  z-index: 999;
}

#nav-banner, #nav-content {
  transition: transform 1s var(--curve), opacity 1s var(--curve);
}

#nav-banner {
  display: flex;
  width: 100%;
  height: 30rem;
  font-size: 14rem;
  position: relative;
  z-index: 9;
  align-items: center;
  justify-content: center;
  color: var(--white);
  overflow: hidden;
  cursor: pointer;
  font-weight: 500;
  strong {
    font-weight: inherit;
    text-decoration: underline;
  }
}

/* Animated gradient background layer for the banner */
#nav-banner-bg {
  position: absolute;
  inset: 0;
  z-index: -1; /* stay behind scrolling items */
  pointer-events: none;
  background: linear-gradient(90deg, #EE1F19 0%, #F4380D 50%, #FA5001 100%);
}
#nav-banner.open {
  height: 35rem;

}
.nav-banner-item {
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-banner-item span, .nav-banner-item svg {
  transition: transform 1s var(--in-out);
}
.nav-banner-item svg {
  width: auto;
  height: 0.9em;
  position: relative;
  top: -0.1em;
  margin-left: 10rem;
  transition-delay: 0.05s;
}
.nav-banner-item:last-child {
  position: absolute;
}
.nav-banner-item:last-child span, .nav-banner-item:last-child svg {
  transform: translateY(30rem);
}
#nav-banner:hover .nav-banner-item:last-child span, #nav-banner:hover .nav-banner-item:last-child svg {
  transform: translateY(0);
}
#nav-banner:hover .nav-banner-item:nth-child(2) span, #nav-banner:hover .nav-banner-item:nth-child(2) svg {
  transform: translateY(-30rem);
}
#nav-content {
  height: 77rem;
  position: relative;
  width: 100%;
  z-index: 1;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--margin);
  background: var(--black);
  font-size: 16rem;
  font-weight: 900;
  font-family: 'Plexes';
  border-bottom: 1px solid #FFFFFF14;
  transition: transform 1s var(--curve), background 1s var(--curve), border-color 1s var(--curve), opacity 1s var(--curve);
}
#nav-logo {
  padding: 20rem 0;
  width: auto;
  height: 100%;
  transition: transform 1s var(--curve);
}
#nav-logo img {
  width: auto;
  height: 100%;
}
#nav-content ul {
  height: 100%;
  display: flex;
  align-items: center;
  list-style: none;
  text-transform: uppercase;
  padding: 0;
  margin: 0;
  gap: 0 40rem;
  transition: transform 1.5s var(--curve);
  li {
    height: 100%;
    display: inline-flex;
    align-items: center;
    a {
      height: 100%;
      display: inline-flex;
      align-items: center;
      position: relative;
      &::before {
        content: '/';
        margin-right: 0.25em;
        color: var(--orange);
        display: none;
      }
      &.is-active {
        &::before {
          display: inline;
        }
      }
    }
    svg {
      width: 10rem;
      margin-left: 10rem;
      fill: currentColor;
      transition: transform 1s var(--curve);
    }
    &:hover {
      a {
        color: var(--title-color);
      }
    }
    &.open {
      svg {
        transform: rotate(180deg);
      }
    }
  }
}
#nav-left, #nav-right {
  display: flex;
  align-items: center;
  gap: 0 24rem;
}
#nav-left {
  height: 100%;
  gap: 48rem;
}
#nav-langs {
  .langs-items {
    top: calc(var(--nav-height) * 0.5 + 18rem);
  }
}
#menu-toggle {
  display: none;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  color: inherit;
  cursor: pointer;
  position: relative;
  transition: transform 1s var(--curve);
  &::before {
    content: '';
    width: 48px;
    height: 48px;
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 0;
    border-radius: 50%;
    background: #333333;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 1s var(--curve);
  }
  svg {
    width: 100%;
    fill: currentColor;
    transition: transform 1s var(--curve);
    &:last-child {
      width: 12px;
      height: 12px;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%) scale(0);
    }
  }
}
#nav-profile-container {
  display: flex;
  align-items: center;
  gap: 8rem;
  user-select: none;
}

#nav-profile-container .profile-intials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  position: relative;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  &::before, &::after {
    content: '';
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    border-radius: 50%;
    transition: transform 1s var(--curve), background 1s var(--curve);
  }
  &::before {
    background: rgba(51, 51, 51, 1);
  }
  &:hover {
    &::before {
      transform: scale(1.1);
    }
  }
}

#nav-profile-container .profile-intials span {
  font-family: 'Plexes';
  font-size: 16px;
  line-height: 18px;
  font-weight: 900;
  color: var(--title-color);
  position: relative;
  top: 0.05em;
}

#nav-profile-container .profile-dropdown {
  width: 100%;
  max-width: 300rem;
  border-radius: 8rem;
  position: absolute;
  top: calc(100% + 8rem);
  right: var(--margin);
  background: #030303;
  z-index: 1;
  padding: 24rem;
  padding-bottom: 8rem;
  box-sizing: border-box;
  border: 1px solid #FFFFFF14;
}
#nav-profile-container .profile-dropdown .profile-dropdown-header {
  display: flex;
  align-items: center;
  margin-bottom: 24rem;
  font-size: 24rem;
  & > svg {
    width: auto;
    height: 0.8em;
    fill: currentColor;
    margin-right: 12rem;
  }
  #nav-profile-toggle {
    display: none;
    width: 24rem;
    height: 24rem;
    margin-left: auto;
    margin-right: 0;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    svg {
      width: 100%;
      height: auto;
      fill: currentColor;
      transition: transform 1s var(--curve);
    }
  }
}
#nav-profile-container .profile-dropdown:not(.show) {
  display: none;
}

#nav-profile-container .profile-dropdown-options {
  display: flex;
  flex-direction: column;

}
#nav-profile-container .profile-dropdown .dropdown-item {
  font-family: 'Plexes';
  text-transform: uppercase;
  letter-spacing: -0.02em;
  font-size: 16rem;
  font-style: 900;
  line-height: 1;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14rem 0;
  span {
    opacity: 0.35;
    transition: opacity 1s var(--curve);
  }
  &:hover span {
    opacity: 1;
  }
}

#nav-search {
  width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  background: transparent;
  border: none;
  outline: none;
  color: inherit;
  cursor: pointer;
  svg {
    width: 100%;
    fill: currentColor;
    transition: transform 1s var(--curve), opacity 1s var(--curve);
  }
  &:hover {
    color: var(--title-color);
    svg {
      transform: scale(1.2);
      opacity: 1;
    }
  }
}
#nav {
  .main-menu-dropdown {
    width: 100%;
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 0;
    background: var(--black);
    display: flex;
    gap: var(--gap);
    padding: 60rem var(--margin);
    transition: transform 1s var(--curve);
    .menu-card {
      width: calc(var(--column) * 4 + var(--gap) * 3);
      .menu-card-media {
        width: 100%;
        aspect-ratio: 424 / 247;
        margin-bottom: 28rem;
        display: flex;
        flex-shrink: 0;
        border-radius: 16rem;
        overflow: hidden;
        img {
          width: 100%;
          height: 100%;
          object-fit: cover;
          transition: transform 1s var(--curve);
        }
      }
      .menu-card-header {
        display: flex;
        align-items: center;
        strong {
          font-size: 32rem;
          color: var(--white);
        }
      }
      .menu-card-icon {
        width: 18rem;
        height: 18rem;
        background: var(--green);
        display: inline-block;
        margin-right: 20rem;
        position: relative;
        top: -0.12em;
      }
      p {
        max-width: 410rem;
        font-size: 18rem;
        line-height: 1.44444444;
        margin: 0;
        margin-top: 10rem;
      }
      &[data-icon="trangle"] {
        .menu-card-icon {
          clip-path: polygon(0 0, 80% 50%, 0% 100%);
        }
      }
      &[data-icon="circle"] {
        .menu-card-icon {
          border-radius: 50%;
        }
      }
      &:hover {
        .menu-card-media {
          img, video {
            transform: scale(1.1);
          }
        }
        .menu-card-icon {
          animation: blink 0.75s infinite;
        }
      }
    }

    &:not(.visible) {
      transform: translateY(-100%);
      pointer-events: none;
    }
  }
}
#nav-gatorade {
  padding: 11rem 24rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  font-size: 16rem;
  position: relative;
  color: var(--title-color);
  &::before {
    content: '';
    width: 100%;
    height: 100%;
    background: currentColor;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    opacity: 0.12;
    border-radius: 8rem;
    transition: opacity 1s var(--curve);
  }
  img, svg {
    width: auto;
    height: 1.2em;
  }
  span {
    margin: 0 12rem;
  }
  svg {
    height: 0.8em;
    fill: currentColor;
  }
  &:hover {
    &::before {
      opacity: 0.3; 
    }
  }
}
html[data-theme="light"] {
  #nav:not(.dark) {
    #nav-content {
      background: var(--white);
    }
    #nav-profile-container .profile-intials {
      &::before {
        opacity: 0.1;
      }
    }
    .main-menu-dropdown {
      background: var(--white);
      .menu-card {
        .menu-card-header strong {
          color: var(--black);
        }
      }
    }
    .profile-dropdown {
      background-color: #F0F0F0;
      .dropdown-item {
        &:last-child {
          border-top: 1px solid #C0C0C0;
        }
      }
    }
  }
}
#nav.dark {
  color: var(--gray);
  --title-color: var(--white);
}
#menu {
  width: 100%;
  height: 100dvh;
  position: fixed;
  z-index: 998;
  top: 0;
  left: 0;
  background: url('../../img/menu-bg.jpg') no-repeat center center/cover;
  color: var(--white);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--margin);
  box-sizing: border-box;
  transition: opacity 1s var(--curve);
  #menu-items {
    height: 100%;
    ul {
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      justify-content: center;
      line-height: 1;
      padding: 0;
      margin: 0;
      li {
        width: 100%;
        list-style: none;
        a {
          width: 100%;
          display: flex;
          align-items: center;
          &::before {
            content: '/';
            margin-right: 0.25em;
            color: var(--orange);
            display: none;
          }
          &.is-active {
            &::before {
              display: inline;
            }
          }
        }
        &:not(:last-child) {
          margin-bottom: 30px;
        }
      }
    }
  }
  #nav-profile-container {
    width: calc(100% - var(--margin) * 2);
    position: absolute;
    bottom: var(--margin);
    left: var(--margin);
    .profile-intials {
      display: none;
    }
    .profile-dropdown {
      max-width: 100%;
      background: none;
      position: static;
      display: flex !important;
      flex-direction: column-reverse;
      border: none;
      padding: 0;
      .profile-dropdown-header, .profile-dropdown-options {
        border-radius: 8px;
      }
      .profile-dropdown-header {
        padding: 16px 24px;
        margin-bottom: 0;
        margin-top: 4px;
        border: 1px solid #FFFFFF29;
        transition: background 1s var(--curve), border-color 1s var(--curve);
        #nav-profile-toggle {
          display: inline-flex;
          position: relative;
          right: -7px;
          svg {
            width: 70%;
          }
        }
      }
      .profile-dropdown-options {
        padding: 8px 24px;
        font-weight: 900;
        background: #222222;
        .dropdown-item:first-child {
          border-top: none;
        }
      }
      &:not(.show) {
        .profile-dropdown-options {
          display: none;
        }
      }
      &.show {
        .profile-dropdown-header {
          background: #222222;
          border-color: #222222;
          #nav-profile-toggle svg {
            transform: rotate(45deg);
          }
        }
      }
    }
  }
  &:not(.show) {
    opacity: 0;
    pointer-events: none;
  }
}
html.menu-open {
  &, body {
    overflow: hidden !important;
  }
  #nav-banner, #nav-content {
    transform: translateY(-35px);
  }
  #nav-content {
    background: transparent;
    border-color: transparent;
  }
  #nav-logo {
    transform: translateY(calc(-100%));
    pointer-events: none;
    transition-delay: 0s;
  }
  #nav-search, #nav-langs .langs-button {
    transform: translateX(calc(-100vw + 167px + var(--margin)));
  }
  #menu-toggle {
    transform: translateX(0px);
    &::before {
      transform: translate(-50%, -50%) scale(1);
    }
    svg {
      &:first-child {
        transform: scale(0);
      }
      &:last-child {
        transform: translate(-50%, -50%) scale(1);
      }
    }
  }
}
html.logged {
  #menu {
    .login {
      display: none !important;
    }
  }
}
html:not(.logged) {
  #menu {
    .profile {
      display: none !important;
    }
  }
}
@media (max-width: 1024px) {
  #nav-banner {
    height: 35px;
    font-size: 12px;
  }
  #nav-content {
    height: 64px;
  }
  #nav-logo {
    padding: 12px 0;
    transition-delay: 0.5s;
  }
  #nav-search, #nav-langs .langs-button {
    transition: transform 1s var(--curve) 0.15s;
  }
  #nav-search {
    svg {
      width: 80%;
    }
  }
  #nav-langs {
    position: static;
    .langs-items {
      width: calc(100vw - var(--margin) * 2);
      max-width: none;
      left: var(--margin);
      right: auto;
      background: #222222;
    }
  }
  #menu-toggle {
    display: inline-flex;
  }
  #nav-content ul, #nav-gatorade, #nav #nav-profile-container {
    display: none;
  }
  html.langs-open {
    #menu-toggle {
      &::before {
        transform: translate(-50%, -50%) scale(1);
      }
      svg {
        &:first-child {
          transform: scale(0);
        }
        &:last-child {
          transform: translate(-50%, -50%) scale(1);
        }
      }
    }
  }
}
@media (max-width: 740px) {
  #nav-banner {
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    .nav-banner-item {
      width: auto;
      margin: 0 0.5em;
      position: static !important;
      opacity: 1;
      span, svg {
        transform: none;
      }
    }
  }
  html.menu-open {
    #nav-search, #nav-langs .langs-button {
      transform: translateX(calc(-100vw + 150px + var(--margin)));
    }
  }  
  html.search-open {
    #nav-content {
      opacity: 0;
      pointer-events: none;
    }
  }
}
@media (min-width: 581px) {
  #nav .show-on-mobile {
    display: none !important;
  }
}
@media (max-width: 580px) {
  #nav {
    .hide-on-mobile {
      display: none !important;
    }
  }
}
@keyframes blink {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
