/* nav-menu.css — task-oriented navigation: desktop dropdowns + mobile groups.
 *
 * WHY A SHARED FILE
 *   Every page carries its own inline <style> block, so the nav's base styles
 *   are duplicated ~114 times already (CLAUDE.md known quirk #6). The dropdown
 *   layer is new, so it starts shared rather than adding another 150 lines to
 *   every page. Loads AFTER the inline block and BEFORE site-responsive.css,
 *   so page CSS sets the baseline, this adds the dropdown, and the responsive
 *   sheet still has the last word.
 *
 * The palette is the existing one: --ivory/--cream/--charcoal/--warm-grey, and
 * the hero pink #E8C9C1 for hover, which is hard-coded site-wide rather than
 * stored in a variable (see CLAUDE.md "Design System").
 */

/* ── Top-level item ──────────────────────────────────────────────────── */

.nav-links > li.nav-has-menu { position: relative; }

/* The trigger is a real <button>: it opens a menu, it does not navigate.
   Matching .nav-links a exactly keeps the row visually unchanged. */
.nav-menu-btn {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--charcoal);
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: inherit;
  /* "Tools & Guides" is wide enough to wrap to three lines inside the flex
     row, which pushes the whole bar out of alignment. */
  white-space: nowrap;
  transition: var(--transition);
}

.nav-menu-btn:hover,
.nav-menu-btn[aria-expanded="true"] { color: #E8C9C1; }

/* Caret. Inherits currentColor so it tracks the text in both nav modes. */
.nav-menu-btn::after {
  content: "";
  width: 4px;
  height: 4px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.25s ease;
  opacity: 0.7;
}
.nav-menu-btn[aria-expanded="true"]::after {
  transform: rotate(-135deg) translateY(-1px);
}

/* ── The panel ───────────────────────────────────────────────────────── */

.nav-menu {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 232px;
  background: var(--ivory);
  border: 1px solid var(--cream);
  /* One soft shadow, not a card stack — the brief asks for restraint. */
  box-shadow: 0 10px 34px rgba(28, 28, 28, 0.09);
  padding: 10px 0;
  margin: 0;
  list-style: none;
  z-index: 1001;
  /* Hidden via [hidden] rather than opacity, so it is out of the a11y tree
     and out of the tab order when closed. */
}

.nav-menu[hidden] { display: none; }

/* A hit area bridging the 14px gap, so the pointer can travel from the
   trigger to the panel without the menu closing underneath it. */
.nav-links > li.nav-has-menu::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 16px;
  display: none;
}
.nav-links > li.nav-has-menu.is-open::after { display: block; }

.nav-menu a {
  display: block;
  padding: 9px 22px;
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: none;
  font-weight: 400;
  color: var(--text);
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

/* Hover is pink ground + charcoal text, the site-wide hover treatment. */
.nav-menu a:hover,
.nav-menu a:focus-visible {
  background: #E8C9C1;
  color: var(--charcoal);
}

/* Current page, named for screen readers too via aria-current. */
.nav-menu a[aria-current="page"] {
  color: var(--charcoal);
  font-weight: 500;
}

.nav-menu .nav-menu-sep {
  height: 1px;
  margin: 8px 16px;
  background: var(--cream);
}

/* ── Focus states ────────────────────────────────────────────────────── */

/* Visible, and on the pink so it reads on both the ivory panel and the
   dark hero. :focus-visible keeps it off mouse clicks. */
.nav-menu-btn:focus-visible,
.nav-menu a:focus-visible,
.nav-phone:focus-visible,
.mobile-menu a:focus-visible,
.mobile-menu-group-btn:focus-visible {
  outline: 2px solid #E8C9C1;
  outline-offset: 3px;
  border-radius: 1px;
}

/* ── The office phone link ───────────────────────────────────────────── */

/* The left group is right-aligned against the logo (justify-content:flex-end),
   so the auto margin on this first item pushes it to the far edge and leaves
   the rest packed by the logo. That mirrors .nav-cta-btn's own margin-left:auto
   on the other side: number at one edge, button at the other. */
.nav-links-left > li.nav-phone-li { margin-right: auto; }

.nav-phone {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.12em;
  font-weight: 400;
  /* Deliberately quieter than .nav-cta-btn: no border, no fill, one weight
     down. FREE EVALUATION stays the only button in the header. */
  color: var(--charcoal);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: var(--transition);
}
.nav-phone:hover { color: #E8C9C1; }
.nav-phone svg { width: 13px; height: 13px; flex: none; opacity: 0.75; }
.nav-phone .nav-phone-word { letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.75; }

/* ── The calculator icon ─────────────────────────────────────────────── */

/* Counterpart to .nav-heart (client-auth.css) on the other side of the logo.
   Deliberately NOT sharing that selector: the heart carries a rose fill and a
   badge, and this is an outline glyph with neither. Same box and same 16px
   mark, so the two balance as a pair. */
.nav-calc {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  vertical-align: middle;
  color: var(--charcoal);
  transition: var(--transition);
}
/* 17px, a hair over the heart's 16. The calculator's artwork is an upright
   rectangle inset inside its viewBox, so at a matched 16 it reads visually
   smaller than the heart, which fills its box corner to corner. */
.nav-calc svg { width: 17px; height: 17px; display: block; }
.nav-calc:hover { color: #E8C9C1; }

/* ── Over the hero ───────────────────────────────────────────────────── */

/* The homepage nav sits on the hero video until scrolled. The page's own CSS
   turns its links ivory with a text-shadow; the new trigger needs the same
   treatment or it vanishes against the footage. */
nav#mainNav.over-video .nav-menu-btn {
  color: var(--ivory) !important;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.25);
}
nav#mainNav.over-video .nav-menu-btn:hover,
nav#mainNav.over-video .nav-menu-btn[aria-expanded="true"] { color: #E8C9C1 !important; }

/* The calculator is an outline glyph in currentColor, so over the footage it
   needs the same treatment as the links or it is a charcoal shape on a dark
   video. (The heart beside it does not, because its rose fill carries it.) */
nav#mainNav.over-video .nav-calc { color: var(--ivory) !important; }
nav#mainNav.over-video .nav-calc:hover { color: #E8C9C1 !important; }

/* The links beside these icons stay readable over the footage because of
   `text-shadow: 0 1px 12px rgba(0,0,0,0.25)` on the nav. text-shadow does
   nothing to SVG strokes, so over a bright, busy frame -- the sunlit foliage
   in the hero -- both glyphs washed out while the words around them held.
   drop-shadow is the filter equivalent and follows the drawn shape, not the
   element box. Pitched darker than the text's because a 1.7px stroke has far
   less mass to carry the contrast than a letterform does. */
nav#mainNav.over-video .nav-calc svg,
nav#mainNav.over-video .nav-heart svg {
  filter: drop-shadow(0 1px 6px rgba(0, 0, 0, 0.55));
}

/* The office number is held back until the hero scroll has finished.
 *
 * index.html toggles .over-video off the moment the hero's bottom passes 90px
 * from the top of the window, which is precisely "the hero is done" -- so
 * that class is the signal, rather than a scroll distance guessed here that
 * would drift if the hero's height ever changed.
 *
 * visibility, not display: the link keeps its place in the row, so nothing
 * shifts sideways when it appears. visibility also takes it out of the tab
 * order and the accessibility tree while hidden, which display:none would do
 * but opacity alone would not -- an invisible link that still catches focus
 * is worse than one that waits its turn.
 *
 * Interior pages never carry .over-video, so the number is present there from
 * the first paint.
 */
nav#mainNav.over-video .nav-phone {
  opacity: 0;
  visibility: hidden;
}

/* The panel itself is always the solid ivory card — never translucent over
   the video, or the links inside it stop being readable. */

/* ── Mobile menu groups ──────────────────────────────────────────────── */

/* The drawer is a column flexbox with align-items:flex-start, so a child
   shrinks to its own content width unless it stretches. Without this the
   group rows and their separators are only as wide as the word "Buy". */
.mobile-menu-group,
.mobile-menu .mobile-menu-call {
  align-self: stretch;
  width: 100%;
}

/* ── Drawer type scale ──────────────────────────────────────────────
   Two levels, and only two. A top-level link (Home, Contact, Search Homes)
   sits in the same column as a group button (Buy, Sell, Homes…) and is the
   same rank, so it is typed the same way: 13px, 0.16em, weight 400. The
   links inside a group are the second level: 14px, sentence case, indented,
   on a faint tint.

   Set here rather than in a page's own CSS or in site-responsive.css because
   this is the one stylesheet every page with a drawer loads, /custom-search
   included — and because weight was being inherited from the page, which on
   /custom-search meant 300 against everyone else's 400. The id raises
   specificity above site-responsive.css, which loads after this file. */
#mobileMenu > a:not(.mobile-menu-cta):not(.mobile-menu-call),
#mobileMenu .mobile-menu-group-btn {
  font-family: var(--font-sans);
  font-size: 13px;
  letter-spacing: 0.16em;
  font-weight: 400;
  text-transform: uppercase;
}
#mobileMenu .mobile-menu-cta {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.2em;
  font-weight: 400;
}

.mobile-menu-group { border-bottom: 1px solid rgba(28, 28, 28, 0.07); }

.mobile-menu-group-btn {
  width: 100%;
  /* 44px minimum touch target. */
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 28px;
  background: none;
  border: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--charcoal);
  cursor: pointer;
  text-align: left;
}

.mobile-menu-group-btn::after {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.25s ease;
  opacity: 0.55;
}
.mobile-menu-group-btn[aria-expanded="true"]::after { transform: rotate(-135deg); }

.mobile-menu-sub { background: rgba(28, 28, 28, 0.025); }
.mobile-menu-sub[hidden] { display: none; }

#mobileMenu .mobile-menu-sub a {
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 10px 28px 10px 42px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  /* Stated here, not left to the page: /custom-search does not carry the
     site's blanket `a { text-decoration: none }`, so these came through
     underlined there while every other page showed them plain. */
  text-decoration: none;
  color: var(--text);
}

/* Call the office — a labelled block, not a fourth button in a sticky bar.
 *
 * site-responsive.css loads after this file and carries
 *     .mobile-menu a:not(.mobile-menu-cta) { display:flex !important; ... }
 * at the same specificity as `.mobile-menu a.mobile-menu-call`, so source
 * order would win and the label and number would share one line with the
 * digits wrapping. Two consequences:
 *   1. The id raises specificity past it honestly, rather than by repeating
 *      a class to game the cascade.
 *   2. The block stays a flex container and simply runs down the column,
 *      which is less brittle than trying to force it back to display:block
 *      against an !important.
 */
#mobileMenu a.mobile-menu-call {
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: center !important;
  gap: 0 !important;
  min-height: 48px;
  padding: 16px 28px !important;
}
.mobile-menu-call .mmc-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--warm-grey);
  margin-bottom: 4px;
}
.mobile-menu-call .mmc-number {
  display: block;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--charcoal);
}

/* ── Motion ──────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .nav-menu-btn::after,
  .mobile-menu-group-btn::after,
  .nav-menu a,
  .nav-phone { transition: none; }
}
