/* Shared header nav (desktop links + mobile hamburger menu), loaded on
   every page so the header is identical site-wide. Originally lived in
   home.css only; extracted here once the same header/nav markup was
   rolled out to every page, not just index.html. */

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

.main-nav a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 14px;
  border-radius: 999px;
  transition: color 0.18s, background 0.18s, box-shadow 0.18s;
  font-weight: 500;
}

.main-nav a:hover, .main-nav a:focus {
  color: var(--brand-blue);
  background: rgba(14, 109, 209, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  position: relative;
  z-index: 1001;
  margin-left: auto;
}

.hamburger {
  display: block;
  width: 25px;
  height: 3px;
  background-color: var(--brand-ink);
  margin: 5px 0;
  transition: 0.3s;
}

.nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.nav-overlay.active {
  display: block;
}

@media (max-width: 768px) {
  header {
    position: relative;
  }

  .nav-toggle {
    display: block !important;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
    background: none !important;
    border: none !important;
    padding: 10px;
  }

  .nav-toggle.active {
    position: fixed !important;
    right: 20px !important;
    top: 20px !important;
    transform: none !important;
    z-index: 10002 !important;
    background: white !important;
    border-radius: 10px !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
  }

  .hamburger {
    background-color: var(--brand-ink);
    width: 24px;
    height: 3px;
    margin: 4px auto;
    display: block;
    transition: all 0.3s ease;
    position: relative;
  }

  .nav-toggle.active .hamburger {
    background-color: #253858 !important;
  }

  .main-nav {
    display: none !important;
  }

  .main-nav.active {
    display: flex !important;
    position: fixed;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background: #253858;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    overflow-y: auto;
    flex-direction: column;
    padding: 80px 0 30px 0;
    gap: 0;
  }

  .main-nav.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(58, 117, 213, 0.1) 0%, transparent 50%);
    pointer-events: none;
  }

  .main-nav.active a {
    display: block;
    color: white;
    padding: 20px 35px;
    border: none;
    font-weight: 500;
    font-size: 16px;
    position: relative;
    transition: all 0.3s ease;
    margin: 0;
    z-index: 1;
  }

  .main-nav.active a:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(-5px);
  }

  .main-nav.active a::before {
    content: '→';
    position: absolute;
    left: 15px;
    opacity: 0;
    transition: all 0.3s ease;
  }

  .main-nav.active a:hover::before {
    opacity: 1;
  }

  .nav-toggle.active .hamburger:nth-child(1) {
    /* Bar 1 sits 11px above the icon's center (3px height + 4px margin on
       each of the 3 bars). translate() is applied before rotate() here, so
       to land the bar's center exactly on the icon's center after a -45deg
       rotation the translate vector must be (11px / sqrt(2)) along the
       (-1, 1) diagonal, not an arbitrary (-5px, 6px) - that mismatch left
       the two bars crossing 6px apart instead of at a shared point. */
    transform: rotate(-45deg) translate(-7.78px, 7.78px) !important;
  }

  .nav-toggle.active .hamburger:nth-child(2) {
    opacity: 0 !important;
  }

  .nav-toggle.active .hamburger:nth-child(3) {
    transform: rotate(45deg) translate(-7.78px, -7.78px) !important;
  }
}
