/* the menu bar on every page (markup at the top of each page's <body>, nav.js). One fixed bar across the top, so
   home, every page and "get in touch" are one click away from anywhere: the logo and wordmark on the left (home),
   projects · tools · about in the middle, the button on the right. At the top of a page the bar is open over the
   page; once the page scrolls it gets the ink ground and a hairline under it. Nothing moves between the states.
   Colours: the "cobalt print" palette (ink, paper, cobalt for fills, coral for small marks), see sub.css */
.site-nav {
  --nav-h: 72px;
  --nav-edge: clamp(20px, calc(16vw - 60px), 220px); /* the pages' --edge */
  --nav-ink: #0d0e11;
  --nav-paper: #eeeae0;
  --nav-line: #26272c;
  --nav-cobalt: #2f5bff;
  --nav-coral: #ff6b57;
  --nav-ease: cubic-bezier(0.16, 1, 0.3, 1);
  position: fixed;
  z-index: 50;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  box-sizing: border-box;
  padding: 0 var(--nav-edge);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  font: 500 15px/1 "DM Sans", sans-serif;
  letter-spacing: -0.01em;
  color: var(--nav-paper);
  background: rgb(13 14 17 / 0);
  box-shadow: inset 0 -1px 0 rgb(38 39 44 / 0);
  transition: background-color 0.4s var(--nav-ease), box-shadow 0.4s var(--nav-ease);
}
.site-nav.scrolled {
  background: rgb(13 14 17 / 1);
  box-shadow: inset 0 -1px 0 var(--nav-line);
}
.site-nav a {
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.site-nav a:focus-visible {
  outline: 2px solid var(--nav-paper);
  outline-offset: 4px;
  border-radius: 4px;
}

/* one line, one height (40px), one face: the wordmark on the left, the links in a quiet track in the middle with
   a pill sliding under the hovered or current page (nav.js), and the button on the right as a pill of the same
   family, its emphasis carried by the cobalt disc with the arrow */
.nav-home {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  height: 40px;
  font: 600 18px/1 "Unbounded", sans-serif;
  letter-spacing: -0.015em;
}
.nav-home .mark-logo,
.nav-home .mark-build {
  color: var(--nav-coral);
}

.nav-links {
  position: relative;
  display: flex;
  height: 40px;
  box-sizing: border-box;
  padding: 3px;
  border-radius: 999px;
  background: #16171b;
  box-shadow: inset 0 0 0 1px var(--nav-line);
  isolation: isolate;
}
/* the sliding pill (nav.js sets --x and --w from the link under it) */
.nav-links::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: var(--w, 0px);
  translate: var(--x, 0px) 0;
  border-radius: 999px;
  background: #2a2c33;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.06);
  opacity: var(--on, 0);
  transition: translate 0.5s var(--nav-ease), width 0.5s var(--nav-ease), opacity 0.3s;
}
.nav-links.ready::before {
  transition: translate 0.5s var(--nav-ease), width 0.5s var(--nav-ease), opacity 0.3s;
}
.nav-links a {
  display: grid;
  align-items: center;
  padding: 0 16px;
  border-radius: 999px;
  color: rgb(238 234 224 / 0.62);
  transition: color 0.3s var(--nav-ease);
}
.nav-roll,
.nav-roll > span {
  display: block;
  line-height: 1;
}
.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a[aria-current="page"] {
  color: var(--nav-paper);
}

.nav-cta {
  justify-self: end;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  box-sizing: border-box;
  padding: 0 4px 0 20px;
  border-radius: 999px;
  background: #16171b;
  box-shadow: inset 0 0 0 1px var(--nav-line);
  color: var(--nav-paper) !important;
  transition: background-color 0.35s var(--nav-ease), box-shadow 0.35s var(--nav-ease), translate 0.3s var(--nav-ease);
}
.nav-cta:hover,
.nav-cta:focus-visible,
.nav-cta[aria-current="page"] {
  background: #1f2026;
  box-shadow: inset 0 0 0 1px #3a3c44;
}
.nav-cta:active {
  translate: 0 1px;
}
/* the cobalt disc; its arrow flies out to the top right and a new one comes in from the bottom left */
.nav-arrow {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--nav-cobalt);
  color: #fff;
  overflow: hidden;
  transition: scale 0.45s var(--nav-ease);
}
.nav-cta:hover .nav-arrow {
  scale: 1.06;
}
.nav-arrow svg {
  position: absolute;
  top: 9px;
  left: 9px;
  width: 14px;
  height: 14px;
  transition: translate 0.55s var(--nav-ease);
}
.nav-arrow svg + svg {
  translate: -18px 18px;
}
.nav-cta:hover .nav-arrow svg,
.nav-cta:focus-visible .nav-arrow svg {
  translate: 18px -18px;
}
.nav-cta:hover .nav-arrow svg + svg,
.nav-cta:focus-visible .nav-arrow svg + svg {
  translate: 0 0;
}

/* the pages start under the bar */
.subpage .screen {
  padding-top: calc(var(--nav-top, 72px) + clamp(20px, 5vh, 56px));
}
body:not(.subpage) > main:not(.home) {
  padding-top: calc(var(--nav-top, 72px) + clamp(20px, 5vh, 56px));
}

@media (prefers-reduced-motion: reduce) {
  .site-nav,
  .site-nav *,
  .site-nav *::before,
  .site-nav *::after {
    transition-duration: 0.01s !important;
  }
}

/* phones: logo on the left, the track next to it, the button on the right; the wordmark and the button's words
   step aside when space is short */
@media (max-width: 760px) {
  .site-nav {
    --nav-h: 60px;
    --nav-edge: 12px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
  }
  .nav-home {
    font-size: 16px;
  }
  .nav-links a {
    padding: 0 12px;
  }
  .subpage .screen,
  body:not(.subpage) > main:not(.home) {
    --nav-top: 60px;
  }
}
@media (max-width: 560px) {
  .nav-word,
  .nav-cta-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .nav-home {
    font-size: 22px;
  }
  .nav-cta {
    padding: 0 4px;
  }
}
