.nav,
.nav-bottom {
  --nav-chrome-ink: var(--ink);
  position: fixed;
  right: 0;
  left: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--nav-chrome-ink);
  pointer-events: none;
  transition: color 0.6s var(--ease);
}

.nav:is(body.in-light .nav),
.nav-bottom:is(body.in-light .nav-bottom) {
  /* Token-sheet gap: exact light-ground chrome ink mandated by Section 1.4. */
  --nav-chrome-ink: rgb(74 55 47);
}

.nav:is(body.nav-open .nav) {
  --nav-chrome-ink: var(--tone-light);
}

/* The chrome floats free over the atmosphere in every state, exactly like
   the approved mockup: no bar, no border, no blur. Legibility over light
   rooms comes from the in-light ink flip; the no-JS fallback band at the
   end of this file is the only backdrop that ever paints. */
.nav {
  top: 0;
  min-height: 96px;
  padding: 26px 34px;
  background: transparent;
}

.nav-brand {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  color: currentColor;
  pointer-events: auto;
  text-decoration: none;
}

.nav-brand__seal {
  width: 34px;
  height: 27px;
  flex: 0 0 34px;
  color: currentColor;
}

.nav-brand__wordmark {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.42em;
  line-height: 1;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: clamp(10px, 2.2vw, 30px);
  pointer-events: auto;
}

.nav-toggle {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 10px;
  background: transparent;
  color: currentColor;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  line-height: 1;
  text-transform: uppercase;
}

.nav-toggle__dot {
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border: 1px solid currentColor;
  border-radius: 50%;
  transition:
    background-color 550ms var(--ease),
    transform 550ms var(--ease);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__dot {
  background: currentColor;
  transform: scale(1.35);
}

.nav-cta {
  flex: 0 0 auto;
  color: currentColor;
  white-space: nowrap;
}

.nav-cta > .rule {
  background: currentColor;
}

.nav-cta__roll {
  display: block;
}

.nav-bottom {
  bottom: 0;
  z-index: 1000;
  min-height: 84px;
  padding: 20px 34px;
}

.nav-bottom__copyright,
.nav-bottom__clock,
.nav-scroll-cue__label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  line-height: 1.4;
  text-transform: uppercase;
}

.nav-bottom__clock {
  position: absolute;
  left: 50%;
  font-variant-numeric: tabular-nums;
  transform: translateX(-50%);
}

.nav-scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.nav-scroll-cue__rule {
  display: block;
  width: 1px;
  height: 34px;
  background: currentColor;
  transform-origin: top;
  animation: nav-scroll-cue 3.6s var(--ease) infinite;
}

.nav-menu {
  --nav-menu-ink: var(--tone-light);
  position: fixed;
  inset: 0;
  z-index: 1100;
  overflow: auto;
  background: var(--tone-night);
  color: var(--nav-menu-ink);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition:
    opacity 900ms var(--ease-in-out),
    visibility 900ms;
}

.nav-menu.is-open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.nav-menu__panel {
  display: flex;
  width: min(100%, var(--shell-max));
  min-height: 100%;
  margin-inline: auto;
  flex-direction: column;
  justify-content: center;
  padding: 132px 34px 54px;
}

.nav-menu__links {
  display: grid;
  width: min(100%, 920px);
}

.nav-menu__link {
  display: grid;
  min-height: 72px;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  padding-block: 8px;
  color: currentColor;
  text-decoration: none;
}

.nav-menu__index {
  align-self: start;
  padding-top: 0.9em;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  line-height: 1;
}

.nav-menu__roll {
  height: clamp(48px, 5.8vw, 82px);
  overflow: hidden;
}

.nav-menu__line {
  display: block;
  height: clamp(48px, 5.8vw, 82px);
  font-family: var(--font-serif);
  font-size: clamp(42px, 5.6vw, 80px);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1;
  transition: transform 700ms var(--ease);
}

.nav-menu__link:hover .nav-menu__line,
.nav-menu__link:focus-visible .nav-menu__line {
  transform: translateY(-100%);
}

.nav-menu__utility {
  display: flex;
  width: min(100%, 920px);
  flex-wrap: wrap;
  gap: 8px clamp(24px, 4vw, 54px);
  margin-top: clamp(36px, 6vh, 72px);
  padding-top: 24px;
  border-top: 1px solid var(--line-strong);
}

.nav-menu__utility-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: currentColor;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.4;
  text-decoration: none;
  text-transform: uppercase;
}

.nav-menu__utility-link:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}

@keyframes nav-scroll-cue {
  0% {
    transform: scaleY(0);
    transform-origin: top;
  }

  45% {
    transform: scaleY(1);
    transform-origin: top;
  }

  100% {
    transform: scaleY(0);
    transform-origin: bottom;
  }
}

@media (max-width: 819px) {
  .nav {
    min-height: 80px;
    padding: 18px 20px;
  }

  .nav-bottom {
    min-height: 72px;
    padding: 16px 20px;
  }

  .nav-bottom__clock {
    display: none;
  }

  .nav-menu__panel {
    padding: 108px 20px 44px;
  }
}

@media (max-width: 599px) {
  .nav {
    padding-inline: 16px;
  }

  .nav-brand__wordmark {
    display: none;
  }

  .nav-actions {
    gap: 6px;
  }

  .nav-toggle {
    gap: 7px;
    padding-inline: 6px;
    letter-spacing: 0.16em;
  }

  .nav-cta {
    gap: 8px;
  }

  .nav-cta > .rule {
    width: 24px;
    flex-basis: 24px;
  }

  .nav-cta:hover > .rule,
  .nav-cta:focus-visible > .rule {
    width: 32px;
    flex-basis: 32px;
  }

  .nav-cta__roll > * {
    font-size: 11px;
    letter-spacing: 0.12em;
  }

  .nav-bottom {
    padding-inline: 16px;
  }

  .nav-bottom__copyright,
  .nav-scroll-cue__label {
    letter-spacing: 0.15em;
  }

  .nav-menu__panel {
    padding-inline: 16px;
  }

  .nav-menu__link {
    min-height: 60px;
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .nav-menu__index {
    padding-top: 0.7em;
  }

  .nav-menu__roll,
  .nav-menu__line {
    height: clamp(44px, 14vw, 64px);
  }

  .nav-menu__line {
    font-size: clamp(38px, 13vw, 58px);
  }
}

@media (max-width: 359px) {
  .nav-toggle__dot {
    display: none;
  }

  .nav-cta {
    gap: 6px;
  }

  .nav-cta > .rule,
  .nav-cta:hover > .rule,
  .nav-cta:focus-visible > .rule {
    display: none;
  }

  .nav-cta__roll > * {
    letter-spacing: 0;
  }

  .nav-bottom__copyright {
    letter-spacing: 0.08em;
  }
}

/* No-JS fallback: the in-light sensor cannot run, so the fixed chrome
   carries its own taupe band. Nearly invisible over the dark chapters,
   it guarantees legible porcelain text over the porcelain light rooms. */
html:not([data-js]) .nav,
html:not([data-js]) .nav-bottom {
  background: rgba(26, 21, 16, 0.88);
}
