/*
 * Navigation Component
 * Top navigation bar with logo, menu items, and dark mode toggle
 */

/* ============================================
   MAIN NAVIGATION CONTAINER
   ============================================ */

.main-nav {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-height);
  background-color: var(--color-bg-primary);
  border-bottom: var(--border-width) solid var(--color-border);
  z-index: var(--z-sticky);
  box-shadow: var(--shadow-sm);
}

.nav-container {
  max-width: var(--max-width-content);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ============================================
   LOGO / SITE NAME
   ============================================ */

.nav-logo {
  font-family: var(--font-heading);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-heading);
  text-decoration: none;
  letter-spacing: 1px;
  transition: opacity var(--transition-fast);
}

.nav-logo:hover {
  opacity: 0.8;
  color: var(--color-heading);
}

/* ============================================
   NAVIGATION MENU
   ============================================ */

.nav-menu {
  display: flex;
  align-items: center;
  gap: var(--spacing-xl);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  display: inline-block;
  margin: 0;
}

.nav-link {
  font-family: var(--font-heading);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--border-radius-sm);
  transition: color var(--transition-fast), background-color var(--transition-fast);
  position: relative;
}

.nav-link:hover {
  color: var(--color-link);
}

/* Active page indicator */
.nav-link.active {
  color: var(--color-link);
  background-color: var(--color-bg-secondary);
}

/* Underline animation on hover */
.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background-color: var(--color-link);
  transition: width var(--transition-fast);
}

.nav-link:hover::after {
  width: 80%;
}

.nav-link.active::after {
  width: 80%;
}

/* ============================================
   DARK MODE TOGGLE
   ============================================ */

.nav-toggle-wrapper {
  display: flex;
  align-items: center;
  margin-left: var(--spacing-lg);
}

.dark-mode-toggle {
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

.toggle-label {
  background-color: #111;
  width: 50px;
  height: 26px;
  border-radius: 50px;
  position: relative;
  padding: 5px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color var(--transition-base);
}

.toggle-label:hover {
  background-color: #222;
}

.toggle-label .fa-moon {
  color: #f1c40f;
  font-size: 14px;
}

.toggle-label .fa-sun {
  color: #f39c12;
  font-size: 14px;
}

.toggle-ball {
  background-color: #fff;
  width: 22px;
  height: 22px;
  position: absolute;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  transition: transform var(--transition-base);
}

.dark-mode-toggle:checked + .toggle-label .toggle-ball {
  transform: translateX(24px);
}

.dark-mode-toggle:focus-visible + .toggle-label {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
}

/* ============================================
   MOBILE MENU TOGGLE BUTTON
   ============================================ */

.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: var(--z-sticky);
}

.mobile-menu-toggle span {
  width: 30px;
  height: 3px;
  background-color: var(--color-heading);
  border-radius: 2px;
  transition: all var(--transition-fast);
  transform-origin: center;
}

/* Hamburger to X animation */
.mobile-menu-toggle.active span:nth-child(1) {
  transform: translateY(10.5px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: translateY(-10.5px) rotate(-45deg);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet breakpoint */
@media (max-width: 1024px) {
  .nav-menu {
    gap: var(--spacing-lg);
  }

  .nav-link {
    font-size: var(--font-size-sm);
    padding: var(--spacing-sm);
  }
}

/* Mobile breakpoint */
@media (max-width: 768px) {
  .nav-container {
    padding: 0 var(--spacing-md);
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--nav-height));
    background-color: var(--color-bg-primary);
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-top: var(--spacing-3xl);
    gap: var(--spacing-2xl);
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
  }

  .nav-menu.active {
    transform: translateX(0);
  }

  .nav-item {
    width: 100%;
    text-align: center;
  }

  .nav-link {
    display: block;
    width: 100%;
    font-size: var(--font-size-lg);
    padding: var(--spacing-md);
  }

  .nav-toggle-wrapper {
    position: fixed;
    top: 20px;
    right: 70px;
    margin: 0;
    z-index: calc(var(--z-sticky) + 1);
  }

  /* Prevent body scroll when menu is open */
  body.menu-open {
    overflow: hidden;
  }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
  .nav-logo {
    font-size: var(--font-size-lg);
  }

  .main-nav {
    height: 60px;
  }

  .nav-toggle-wrapper {
    right: 60px;
    top: 17px;
  }

  .nav-menu {
    top: 60px;
    height: calc(100vh - 60px);
    padding-top: var(--spacing-2xl);
  }
}
