/* ============================================================
   SIDEBAR.CSS — Side navigation, mobile overlay, menu button
   ============================================================ */

/* ── Sidebar shell ───────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 12px rgba(17,17,17,0.04);
  overflow: hidden;
  transition: width var(--transition-base);
}
.sidebar:hover { width: var(--sidebar-expanded); }

/* ── Logo ────────────────────────────────────────────────── */
.sidebar__logo {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 1.25rem var(--space-md);
  border-bottom: 1px solid var(--border-light);
  text-decoration: none;
  min-height: 64px;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar__logo-mark {
  width: 32px; height: 32px;
  flex-shrink: 0;
  background: var(--accent);
  color: var(--bg-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-weight: 400;
}

.sidebar__logo-text {
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: opacity var(--transition-base), width var(--transition-base);
}
.sidebar:hover .sidebar__logo-text {
  opacity: 1;
  width: 130px;
}

/* ── Nav ─────────────────────────────────────────────────── */
.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-sm) 0;
  scrollbar-width: none;
}
.sidebar__nav::-webkit-scrollbar { display: none; }

.sidebar__nav ul { list-style: none; }

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  padding: 0.85rem var(--space-md);
  background: none;
  border: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-align: left;
  transition: all var(--transition-fast);
  overflow: hidden;
  white-space: nowrap;
}

.sidebar__link:hover {
  color: var(--accent);
  background: var(--accent-light);
  border-left-color: var(--border);
}

.sidebar__link.active,
.sidebar__link[data-active="true"] {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-light);
}

.sidebar__icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: inherit;
}
.sidebar__icon svg {
  width: 18px; height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar__label {
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: opacity var(--transition-base), width var(--transition-base);
  font-family: var(--font-body);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
}
.sidebar:hover .sidebar__label {
  opacity: 1;
  width: 130px;
}

/* ── Bottom area ─────────────────────────────────────────── */
.sidebar__bottom {
  flex-shrink: 0;
  border-top: 1px solid var(--border-light);
  padding: var(--space-sm) 0;
}

.sidebar__progress-wrap {
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  overflow: hidden;
}

.sidebar__progress-track {
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  flex: 1;
  min-width: 0;
  opacity: 0;
  transition: opacity var(--transition-base);
}
.sidebar:hover .sidebar__progress-track { opacity: 1; }

.sidebar__progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 1px;
  width: 0%;
  transition: width 200ms ease;
}

.sidebar__blog-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0.85rem var(--space-md);
  border-left: 3px solid transparent;
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  overflow: hidden;
  white-space: nowrap;
  transition: all var(--transition-fast);
}
.sidebar__blog-link:hover {
  color: var(--accent);
  background: var(--accent-light);
  border-left-color: var(--border);
}

/* ── Mobile menu button ──────────────────────────────────── */
.menu-btn {
  display: none;
  position: fixed;
  top: var(--space-md);
  left: var(--space-md);
  z-index: 1001;
  width: 40px; height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.menu-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
}
.menu-btn:hover .menu-btn__bar { background: var(--bg-primary); }

.menu-btn__bar {
  width: 18px; height: 1.5px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: all var(--transition-base);
}

/* Morph to X when open */
.menu-btn.open .menu-btn__bar:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}
.menu-btn.open .menu-btn__bar:nth-child(2) {
  opacity: 0; transform: scaleX(0);
}
.menu-btn.open .menu-btn__bar:nth-child(3) {
  transform: translateY(-5.5px) rotate(-45deg);
}

/* ── Mobile fullscreen overlay ───────────────────────────── */
.mobile-overlay {
  position: fixed; inset: 0;
  z-index: 2000;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xl);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}
.mobile-overlay.open { opacity: 1; pointer-events: all; }

.mobile-overlay__header {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
}

.mobile-close {
  width: 40px; height: 40px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--border-radius);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1.25rem;
  transition: all var(--transition-fast);
}
.mobile-close:hover {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

/* Brand mark in overlay */
.mobile-overlay__brand {
  text-align: center;
}
.mobile-overlay__brand-mark {
  width: 48px; height: 48px;
  background: var(--accent);
  color: var(--bg-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  margin-bottom: var(--space-sm);
}
.mobile-overlay__name {
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mobile-overlay__links {
  list-style: none;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
  max-width: 280px;
}

.mobile-nav-link {
  display: block;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--font-size-xl);
  color: var(--text-secondary);
  text-decoration: none;
  padding: var(--space-md) 0;
  letter-spacing: 0.04em;
  text-align: center;
  transition: color var(--transition-fast);
}
.mobile-nav-link:hover,
.mobile-nav-link.active {
  color: var(--accent);
}
.mobile-nav-link:last-child { border-bottom: none; }

.mobile-overlay__links li:nth-child(1)  .mobile-nav-link { transition-delay: 0.03s; }
.mobile-overlay__links li:nth-child(2)  .mobile-nav-link { transition-delay: 0.06s; }
.mobile-overlay__links li:nth-child(3)  .mobile-nav-link { transition-delay: 0.09s; }
.mobile-overlay__links li:nth-child(4)  .mobile-nav-link { transition-delay: 0.12s; }
.mobile-overlay__links li:nth-child(5)  .mobile-nav-link { transition-delay: 0.15s; }
.mobile-overlay__links li:nth-child(6)  .mobile-nav-link { transition-delay: 0.18s; }
.mobile-overlay__links li:nth-child(7)  .mobile-nav-link { transition-delay: 0.21s; }
.mobile-overlay__links li:nth-child(8)  .mobile-nav-link { transition-delay: 0.24s; }
.mobile-overlay__links li:nth-child(9)  .mobile-nav-link { transition-delay: 0.27s; }
.mobile-overlay__links li:nth-child(10) .mobile-nav-link { transition-delay: 0.30s; }

/* ── Mobile breakpoint ───────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .menu-btn { display: flex; }
}

/* ── Theme toggle button ────────────────────────────────────── */
.sidebar__theme-btn {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  padding: 0.85rem var(--space-md);
  background: none;
  border: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}
.sidebar__theme-btn:hover {
  color: var(--accent);
  background: var(--accent-light);
  border-left-color: var(--border);
}
.sidebar__theme-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ── Mobile floating theme button ───────────────────────────── */
.mobile-theme-btn {
  display: none;
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 1001;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.mobile-theme-btn:hover {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}
.mobile-theme-btn svg { width: 18px; height: 18px; }

@media (max-width: 768px) {
  .sidebar__theme-btn { display: none; }
  .mobile-theme-btn   { display: flex; }
}
