/* ── NAV ────────────────────────────────────────────────────────── */
nav {
  position: fixed; inset: 0 0 auto;
  z-index: 200;
  display: flex; align-items: center; justify-content: space-between;
  padding: 32px 56px;
  transition: padding .35s ease, background .35s ease, border-color .35s ease;
  border-bottom: 1px solid transparent;
  background-color: var(--cream);;
}
nav.scrolled {
  padding: 16px 56px;
  background: rgba(247,244,239,0.95);
  backdrop-filter: blur(20px);
  border-bottom-color: var(--line);
}
.nav-logo {
  font-family: var(--f-serif);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: 8px;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  line-height: 1;
}
.nav-links { display: flex; gap: 36px; list-style: none; }
.nav-links a {
  font-size: 11px; font-weight: 400;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--warm); text-decoration: none;
  transition: color .2s;
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute; left: 0; bottom: -3px;
  width: 0; height: 1px;
  background: var(--gold);
  transition: width .25s;
}
.nav-links a:hover { color: var(--gold); }
.nav-links a:hover::after { width: 100%; }
.nav-cta {
  font-size: 10px; font-weight: 500;
  letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--white); background: var(--charcoal);
  padding: 12px 28px; text-decoration: none;
  border: 1px solid var(--charcoal);
  transition: background .2s, color .2s;
}
.nav-cta:hover { background: var(--gold); border-color: var(--gold); }
/* ── DESKTOP SUBMENU STYLES ──────────────────────────────────── */
/* ── FIXED DESKTOP SUBMENU STYLES ──────────────────────────────────── */

.nav-links > li.has-submenu {
  position: relative;
  display: flex;
  align-items: center;
  /* Added a tiny bit of padding to the container to help stabilize the hover zone */
  padding-bottom: 15px; 
  margin-bottom: -20px;
}

.submenu {
  position: absolute;
  /* Pushes the menu down safely below the main navbar text line */
  top: 100%; 
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #ffffff;
  border: 1px solid var(--line, rgba(0,0,0,0.05));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 16px 0; 
  list-style: none; 
  min-width: 240px;
  opacity: 0; 
  visibility: hidden;
  transition: opacity .3s ease, transform .3s ease, visibility .3s;
  z-index: 210;
}

/* ⚡️ THE HOVER BRIDGE FIX ⚡️ */
/* This creates an invisible hit-box between the link and the dropdown */
.submenu::before {
  content: '';
  position: absolute;
  top: -25px; /* Stretches upwards to cover the blank air gap */
  left: 0;
  width: 100%;
  height: 25px;
  background: transparent; /* Invisible to the eye, but active for the mouse */
}

/* Trigger the visibility smoothly when hovering the parent li */
.nav-links > li.has-submenu:hover .submenu {
  opacity: 1; 
  visibility: visible; 
}

.submenu li a {
  display: block; 
  padding: 10px 24px; 
  font-size: 11px;
  font-weight: 400; 
  letter-spacing: 1.5px; 
  text-transform: uppercase;
  color: var(--warm); 
  text-decoration: none; 
  transition: background .2s, color .2s;
}

.submenu li a:hover { 
  background: rgba(247,244,239,0.5); 
  color: var(--ink); 
}

.submenu li a::after { 
  display: none; 
}
/* ── NEW: HAMBURGER BUTTON (HIDDEN ON DESKTOP) ────────────────── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px; height: 18px;
  background: transparent; border: none; cursor: pointer;
  padding: 0; z-index: 210;
}
.nav-toggle span {
  width: 100%; height: 2px;
  background-color: var(--ink, #000);
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s;
  z-index: 100; /* Sits behind the 200+ z-index nav bar */
}

/* Reveal the blur overlay when mobile menu is active */
nav.active ~ .nav-overlay {
  opacity: 1;
  visibility: visible;
}
@media (max-width: 1100px){
     nav, nav.scrolled { padding-left: 32px; padding-right: 32px; }
}
/* ── RESPONSIVE MOBILE STYLES (UNDER 768px) ─────────────────── */
@media (max-width: 768px) {
  nav {
    padding: 16px 24px;
    flex-wrap: wrap;
    position: fixed;
    top: 0; left: 0; right: 0;
  }
  
  nav.scrolled {
    padding: 12px 24px;
  }

  .nav-toggle { 
    display: flex; 
    order: 2; 
  }
  
  .nav-cta { 
    display: none; /* Hiding to save space on small viewports */
  }

  nav.active {
    background: rgba(247,244,239,1) !important;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%; left: 0; width: 100%;
    background: rgba(247,244,239,1); /* Solid on mobile for readability */
    border-top: 1px solid var(--line, rgba(0,0,0,0.05));
    border-bottom: 1px solid var(--line, rgba(0,0,0,0.05));
    padding: 24px;
    box-sizing: border-box;
    flex-direction: column; gap: 0;
    max-height: 80vh; /* Prevents overflow clipping on small screens */
    overflow-y: auto;
  }

  nav.active .nav-links {
    display: flex;
  }
  /* Reveal drawer */
  nav.active .nav-links {
    display: flex;
  }

  /* Hamburger to X transitions */
  nav.active .nav-toggle span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  nav.active .nav-toggle span:nth-child(2) { opacity: 0; }
  nav.active .nav-toggle span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

  /* Main List Items alignment fix */
  .nav-links > li { 
    width: 100%; 
    padding: 14px 0;
    box-sizing: border-box;
  }
  
  .nav-links > li > a { 
    font-size: 13px; 
    display: inline-block;
    color: var(--ink);
  }

  /* Setting up the alignment row for Services + Arrow */
  .nav-links > li.has-submenu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin: 0;
  }
  
  /* Arrow icon positioning */
  .submenu-arrow {
    display: inline-block;
    width: 32px; 
    height: 32px;
    position: relative; 
    cursor: pointer;
  }
  
  .submenu-arrow::before {
    content: ''; 
    position: absolute; 
    top: 12px; 
    right: 8px;
    width: 6px; 
    height: 6px;
    border-right: 1.5px solid var(--warm, #000); 
    border-bottom: 1.5px solid var(--warm, #000);
    transform: rotate(45deg); 
    transition: transform 0.3s;
  }

  /* FIXED: Submenu Accordion Container */
  .submenu {
    position: static; 
    transform: none; 
    box-shadow: none; 
    border: none;
    background: transparent; 
    width: 100%; /* Spans full width of the parent layout */
    padding: 8px 0 0 0; /* Keeps it flush to the left alignment */
    margin: 0;
    display: none; /* Controlled via JS toggle */
    opacity: 1; 
    visibility: visible;
  }

  /* Show submenu when parent li gets the .open class */
  .nav-links li.has-submenu.open .submenu { 
    display: block; 
  }
  
  /* Flips the arrow around when menu opens */
  .nav-links li.has-submenu.open .submenu-arrow::before { 
    transform: rotate(-135deg); 
  }

  /* FIXED: Submenu links alignment and wrapping fixes */
  .submenu li {
    width: 100%;
    padding: 8px 0;
  }

  .submenu li a {
    display: block; 
    padding: 4px 0; 
    font-size: 11px;
    font-weight: 400; 
    letter-spacing: 1.5px; 
    text-transform: uppercase;
    color: var(--warm); 
    text-decoration: none;
    white-space: normal; /* Allows long text like 'Corporate Communications' to break nicely */
    line-height: 1.4;
  }
}