/* ---------- NAV ---------- */
nav {
  position: fixed;
  top: 0;
  left: 0;
  /* Lock to viewport width: width:100% of the ICB plus max-width:100vw is
     a belt-and-suspenders guarantee that the nav cannot exceed the visible
     viewport, even if a child reports a wider intrinsic size. */
  width: 100%;
  max-width: 100vw;
  z-index: 50;
  /* Longhand so safe-area insets can additively pad the edges on
     notched / rounded-corner devices without clobbering vertical padding.
     Floor matches .container so nav icons align horizontally with body content. */
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  padding-left: max(clamp(2rem, 5vw, 4rem), env(safe-area-inset-left));
  padding-right: max(clamp(2rem, 5vw, 4rem), env(safe-area-inset-right));
  display: grid;
  /* minmax(0, 1fr) lets the side columns shrink below their content size,
     so wide children (e.g. nav-links on tablet) can never push the grid
     past the nav's content box. */
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transform: translateY(0);
  will-change: transform, background;
  transition:
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.7s ease,
    backdrop-filter 0.7s ease,
    -webkit-backdrop-filter 0.7s ease;
}

nav.scrolled {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

nav.nav-hidden {
  transform: translateY(-100%);
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 2.2rem;
  align-items: center;
  justify-self: start;
}
.nav-links a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bone-dim);
  transition: color 0.2s ease;
  position: relative;
}
.nav-links a:hover { color: var(--white); }
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -6px; left: 0;
  width: 0; height: 1px;
  background: var(--blue);
  transition: width 0.25s ease;
}
.nav-links a:hover::after { width: 100%; }

.nav-logo {
  justify-self: center;
  display: block;
  line-height: 0;
  position: relative;
}
.nav-logo .mmr-logo {
  width: auto;
  height: 64px;
  fill: var(--white);
  display: block;
  transition: fill 0.3s ease, filter 0.3s ease, transform 0.3s ease;
}
.nav-logo:hover .mmr-logo {
  fill: var(--blue);
  filter: drop-shadow(0 0 18px rgba(31, 182, 255, 0.5));
  transform: scale(1.04);
}

.nav-socials {
  display: flex;
  gap: 1.1rem;
  align-items: center;
  justify-self: end;
}
.nav-socials a {
  color: var(--bone-dim);
  transition: color 0.2s ease, transform 0.25s ease;
  line-height: 0;
  padding: 0.5rem;
  margin: -0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-socials a:hover { color: var(--blue); transform: translateY(-2px); }
.nav-socials svg { width: 17px; height: 17px; fill: currentColor; display: block; }

/* ---------- MOBILE NAV ACTIONS (quick contact + hamburger) ---------- */
.nav-quick {
  display: none;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--grit-line-strong);
  align-items: center;
  justify-content: center;
  justify-self: start;
  color: var(--bone-dim);
  transition: border-color 0.25s ease, color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.nav-quick:hover,
.nav-quick:focus-visible { border-color: var(--blue); color: var(--blue); outline: none; }
.nav-quick svg { width: 18px; height: 18px; display: block; }

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--grit-line-strong);
  cursor: pointer;
  padding: 0;
  align-items: center;
  justify-content: center;
  justify-self: end;
  position: relative;
  transition: border-color 0.25s ease, background 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle:hover { border-color: var(--blue); }

.nav-toggle-bars {
  position: relative;
  width: 18px;
  height: 12px;
  display: block;
}
.nav-toggle-bars span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: var(--white);
  transition: transform 0.3s cubic-bezier(0.65, 0, 0.35, 1),
              opacity 0.2s ease,
              top 0.3s cubic-bezier(0.65, 0, 0.35, 1);
}
.nav-toggle-bars span:nth-child(1) { top: 0; }
.nav-toggle-bars span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.nav-toggle-bars span:nth-child(3) { top: 100%; transform: translateY(-100%); }

/* Open state: morph into an X */
.nav-toggle[aria-expanded="true"] { border-color: var(--blue); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(1) {
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(3) {
  top: 50%;
  transform: translateY(-50%) rotate(-45deg);
}

/* ---------- MOBILE OVERLAY MENU ---------- */
.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 49;
  background: rgba(0, 0, 0, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem 1.5rem 3rem;
  /* If the menu content is taller than the viewport (e.g. landscape phone),
     allow internal scroll on the overlay itself — body is locked behind it. */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  transition:
    opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 0.35s;
}
.mobile-nav[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition:
    opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 0s;
}

.mobile-nav-inner {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.mobile-nav-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--grit-line);
}
.mobile-nav-links li {
  border-bottom: 1px solid var(--grit-line);
}
.mobile-nav-links a {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  padding: 1.1rem 0;
  text-decoration: none;
  transition: color 0.2s ease, padding 0.25s ease;
  min-height: 56px;
}
.mobile-nav-links a:hover,
.mobile-nav-links a:focus-visible { padding-left: 0.5rem; outline: none; }
.mobile-nav-links a:hover .mobile-nav-label,
.mobile-nav-links a:focus-visible .mobile-nav-label { color: var(--blue); }

.mobile-nav-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  color: var(--blue);
  min-width: 2.5rem;
}
.mobile-nav-label {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: clamp(2rem, 9vw, 2.6rem);
  text-transform: uppercase;
  letter-spacing: 0.005em;
  color: var(--white);
  line-height: 1;
  transition: color 0.2s ease;
}

.mobile-nav-cta {
  display: flex;
}
.mobile-nav-cta .btn-line {
  flex: 1;
  justify-content: center;
  min-height: 56px;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
}

.mobile-nav-socials {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--grit-line);
}
.mobile-nav-socials a {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--bone-dim);
  transition: color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-socials a:hover,
.mobile-nav-socials a:focus-visible { color: var(--blue); outline: none; }
.mobile-nav-socials svg { width: 20px; height: 20px; fill: currentColor; display: block; }

@media (prefers-reduced-motion: reduce) {
  .mobile-nav,
  .mobile-nav[aria-hidden="false"] {
    transition: opacity 0.01s linear, visibility 0s;
    transform: none;
  }
  .nav-toggle-bars span { transition: none; }
}

/* ---------- SECTION COMMON ---------- */
section {
  position: relative;
  padding: clamp(5rem, 10vw, 9rem) 0;
}

.section-eyebrow {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}
.section-eyebrow .bar {
  width: 48px;
  height: 2px;
  background: var(--blue);
}
.section-eyebrow .num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--bone-dim);
  text-transform: uppercase;
}

.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 900;
  font-size: clamp(2.5rem, 7vw, 6rem);
  line-height: 0.9;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  margin-bottom: 3rem;
}
.section-title .strike { color: var(--blue); }
