.com-page-index {
  --color-com-page-index-text: hsl(0 0% 20% / 1);
  --color-com-page-index-border: hsl(0 0% 85% / 1);
  --color-com-page-index-marker: hsl(0 0% 50% / 1);
  --color-com-page-index-active: var(--color-link);
  --com-page-index-offset: calc(var(--subheader-height) + 44px);
  position: sticky; top: var(--com-page-index-offset);
  /*
    Cap the index to the visible area so a long one scrolls itself rather than
    overflowing. The 100% term resolves against the grid area, which also keeps
    the index inside its own column on pages whose content is shorter than it.
  */
  max-height: min(calc(100vh - var(--com-page-index-offset) - 2rem), 100%);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/*
  This must stay in flow. While it was position:absolute the sticky wrapper
  above collapsed to zero height, so sticky never ran out of room inside its
  grid-row: 2 / span 1000 area: it stayed pinned to the bottom of the page and
  the out-of-flow links spilled past the content grid and under the site footer,
  which paints over them (it is position:relative and later in DOM order).
*/
.com-page-index-content {
  width: 100%; height: auto;
  padding: 0 20px;
}

.com-page-index header {
  --gap: 1rem;
  margin-bottom: var(--gap); padding-bottom: var(--gap);
  font-size: 12px; font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-primary-purple); opacity: 0.5;
  border-bottom: 1px solid var(--color-com-page-index-border);
}

.com-page-index ul { margin: 0; padding: 0; }

.com-page-index li {
  list-style-type: disc;
  list-style-position: outside;
  margin: 0 0 0.5rem 1.08rem;
  padding: 0;
}

.com-page-index li.level-h2 { margin-left: 2.2rem; }
.com-page-index li.level-h3 { margin-left: 3.3rem; }

.com-page-index li::marker { color: var(--color-com-page-index-marker); }

.com-page-index a {
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--color-com-page-index-text);
  transition: color ease-out 200ms;
}

.com-page-index a:hover { color: var(--color-com-page-index-active); }
.com-page-index a.active { color: var(--color-com-page-index-active); }
