/* ============================================================
   M.A.R.J.E.N.E — css/navigation.css
   Floating, centered glassmorphism navbar.
   ============================================================ */

.mje-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  justify-content: center;
  padding: 20px 24px 0;
  pointer-events: none; /* only the pill + drawer below are clickable */

  --mje-nav-accent: var(--color-primary, #dc2626);
  --mje-nav-ink: var(--color-gray-900, #0f0f10);
  --mje-nav-muted: var(--color-gray-500, #64748b);
}

/* ------------------------------------------------------------
   The pill — this is the actual glass surface, centered and
   capped in width so it floats in the middle of the viewport
   instead of stretching edge to edge.
   ------------------------------------------------------------ */
.mje-nav__inner {
  pointer-events: auto;
  width: 100%;
  max-width: 1180px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;

  padding: 16px 20px 16px 30px;
  border-radius: 999px;

  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  box-shadow: 0 10px 34px rgba(15, 15, 16, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.6);

  transition: background 0.35s ease, box-shadow 0.35s ease, padding 0.35s ease,
    border-color 0.35s ease;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .mje-nav__inner {
    background: rgba(255, 255, 255, 0.92);
  }
}

/* A touch more opaque + a slightly tighter pill once you scroll,
   so it reads clearly over any part of the page. */
.mje-nav[data-state='scrolled'] .mje-nav__inner {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(15, 15, 16, 0.06);
  box-shadow: 0 12px 40px rgba(15, 15, 16, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  padding-top: 12px;
  padding-bottom: 12px;
}

.mje-nav__logo {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-decoration: none;
  color: var(--mje-nav-ink);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
}

.mje-nav__mark {
  font-family: 'Clash Display', 'JetBrains Mono', sans-serif;
  font-weight: 600;
  font-size: 21px;
  letter-spacing: 0.02em;
}

.mje-nav__tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--mje-nav-muted);
  letter-spacing: 0.03em;
}

.mje-nav__links {
  display: flex;
  align-items: center;
  gap: 30px;
}

.mje-nav__link {
  position: relative;
  font-size: 15px;
  font-weight: 500;
  color: var(--mje-nav-ink);
  text-decoration: none;
  padding: 8px 2px;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.mje-nav__link::after {
  content: '';
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--mje-nav-accent);
  transition: right 0.25s ease;
}

.mje-nav__link:hover {
  color: var(--mje-nav-accent);
}

.mje-nav__link:hover::after,
.mje-nav__link[aria-current='page']::after {
  right: 0;
}

.mje-nav__link[aria-current='page'] {
  color: var(--mje-nav-accent);
}

.mje-nav__link.mje-nav__cta {
  padding: 11px 24px;
  border-radius: 999px;
  background: var(--mje-nav-accent);
  color: #fff;
  font-weight: 600;
}

.mje-nav__link.mje-nav__cta::after {
  display: none;
}

.mje-nav__link.mje-nav__cta:hover {
  filter: brightness(1.08);
  color: #fff;
}

/* ------------------------------------------------------------
   Hamburger toggle — hidden on desktop
   ------------------------------------------------------------ */
.mje-nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  flex: none;
  border: none;
  border-radius: 50%;
  background: rgba(15, 15, 16, 0.05);
  cursor: pointer;
}

.mje-nav__toggle span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--mje-nav-ink);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.mje-nav__toggle[aria-expanded='true'] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mje-nav__toggle[aria-expanded='true'] span:nth-child(2) {
  opacity: 0;
}

.mje-nav__toggle[aria-expanded='true'] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.mje-skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  z-index: 10000;
  background: #fff;
  color: var(--mje-nav-ink, #0f0f10);
  padding: 12px 18px;
  border-radius: 8px;
}

.mje-skip-link:focus {
  left: 16px;
  top: 16px;
}

/* ------------------------------------------------------------
   Mobile — the pill shrinks to logo + toggle, and the links
   become their own centered glass dropdown floating just below
   the pill (not a full-height drawer). It carries a high, fixed
   opacity of its own so it reads as a solid card regardless of
   what's scrolling behind it — this, plus the body-scroll-lock
   in navigation.js, is what stops the "background disappearing
   on scroll" glitch.
   ------------------------------------------------------------ */
@media (max-width: 860px) {
  .mje-nav {
    padding: 14px 14px 0;
  }

  .mje-nav__inner {
    padding: 12px 14px 12px 22px;
    gap: 12px;
  }

  .mje-nav__mark {
    font-size: 18px;
  }

  .mje-nav__tag {
    display: none;
  }

  .mje-nav__toggle {
    display: flex;
  }

  .mje-nav__links {
    position: fixed;
    top: 86px;
    left: 50%;
    width: min(92vw, 420px);
    max-height: calc(100vh - 110px);
    overflow-y: auto;

    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 18px;
    border-radius: 26px;

    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.6);
    -webkit-backdrop-filter: blur(26px) saturate(180%);
    backdrop-filter: blur(26px) saturate(180%);
    box-shadow: 0 24px 60px rgba(15, 15, 16, 0.20);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, -10px) scale(0.98);
    transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s ease;
  }

  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .mje-nav__links {
      background: rgba(255, 255, 255, 0.99);
    }
  }

  .mje-nav__links[data-open='true'] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, 0) scale(1);
  }

  .mje-nav__link {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 16px;
  }

  .mje-nav__link::after {
    display: none;
  }

  .mje-nav__link:hover,
  .mje-nav__link[aria-current='page'] {
    background: rgba(220, 38, 38, 0.08);
  }

  .mje-nav__link.mje-nav__cta {
    margin-top: 6px;
    text-align: center;
  }
}

/* Applied to <body> by navigation.js while the mobile menu is
   open — locks the page in place with `position: fixed` rather
   than relying on overflow:hidden alone, which iOS Safari can
   ignore during momentum scroll. */
body.mje-menu-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
}