/* Floating glass pill nav. Sizes in px so it stays the same on every page.
   Under 900px: logo, current page and a menu button that opens a full-screen panel.
   From 900px: a wider pill with the page links laid out, and no panel. */
:root {
  --nav-font: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --nav-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

.nav {
  position: fixed;
  inset: 16px 0 auto;
  z-index: 100;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  font-family: var(--nav-font);
  color: #fff;
  pointer-events: none;
}

/* The pill */

.nav__bar {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  width: min(427px, 100%);
  height: 46px;
  padding: 0 4px 0 20px;
  border-radius: 999px;
  background: rgba(24, 27, 22, 0.3);
  backdrop-filter: blur(14px) saturate(1.6) brightness(1.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.6) brightness(1.05);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.38),
    inset -1px -1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 20px rgba(255, 255, 255, 0.07),
    0 12px 32px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
  transition: background-color 0.45s var(--nav-ease);
}

.nav-open .nav__bar { background: rgba(255, 255, 255, 0.06); }

.nav__logo {
  justify-self: start;
  display: flex;
}

.nav__logo img {
  display: block;
  height: 16px;
}

.nav__here {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Desktop links, hidden until 900px */

.nav__links {
  display: none;
  align-items: center;
  gap: 28px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav__links a {
  color: rgba(255, 255, 255, 0.72);
  transition: color 0.35s var(--nav-ease);
}

.nav__links a:hover,
.nav__links a[aria-current="page"] { color: #fff; }

.nav__links a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}

/* Menu button (under 900px) */

.nav__toggle {
  justify-self: end;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: inherit;
  cursor: pointer;
}

.nav__toggle-line {
  grid-area: 1 / 1;
  width: 18px;
  height: 2px;
  background: currentColor;
  transform: translateY(-3px);
  transition: transform 0.4s var(--nav-ease);
}

.nav__toggle-line + .nav__toggle-line { transform: translateY(3px); }

.nav-open .nav__toggle-line { transform: rotate(45deg); }

.nav-open .nav__toggle-line + .nav__toggle-line { transform: rotate(-45deg); }

/* The panel */

.nav__panel {
  position: fixed;
  inset: 0;
  z-index: 1;
  padding: 128px 48px 48px;
  background: #0a0a0a;
  opacity: 0;
  visibility: hidden;
  pointer-events: auto;
  transition: opacity 0.45s var(--nav-ease), visibility 0s 0.45s;
}

.nav-open .nav__panel {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s var(--nav-ease);
}

.nav__panel-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px 46px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__panel-item {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--nav-ease), transform 0.6s var(--nav-ease);
  transition-delay: calc(var(--i, 0) * 60ms);
}

.nav-open .nav__panel-item {
  opacity: 1;
  transform: none;
}

.nav__panel-link {
  display: flex;
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  transition: border-color 0.35s var(--nav-ease);
}

.nav__panel-link:hover,
.nav__panel-link[aria-current="page"] { border-color: #fff; }

.nav__panel-index {
  font-size: 20px;
  line-height: 1.4;
  opacity: 0.6;
}

@media (max-width: 700px) {
  .nav__panel { padding: 104px 24px 32px; }

  .nav__panel-list {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav__panel-link { font-size: 32px; }
}

/* Desktop: the wide pill. Kept last so it overrides the menu-button rules above. */
@media (min-width: 900px) {
  .nav__bar {
    grid-template-columns: 1fr auto;
    width: min(880px, 100%);
    padding: 0 22px;
  }

  .nav__here,
  .nav__toggle,
  .nav__panel { display: none; }

  .nav__links { display: flex; }
}
