@use 'sass:math';

.section-navigation {
  @include selection_Light;
  &.light {
    @include background_Dark;
    color: white;
  }
  &.clear-bg {
    background-color: unset;
    @include selection_Light;
  }
  @include medium {
    > .grid {
      padding-left: 0;
      padding-right: 0;
    }
  }
}

.site-logo-container {
  &.light {
    color: white;
    transition: 250ms ease;
    svg {
      fill: white;
      transition: 250ms ease;
    }
    @include small {
      &.menu-open {
        color: $ebony;
        svg {
          fill: $ebony;
        }
      }
    }
  }
}

.nav-items-wrapper {
  &.light {
    .nav-item:not(.current-page) {
      &:after {
        border: solid 2px white;
      }
    }
  }
}

#navigation {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: $navigationHeight;
  z-index: 50;
  @include medium {
    padding-left: clamp(2rem, 8vw, 6rem);
    padding-right: clamp(2rem, 8vw, 6rem);
  }
}

.nav-bar {
  width: 100%;
  margin-top: 1.5rem;
  &.breadcrumbs-hidden {
    margin-top: 0;
  }
}

.nav-bar,
.nav-items-wrapper {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

.nav-item {
  @include fontWeight_Semibold;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.site-logo-container {
  .anchor-wrapper {
    display: flex;
    flex-direction: row;
    height: 2rem;
  }
  .site-logo-image {
    width: 2rem;
    cursor: pointer;
    transition: all $transitionDuration ease;
  }
  .site-logo-text {
    display: inline;
    @include fontSize_Medium;
    @include fontWeight_Medium;
    margin: 0 0.375rem;
    line-height: 2rem;
    transition: all $transitionDuration ease;
    &.light {
      color: $white;
    }
    &.dark {
      color: $ebony;
    }
    @include small {
      &.menu-open {
        color: $ebony;
      }
    }
  }

  &:hover {
    .site-logo-image {
      transform: scale(0.85) translateX(-0.625rem);
    }
    .site-logo-text {
      transform: scale(1.1);
    }
  }
}

.nav-items-wrapper {
  .button {
    margin: 0 1rem;
    padding: 0 0.5rem;
    position: relative;
    div {
      display: flex;
    }
  }
  .nav-item {
    position: relative;
    align-self: flex-end;
    @include fontSize_Small;
    @include fontWeight_Semibold;
    text-transform: uppercase;
    margin: 0 1rem;
    padding: 0 0.5rem;
    height: 100%;
    transition: 200ms ease;
    cursor: pointer;
    @include medium {
      margin: 0 0.875rem;
    }
    &:after {
      content: '';
      position: absolute;
      bottom: 0rem;
      left: 0.25rem;
      width: calc(100% - 0.5rem);
      height: 0.25rem;
      border-radius: 2px;
      border: solid 2px $ebony;
      opacity: 0;
      transition: 200ms ease;
    }
    &:hover {
      color: $blue;
      height: 120%;
      &:after {
        border: solid 2px $blue;
      }
    }
    &.current-page {
      height: 120%;
      &:after {
        opacity: 1;
      }
    }
  }
  & > *:last-child {
    margin-left: 1rem;
    margin-right: 0;
  }
  &.light {
    .nav-item {
      &:hover {
        color: $malibu;
        &:after {
          border: solid 2px $malibu;
        }
      }
      &.current-page {
        &:after {
          border: solid 2px $white;
        }
      }
    }
  }
}

.navigation-loader {
  position: absolute !important;
  left: 50%;
  transform: translateX(-50%);
}

.navigation-loader-text {
  visibility: hidden;
}

// ///////////////////////////////////////////////////////////////////////// App
.nav-dd-button {
  position: relative;
  display: flex;
  &:hover {
    .nav-dropdown {
      transform: translate(50%, 0rem);
      opacity: 1;
      visibility: visible;
    }
  }
}

.nav-dropdown {
  position: absolute;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  padding-right: 3.5rem;
  top: calc(100% + 1rem);
  right: 50%;
  opacity: 0;
  transform: translate(50%, 1.5rem);
  transition: 250ms ease;
  border-radius: 0.625rem;
  border: solid 1px $waterloo;
  background-color: rgba($woodsmoke, 0.85);
  z-index: 1;
  box-shadow: 0px 0px 4px $malibu;
  visibility: hidden;
  &:before {
    content: '';
    position: absolute;
    top: -1rem;
    left: 0;
    width: 100%;
    height: 1rem;
  }
  .label {
    position: relative;
    text-align: left;
    @include fontSize_Small;
    @include fontWeight_Regular;
    color: $white;
    line-height: leading(20, 16);
    letter-spacing: 0.025em;
    margin-top: 0;
    &:after {
      content: '';
      position: absolute;
      top: calc(100% + 1rem);
      left: -1.5rem;
      width: calc(100% + 5rem);
      border-top: solid 1px $white;
      opacity: 0.05;
    }
  }
  .nav-dropdown-button,
  .nav-dropdown-link {
    position: relative;
    padding: 0.5rem 0;
    @include fontSize_Mini;
    @include fontWeight_Medium;
    line-height: leading(22, 15);
    text-align: left;
    color: $seaShell;
    transition: 200ms ease;
    transform: translateX(0);
    white-space: nowrap;
    &:before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 2.25rem;
      height: 100%;
      padding: 0.75rem 0;
      background-image: url('/images/illustrations/zigzag-tiny.png');
      background-position: 0 4px;
      background-size: 0 1.75rem;
      background-repeat: no-repeat;
      transform: translate(0);
      transition: inherit;
      opacity: 0;
    }
    &:hover {
      transform: translateX(2.25rem);
      &:before {
        background-size: 1.75rem 1.75rem;
        transform: translate(-2.25rem);
        opacity: 1;
      }
    }
    &.current-route {
      color: $malibu;
      &:hover {
        transform: translateX(0) !important;
        cursor: default;
        &:before {
          background-size: 0 1.75rem;
          transform: 0;
          opacity: 0;
        }
      }
    }
  }
}

// ////////////////////////////////////////////////////////////////////// mobile

.nav-bar {
  position: relative;
  z-index: 1;
  transition: 350 ease;
  &.mobile-panel {
    z-index: 50;
  }
}

.nav-items-wrapper {
  @include medium {
    display: none;
  }
}

.nav-menu-toggle {
  display: none;
  @include medium {
    display: flex;
    .DocSearch {
      margin-right: 1rem;
    }
    button {
      display: flex;
      align-items: center;
    }
  }
  &.light {
    svg,
    path {
      // fill: white;
      stroke: white;
      transition: 250ms ease;
    }
    &.menu-open {
      svg,
      path {
        fill: $ebony;
        stroke: $ebony;
      }
    }
  }
}

.nav-mobile-panel {
  visibility: hidden;
  position: absolute;
  top: 0;
  overflow: hidden;

  @include medium {
    padding: 0 3.5rem;
    left: -99999px;
    right: -99999px;
    margin: 0 auto;
    width: 100vw;
    transform: translateY(calc(-100% - 9rem));
    transition: 350ms ease;
    color: $ebony;
    > div {
      padding-left: clamp(2rem, 8vw, 6rem);
      padding-right: clamp(2rem, 8vw, 6rem);
    }
  }

  @include tiny {
    transform: translateY(-100%);
    &:before {
      height: 100%;
      background-position: right -100px bottom 0;
    }
  }

  &.open {
    @include medium {
      visibility: visible;
    }
    transform: translateY(0%);
  }
}

.mobile-items-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-bottom: 6rem;
  position: relative;
  z-index: 51;
  margin-top: $navigationHeight;
  .nav-item-heading,
  .nav-sublink,
  .nav-item {
    padding: 0.375rem 0;
    text-align: left;
    @include fontSize_Small;
    @include fontWeight_Semibold;
  }
  .accordion-content {
    margin-left: 2rem;
    transition: height 300ms ease-in-out;
  }
  .accordion-header {
    margin-bottom: 0;
    &:after {
      padding: 5px;
      content: '+';
    }
  }
  .open {
    .accordion-header {
      &:after {
        content: '–';
      }
    }
  }
  .accordion-section {
    margin-bottom: 0rem;
  }
  .button {
    margin: 0.375rem 0;
  }
  .button {
    position: relative;
    width: fit-content;
    div {
      display: flex;
    }
  }
  button {
    @include fontWeight_Semibold;
  }
}

.nav-sublinks-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  .nav-sublink {
    padding: 0.375rem 1rem 0.375rem 0;
    cursor: pointer;
    text-align: left;
    @include fontSize_Mini;

    &.current-page {
      color: $blue;
    }
  }
}

.mobile-nav-gradient-wrapper {
  position: absolute;
  left: calc(-75% - 3rem);
  top: 0;
  width: 200%;
  height: 100%;
  overflow: hidden;
  border-radius: 100% 0% 82% 18% / 0% 75% 25% 100%;
  @include mini {
    border-radius: 100% 0% 54% 46% / 0% 81% 19% 100%;
  }

  .gradient-background-component {
    .saturated-variant {
      position: absolute;
      left: -9999px;
      right: -9999px;
      margin: 0 auto;
      transform: rotate(-40deg) translateX(12rem);
      bottom: -30rem;
      @include medium {
        bottom: -25rem;
        width: 3000px;
        height: 1700px;
      }
    }
  }
}
