// the following styles control the show/hide of the mobile menu.
// They're listed out here because the mobile menu exists
// outside of the regular nav.

#hamburgerContainer {
  display: none;
  @include media-medium {
    display: block;
  }

  #hamburgerIcon {
    display: block;
    font-size: 36px;
    height: 48px;
    width: 48px;
    line-height: 48px;
    text-align: center;

    .menu {
      display: block;
    }

    .close {
      display: none;
    }
  }

  input[type="checkbox"] {
    display: none;
  }
}

.menuLinksMobile {
  height: 0;
  overflow: hidden;

  ul {
    margin: 0;
    margin-block-start: 0.5em;
    padding-inline-start: 0;
    li {
      list-style-type: none;
      padding: 0.5em 1em;
      margin: 0;
      border-bottom: 1px solid var(--grey-40);

      &:last-child {
        border-bottom: none;
      }

      a {
        text-decoration: none;
        color: var(--grey-70);
        white-space: nowrap;
        font-weight: 500;
        font-size: 1em;
        line-height: 1em;

        .open_in_new {
          font-size: 1.25em;
        }
      }
    }
  }
}

body:has(#mobileMenuController:checked) {
  .menuLinksMobile {
    height: fit-content;
    padding: 0 18px 12px 18px;
  }
  #hamburgerContainer {
    #hamburgerIcon .close {
      display: block;
    }
    #hamburgerIcon .menu {
      display: none;
    }
  }
}

header {
  position: sticky;
  top: 0;
  background-color: var(--background);
  z-index: 999;
  box-shadow: 0 0 6px color-mix(in srgb, var(--dora-primary-dark), transparent 70%);

  @include media-medium {
    position: relative;
  }

  .navContainer {
    div.dora-logo-link a {
      display: block;
      line-height: 1;
    }
    nav {
      display: flex;
      flex-grow: 1;
      justify-content: flex-end;
      margin-right: 16px;
      font-size: 0.9em;

      ul.menuLinksDesktop {
        display: flex;
        align-items: center;
        margin: 0;
        li {
          list-style-type: none;
          padding: 0 1em;

          @include media-large {
            font-size:.85em;
            padding: 0 .7em;
          }

          a {
            text-decoration: none;
            color: var(--grey-70);
            white-space: nowrap;
            font-weight: 500;
            font-size: 1em;
            line-height: 1em;
            transition: all 0.3s ease;
            text-decoration: underline solid white;

            .open_in_new {
              font-size: 1em;
            }
          }

          a:hover {
            color: hsl(208, 5%, 25%);
            text-decoration: underline solid hsl(208, 5%, 80%);
            text-underline-offset: 0.5em;
          }

          a.active {
            color: hsl(208, 5%, 0%);
            text-decoration: underline solid hsl(208, 5%, 50%);
            text-underline-offset: 0.5em;
          }
        }
      }
    }
    #searchIcon {
      font-size: 24px;
    }
  }

  @include media-medium {
    .navContainer {
      nav {
        ul.menuLinksDesktop {
          display: none;
        }
      }
    }
  }

  #searchInputPopover {
    position: fixed;
    top: 0;
    left: 0;
    margin: 0;
    border: none;
    padding: 0;
    height: 64px;
    background-color: transparent;
    width: 100%;

    &:popover-open {
      display: flex;
    }

    #searchInputPopoverFields {
      display: grid;
      justify-items: right;
      align-items: center;
      height: 100%;
      animation: popoverAppear 0.2s ease-in;
      width: 100%;

      #searchForm {
        width: 52em;
      }
    }
  }

  @keyframes popoverAppear {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
}

.site-banner {
  background-color: var(--dora-primary-dark);
  padding: 0 0 2px 0;
  text-align: center;

  a {
    display: inline-block;
    border-radius: 0.2em;
    padding: 4pt 6pt;
    color: var(--dora-primary-light);
    font-weight: 500;
    text-decoration: none;

    &:visited {
      color: var(--dora-primary-light);
    }

    &:hover {
      color: var(--dora-highlight);
    }
  }
}
