/* Stage 3 — KOVA responsive navigation. Loaded after base/mobile to keep the header isolated. */
.site-header {
  top: clamp(18px, 1.55vw, 26px);
  pointer-events: none;
}

.nav-shell {
  min-height: 46px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  pointer-events: auto;
}

.brand-mark,
.nav-center,
.nav-actions {
  pointer-events: auto;
}

.brand-mark {
  justify-self: start;
  width: 68px;
  height: 56px;
  display: grid;
  place-items: center;
  overflow: visible;
  border-radius: 10px;
  transition: opacity var(--transition-fast) ease;
}

.brand-mark img {
  display: block;
  width: 62px;
  height: 62px;
  max-width: none;
  object-fit: contain;
}

.brand-mark:hover {
  opacity: .78;
}

.nav-center {
  justify-self: center;
}

.nav-center a {
  opacity: .72;
  transition: opacity var(--transition-fast) ease;
}

.nav-center a:hover,
.nav-center a:focus-visible,
.nav-center a.active {
  opacity: 1;
  text-decoration: none;
}

.nav-center a.active::after {
  transform-origin: left center;
  transform: scaleX(1);
}

.nav-actions {
  justify-self: end;
}

.contact-pill {
  white-space: nowrap;
}

.contact-pill span {
  transition: transform var(--transition-fast) ease;
}

.contact-pill:hover span {
  transform: translate(1px, -1px);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .42;
  transition: opacity var(--transition-fast) ease;
}

:root[data-theme="dark"] .theme-toggle .moon,
:root[data-theme="light"] .theme-toggle .sun {
  opacity: 1;
}

body.menu-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .site-header {
    left: 0;
    right: 0;
  }

  .nav-shell {
    width: min(calc(100% - 40px), var(--max));
    grid-template-columns: 1fr auto;
    position: relative;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
    min-width: 46px;
    position: relative;
    z-index: 82;
  }

  .brand-mark img {
    display: block;
    width: 42px;
    height: 42px;
    object-fit: contain;
  }

  .brand-mark::after {
    content: none;
  }

  .nav-actions {
    gap: 8px;
    position: relative;
    z-index: 82;
  }

  .contact-pill {
    display: none;
  }

  .theme-toggle {
    height: 42px;
    min-width: 58px;
  }

  .menu-toggle {
    display: block;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: transparent;
    position: relative;
    cursor: pointer;
  }

  .menu-toggle i {
    position: absolute;
    left: 12px;
    right: 12px;
    height: 1.5px;
    background: currentColor;
    top: 17px;
    transition: transform var(--transition-fast) ease, top var(--transition-fast) ease, opacity var(--transition-fast) ease;
  }

  .menu-toggle i + i {
    top: 25px;
  }

  .menu-toggle[aria-expanded="true"] i:first-child {
    top: 21px;
    transform: rotate(45deg);
  }

  .menu-toggle[aria-expanded="true"] i:last-child {
    top: 21px;
    transform: rotate(-45deg);
  }

  .nav-center {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 76;
    background: var(--bg);
    border: 0;
    border-radius: 0;
    padding: clamp(110px, 18vh, 160px) 24px 42px;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 0;
  }

  .nav-center.is-open {
    display: flex;
  }

  .nav-center a {
    display: flex;
    align-items: center;
    min-height: 58px;
    padding: 0;
    border-bottom: 1px solid var(--line2);
    font-size: clamp(20px, 6vw, 30px);
    font-weight: 600;
    letter-spacing: -.035em;
    opacity: 1;
  }

  .nav-center a:first-child {
    border-top: 1px solid var(--line2);
  }

  .nav-center a.active::after {
    display: none;
  }
}

@media (max-width: 720px) {
  .site-header {
    top: 18px;
  }

  .nav-shell {
    width: calc(100% - 40px);
  }

  .nav-actions {
    gap: 7px;
  }

  .theme-toggle {
    height: 42px;
    min-width: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-mark,
  .nav-center a,
  .contact-pill span,
  .theme-toggle svg,
  .menu-toggle i {
    transition: none;
  }
}
