/* The Library Ape — global sidebar (Stacks + Index Cards) */
.la-sidebar {
  position: fixed;
  top: 64px;
  left: 0;
  bottom: 0;
  width: 260px;
  background: #FAF8F5;
  border-right: 1px solid #E4DFD6;
  z-index: 30;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.22s ease;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  box-shadow: 1px 0 0 rgba(0,0,0,0.02);
}
.la-sidebar.collapsed { transform: translateX(-260px); }

.la-sidebar__toggle {
  position: fixed;
  top: 76px;
  left: 268px;
  width: 28px;
  height: 28px;
  border: 1px solid #E4DFD6;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  color: #4A6741;
  z-index: 31;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: left 0.22s ease;
}
.la-sidebar.collapsed ~ .la-sidebar__toggle { left: 8px; }
.la-sidebar__toggle:hover { background: #F2EDE7; }

.la-sidebar__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 14px 12px 14px;
}
.la-sidebar__section { margin-bottom: 18px; }
.la-sidebar__section-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8B6F47;
  margin: 0 4px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.la-sidebar__section-title::before,
.la-sidebar__section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #E4DFD6;
}

.la-tree, .la-tree ul { list-style: none; margin: 0; padding: 0; }
.la-tree ul { padding-left: 14px; }
.la-tree__node {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 13px;
  color: #2D2A26;
  cursor: pointer;
  text-decoration: none;
  user-select: none;
}
.la-tree__node:hover { background: #F2EDE7; color: #4A6741; }
.la-tree__node.active { background: rgba(74, 103, 65, 0.10); color: #4A6741; font-weight: 600; }
.la-tree__caret {
  display: inline-block;
  width: 12px;
  font-size: 9px;
  color: #8B6F47;
  transition: transform 0.15s;
}
.la-tree__caret.empty { visibility: hidden; }
.la-tree li.expanded > .la-tree__node > .la-tree__caret { transform: rotate(90deg); }
.la-tree li:not(.expanded) > ul { display: none; }
.la-tree__label { flex: 1; line-height: 1.35; }
.la-tree__count {
  font-size: 10px;
  color: #8B6F47;
  background: #F2EDE7;
  border-radius: 8px;
  padding: 1px 6px;
}

.la-sidebar__cards {
  border-top: 1px solid #E4DFD6;
  padding: 14px 14px 16px;
  background: #F5F0E8;
}
.la-index-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #E4DFD6;
  border-radius: 6px;
  margin-bottom: 6px;
  text-decoration: none;
  color: #2D2A26;
  font-size: 13px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}
.la-index-card::before {
  content: '';
  width: 4px;
  height: 18px;
  background: #8B6F47;
  border-radius: 2px;
}
.la-index-card:hover { background: #FAF8F5; color: #4A6741; }
.la-index-card:last-child { margin-bottom: 0; }

body.la-sb-open { padding-left: 260px; padding-top: 64px; transition: padding-left 0.22s ease; }
body:not(.la-sb-open) { padding-left: 0; transition: padding-left 0.22s ease; }

/* Pin header to full viewport width — escape body padding-left when sidebar open */
body.la-sb-open .la-shell-nav,
body.la-sb-open #root > div > nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100vw;
  margin: 0;
  z-index: 100;
}

@media (max-width: 900px) {
  .la-sidebar { width: 240px; }
  .la-sidebar.collapsed { transform: translateX(-240px); }
  .la-sidebar:not(.collapsed) { transform: translateX(0); box-shadow: 4px 0 12px rgba(0,0,0,0.08); }
  body.la-sb-open { padding-left: 0; }
  .la-sidebar:not(.collapsed) ~ .la-sidebar__toggle { left: 248px; }
}
