header {
  background-color: var(--marine-blue);
  color: white;
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); /* Added shadow for separation */
  overflow: visible; /* Allow mobile menu to expand outside */
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1rem; /* More vertical space */
  position: relative;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  overflow: visible; /* Allow mobile menu to expand outside */
}

nav a {
  color: white;
  display: inline-block;
  text-decoration: none;
  transition: color 0.3s ease, background-color 0.3s ease,
    border-color 0.3s ease;
  padding: 6px 12px; /* Standardize padding for all links */
  border-radius: 8px;
}

nav a:hover {
  color: var(--quaternary-color);
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1.5rem; /* Increased gap for better spacing */
}

.uncollapsible-menu {
  display: none; /* Mobile first default */
  width: 100%;
  align-items: center;
}

.logo-container {
  display: flex;
  align-items: center;
  margin-right: 2rem; /* Spacing between logo and links */
}

.uncollapsible-menu ul {
  margin-right: auto; /* Push Contact Me button to the far right */
}

.logo-img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 50%;
  aspect-ratio: 1 / 1;
}

/* Contact Link Button */
.contact-link {
  text-decoration: none;
  color: white;
  padding: 8px 24px;
  border-radius: 25px;
  border: 2px solid white;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.contact-link:hover {
  background-color: white;
  color: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

/* Mobile Menu */
.collapsible-menu {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.collapsible-menu input {
  display: none;
}

.collapsible-menu label {
  display: block;
  cursor: pointer;
  background: url("img/OpenMenu.webp") no-repeat left center;
  padding: 10px 0 10px 40px;
  background-size: 24px 24px;
  color: white;
}

.menu-content {
  display: block;
  max-height: 0;
  overflow-y: auto; /* Allow scrolling if items don't fit */
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  /* Restored Glass styling with higher opacity to prevent too much bleed-through */
  background-color: rgba(19, 33, 57, 0.98);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
  z-index: 999;
  padding: 0;
}

.collapsible-menu input:checked ~ .menu-content {
  max-height: calc(100vh - 60px); /* Fit to screen height minus navbar */
  padding: 1rem 0;
}

.collapsible-menu input:checked ~ label {
  background-image: url("img/CloseMenu.webp");
}

.menu-content ul {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 1rem;
}

.menu-content li a {
  display: block;
  padding: 10px 16px !important; /* Force padding for highlight spacing */
}

/* Mobile menu contact link */
.menu-content .contact-link {
  display: block;
  margin: 1.5rem 1rem;
  text-align: center;
  text-decoration: none !important;
}

/* Remove underline from ALL active links in mobile menu and contact buttons */
.menu-content a.active::after,
.menu-content .contact-link.active::after,
.contact-link::after {
  display: none !important;
  content: none !important;
}

/* Ensure contact-link never shows the underline pseudo-element */
.contact-link.active::after {
  display: none !important;
  content: none !important;
}

/* Ensure contact-link doesn't change color/weight when active */
.contact-link.active,
.contact-link.active:focus {
  color: white !important;
  font-weight: normal !important;
  background-color: transparent !important;
  border-color: white !important;
  text-decoration: none !important;
}

.contact-link.active:hover {
  background-color: white !important;
  color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
}

/* Desktop Styles */
@media (min-width: 925px) {
  .uncollapsible-menu {
    display: flex;
  }

  .collapsible-menu {
    display: none;
  }
}
