/* =====================================================
   NAV.CSS — Navigation Bar (shared across all pages)
   ===================================================== */

/* ─── Nav Shell ─── */
#main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(253, 250, 245, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.nav-inner {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* ─── Logo ─── */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo-icon {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--teal) 100%);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -1px;
  flex-shrink: 0;
}

.nav-logo-text {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
  line-height: 1;
}

.nav-logo-text small {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ─── Chapter Links ─── */
.nav-chapters {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
}

.nav-chapters::-webkit-scrollbar { display: none; }

.nav-chapter-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  padding: 0.28rem 0.6rem;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-chapter-link:hover {
  background: var(--blue-pale);
}

.nav-chapter-link.active {
  background: var(--blue-light);
}

.nav-chapter-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1;
  margin-bottom: 1px;
}

.nav-chapter-label {
  font-family: 'Source Serif 4', serif;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.nav-chapter-link:hover .nav-chapter-label,
.nav-chapter-link:hover .nav-chapter-num {
  color: var(--blue);
}

.nav-chapter-link.active .nav-chapter-label,
.nav-chapter-link.active .nav-chapter-num {
  color: var(--blue);
  font-weight: 600;
}

/* ─── Divider ─── */
.nav-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
  margin: 0 0.4rem;
}

/* ─── Hamburger (mobile) ─── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius);
  margin-left: auto;
  flex-shrink: 0;
}

.nav-hamburger span {
  display: block;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* ─── Mobile Menu ─── */
.nav-mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(28, 25, 23, 0.4);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.nav-mobile-menu.open {
  opacity: 1;
  pointer-events: auto;
}

.nav-mobile-panel {
  background: var(--bg-card);
  max-height: 100%;
  overflow-y: auto;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem 2rem;
  transform: translateY(-8px);
  transition: transform 0.2s ease;
  box-shadow: var(--shadow-lg);
}

.nav-mobile-menu.open .nav-mobile-panel {
  transform: translateY(0);
}

.nav-mobile-menu a {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  transition: color 0.15s;
}

.nav-mobile-menu a:last-child { border-bottom: none; }
.nav-mobile-menu a:hover { color: var(--blue); }
.nav-mobile-menu a.active { color: var(--blue); font-weight: 600; }

.nav-mobile-menu .m-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-faint);
  min-width: 24px;
}

.nav-mobile-menu .m-label {
  font-family: 'Source Serif 4', serif;
  font-size: 1rem;
}

.nav-mobile-home {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1rem !important;
  margin-bottom: 0.5rem;
  padding-bottom: 1rem !important;
  color: var(--text-primary) !important;
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .nav-chapters { display: none; }
  .nav-divider { display: none; }
  .nav-hamburger { display: flex; }
  .nav-mobile-menu { display: block; }
}

@media (max-width: 480px) {
  .nav-logo-text small { display: none; }
}
