/* ==========================================================================
   DirectCare site navigation
   Loaded by every page. Uses the design tokens defined by the page's own
   stylesheet (index.html inline, or /insights/insights.css), so this file
   carries layout and no palette of its own.
   Markup lives in /partials/nav.html and is injected by /components.js.
   ========================================================================== */

html { scroll-padding-top: 130px; }

/* ---- Cross-site bar: DirectCare and QIDP Consultant ---- */
.site-switch { background: #1F5147; }
[data-theme="dark"] .site-switch { background: #14201C; }
.switch-inner {
  width: min(1120px, 92%); margin: 0 auto; height: 24px;
  display: flex; align-items: center; gap: 10px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px; line-height: 1;
  text-transform: uppercase; letter-spacing: .06em;
}
.site-switch a {
  color: rgba(255, 255, 255, .70); text-decoration: none; font-weight: 700;
  transition: color .15s ease;
}
.site-switch a:hover, .site-switch a:focus { color: #fff; text-decoration: underline; }
.site-switch a[aria-current="true"] { color: #fff; }
.site-switch .sep { color: rgba(255, 255, 255, .32); }

.site-header {
  position: sticky; top: 0; z-index: 60;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  transition: background-color .25s ease, border-color .25s ease;
}
.nav-inner { width: min(1120px, 92%); margin: 0 auto; }
.nav-row { display: flex; align-items: center; }

/* ---- Line 1: logo and actions ---- */
.nav-row-top { justify-content: space-between; gap: 16px; padding: 15px 0 13px; }

.logo {
  font-family: var(--serif); font-size: 1.45rem; font-weight: 700; color: var(--ink);
  text-decoration: none; display: inline-flex; align-items: center; gap: 9px; line-height: 1;
}
.logo svg { width: 1.1em; height: 1.1em; fill: var(--brand); flex-shrink: 0; }
.logo:hover { color: var(--brand); }

.nav-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.theme-btn {
  width: 40px; height: 40px; border-radius: 8px; cursor: pointer; padding: 0;
  background: var(--surface); border: 1.5px solid var(--line); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}
.theme-btn:hover { border-color: var(--brand); color: var(--brand); }
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn .icon-sun { display: none; }
[data-theme="dark"] .theme-btn .icon-moon { display: none; }
[data-theme="dark"] .theme-btn .icon-sun { display: block; }

.nav-cta {
  height: 40px; padding: 0 20px; font-size: .95rem;
  display: inline-flex; align-items: center; white-space: nowrap;
}
.nav-cta .cta-short { display: none; }

.menu-btn {
  display: none; width: 40px; height: 40px; border-radius: 8px; padding: 0; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--line); color: var(--ink);
  align-items: center; justify-content: center;
  transition: border-color .18s ease, color .18s ease;
}
.menu-btn:hover { border-color: var(--brand); color: var(--brand); }
.menu-btn svg { width: 20px; height: 20px; }
.menu-btn .icon-x { display: none; }
.menu-btn[aria-expanded="true"] .icon-burger { display: none; }
.menu-btn[aria-expanded="true"] .icon-x { display: block; }

/* ---- Line 2: section links ---- */
.nav-row-bottom { border-top: 1px solid var(--line); }

.nav-links {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 0 28px; list-style: none; margin: 0; padding: 0;
}
.nav-links a {
  position: relative; display: inline-block; padding: 11px 0 12px;
  text-decoration: none; color: var(--ink-soft);
  font-weight: 600; font-size: .95rem; letter-spacing: .01em;
  transition: color .16s ease;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--brand); border-radius: 2px 2px 0 0;
  transform: scaleX(0); transform-origin: left; transition: transform .18s ease;
}
.nav-links a:hover { color: var(--brand); }
.nav-links a:hover::after,
.nav-links a[aria-current="page"]::after { transform: scaleX(1); }
.nav-links a[aria-current="page"] { color: var(--brand); }

/* ---- Small screens: line 2 becomes a burger panel ---- */
@media (max-width: 760px) {
  html { scroll-padding-top: 76px; }

  .nav-row-top { padding: 10px 0; gap: 10px; }
  .logo { font-size: 1.18rem; }
  .nav-actions { gap: 8px; }
  .theme-btn, .menu-btn { width: 38px; height: 38px; }
  .menu-btn { display: inline-flex; }

  .nav-cta { height: 38px; padding: 0 14px; font-size: .88rem; }
  .nav-cta .cta-long { display: none; }
  .nav-cta .cta-short { display: inline; }

  .nav-row-bottom {
    display: block; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--surface); border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
    max-height: 0; overflow: hidden; visibility: hidden;
    transition: max-height .26s ease, visibility 0s linear .26s;
  }
  .nav-row-bottom.open {
    max-height: 78vh; overflow-y: auto; visibility: visible;
    transition: max-height .26s ease, visibility 0s;
  }

  .nav-links { flex-direction: column; align-items: stretch; gap: 0; padding: 6px 0 10px; }
  .nav-links li { width: 100%; }
  .nav-links a {
    display: block; padding: 14px 4vw; font-size: 1.02rem;
    border-bottom: 1px solid var(--line);
  }
  .nav-links li:last-child a { border-bottom: none; }
  .nav-links a::after { display: none; }
  .nav-links a[aria-current="page"] { background: var(--brand-tint); }
}

@media (max-width: 360px) {
  .logo { font-size: 1.04rem; }
  .nav-cta { padding: 0 11px; font-size: .82rem; }
}

@media (prefers-reduced-motion: reduce) {
  .nav-links a::after { transition: none; }
  .nav-row-bottom { transition: none; }
}
