/* ============================================================
   Shared mobile nav — hamburger drop-down menu + expanding search.
   Loaded AFTER each page's embedded <style>, so its rules win and
   give every page one consistent mobile nav (the per-page blocks
   used to hide .nav-links at varying widths: 640 / 760 / 860).
   The hamburger and close (✕) buttons are injected by nav.js.
   ============================================================ */

/* Keyboard focus: the site had no :focus-visible styles anywhere, so
   keyboard users got browser defaults at best (nothing on styled pills).
   Loaded on every page, so this is the one global focus ring. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #d85a48;
  outline-offset: 2px;
}

/* Respect reduced-motion: stop the homepage ticker marquee and any
   long decorative animations. */
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none !important; }
  * { scroll-behavior: auto !important; }
}

/* Buttons are hidden by default; the media queries below reveal them. */
.nav-burger,
.nav-search-close {
  display: none;
  flex: none;
  position: relative;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  border-radius: 10px;
}
.nav-burger:hover,
.nav-search-close:hover { background: rgba(26, 26, 46, 0.06); }

/* Three-line icon that morphs into an ✕ when the menu is open. */
.nav-burger span {
  position: absolute;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-burger span:nth-child(1) { transform: translateY(-6px); }
.nav-burger span:nth-child(3) { transform: translateY(6px); }
.nav.menu-open .nav-burger span:nth-child(1) { transform: rotate(45deg); }
.nav.menu-open .nav-burger span:nth-child(2) { opacity: 0; }
.nav.menu-open .nav-burger span:nth-child(3) { transform: rotate(-45deg); }

.nav-search-close { font-size: 19px; line-height: 1; }

/* ---- Desktop: inline links, never a hamburger ---- */
/* Breakpoint is 1000px (not 760px): the full inline nav — logo + 5 links +
   280px search — needs ~993px to lay out, so anything narrower than that used
   to overflow horizontally (the 761–993px "dead zone": desktop nav too wide,
   hamburger not yet engaged). Switching to the hamburger at ≤1000px closes it. */
@media (min-width: 1001px) {
  .nav-links { display: flex; }
  .nav-burger,
  .nav-search-close { display: none; }
}

/* ---- Mobile / tablet: hamburger + drop-down menu + expanding search ---- */
@media (max-width: 1000px) {
  .nav { padding: 10px 18px; gap: 12px; flex-wrap: nowrap; align-items: center; }
  .nav-links { display: none; }
  .nav-burger { display: flex; }

  /* Let the search fill the space between the logo and the hamburger.
     search.js wraps the input in a <div>, so that wrapper must grow too. */
  .nav-right { flex: 1 1 auto; min-width: 0; display: flex; }
  .nav-right > div { flex: 1 1 auto; min-width: 0; display: flex; }
  .nav-right .search { width: 100%; flex: 1; min-width: 0; }

  /* Drop-down menu panel below the sticky header. */
  .nav.menu-open .nav-links {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--cream);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 20px 40px -24px rgba(26, 26, 46, 0.45);
    padding: 6px 18px 12px;
  }
  .nav.menu-open .nav-links a {
    padding: 13px 4px;
    font-size: 16px;
    opacity: 0.85;
    border-bottom: 1px solid var(--line);
  }
  .nav.menu-open .nav-links a:last-child { border-bottom: 0; }

  /* Tapping the search expands it to fill the bar: logo + hamburger
     slide out, the ✕ appears to collapse it again. */
  .nav.search-open .logo-wrap,
  .nav.search-open .nav-burger { display: none; }
  .nav.search-open .nav-search-close { display: flex; }

  /* Collapsed search reads as an icon-only button: centre the magnifier and
     hide the placeholder so a narrow pill never shows a truncated "S".
     The full placeholder returns once the search is expanded. */
  .nav:not(.search-open) .search { background-position: center; text-indent: -9999px; }
  .nav:not(.search-open) .search::placeholder { color: transparent; }
  .nav.search-open .search { background-position: 14px center; text-indent: 0; }
}
