/* Fixed top navbar, desktop dropdowns and the mobile slide-in menu */

.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  min-height: var(--nav-height);
  padding: 1rem 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 1000;
  border-bottom: 3px solid var(--color-gold);
  transition: background 0.3s ease, box-shadow 0.3s ease, min-height 0.3s ease, padding 0.3s ease;
}

.navbar.scrolled {
  min-height: 68px;
  padding-block: 0.6rem;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 6px 24px rgba(11, 19, 43, 0.08);
}

.nav-brand {
  flex-shrink: 0;
}

.nav-brand img {
  height: 48px;
  width: auto;
  display: block;
  border-radius: 6px;
  transition: height 0.3s ease;
}

.navbar.scrolled .nav-brand img {
  height: 42px;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-links li {
  position: relative;
}

.nav-links li a {
  white-space: nowrap;
  text-decoration: none;
  color: var(--color-dark-navy);
  font-weight: 600;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.3s ease;
  position: relative;
}

.nav-links > li > a .nav-text {
  position: relative;
  display: inline-block;
}

.nav-links > li > a .nav-text::after {
  content: '';
  position: absolute;
  width: 0;
  height: 3px;
  bottom: -5px;
  left: 0;
  border-radius: 2px;
  background-color: var(--color-gold);
  transition: width 0.3s ease;
}

.nav-links > li > a:hover,
.nav-links > li.current-menu-item > a,
.nav-links > li.current_page_item > a,
.nav-links > li.current-menu-ancestor > a,
.nav-links > li.current_page_ancestor > a {
  color: var(--color-red);
}

.nav-links > li > a:hover .nav-text::after,
.nav-links > li.current-menu-item > a .nav-text::after,
.nav-links > li.current_page_item > a .nav-text::after,
.nav-links > li.current-menu-ancestor > a .nav-text::after,
.nav-links > li.current_page_ancestor > a .nav-text::after {
  width: 100%;
}

/* Desktop dropdown */
.nav-links .sub-menu {
  position: absolute;
  top: calc(100% + 15px);
  left: 50%;
  transform: translateX(-50%) translateY(10px) scale(0.95);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  width: 240px;
  max-width: calc(100vw - 2rem);
  min-width: 180px;
  list-style: none;
  padding: 0.6rem;
  box-shadow: 0 20px 40px rgba(11, 19, 43, 0.1), 0 1px 3px rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  opacity: 0;
  visibility: hidden;
  transition: all 0.35s var(--ease-out);
  z-index: 1000;
}

/* Invisible bridge so the menu doesn't close while moving the mouse down */
.nav-links .sub-menu::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -20px;
  height: 20px;
}

.nav-links li:hover > .sub-menu,
.nav-links li:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  top: calc(100% + 10px);
  transform: translateX(-50%) translateY(0) scale(1);
}

.nav-links .sub-menu li {
  margin: 0;
  width: 100%;
}

.nav-links .sub-menu li a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  white-space: nowrap;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  text-transform: none;
  font-weight: 500;
  color: var(--color-text-dark);
  border-radius: var(--radius-sm);
  transition: background-color 0.2s ease, color 0.2s ease, padding 0.2s ease;
  width: 100%;
}

.nav-links .sub-menu li a::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--color-gold);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.nav-links .sub-menu li a:hover,
.nav-links .sub-menu li.current-menu-item > a {
  background: rgba(28, 37, 65, 0.05);
  color: var(--color-navy);
  padding-left: 1.25rem;
}

.nav-links .sub-menu li a:hover::before,
.nav-links .sub-menu li.current-menu-item > a::before {
  opacity: 1;
  transform: scale(1);
}

/* On desktop the panel wrapper is invisible and the menu sits in the bar */
.nav-panel {
  display: contents;
}

.nav-panel-footer,
.nav-backdrop {
  display: none;
}

/* Burger (mobile only) */
.burger {
  display: none;
  padding: 6px;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.burger span {
  display: block;
  width: 25px;
  height: 3px;
  border-radius: 2px;
  background-color: var(--color-dark-navy);
  margin: 5px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Medium screens: tighter bar so all items fit on one line */
@media screen and (min-width: 1025px) and (max-width: 1279px) {
  .nav-links {
    gap: 1.25rem;
  }

  .nav-links > li > a {
    font-size: 0.88rem;
    letter-spacing: 0.3px;
  }
}

/* Mobile and tablet: burger with slide-in panel (the bar has too many items below 1025px) */
@media screen and (max-width: 1024px) {
  :root {
    --nav-height: 72px;
  }

  .navbar {
    padding-block: 0.75rem;
  }

  .nav-brand img,
  .navbar.scrolled .nav-brand img {
    height: 40px;
  }

  /* Slide-in panel below the bar */
  .nav-panel {
    display: flex;
    flex-direction: column;
    position: absolute;
    right: 0;
    top: calc(100% + 3px); /* below the gold border */
    height: calc(100vh - 100%);
    height: calc(100dvh - 100% - 3px);
    width: min(85%, 400px);
    padding: 1rem 1.75rem 2rem;
    background: var(--color-white);
    box-shadow: -10px 0 30px rgba(11, 19, 43, 0.12);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.4s var(--ease-out), visibility 0s linear 0.4s;
  }

  .nav-panel:focus {
    outline: none;
  }

  .nav-open .nav-panel {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.4s var(--ease-out), visibility 0s;
  }

  /* Dimmed page behind the panel; tapping it closes the menu */
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 999; /* just below the navbar */
    background: rgba(11, 19, 43, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
  }

  .nav-open .nav-backdrop {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s;
  }

  /* No scrolling of the page while the menu is open */
  html:has(body.nav-open),
  body.nav-open {
    overflow: hidden;
  }

  .nav-links {
    flex-direction: column;
    gap: 0;
  }

  .nav-links > li {
    border-bottom: 1px solid var(--color-border);
  }

  .nav-links > li > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 56px;
    padding: 0.75rem 0;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 1px;
  }

  /* Current page: red text with a gold bar on the left instead of the underline */
  .nav-links > li > a .nav-text::after {
    display: none;
  }

  .nav-links > li.current-menu-item > a,
  .nav-links > li.current_page_item > a {
    box-shadow: inset 4px 0 0 var(--color-gold);
    padding-left: 0.9rem;
  }

  /* Chevron of parent items, turns down when the submenu is open */
  .nav-links > li.menu-item-has-children > a::after {
    content: '';
    flex-shrink: 0;
    width: 9px;
    height: 9px;
    margin-right: 6px;
    border-top: 2px solid var(--color-gold-text);
    border-right: 2px solid var(--color-gold-text);
    transform: rotate(45deg);
    transition: transform 0.25s var(--ease-out);
  }

  .nav-links > li.is-open > a::after {
    transform: translateY(-3px) rotate(135deg);
  }

  /* Accordion submenus */
  .nav-links .sub-menu {
    position: static;
    display: none;
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
    padding: 0 0 0.75rem;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
  }

  .nav-links li:hover > .sub-menu,
  .nav-links li:focus-within > .sub-menu {
    transform: none;
  }

  .nav-links .sub-menu::before {
    display: none;
  }

  .nav-links > li.is-open > .sub-menu {
    display: block;
    animation: navSubmenuIn 0.25s var(--ease-out);
  }

  .nav-links .sub-menu li a {
    min-height: 46px;
    padding: 0.6rem 0.75rem;
    font-size: 1rem;
    white-space: normal;
  }

  .nav-links .sub-menu li a::before {
    opacity: 1;
    transform: scale(1);
    background: rgba(11, 19, 43, 0.2);
  }

  .nav-links .sub-menu li a:hover {
    padding-left: 0.75rem;
  }

  .nav-links .sub-menu li.current-menu-item > a {
    padding-left: 0.75rem;
    color: var(--color-red);
    font-weight: 600;
  }

  .nav-links .sub-menu li.current-menu-item > a::before {
    background: var(--color-gold);
  }

  /* Contact and social links at the bottom of the panel */
  .nav-panel-footer {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-top: auto;
    padding-top: 2.5rem;
  }

  .nav-panel-mail {
    color: var(--color-red);
    font-weight: 600;
    text-decoration: none;
  }

  .nav-panel .social-links {
    margin: 0;
    gap: 0.75rem;
  }

  .nav-panel .social-links a {
    width: 44px;
    height: 44px;
    color: var(--color-navy);
    background: var(--color-bg-light);
    border-color: var(--color-border);
  }

  .nav-panel .social-links a:hover {
    color: var(--color-white);
    background: var(--color-red);
    border-color: var(--color-red);
  }

  .nav-panel .social-links svg {
    width: 20px;
    height: 20px;
  }

  .burger {
    display: block;
  }

  .burger.active .line1 {
    transform: translateY(8px) rotate(45deg);
  }

  .burger.active .line2 {
    opacity: 0;
  }

  .burger.active .line3 {
    transform: translateY(-8px) rotate(-45deg);
  }
}

@keyframes navSubmenuIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
