/* Should only appear on mobile nav */
#home-link {
  display: none;
}

/* Fixed navbar means that it can't move around from overscrolling/rubberbanding effect */
/* Also stole a bunch of styles straight from Apple's website, navbar pretty much looks identitical lol */
.nav-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  box-sizing: border-box;
  z-index: 9999;
  background-color: rgba(29, 29, 31, .8);
  backdrop-filter: saturate(180%) blur(20px) brightness(100%);
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 422ms cubic-bezier(.4, 0, .6, 1) 80ms,
              backdrop-filter 422ms cubic-bezier(.4, 0, .6, 1) 80ms, 
              opacity .32s cubic-bezier(.4, 0, .6, 1);
}

/* Padding to make up for fixed navbar */
body {
  padding-top: 54px !important;
}

/* Disable transition on start up so that you can't see the navbar change from dark to light mode & vice versa */
/* Transitions get re-enabled the moment you scroll though */
.nav-header:not(.allow-transitions) {
  transition: none;
}

/* Light mode navbar */
body.light-bg .nav-header {
  background-color: rgba(229, 229, 231, .8);
}

body.light-bg .nav-header a,
body.light-bg .nav-header button {
  filter: invert(1);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  transition: opacity .32s cubic-bezier(.4, 0, .6, 1);
}

.logo-image {
  height: 30px;
  filter: brightness(0.9);
  transition: filter .32s cubic-bezier(.4, 0, .6, 1);
}

.logo-container:hover .logo-image {
  filter: brightness(1);
}

.logo-text {
  color: rgba(255, 255, 255, .9);
  font-size: 24px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.003em;
  font-family: SF Pro Display, SF Pro Icons, Helvetica Neue, Helvetica, Arial, sans-serif;
  transition: color .32s cubic-bezier(.4, 0, .6, 1);
}

.logo-container:hover .logo-text {
  color: white;
}

.navbar {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links {
  text-decoration: none;
  color: rgba(255, 255, 255, .8);
  font-size: 12px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: -.01em;
  font-family: SF Pro Text, SF Pro Icons, Helvetica Neue, Helvetica, Arial, sans-serif;
  transition: color .32s cubic-bezier(.4, 0, .6, 1);
}

.nav-links:hover {
  color: white;
}

/* Hide mobile nav menu button */
.globalnav-menutrigger {
  display: none;
}

/* Prevents scrolling when the mobile nav menu is open */
body.no-scroll {
  overflow: hidden !important;
}

@media (orientation: portrait) {
  #home-link {
    display: block;
  }

  body {
    /* Fixed navbar means we need padding */
    padding-top: calc(50px + env(safe-area-inset-top)) !important;
    /* Pushes everything up so it doesn't appear behind the navigation bar on mobile */
    /* padding-bottom: env(safe-area-inset-top); */
  }

  .nav-header {
    padding: 1rem;
    /* Pushes navbar down so it doesn't appear behind the notch/camera hole on mobile */
    padding-top: calc(1rem + env(safe-area-inset-top));
  }

  .logo-container {
    gap: 0.35rem;
    z-index: 9999;
  }

  .logo-image {
    height: 18px;
  }

  .logo-text {
    font-size: 16px;
  }

  /* Bunch of styles for mobile nav below that I got from Apple website or Gemini */
  .globalnav-menutrigger {
    display: block;
    z-index: 9999;
  }

  .globalnav-menutrigger-button {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    opacity: .8;
    cursor: pointer;
    outline-offset: -7px;
    transition: opacity .32s cubic-bezier(.4, 0, .6, 1), color .32s cubic-bezier(.4, 0, .6, 1);
    -webkit-tap-highlight-color: transparent;
    padding: 0;
  }

  .nav-header button {
    background: none;
    border: 0;
    box-sizing: content-box;
    cursor: pointer;
    font: inherit;
    line-height: inherit;
    overflow: visible;
    vertical-align: inherit;
  }

  .navbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background-color: rgba(29, 29, 31, .8);
    position: fixed;
    top: 100%;
    left: 0;
    width: 100%;
    height: 0;
    z-index: 9998;
    padding: 0 48px;
    box-sizing: border-box;
    overflow: hidden;
    transition: background 422ms cubic-bezier(.4, 0, .6, 1) 80ms, 
                height 422ms cubic-bezier(.4, 0, .6, 1) 80ms, 
                opacity .32s cubic-bezier(.4, 0, .6, 1), 
                color .32s cubic-bezier(.4, 0, .6, 1);
  }

  body.light-bg .navbar {
    background-color: rgba(229, 229, 231, .8);
  }

  .nav-header[data-nav-open="true"] .navbar {
    height: 100dvh;
    background-color: #161617;
  }

  .nav-header[data-nav-open="true"] .logo-container {
    opacity: 0;
    pointer-events: none;
  }

  .nav-header[data-nav-open="true"] {
    background-color: #161617;
    backdrop-filter: saturate(100%) blur(0px);
    -webkit-backdrop-filter: saturate(100%) blur(0px);
    border-bottom: none !important;
    box-shadow: none !important;
  }

  /* Light mode mobile navbar when menu is opened */
  body.light-bg .nav-header[data-nav-open="true"], 
  body.light-bg .nav-header[data-nav-open="true"] .navbar {
    background-color: #e5e5e7;
  }

  /* Links need to have -20px transform for super cool cascade effect */
  .nav-links {
    width: 100%;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: .007em;
    padding: 12px 0;
    font-family: SF Pro Display, SF Pro Icons, Helvetica Neue, Helvetica, Arial, sans-serif;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity .32s ease, transform .32s ease;
  }

  .nav-header[data-nav-open="true"] .nav-links {
    opacity: 1;
    transform: translateY(0);
  }

  /* Transition for opacity change, transform change shouldn't kick in until after fade out is complete */
  .nav-header[data-nav-open="false"] .nav-links {
    transition: opacity .32s ease 0s, transform 0s linear .32s !important;
  }
}