/* ============================================================
   Site Navigation Bar
   Responsive: horizontal on desktop, hamburger on mobile
   Colour palette matches ggomez.css:
     red   #99121B   blue  #003366   white #ffffff
   ============================================================ */

/* --- Nav bar container ------------------------------------ */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: #ffffff;
}

.nav-container {
  position: relative;            /* needed for ::after absolute positioning */
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 50px;   /* matches .content-wrapper horizontal padding */
  min-height: 50px;
}

/* Line positioned by JS measurement — left/right set as CSS custom properties */
.nav-container::after {
  content: '';
  position: absolute;
  bottom: 0;
  left:  var(--nav-line-left,  50px);
  right: var(--nav-line-right, 60px);
  height: 2px;
  background: #99121B;
}

/* --- Brand / home link ------------------------------------ */
.nav-brand {
  font-family: Trebuchet MS, Helvetica, sans-serif;
  font-size: 0.95em;
  font-weight: bold;
  color: #99121B !important;
  text-decoration: none !important;
  white-space: nowrap;
  padding: 14px 0;   /* match vertical padding of nav-menu items */
  line-height: 1;
}

.nav-brand:hover {
  opacity: 0.75;
  transition: opacity 0.2s ease;
}

/* --- Menu list (horizontal row on desktop) --------------- */
.nav-menu {
  display: flex;
  flex-direction: row;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
  gap: 2px;
}

/* All direct children of nav-menu */
.nav-menu > li {
  position: relative;
}

/* Links and dropdown-toggle buttons in the top-level menu */
.nav-menu > li > a,
.nav-menu > li > .dropdown-toggle {
  display: inline-block;
  padding: 14px 10px;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.82em;
  font-weight: bold !important;  /* bold at rest, like old heading links */
  color: #003366 !important;
  text-decoration: none !important;
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
  opacity: 0.7;                  /* slightly muted at rest */
  transition: opacity 0.2s ease;
}

.nav-menu > li > a:hover,
.nav-menu > li > .dropdown-toggle:hover {
  color: #003366 !important;
  font-weight: bold !important;
  opacity: 1;                    /* fade IN to full on hover */
}

/* Active page indicator */
.nav-menu a[aria-current="page"] {
  color: #99121B !important;
  font-weight: bold;
  border-bottom: 2px solid #99121B;
}

/* --- Dropdown menus --------------------------------------- */
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #ffffff;
  border: 1px solid #cccccc;
  border-top: 2px solid #99121B;
  min-width: 210px;
  list-style: none;
  padding: 6px 0;
  margin: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  z-index: 201;
}

/* Show on desktop hover (pointer devices only) */
@media (hover: hover) {
  .has-dropdown:hover > .dropdown-menu {
    display: block;
  }
}

/* Show via JS-added .open class (click / keyboard / mobile) */
.has-dropdown.open > .dropdown-menu {
  display: block;
}

.dropdown-menu li {
  display: block;
  margin: 0;          /* reset ggomez-projects.css: li { margin: ...30px } */
}

.dropdown-menu li a {
  display: block;
  padding: 8px 10px;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.82em;
  font-weight: normal;
  color: #003366 !important;
  text-decoration: none !important;
  opacity: 0.75;
  transition: opacity 0.2s ease, background 0.15s ease;
}

.dropdown-menu li a:hover {
  color: #003366 !important;
  font-weight: normal;
  opacity: 1;                    /* fade IN on hover */
  background: #f7f7f7;
}

/* --- Hamburger button (hidden on desktop) ----------------- */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-self: center;   /* override baseline alignment — no text in button */
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px 0;
  min-height: 0 !important;
}

.hamburger-bar {
  display: block;
  width: 24px;
  height: 2px;
  background: #99121B;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Animate hamburger → X when menu is open */
.nav-toggle[aria-expanded="true"] .hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .hamburger-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .hamburger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
   Mobile styles  (≤ 767px)
   ============================================================ */
@media screen and (max-width: 767px) {
  .nav-container {
    padding: 0 15px;   /* matches .content-wrapper mobile padding */
    flex-wrap: wrap;
  }


  /* Show hamburger */
  .nav-toggle {
    display: flex;
  }

  /* Menu collapses; shown by JS .open class */
  .nav-menu {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    padding: 4px 0 10px;
    gap: 0;
    border-top: 1px solid #eeeeee;
    margin-top: 4px;
  }

  .nav-menu.open {
    display: flex;
  }

  /* Full-width tap targets */
  .nav-menu > li > a,
  .nav-menu > li > .dropdown-toggle {
    display: block;
    width: 100%;
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #eeeeee;
    box-sizing: border-box;
  }

  /* Mobile dropdowns: static, no shadow */
  .dropdown-menu {
    position: static;
    border: none;
    border-top: none;
    box-shadow: none;
    background: #f9f9f9;
    min-width: 0;
    padding: 0;
  }

  /* Disable CSS hover on mobile (only JS .open class works) */
  .has-dropdown:hover > .dropdown-menu {
    display: none;
  }
  .has-dropdown.open > .dropdown-menu {
    display: block;
  }

  .dropdown-menu li a {
    padding: 11px 10px;
    border-bottom: 1px solid #eeeeee;
  }
}
