/* T41/T42 — persistent header + hidden drawer, the app's first shared nav
 * chrome. Rendered once from the layout (see _nav_chrome.html.erb) on the
 * four pages that have no header of their own: chat#show, itinerary#show,
 * dashboards#show, trips#index.
 *
 * Overlay-only. The design handoff offered two mobile drawer patterns
 * (overlay vs push-aside) as an open question and asked for one pick before
 * shipping — overlay, since it needs no separate desktop/mobile layout branch.
 *
 * Tokens come from design_tokens.css. The drawer is dark-on-dark like the
 * existing sidebar (--sidebar-bg), but its dim-text opacities are the
 * design's own scale (rgba(247,245,240,*)) rather than --sidebar-muted —
 * kept local here rather than added to design_tokens.css since nothing else
 * uses this exact 4-step opacity scale yet.
 */

.nav-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
@media (min-width: 768px) {
  .nav-header { padding: 0 24px; }
}

.nav-header.nav-header-dark {
  background: var(--sidebar-bg);
  border-bottom-color: rgba(247,245,240,0.10);
  color: #F7F5F0;
}

.nav-header-spacer { height: 56px; }

.nav-trigger {
  flex-shrink: 0;
  width: 44px; height: 44px;
  margin-left: -8px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-header-dark .nav-trigger.nav-trigger-open { background: rgba(247,245,240,0.08); }
.nav-header:not(.nav-header-dark) .nav-trigger.nav-trigger-open { background: var(--surface-2); }

.nav-wordmark { display: flex; align-items: center; gap: 9px; min-width: 0; text-decoration: none; color: inherit; }
.nav-wordmark-mark {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--green);
  color: #F7F5F0;
  display: flex; align-items: center; justify-content: center;
}
.nav-wordmark-text {
  font-family: 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -0.02em;
  color: inherit;
  white-space: nowrap;
}
.nav-wordmark-sub {
  font-family: 'Geist Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: rgba(247,245,240,0.38);
  margin-top: 4px;
  white-space: nowrap;
}

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

.nav-stage-indicator {
  display: none;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.nav-header-dark .nav-stage-indicator { color: rgba(247,245,240,0.62); }
@media (min-width: 768px) {
  .nav-stage-indicator { display: block; }
}

.nav-avatar {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 9999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--text-2);
}
.nav-header-dark .nav-avatar {
  background: rgba(247,245,240,0.12);
  border-color: transparent;
  color: #F7F5F0;
}

/* ── Drawer ── */

.nav-scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(28,28,26,0);
  transition: background 0.25s ease;
}
.nav-scrim.hidden { display: none; }
.nav-scrim.nav-scrim-visible { background: rgba(28,28,26,0.55); }

.nav-drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 61;
  width: 268px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.25s ease-out;
  box-shadow: 8px 0 32px rgba(28,28,26,0.28);
  padding-top: env(safe-area-inset-top, 0px);
}
.nav-drawer.nav-drawer-open { transform: translateX(0); }
@media (min-width: 768px) {
  .nav-drawer { width: 300px; }
}

.nav-drawer-header { padding: 18px 16px 4px; }

.nav-section-label {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(247,245,240,0.38);
  padding: 18px 16px 8px;
}

.nav-divider { height: 1px; background: rgba(247,245,240,0.10); margin: 18px 16px 0; }

.nav-flow-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 16px 10px 13px;
  border-left: 3px solid transparent;
}
.nav-flow-item.nav-flow-active {
  border-left-color: var(--green-dim);
  background: rgba(45,107,80,0.15);
}
.nav-flow-item.nav-flow-locked { opacity: 0.4; }

.nav-flow-marker {
  flex-shrink: 0;
  width: 26px;
  display: flex;
  justify-content: center;
  font-family: 'Geist Mono', monospace;
  font-size: 11.5px;
  color: rgba(247,245,240,0.62);
}
.nav-flow-active .nav-flow-marker { color: #F7F5F0; }

.nav-flow-body { flex: 1; min-width: 0; }
.nav-flow-label {
  display: block;
  font-family: 'Archivo', sans-serif;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: rgba(247,245,240,0.82);
}
.nav-flow-active .nav-flow-label { font-weight: 700; color: #F7F5F0; }
.nav-flow-sub {
  display: block;
  font-size: 11.5px;
  color: rgba(247,245,240,0.62);
  margin-top: 1px;
}
.nav-flow-lock { flex-shrink: 0; color: rgba(247,245,240,0.62); }

.nav-drawer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 10px 16px;
  color: rgba(247,245,240,0.82);
  text-decoration: none;
}
.nav-drawer-link .nav-flow-marker { color: rgba(247,245,240,0.62); width: auto; }
.nav-drawer-link-body { flex: 1; min-width: 0; }
.nav-drawer-link-label {
  display: block;
  font-family: 'Archivo', sans-serif;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.nav-drawer-link-sub { display: block; font-size: 11.5px; color: rgba(247,245,240,0.62); margin-top: 1px; }

.nav-drawer-spacer { flex: 1; }

.nav-drawer-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid rgba(247,245,240,0.10);
  text-decoration: none;
}
.nav-drawer-footer-avatar {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 9999px;
  background: rgba(247,245,240,0.12);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  color: #F7F5F0;
}
.nav-drawer-footer-body { flex: 1; min-width: 0; }
.nav-drawer-footer-name { font-size: 13px; color: rgba(247,245,240,0.86); font-weight: 500; }
.nav-drawer-footer-status {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  color: rgba(247,245,240,0.62);
}
.nav-drawer-footer-chevron { flex-shrink: 0; color: rgba(247,245,240,0.62); }
