/* ============================================================
   sidebar.css  —  Sidebar shell, profile card, search, nav
   ============================================================ */

/* ── Shell ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 200;
  transition: transform var(--dur2) var(--ease), background var(--dur2) var(--ease),
              border-color var(--dur2) var(--ease);
  scrollbar-width: thin;
  scrollbar-color: var(--surface) transparent;
}
.sidebar::-webkit-scrollbar       { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--surface); border-radius: 2px; }

.sidebar-inner {
  padding: 1.75rem 1.125rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}

/* Overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 150;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ── Profile card ────────────────────────────────────────── */
.sidebar-profile {
  text-align: center;
  padding-bottom: 1.125rem;
  border-bottom: 1px solid var(--border);
}
.profile-avatar {
  width: 84px; height: 84px;
  border-radius: 50%;
  margin: 0 auto 0.875rem;
  overflow: hidden;
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name     { font-size: 1rem; font-weight: 700; color: var(--fg); margin-bottom: 0.2rem; }
.profile-tagline  { font-size: 0.775rem; color: var(--fg2); margin-bottom: 0.75rem; }
.profile-links    { display: flex; flex-wrap: wrap; gap: 0.375rem; justify-content: center; }
.profile-link {
  padding: 0.25rem 0.625rem;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--r);
  font-size: 0.74rem; font-weight: 500;
  color: var(--fg2);
  transition: all var(--dur) var(--ease);
}
.profile-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

/* ── Search ──────────────────────────────────────────────── */
.sidebar-search { position: relative; }
.search-icon {
  position: absolute; left: 0.6rem; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--fg2); pointer-events: none;
}
.search-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--fg);
  font-size: 0.83rem; font-family: var(--font);
  padding: 0.45rem 0.75rem 0.45rem 2rem;
  outline: none;
  transition: border-color var(--dur) var(--ease), background var(--dur2) var(--ease);
}
.search-input::placeholder { color: var(--fg2); }
.search-input:focus { border-color: var(--accent); }

/* ── Sidebar nav ─────────────────────────────────────────── */
.sidebar-nav { display: flex; flex-direction: column; gap: 0.125rem; }

/* Root-level direct link (no children) */
.nav-root {
  display: block;
  padding: 0.4rem 0.625rem;
  border-radius: var(--r);
  font-size: 0.875rem; color: var(--fg2);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav-root:hover { color: var(--fg); background: color-mix(in srgb, var(--fg) 6%, transparent); }
.nav-root.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); font-weight: 600; }

/* Collapsible section wrapper */
.nav-section { margin-bottom: 0.125rem; }

.nav-section-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 0.4rem 0.625rem;
  background: none; border: none;
  border-radius: var(--r);
  font-size: 0.71rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--fg2);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
/* Indent section button based on depth */
.nav-section-btn[style*="--depth: 1"] { padding-left: 1.25rem; font-size: 0.875rem; text-transform: none; letter-spacing: 0; font-weight: 500; }
.nav-section-btn[style*="--depth: 2"] { padding-left: 2rem;    font-size: 0.85rem;  text-transform: none; letter-spacing: 0; font-weight: 500; }
.nav-section-btn[style*="--depth: 3"] { padding-left: 2.625rem; }
.nav-section-btn[style*="--depth: 4"] { padding-left: 3.25rem;  }

.nav-section-btn:hover { color: var(--fg); background: color-mix(in srgb, var(--fg) 5%, transparent); }
.nav-section.is-open > .nav-section-btn { color: var(--accent); }

.nav-chevron {
  width: 14px; height: 14px; flex-shrink: 0;
  transition: transform var(--dur) var(--ease);
}
.nav-section.is-open > .nav-section-btn .nav-chevron { transform: rotate(180deg); }

/* Grid expand animation */
.nav-section-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur2) var(--ease);
}
.nav-section.is-open > .nav-section-body { grid-template-rows: 1fr; }
.nav-section-body > .nav-children { overflow: hidden; list-style: none; }

/* Links at each depth */
.nav-link {
  display: block;
  padding: 0.35rem 0.625rem;
  padding-left: calc(0.875rem + var(--depth, 0) * 0.75rem);
  border-radius: var(--r);
  font-size: 0.875rem; color: var(--fg2);
  position: relative;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav-link:hover { color: var(--fg); background: color-mix(in srgb, var(--fg) 6%, transparent); }
.nav-link.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; background: var(--accent);
  border-radius: 0 3px 3px 0;
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }
  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,.4);
  }
}

/* ── Profile social icons (platform-based links) ─────────── */
.profile-social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid transparent;
  color: var(--fg2);
  transition: background var(--dur) var(--ease),
              color var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.profile-social-icon svg {
  width: 15px;
  height: 15px;
  display: block;
  flex-shrink: 0;
}
.profile-social-icon:hover {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent);
  transform: translateY(-1px);
  filter: none;
}

/* Mixed row: icons + text pills can coexist */
.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  align-items: center;
}
