/* Dense chapter index within the shared personal-site shell. */
.code-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 72px;
  padding-top: 64px;
  padding-bottom: 64px;
}
.code-sidebar {
  position: sticky;
  top: 118px;
  align-self: start;
}
.code-sidebar .eyebrow {
  font-size: 10px;
  color: #687f94;
}
.code-nav-title {
  font-size: 21px;
  margin: 12px 0 22px;
}
.chapter-link {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 46px;
  padding: 8px 10px;
  border-left: 2px solid transparent;
  font-size: 13px;
  color: #657084;
}
.chapter-link > span,
.chapter-link small {
  font: 10px var(--mono);
}
.chapter-link small {
  margin-left: auto;
}
.chapter-link:hover,
.chapter-link[aria-current] {
  border-color: #6998b6;
  background: #e9f0f4;
  color: #305e7b;
}
.code-return {
  display: inline-block;
  font-size: 12px;
  margin: 26px 10px 0;
  color: #526e82;
}
.code-picker {
  display: none;
}
.code-chapter {
  scroll-margin-top: 24px;
  padding-bottom: 52px;
}
.code-chapter:last-child {
  padding-bottom: 0;
}
.code-chapter-head .eyebrow {
  font-size: 10px;
  color: #647f94;
  letter-spacing: 2px;
  margin-bottom: 10px;
}
.code-chapter-head > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.code-chapter-head h2 {
  font-size: 27px;
  font-weight: 500;
}
.code-chapter-head > div > span {
  font: 11px var(--mono);
  color: #758496;
}
.code-chapter-head > p:last-child {
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
}
.code-entries {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  border-top: 1px solid #cdd7df;
}
.code-entries a {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 20px;
  gap: 16px;
  align-items: center;
  min-height: 60px;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  transition: background 0.18s;
}
.code-entries a:hover {
  background: #edf2f5;
  color: #376e92;
}
.code-entry-number {
  font: 11px var(--mono);
  color: #71899b;
}
.code-entry-arrow {
  font-size: 15px;
  color: #728697;
  transition: transform 0.18s;
}
.code-entries a:hover .code-entry-arrow {
  transform: translate(2px, -2px);
}
@media (max-width: 1000px) {
  .code-layout {
    gap: 32px;
    grid-template-columns: 190px minmax(0, 1fr);
  }
}
@media (max-width: 760px) {
  .code-layout {
    display: block;
    padding-top: 0;
    padding-bottom: 36px;
  }
  .code-sidebar {
    display: none;
  }
  .code-picker {
    display: block;
    position: sticky;
    top: 70px;
    z-index: 30;
    background: #fafaf8fa;
    border-bottom: 1px solid var(--line);
    margin-bottom: 32px;
  }
  .code-picker summary {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 56px;
    cursor: pointer;
    font-size: 13px;
    list-style: none;
  }
  .code-picker summary::-webkit-details-marker {
    display: none;
  }
  .code-picker summary > span:last-child {
    margin-left: auto;
  }
  .code-picker nav {
    max-height: calc(100svh - 190px);
    overflow-y: auto;
    padding-bottom: 12px;
  }
  .code-chapter {
    scroll-margin-top: 68px;
    padding-bottom: 40px;
  }
  .code-chapter-head h2 {
    font-size: 24px;
  }
  .code-chapter-head > p:last-child {
    font-size: 12px;
  }
  .code-entries a {
    font-size: 14px;
    grid-template-columns: 25px minmax(0, 1fr) 16px;
    gap: 10px;
    padding-inline: 6px;
  }
  .code-hero .agent-count {
    font-size: 16px;
  }
  .code-hero .agent-count b {
    margin-inline: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .code-entries a,
  .code-entry-arrow {
    transition: none;
  }
  .code-entries a:hover .code-entry-arrow {
    transform: none;
  }
}
