/* Base CSS */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  display: block; /* Changed from none to block for better fallback */
  background-color: rgb(240, 240, 240);
  font-family: "Merriweather Sans", Arial, sans-serif; /* Added fallback fonts */
  font-size: 14px;
  line-height: 1.6;
}

/* Accessibility improvements */
.visually-hidden-focusable {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.visually-hidden-focusable:focus {
  position: static !important;
  width: auto !important;
  height: auto !important;
  padding: 0.5rem !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
  background: #000 !important;
  color: #fff !important;
  text-decoration: none !important;
  z-index: 999999 !important;
}

.container {
  margin-top: 1.5vh;
  margin-bottom: 1.5vh;
  width: 85vw;
  min-height: 100vh;
  max-width: 1200px; /* Added max-width for better readability */
  margin-left: auto;
  margin-right: auto;
}

.nav-brand {
  height: 60px; /* Fixed height for consistency */
  width: auto; /* Auto width to maintain aspect ratio */
  max-width: min(300px, 30vw); /* Responsive max-width with fallback */
  margin: 0.5rem 0; /* Fixed margin instead of viewport units */
  flex-shrink: 0; /* Prevent logo from shrinking */
}

/* Enhanced navbar styles */
.navbar {
  padding: 0.5rem 1rem;
  flex-wrap: nowrap; /* Prevent wrapping that causes overflow */
  overflow: hidden; /* Prevent any content from overflowing */
}

.navbar-brand {
  flex-shrink: 0; /* Prevent brand from shrinking */
  margin-right: 1rem; /* Consistent spacing */
}

.navbar-light .navbar-toggler {
  color: transparent;
  border-color: transparent;
  padding: 0.5rem;
  margin-left: auto; /* Push toggle button to the right */
  flex-shrink: 0; /* Prevent toggle from shrinking */
}

.navbar-nav {
  flex-wrap: wrap; /* Allow menu items to wrap if needed */
  gap: 0.25rem; /* Consistent spacing between items */
  overflow: hidden; /* Prevent overflow */
}

.navbar-nav .nav-link {
  color: rgb(0, 0, 80) !important;
  font-weight: 500;
  padding: 0.5rem 0.75rem !important; /* Reduced horizontal padding */
  transition: color 0.3s ease;
  white-space: nowrap; /* Prevent text wrapping in nav items */
  font-size: 0.95rem; /* Slightly smaller to fit better */
  max-width: 120px; /* Maximum width to prevent overflow */
  overflow: hidden;
  text-overflow: ellipsis; /* Add ellipsis for long text */
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus {
  color: rgb(0, 0, 120) !important;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Current page indicator */
.navbar-nav .nav-link[aria-current="page"] {
  color: rgb(0, 0, 120) !important;
  font-weight: 600;
}

/* Improve mobile toggle button */
.animated-icon {
  width: 30px;
  height: 20px;
  position: relative;
  transform: rotate(0deg);
  transition: 0.5s ease-in-out;
  cursor: pointer;
  margin: 0; /* Remove viewport-based margins */
}

.animated-icon span {
  display: block;
  position: absolute;
  height: 3px;
  width: 100%;
  border-radius: 9px;
  opacity: 1;
  left: 0;
  transform: rotate(0deg);
  transition: 0.25s ease-in-out;
  background: rgb(0, 0, 80);
}

.animated-icon span:nth-child(1) {
  top: 0px;
}

.animated-icon span:nth-child(2),
.animated-icon span:nth-child(3) {
  top: 10px;
}

.animated-icon span:nth-child(4) {
  top: 20px;
}

.animated-icon.open span:nth-child(1),
.animated-icon.open span:nth-child(4) {
  top: 11px;
  width: 0%;
  left: 50%;
}

.animated-icon.open span:nth-child(2) {
  transform: rotate(45deg);
}

.animated-icon.open span:nth-child(3) {
  transform: rotate(-45deg);
}

.nav-item {
  font-family: "Lato", sans-serif;
  font-size: 14px;
  text-transform: uppercase;
  text-decoration: none;
  letter-spacing: 4px;
  margin-top: 2.5vw;
  margin-left: 4vw;
}

.navbar-light .navbar-nav .nav-link {
  color: rgb(0, 0, 80);
}

.nav-link {
  text-decoration: none;
}

.nav-link:hover {
  text-decoration: underline;
  text-decoration-thickness: 0.25vw;
  text-underline-offset: 4px;
}

.footer {
  width: 100vw;
  margin-top: 1vh;
  background-color: rgb(0, 0, 80);
  color: rgb(160, 160, 160);
  text-align: center;
  font-size: 10px;
}

.footer a {
  color: rgb(240, 240, 240);
  font-size: 10px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.footer a:hover {
  color: rgb(160, 160, 160);
  text-decoration-color: rgb(160, 160, 160);
}

h2 {
  font-family: "Lato", sans-serif;
  color: rgb(0, 0, 80);
  font-size: 18px;
  letter-spacing: 0.2vw;
  text-decoration: none;
  text-transform: uppercase;
}

a {
  color: rgb(0, 0, 80);
}

a:hover {
  color: rgb(0, 0, 80);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.media-heading,
.pub-link {
  background-color: rgb(240, 240, 240);
  font-size: 14px;
  border: none;
  text-decoration: underline;
}

.media-heading:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.info {
  font-size: 14px;
  padding: 0;
  width: 100%;
}

/* Mobile and small tablet styles */
@media only screen and (max-width: 768px) {
  .container {
    width: 95vw;
    margin-top: 1vh;
    margin-bottom: 1vh;
    padding: 0 10px;
  }

  .nav-brand {
    height: 50px; /* Smaller logo on mobile */
    max-width: min(250px, 40vw);
  }

  .navbar {
    padding: 0.25rem 0.5rem; /* Reduced padding on mobile */
  }

  .navbar-nav .nav-link {
    font-size: 0.9rem;
    padding: 0.5rem 0.5rem !important;
  }

  .nav-item {
    font-size: 12px;
    letter-spacing: 1px; /* Reduced letter spacing */
  }

  h2 {
    font-size: 16px;
    letter-spacing: 0.1vw;
  }

  body {
    font-size: 12px;
  }

  .animated-icon {
    width: 25px; /* Smaller toggle button on mobile */
    height: 18px;
  }
}

/* Medium tablets */
@media only screen and (min-width: 769px) and (max-width: 1023px) {
  .container {
    width: 90vw;
  }

  .nav-brand {
    height: 55px;
    max-width: min(280px, 35vw);
  }

  .navbar-nav .nav-link {
    font-size: 1rem;
    padding: 0.5rem 0.75rem !important;
  }

  .nav-item {
    font-size: 16px;
    letter-spacing: 2px; /* Moderate letter spacing */
  }

  h2 {
    font-size: 20px;
  }

  body {
    font-size: 16px;
  }
}


/* Large screens */
@media only screen and (min-width: 1024px) {
  body {
    font-size: 18px;
  }

  .nav-brand {
    height: 60px;
    max-width: 300px; /* Fixed max-width instead of viewport units */
  }

  .navbar-nav {
    margin-left: auto;
    margin-right: auto;
  }

  .navbar-nav .nav-link {
    font-size: 1.1rem;
    padding: 0.5rem 1rem !important; /* Full padding on large screens */
  }

  .nav-item {
    font-size: 18px;
    letter-spacing: 0.1rem; /* Fixed letter spacing instead of vw */
    margin-left: 0.75rem; /* Fixed margin instead of vw */
  }

  .nav-link:hover {
    text-underline-offset: 8px;
  }

  h2 {
    font-size: 24px;
  }

  a:hover {
    text-underline-offset: 4px;
  }

  ul {
    list-style: none;
    margin-left: 0;
    padding-left: 0;
  }

  .footer {
    font-size: 14px;
  }

  .footer a {
    font-size: 12px;
  }

  .media-heading {
    font-size: 18px;
  }

  .media-heading:hover {
      text-underline-offset: 4px;
  }

  .info {
    font-size: 14px;
  }

  .fas,
  .fab {
    color: rgb(0, 0, 80);
  }

  .fas:hover,
  .fab:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
  }

  .socials {
    vertical-align: bottom;
  }
}

/* Add extra-wide screen support */
@media only screen and (min-width: 1400px) {
  .navbar-nav .nav-link {
    padding: 0.5rem 1.25rem !important; /* Extra spacing on very large screens */
    max-width: none; /* Remove max-width constraint on very large screens */
  }
  
  .nav-brand {
    max-width: 350px; /* Allow larger logo on very wide screens */
  }
}

/* Fix for very narrow screens */
@media only screen and (max-width: 320px) {
  .navbar {
    padding: 0.25rem 0.25rem;
  }
  
  .nav-brand {
    height: 45px;
    max-width: 180px;
  }
  
  .navbar-nav .nav-link {
    font-size: 0.85rem;
    padding: 0.5rem 0.25rem !important;
  }
}
