/* ---------- NAV ---------- */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 1.1rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(247, 244, 239, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
nav .logo {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
nav > ul {
  display: flex;
  list-style: none;
  gap: 2rem;
  font-size: 0.9rem;
  font-weight: 500;
  align-items: center;
  margin: 0;
  padding: 0;
}
nav > ul > li { position: relative; display: inline-flex; align-items: center; }
nav > ul > li > a {
  color: var(--navy);
  text-decoration: none;
  transition: color 0.3s;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0;
  display: inline-flex;
  align-items: center;
}
nav > ul > li > a:hover { color: var(--crimson); }
nav > ul > li > a.active { color: var(--crimson); }

/* --- Chevron toggle button (separate from link) --- */
.chevron-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  margin-left: 2px;
  color: var(--navy);
  transition: color 0.3s;
  position: relative;
}
.chevron-btn:hover { color: var(--crimson); }
.chevron-btn .chevron {
  display: inline-block;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.3s;
}
nav > ul > li.dropdown-open > .chevron-btn .chevron { transform: rotate(180deg); }

/* --- Dropdown panel --- */
.dropdown {
  position: absolute;
  top: calc(100% + 0.75rem);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  min-width: 240px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(11, 37, 69, 0.12);
  padding: 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s, transform 0.25s;
  list-style: none;
  margin: 0;
}
/* Open via click */
nav > ul > li.dropdown-open > .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.dropdown li { position: relative; list-style: none; }
.dropdown li a,
.dropdown li .sub-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.3rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--navy);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  width: 100%;
}
.dropdown li a:hover,
.dropdown li .sub-toggle:hover {
  background: rgba(215, 38, 61, 0.06);
  color: var(--crimson);
}
.sub-toggle .chevron-right {
  display: inline-block;
  width: 0; height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid currentColor;
  margin-left: 0.6rem;
  transition: transform 0.3s;
}

/* --- Sub-dropdown (Blogs) --- */
.sub-dropdown {
  position: absolute;
  top: -0.5rem;
  left: 100%;
  min-width: 280px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(11, 37, 69, 0.12);
  padding: 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s, transform 0.25s;
  transform: translateX(6px);
  list-style: none;
  margin: 0;
}
.dropdown li:hover > .sub-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}
.sub-dropdown li a {
  padding: 0.55rem 1.3rem;
  font-size: 0.85rem;
}

/* --- Hamburger --- */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  width: 36px;
  height: 36px;
  z-index: 110;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--navy);
  border-radius: 2px;
  transition: all 0.3s;
  flex-shrink: 0;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

nav .cta {
  padding: 0.65rem 1.3rem;
  background: var(--crimson);
  color: var(--ivory);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
nav .cta:hover { background: var(--crimson-deep); transform: translateY(-1px); }
nav .cta::after { content: '\2192'; transition: transform 0.3s; }
nav .cta:hover::after { transform: translateX(3px); }

/* ---------- MOBILE NAV (≤900px) ---------- */
@media (max-width: 900px) {
  nav {
    padding: 0.9rem 1.2rem;
  }

  /* Hide the CTA button */
  nav .cta { display: none; }

  /* Show hamburger, pin to the right */
  .hamburger {
    display: flex;
    margin-left: auto;
  }

  /* Mobile menu panel - fits content, not full screen */
  nav > ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: #f7f4ef;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 1rem 1.5rem 1.5rem;
    gap: 0;
    z-index: 9999;
    max-height: 80vh;
    overflow-y: auto;
    font-size: 1rem;
    border-bottom: 1px solid rgba(11, 37, 69, 0.14);
    box-shadow: 0 12px 40px rgba(11, 37, 69, 0.1);
  }
  nav > ul.open { display: flex; }

  /* Each nav item full width */
  nav > ul > li {
    width: 100%;
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }
  nav > ul > li > a {
    padding: 1rem 0;
    flex: 1;
    font-size: 1rem;
    color: #0b2545;
  }

  /* Chevron button in mobile */
  .chevron-btn {
    padding: 1rem 0.75rem;
    margin-left: auto;
    color: #0b2545;
  }
  .chevron-btn .chevron {
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
  }

  /* Dropdown: hidden by default, expands inline on click */
  .dropdown {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    box-shadow: none;
    border: none;
    border-radius: 0;
    min-width: 0;
    width: 100%;
    padding: 0 0 0.75rem 1rem;
    display: none;
    background: transparent;
    margin: 0;
  }
  nav > ul > li.dropdown-open > .dropdown {
    display: block;
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    box-shadow: none;
    border: none;
    border-radius: 0;
    min-width: 0;
    width: 100%;
    background: transparent;
  }

  /* Dropdown list items - hardcoded colors for reliability */
  .dropdown li a,
  .dropdown li .sub-toggle {
    padding: 0.65rem 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: #0b2545;
    white-space: normal;
    border-radius: 6px;
  }
  .dropdown li a:hover,
  .dropdown li .sub-toggle:hover {
    background: rgba(215, 38, 61, 0.06);
    color: #d7263d;
  }

  /* Sub-dropdown (Blogs): expands inline below */
  .sub-dropdown {
    position: static !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    box-shadow: none;
    border: none;
    border-radius: 0;
    min-width: 0;
    width: 100%;
    padding: 0 0 0.5rem 1rem;
    display: none;
    background: transparent;
    margin: 0;
  }
  .dropdown li.mobile-open > .sub-dropdown {
    display: block;
    position: static !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    box-shadow: none;
    border: none;
    border-radius: 0;
    width: 100%;
    background: transparent;
  }
  .sub-dropdown li a {
    padding: 0.55rem 0.5rem;
    font-size: 0.9rem;
    color: #0b2545;
    white-space: normal;
  }
  .sub-dropdown li a:hover {
    color: #d7263d;
  }
}
