/* ==================================================================
   toc.css — fixed left-side table of contents.
   Cream parchment palette, small-caps Cormorant Garamond, scroll-spy
   active state in rust. Hides on narrow viewports.
   ================================================================== */

.page-toc {
  position: fixed;
  top: 4rem;
  left: 1.4rem;
  width: 188px;
  z-index: 50;
  font-family: 'Cormorant Garamond', 'Source Serif Pro', Georgia, serif;
  color: var(--ink-2, #4a4438);
  user-select: none;

  /* Subtle parchment-on-parchment so the sidebar blends with the page */
  background: linear-gradient(
    180deg,
    rgba(253, 250, 242, 0.92),
    rgba(253, 250, 242, 0.72) 80%,
    rgba(253, 250, 242, 0)
  );
  padding: 1.1rem 0.6rem 1.4rem 0.9rem;
  border-right: 1px solid #d8cdb6;
}

.page-toc .toc-label {
  font-family: 'Cormorant Garamond', serif;
  font-variant: small-caps;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  color: var(--rust, #b54a2a);
  margin: 0 0 0.85rem 0;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid #d8cdb6;
  font-weight: 600;
}

.page-toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: none;
}

.page-toc li {
  margin: 0;
  padding: 0;
}

.page-toc a {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 0.45rem;
  align-items: baseline;
  padding: 0.32rem 0.4rem 0.32rem 0.55rem;
  text-decoration: none;
  color: inherit;
  border-left: 2px solid transparent;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
  line-height: 1.25;
}

.page-toc a:hover {
  color: var(--ink, #2a2a2a);
  background: rgba(181, 74, 42, 0.05);
}

.page-toc .toc-num {
  font-variant: small-caps;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--rust, #b54a2a);
  font-weight: 500;
  text-align: right;
  opacity: 0.75;
}

.page-toc .toc-title {
  font-size: 0.92rem;
  font-weight: 400;
}

/* Active section: rust accent + bolder type + a small notch on the left */
.page-toc a.is-active {
  color: var(--ink, #2a2a2a);
  border-left-color: var(--rust, #b54a2a);
  background: rgba(181, 74, 42, 0.07);
}
.page-toc a.is-active .toc-num {
  opacity: 1;
  font-weight: 600;
}
.page-toc a.is-active .toc-title {
  font-weight: 500;
  font-style: italic;
}

/* Show the ToC only when there is room for it. Below ~1180px the main
   column starts to crowd it, so we hide. */
@media (max-width: 1180px) {
  .page-toc { display: none; }
}
