/* Styles for the navigation menu */
.nav-menu-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
}

.nav-menu-item {
  position: relative;
  margin-bottom: 0.5rem;
}

/* Create scrollable dropdown containers */
.nav-scroll-container {
  max-height: 70vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--clr-accent-900) var(--clr-neutral-100);
}

.nav-scroll-container::-webkit-scrollbar {
  width: 8px;
}

.nav-scroll-container::-webkit-scrollbar-track {
  background: var(--clr-neutral-100);
  border-radius: 4px;
}

.nav-scroll-container::-webkit-scrollbar-thumb {
  background-color: var(--clr-accent-900);
  border-radius: 4px;
}

/* Submenu styling */
.nav-submenu-list {
  list-style: none;
  padding: 0 0 0 1rem;
  margin: 0.5rem 0 0 1.5rem;
  border-left: 2px solid var(--clr-neutral-100);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.nav-menu-item:hover .nav-submenu-list,
.nav-menu-item:focus-within .nav-submenu-list {
  max-height: 500px; /* Large enough to accommodate content */
}

.nav-submenu-item {
  margin-bottom: 0.4rem;
}

/* Make submenu links smaller and more compact */
.submenu-link {
  padding: 0.25rem 0.5rem !important;
  margin-bottom: 0.25rem !important;
  font-size: 0.9rem;
  border-width: 1px !important;
}

.submenu-link .link-text {
  font-size: 0.9rem !important;
}

/* Indicator for items with submenus */
.nav-menu-item > a:after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 0.5rem;
  vertical-align: middle;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 4px solid currentColor;
  transition: transform 0.3s ease;
}

.nav-menu-item:hover > a:after,
.nav-menu-item:focus-within > a:after {
  transform: rotate(90deg);
}

/* Hide the indicator for items without submenus */
.nav-menu-item:not(:has(.nav-submenu-list)) > a:after {
  display: none;
}

/* Always visible submenu for chapters section */
.always-visible {
  max-height: 1000px !important; /* Large enough to show all content */
  overflow: visible;
  margin-top: 0.75rem;
}

/* Remove the arrow indicator for items with always-visible submenus */
.nav-menu-item:has(.always-visible) > a:after {
  display: none;
}

/* Styling for third-level submenu items */
.link-container.submenu-link.third-level {
  padding-left: 2rem;
  font-size: 0.9em;
}

/* Adjust existing mega menu sections for scrolling */
.mega-menu-section {
  max-height: 80vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--clr-accent-900) var(--clr-neutral-100);
}

.mega-menu-section::-webkit-scrollbar {
  width: 8px;
}

.mega-menu-section::-webkit-scrollbar-track {
  background: var(--clr-neutral-100);
  border-radius: 4px;
}

.mega-menu-section::-webkit-scrollbar-thumb {
  background-color: var(--clr-accent-900);
  border-radius: 4px;
}

/* Reduce dropdown link size */
.link-container {
  padding: 0.4rem 0.8rem;
  gap: 0.4rem;
  transition: all 0.2s ease-in-out;
}

.link-icon {
  width: 2.5rem;
  height: 2.5rem;
}

.link-text {
  font-size: 0.95rem;
  line-height: 1.2;
}

/* Mobile adjustments */
@media (max-width: 992px) {
  .nav-submenu-list {
    margin-left: 1rem;
  }
  
  .link-container {
    padding: 0.35rem 0.7rem;
  }
  
  .link-icon {
    width: 2.2rem;
    height: 2.2rem;
  }
  
  .link-text {
    font-size: 0.9rem;
  }
}

@media (max-width: 576px) {
  .nav-submenu-list {
    margin-left: 0.5rem;
  }
  
  .submenu-link {
    padding: 0.2rem 0.4rem !important;
  }
  
  .link-container {
    padding: 0.3rem 0.6rem;
  }
  
  .link-icon {
    width: 2rem;
    height: 2rem;
  }
  
  .link-text {
    font-size: 0.85rem;
  }
}

#navbar {
  position: sticky;
  top: 0;
  width: 100%;
  background-color: var(--clr-neutral-900);
  /*border-bottom: 3px solid var(--clr-accent-900);*/
  color: #fff;
  z-index: 1000;
}

.nav-mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%; /* Replace with the actual height */
  background-color: var(--clr-neutral-900);
  z-index: 20; /* Adjust to ensure it's above the mega-menu but below the nav content */
  pointer-events: none; /* Allows clicks to pass through to elements underneath */
}

.nav-wrapper {
  position: relative;
  max-width: 1260px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background-color: var(--clr-neutral-900);
  z-index: 30;
}

.logo img {
  width: 8vw;
  min-width: 200px;
  max-width: 350px;
  margin: 1rem 2rem 1rem 0rem;
  transition: min-width 0.3s ease-in-out, margin 0.3s ease-in-out; /* Smooth transition for logo resizing */
}

@media (max-width: 768px) {
  .logo img {
    width: 7vw;
    min-width: 100px;
    max-width: 250px;
    margin: 0.75rem 1.5rem 0.75rem 0rem;
  }
}

.nav-links a {
  font-family: var(--ff-secondary);
  /*font-style:italic;*/
  font-weight: var(--fw-semi-bold);
  transition: color 0.3s ease-in-out;
}

.nav-links a,
.login-social a,
.social-icons a {
  text-decoration: none;
  color: #fff;
  margin-right: 1rem;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.nav-links a:hover {
  color: var(--clr-accent-400);
}

.login-link {
  margin-right: 2rem; /* additional spacing for login link */
}

.login-social {
  display: flex;
}

.hamburger-icon {
  display: none;
  font-size: 2rem;
  cursor: pointer;
  font-family: var(--ff-secondary); /* Custom font family */
  font-weight: var(--fw-semi-bold); /* Semi-bold font weight */
  margin-right: 1rem;
}

.mobile-nav {
  position: absolute;
  background-color: var(--clr-neutral-900);
  top: 100%; /* Positioned right below the nav-wrapper */
  width: 100%;
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 0.5s ease, opacity 0.5s ease;
  z-index: -1; /* Adjusted for the mobile-nav */
  padding: 2rem;
}

.mega-menu-container {
  position: absolute;
  background-color: red;
  top: 100%; /* Positioned right below the nav-wrapper */
  width: 100%;
  transform: translateY(-100%);
  opacity: 1;
  transition: transform 0.5s ease, opacity 0.5s ease;
  z-index: -1; /* Adjusted for the mobile-nav */
}

.mobile-nav-active,
.mega-menu-section.active {
  transform: translateY(0);
  opacity: 1;
}

.mobile-nav-close {
  position: absolute;
  top: 1rem;
  right: 2rem;
  padding-top: 5px;
  cursor: pointer;
  background-color: var(--clr-accent-900);
  color: #fff;
  border: 2px solid #ffffff;
  border-radius: 5px;
  width: 2.5rem; /* Adjust the size as needed */
  height: 2rem; /* Adjust the size as needed */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem; /* Adjust the font size if necessary */
  font-weight: bold;
}

.mega-menu-section {
  position: absolute;
  top: 100%; /* Position at the bottom of the navbar */
  width: 100%;
  visibility: hidden; /* Initially hidden */
  opacity: 0; /* Initially transparent */
  pointer-events: none; /* No interaction when hidden */
  transform: translateY(-50px); /* Initial position above the final one */
  transition: visibility 0.3s, opacity 0.3s, transform 0.3s; /* Transition effects */
  background: #9e7777;
  /*min-height: 30vh;*/
  /*max-height: 90vh;
  z-index: 99; /* Ensure it appears above the mobile-nav */
  box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.2);
  padding: 2rem;
}

.mega-menu-section.active {
  visibility: visible; /* Visible when active */
  opacity: 1; /* Fully opaque when active */
  pointer-events: auto; /* Allows interaction when visible */
  transform: translateY(0); /* Final position */
}

.mega-menu-content {
  max-width: 1260px;
  padding: 0.25rem 1rem;
  margin: 0 auto;
}

/* Utility classes for 1 to 5 columns with a 20px gap */
.mega-1 {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 0.5rem;
}

.mega-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.mega-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.mega-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.mega-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

/* Media query for screens wider than 992px */
@media (max-width: 992px) {
  .mega-2,
  .mega-3,
  .mega-4,
  .mega-5 {
    grid-template-columns: repeat(2, 1fr);
    /* gap remains 20px */
  }
}

/* Media query for screens wider than 576px */
@media (max-width: 576px) {
  .mega-1,
  .mega-2,
  .mega-3,
  .mega-4,
  .mega-5 {
    grid-template-columns: 1fr;
    /* gap remains 20px */
  }
}

.close-button {
  position: absolute;
  top: 1rem;
  right: 2rem;
  padding-top: 5px;
  cursor: pointer;
  background-color: var(--clr-accent-900);
  color: #fff;
  border: 1px solid #ffffff;
  border-radius: 5px;
  width: 2.5rem; /* Adjust the size as needed */
  height: 2rem; /* Adjust the size as needed */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem; /* Adjust the font size if necessary */
  font-weight: bold;
}

@media (max-width: 1140px) {
  .nav-links {
    display: none;
  }

  .hamburger-icon {
    display: block;
  }

  .toggle-label {
    font-size: 0.5rem !important;
  }
}

/* Styles for mobile navigation links */
.mobile-nav a {
  display: block; /* Stack links vertically */
  color: white; /* Text color */
  padding: 1rem 4rem 1rem 2rem; /* Spacing for each link with 4rem left padding */
  text-decoration: none; /* No underlines */
  text-align: left; /* Align text to the left */
  font-family: var(--ff-secondary); /* Custom font family */
  font-weight: var(--fw-semi-bold); /* Semi-bold font weight */
  font-style: italic;
  border-bottom: 1px solid var(--clr-accent-400); /* Divider line */
}

/* Remove border from the last link */
.mobile-nav a:last-child {
  border-bottom: none;
}

/* Hover effect for links */
.mobile-nav a:hover {
  background-color: var(--clr-accent-400); /* Background color on hover */
  transition: background-color 0.3s; /* Transition effect for background color */
  color: var(--clr-neutral-100);
}

/* Styles for social icons */
.mobile-nav .social-icons {
  display: flex;
  justify-content: center;
  padding-top: 1rem; /* Extra space above the social icons */
}

.mobile-nav .social-icon {
  margin: 0 0.5rem; /* Space between icons */
}

/*Set up mega menu link styles*/
.link-container {
  display: flex; /* Use flexbox to align items horizontally */
  align-items: center; /* Vertically center the content */
  justify-content: flex-start; /* Left-justify the content */
  gap: 0.5rem;
  border: 1.5px solid var(--clr-neutral-100);
  padding: 0.5rem 1rem;
  /*transition: transform 0.2s ease-in;*/
}

.link-container:hover {
  /*transform: translateY(-0.25rem);*/
}

.link-icon {
  color: var(--clr-neutral-100);
  width: 3rem;
  height: 3rem;
}

.link-text {
  font-family: var(--ff-secondary);
  font-weight: var(--fw-semi-bold);
  color: var(--clr-neutral-100);
  line-height: 1.25;
  font-style: italic;
}

.mega-menu-content a,
.mega-menu-content a:hover {
  text-decoration: none;
}

.link-container.active {
  border-left: 1rem solid var(--clr-accent-900);
  border-top: 1.5px solid var(--clr-accent-900);
  border-bottom: 1.5px solid var(--clr-accent-900);
  border-right: 1.5px solid var(--clr-accent-900);
}

/* Section Color Styles */
.section-style-1 {
  background-color: var(--clr-accent-400);
}

.section-style-1 .link-container {
  background-color: var(--clr-accent-400);
  transition: background-color 0.3s ease-out;
}

.section-style-1 .link-container:hover {
  background-color: var(--clr-accent-500);
}

.section-style-1 .link-container.active {
  background-color: var(--clr-neutral-900);
}

.vertical-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
