/* ============================================================
   HEADER + NAVIGATION
   Phase 4 — professional header with dropdown menus
   ============================================================ */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--cream);
  border-bottom: 1px solid var(--rule);
  transition: box-shadow 0.2s ease;
}
.header.scrolled {
  box-shadow: 0 2px 12px -6px rgba(31, 57, 73, 0.12);
}
.header .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}
.brand img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name {
  font-family: var(--serif);
  font-size: 22px;
  font-variation-settings: "opsz" 18;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.brand-tag {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mute);
  margin-top: 2px;
}

.nav { display: flex; align-items: center; gap: 28px; }

/* ---------- Primary nav ---------- */
.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
}
.nav-item { position: relative; }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.01em;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  background: none;
  border: none;
  white-space: nowrap;
  transition: color 0.18s ease, background 0.18s ease;
}
.nav-link:hover { color: var(--terracotta-deep); background: var(--cream-deep, #F1ECE3); }
.nav-link[data-current="true"] {
  color: var(--terracotta-deep);
}
.nav-link[data-current="true"]::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 16px;
  right: 16px;
  height: 2px;
  background: var(--terracotta);
  border-radius: 1px;
}
.nav-chevron {
  width: 10px;
  height: 10px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 2px;
}
.nav-item.open .nav-chevron,
.nav-item:hover .nav-chevron { transform: rotate(180deg); }

/* ---------- Dropdown panel ---------- */
.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  min-width: 320px;
  background: var(--cream);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: 0 16px 40px -12px rgba(31, 57, 73, 0.18);
  padding: 12px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 110;
}
.nav-item:hover .nav-dropdown,
.nav-item.open .nav-dropdown,
.nav-item:focus-within .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Hover bridge — closes the gap so dropdown doesn't disappear when crossing */
.nav-item::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 12px;
}

.nav-dropdown.is-wide { min-width: 640px; }
.nav-dropdown.is-wide .nav-dropdown-list {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2px;
}

.nav-dropdown-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-dropdown-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
  transition: background 0.15s ease;
}
.nav-dropdown-item:hover {
  background: var(--cream-deep, #F1ECE3);
}
.nav-dropdown-title {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.nav-dropdown-title svg {
  width: 14px;
  height: 14px;
  color: var(--terracotta);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  flex-shrink: 0;
}
.nav-dropdown-item:hover .nav-dropdown-title svg {
  opacity: 1;
  transform: translateX(0);
}
.nav-dropdown-desc {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--mute);
  line-height: 1.4;
}

/* Two-column dropdown for areas */
.nav-dropdown.is-grid { min-width: 460px; }
.nav-dropdown.is-grid .nav-dropdown-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}

/* Three-column regional dropdown for service areas */
.nav-dropdown.is-regions { min-width: 600px; padding: 16px; }
.nav-regions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
.nav-region {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav-region-heading {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--terracotta-deep);
  padding: 4px 12px 8px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 4px;
}
.nav-region-link {
  display: block;
  padding: 8px 12px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-region-link:hover {
  background: var(--cream-deep, #F1ECE3);
  color: var(--terracotta-deep);
}

.nav-dropdown-divider {
  height: 1px;
  background: var(--rule);
  margin: 8px 4px;
}

.nav-dropdown-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--terracotta-deep);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s ease;
}
.nav-dropdown-footer:hover {
  background: var(--cream-deep, #F1ECE3);
}
.nav-dropdown-footer svg {
  width: 14px;
  height: 14px;
  transition: transform 0.18s ease;
}
.nav-dropdown-footer:hover svg { transform: translateX(3px); }

/* Right-anchored dropdowns when too close to edge */
@media (max-width: 1100px) {
  .nav-item.is-right .nav-dropdown {
    left: auto;
    right: 0;
    transform: translateY(-6px);
  }
  .nav-item.is-right:hover .nav-dropdown,
  .nav-item.is-right.open .nav-dropdown,
  .nav-item.is-right:focus-within .nav-dropdown {
    transform: translateY(0);
  }
}

.nav-cta-row { display: flex; gap: 12px; align-items: center; }

.menu-toggle {
  display: none;
  width: 40px; height: 40px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
}
.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  transition: all 0.3s ease;
}
.menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   MOBILE — drawer with collapsible sections
   ============================================================ */

@media (max-width: 960px) {
  .nav-links {
    display: none;
    position: fixed;
    top: 81px; /* below header */
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--cream);
    flex-direction: column;
    align-items: stretch;
    padding: 16px var(--pad) 36px;
    gap: 0;
    overflow-y: auto;
    border-top: 1px solid var(--rule);
  }
  .header.menu-open .nav-links { display: flex; }
  .menu-toggle { display: flex; }
  .nav-cta-row .btn { display: none; }

  /* Reset desktop dropdown styles */
  .nav-item { width: 100%; }
  .nav-item::after { display: none; }
  .nav-link {
    width: 100%;
    justify-content: space-between;
    padding: 16px 4px;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    font-size: 16px;
    font-weight: 500;
  }
  .nav-link:hover { background: none; }
  .nav-link[data-current="true"]::after { display: none; }

  /* Mobile dropdown — accordion */
  .nav-dropdown {
    position: static;
    min-width: 0;
    box-shadow: none;
    border: none;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    padding: 0 0 12px 16px;
    opacity: 1;
    visibility: hidden;
    transform: none;
    background: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, visibility 0.3s, padding 0.3s ease;
  }
  .nav-item.open .nav-dropdown {
    visibility: visible;
    max-height: 1000px;
    padding: 8px 0 16px 16px;
  }
  .nav-dropdown.is-grid { min-width: 0; }
  .nav-dropdown.is-grid .nav-dropdown-list {
    grid-template-columns: 1fr;
  }
  .nav-dropdown.is-wide { min-width: 0; }
  .nav-dropdown.is-wide .nav-dropdown-list {
    grid-template-columns: 1fr;
  }
  .nav-dropdown.is-regions { min-width: 0; padding: 8px 0 16px 16px; }
  .nav-regions {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .nav-region-heading {
    padding: 4px 12px 6px;
    font-size: 10.5px;
  }

  .nav-dropdown-item {
    padding: 12px 12px;
  }
  .nav-dropdown-desc { display: none; }
  .nav-dropdown-footer { padding: 12px; }

  /* Mobile CTA inside drawer */
  .nav-mobile-cta {
    margin-top: 24px;
    display: block;
  }
  @media (min-width: 961px) {
    .nav-mobile-cta { display: none; }
  }
}

@media (min-width: 961px) {
  .nav-mobile-cta { display: none; }
}
