/* Mobile Header Styles */
@media (max-width: 768px) {
  /* Hamburger Menu Icon */
  .hamburger-menu {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
    z-index: 1001; /* Above the drawer */
    position: relative;
  }

  .hamburger-menu span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--color-light-teal);
    border-radius: 3px;
    transition: all 0.3s ease-in-out;
  }

  /* Animation for Hamburger to X */
  .hamburger-menu.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
  }

  .hamburger-menu.active span:nth-child(2) {
    opacity: 0;
  }

  .hamburger-menu.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
  }

  /* Navigation Drawer (Sliding from Top-Right) */
  nav ul {
    position: fixed;
    top: 0;
    right: -100%; /* Hidden off-screen */
    width: 70%;
    max-width: 300px;
    height: 100vh;
    background-color: rgba(10, 10, 10, 0.98);
    flex-direction: column;
    justify-content: flex-start; /* Align items to top */
    padding-top: 80px; /* Space for close button/header */
    align-items: center;
    gap: 2rem;
    transition: right 0.4s cubic-bezier(0.77, 0, 0.175, 1); /* Smooth eased transition */
    z-index: 1000;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
    border-left: 2px solid var(--color-dark-teal);
  }

  /* Active State for Drawer */
  nav ul.active {
    right: 0;
  }

  /* Adjust Navigation Links for Drawer */
  nav ul li {
    width: 100%;
    text-align: center;
    opacity: 0; /* Hidden initially for stagger effect */
    transform: translateX(20px);
    transition:
      opacity 0.3s ease,
      transform 0.3s ease;
  }

  nav ul.active li {
    opacity: 1;
    transform: translateX(0);
  }

  /* Staggered Animation Delays for Links */
  nav ul.active li:nth-child(1) {
    transition-delay: 0.1s;
  }
  nav ul.active li:nth-child(2) {
    transition-delay: 0.2s;
  }
  nav ul.active li:nth-child(3) {
    transition-delay: 0.3s;
  }
  nav ul.active li:nth-child(4) {
    transition-delay: 0.4s;
  }
  nav ul.active li:nth-child(5) {
    transition-delay: 0.5s;
  }
  nav ul.active li:nth-child(6) {
    transition-delay: 0.6s;
  }
  nav ul.active li:nth-child(7) {
    transition-delay: 0.7s;
  }

  nav ul a {
    display: block;
    padding: 1rem;
    font-size: 1.2rem;
    width: 100%;
  }

  /* Prevent scrolling when menu is open */
  body.menu-open {
    overflow: hidden;
  }

  /* Overlay for clicking outside */
  .menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
  }

  .menu-overlay.active {
    display: block;
    opacity: 1;
  }
}

/* Ensure hamburger is hidden on desktop */
@media (min-width: 769px) {
  .hamburger-menu {
    display: none;
  }

  .menu-overlay {
    display: none !important;
  }
}

/* Global Header Sizing Override */
nav {
  padding: 0.5rem 2rem !important;
}

/* Specific Mobile Adjustments for Narrower Header */
@media (max-width: 768px) {
  nav {
    padding: 0.5rem 1rem !important;
  }

  /* Adjust main content padding to prevent large gap */
  main {
    padding-top: 70px !important;
  }
}
