/* [2026-05-09] nav_shell.css — universal navigation frame.
   Loaded by every chapter HTML + index.html. Provides:
     - sticky breadcrumb (chapter > band > section > page N/M)
     - sticky bottom-bar with SVG icon buttons (chapter pages only)
     - hamburger TOC modal (chapter > band > section drill-down)
     - vastness banner component (warm cream, used on index.html)
*/

:root {
  --ns-accent: #d4691a;
  --ns-accent-soft: #fdf3e8;
  --ns-ink: #1a1a1a;
  --ns-ink-muted: #666;
  --ns-bg: #faf8f3;
  --ns-card: #ffffff;
  --ns-border: #e5e1d8;
  --ns-good: #16a34a;
  --ns-good-soft: #dcfce7;
}

/* ─── Breadcrumb (sticky just under existing topbar) ────────── */
.ns-breadcrumb {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--ns-card);
  border-bottom: 1px solid var(--ns-border);
  padding: 7px 14px;
  font-size: 12px;
  color: var(--ns-ink-muted);
  font-family: 'Inter', system-ui, sans-serif;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  overflow-x: auto;
  white-space: nowrap;
}
.ns-crumb {
  color: var(--ns-ink-muted);
  text-decoration: none;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  transition: background 150ms;
}
.ns-crumb:hover { background: var(--ns-accent-soft); color: var(--ns-accent); }
.ns-crumb.ns-current { color: var(--ns-ink); font-weight: 600; }
.ns-crumb-sep { color: var(--ns-border); -webkit-user-select: none; user-select: none; padding: 0 1px; }
.ns-page-counter {
  margin-left: auto;
  font-weight: 700;
  color: var(--ns-accent);
  font-size: 11px;
  letter-spacing: 0.04em;
  background: var(--ns-accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ─── Bottom navigation bar (fixed, chapter pages only) ─────── */
.ns-bottombar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  height: 52px;
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--ns-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-family: 'Inter', system-ui, sans-serif;
}
/* Left/right edge: one button each */
.ns-bb-edge { display: flex; align-items: center; }
/* Center: Menu + Mastery together */
.ns-bb-center { display: flex; align-items: center; gap: 10px; }

/* Icon-only circular buttons */
.ns-icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--ns-border);
  background: transparent;
  color: var(--ns-ink-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 180ms, border-color 180ms, color 180ms;
  padding: 0;
  flex-shrink: 0;
}
.ns-icon-btn:hover {
  background: var(--ns-bg);
  border-color: var(--ns-accent);
  color: var(--ns-accent);
}
/* Invisible + non-interactive at page boundaries */
.ns-icon-btn.ns-hidden {
  opacity: 0;
  pointer-events: none;
}
/* Menu: accent-tinted */
.ns-icon-btn-menu {
  width: 40px;
  height: 40px;
  border-color: rgba(212, 105, 26, 0.3);
  color: var(--ns-accent);
}
.ns-icon-btn-menu:hover {
  background: var(--ns-accent-soft);
  border-color: var(--ns-accent);
}
/* Mastery: green-tinted */
.ns-icon-btn-mastery {
  width: 40px;
  height: 40px;
  border-color: rgba(22, 163, 74, 0.3);
  color: var(--ns-good);
}
.ns-icon-btn-mastery:hover {
  background: var(--ns-good-soft);
  border-color: var(--ns-good);
}

body.ns-bottombar-active { padding-bottom: 56px; }

/* ─── Custom tooltips (always within viewport) ───────────────── */
.ns-icon-btn::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26, 26, 26, 0.92);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  padding: 4px 9px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms;
  z-index: 200;
  font-family: 'Inter', system-ui, sans-serif;
  letter-spacing: 0.01em;
}
.ns-icon-btn:hover::after { opacity: 1; }
/* Prev is leftmost — tooltip anchors to left edge to stay in viewport */
#ns-btn-prev::after { left: 0; transform: none; }
/* Next is rightmost — tooltip anchors to right edge */
#ns-btn-next::after { left: auto; right: 0; transform: none; }

/* ─── Generic shared button (used inside modals) ────────────── */
.ns-btn {
  background: var(--ns-card);
  border: 1.5px solid var(--ns-border);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ns-ink);
  cursor: pointer;
  transition: all 180ms;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
}
.ns-btn:hover { border-color: var(--ns-accent); background: var(--ns-accent-soft); color: var(--ns-accent); }

/* ─── TOC modal ─────────────────────────────────────────────── */
.ns-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: ns-fade-in 180ms ease-out;
  will-change: opacity;
}
@keyframes ns-fade-in { from { opacity: 0; } to { opacity: 1; } }

.ns-modal {
  background: var(--ns-card);
  border-radius: 14px;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  font-family: 'Inter', system-ui, sans-serif;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}
.ns-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--ns-border);
}
.ns-modal-title { font-size: 15px; font-weight: 700; color: var(--ns-ink); }
.ns-modal-close {
  background: transparent;
  border: none;
  color: var(--ns-ink-muted);
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 6px;
}
.ns-modal-close:hover { background: var(--ns-bg); color: var(--ns-ink); }
.ns-modal-body {
  overflow-y: auto;
  padding: 14px 18px;
  flex: 1;
}
.ns-modal-section { margin-bottom: 16px; }
.ns-modal-section:last-child { margin-bottom: 0; }
.ns-modal-section-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ns-ink-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 6px;
}
/* Pill showing page / band / section counts inline with section labels */
.ns-count-pill {
  font-size: 10px;
  font-weight: 600;
  color: var(--ns-accent);
  background: var(--ns-accent-soft);
  padding: 1px 7px;
  border-radius: 999px;
  letter-spacing: 0.01em;
  text-transform: none;
  white-space: nowrap;
}
/* Section number prefix (1. 2. 3. …) */
.ns-sec-num {
  color: var(--ns-ink-muted);
  font-size: 10px;
  font-weight: 700;
  min-width: 14px;
  display: inline-block;
}

/* "Where you are" card */
.ns-where-card {
  background: var(--ns-accent-soft);
  border: 1px solid rgba(212, 105, 26, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.ns-where-line { font-size: 13px; color: var(--ns-ink); font-weight: 600; margin-bottom: 3px; }
.ns-where-meta { font-size: 11px; color: var(--ns-ink-muted); margin-bottom: 8px; }
.ns-where-row { display: flex; gap: 7px; }

/* Fully-expanded band > section tree (no collapse toggle) */
.ns-tree-band {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 5px;
  margin-top: 8px;
  border-bottom: 2px solid var(--ns-border);
}
.ns-tree-band-name {
  flex: 1;
  font-size: 11px;
  font-weight: 800;
  color: var(--ns-ink-muted);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.ns-tree-band.ns-current-band .ns-tree-band-name { color: var(--ns-accent); }

.ns-section-list { padding-left: 12px; margin: 2px 0 4px; }
.ns-section-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11.5px;
  color: var(--ns-ink);
  transition: background 140ms;
}
.ns-section-row:hover { background: var(--ns-bg); }
.ns-section-row.ns-current-section { background: var(--ns-accent-soft); font-weight: 600; }
.ns-section-row.ns-mastery-row { color: var(--ns-good); }
.ns-section-row.ns-mastery-row:hover { background: var(--ns-good-soft); }
.ns-section-row .ns-status-dot { font-size: 10px; width: 14px; flex-shrink: 0; text-align: center; }
.ns-section-row .ns-section-title { flex: 1; }
.ns-section-row .ns-section-counts { font-size: 10px; color: var(--ns-ink-muted); white-space: nowrap; }

/* Other-chapters list */
.ns-chapter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 140ms;
}
.ns-chapter-row:hover { background: var(--ns-bg); }
.ns-chapter-row.ns-current-chapter { background: var(--ns-accent-soft); }
.ns-chapter-row .ns-status-dot { font-size: 11px; width: 14px; flex-shrink: 0; }
.ns-chapter-row .ns-chapter-title { flex: 1; font-size: 12.5px; font-weight: 600; color: var(--ns-ink); }
.ns-chapter-row .ns-chapter-meta { font-size: 10px; color: var(--ns-ink-muted); }

.ns-modal-footer {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--ns-border);
}

/* ─── Vastness banner (warm cream, used on index.html) ───────── */
.ns-vastness {
  background: #fff9f4;
  border: 1px solid rgba(212, 105, 26, 0.18);
  border-radius: 12px;
  padding: 18px 22px;
  margin: 16px 0;
  font-family: 'Inter', system-ui, sans-serif;
}
.ns-vastness-tagline {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 10px;
  color: var(--ns-ink);
}
.ns-vastness-numbers {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ns-ink-muted);
}
.ns-vastness-numbers strong {
  color: var(--ns-accent);
  font-size: 22px;
  font-weight: 800;
  display: block;
  margin-bottom: 1px;
  line-height: 1.1;
}
.ns-vastness-stat { min-width: 72px; }
.ns-vastness-foot {
  font-size: 11px;
  color: var(--ns-ink-muted);
  margin-top: 10px;
  letter-spacing: 0.02em;
}

/* Mobile */
@media (max-width: 480px) {
  .ns-breadcrumb { font-size: 11px; padding: 5px 10px; }
  .ns-page-counter { font-size: 10px; padding: 2px 6px; }
  .ns-bottombar { gap: 12px; }
  .ns-icon-btn { width: 34px; height: 34px; }
  .ns-icon-btn-menu { width: 38px; height: 38px; }
  .ns-modal { max-height: 92vh; }
  .ns-modal-body { padding: 10px 12px; }
  .ns-vastness-numbers { gap: 14px; }
  .ns-vastness-numbers strong { font-size: 18px; }
}
