/*!
 * Outline - table of contents with scroll spy and reading progress
 * Styles only. No external requests.
 */

.outline {
  --outline-accent: #2f6df6;
  --outline-text: #101418;
  --outline-muted: #667085;
  --outline-line: #e4e7ec;
  --outline-font-size: 14px;
  position: sticky;
  top: var(--outline-sticky-top, 24px);
  align-self: start;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  font: var(--outline-font-size)/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--outline-text);
  padding-right: 4px;
}

.outline__title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--outline-muted);
}

.outline__details > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  border: 1px solid var(--outline-line);
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.outline__details > summary::-webkit-details-marker { display: none; }

.outline__details > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  opacity: 0.6;
  transition: transform 0.18s ease;
}

.outline__details[open] > summary::after {
  transform: rotate(-135deg) translateY(-2px);
}

.outline__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.outline__details .outline__list {
  margin-top: 10px;
  border-left: 1px solid var(--outline-line);
  padding-left: 2px;
}

.outline__link {
  display: block;
  padding: 6px 12px;
  margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--outline-muted);
  text-decoration: none;
  border-radius: 0 6px 6px 0;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.outline__link:hover {
  color: var(--outline-text);
  background: rgba(16, 20, 24, 0.04);
}

.outline__link:focus-visible {
  outline: 2px solid var(--outline-accent);
  outline-offset: 1px;
}

.outline__link.is-active {
  color: var(--outline-accent);
  border-left-color: var(--outline-accent);
  font-weight: 600;
  background: rgba(47, 109, 246, 0.06);
}

.outline__list--sub .outline__link {
  padding-left: 26px;
  font-size: 0.93em;
}

.outline__item--h3 > .outline__link { color: var(--outline-muted); }

/* Reading progress */
.outline-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 50;
  pointer-events: none;
}

.outline-progress__bar {
  display: block;
  height: 100%;
  width: 0;
  background: var(--outline-accent, #2f6df6);
  transition: width 0.1s linear;
}

@media (max-width: 900px) {
  .outline {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (prefers-reduced-motion: reduce) {
  .outline__link,
  .outline__details > summary::after,
  .outline-progress__bar {
    transition: none;
  }
}
