/* Article table of contents. Static in-page navigation: plain anchors, no script. */
@layer components {
  .c-toc { max-width: var(--content); padding: var(--space-4) var(--space-6) var(--space-6); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); }
  .c-toc__title { margin-bottom: var(--space-2); font-family: var(--font-sans); font-size: var(--fs-sm); font-weight: var(--fw-semibold); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
  .c-toc__list, .c-toc__list ol { margin: 0; padding: 0; list-style: none; }
  .c-toc li { display: flex; flex-wrap: wrap; align-items: baseline; }
  .c-toc li::before { content: ""; flex: none; inline-size: 0.5em; block-size: 0.5em; margin-inline-end: var(--space-3); border-radius: 50%; background: var(--accent); }
  .c-toc a { flex: 1 1 0; min-inline-size: 0; display: block; padding-block: var(--space-2); min-block-size: var(--tap); box-sizing: border-box; font-family: var(--font-sans); font-size: var(--fs-md); line-height: var(--lh-snug); color: var(--ink); text-decoration: none; hyphens: auto; overflow-wrap: anywhere; align-content: center; }
  .c-toc a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 0.2em; }
  .c-toc a:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: var(--focus-offset); }
  /* Sub-headings: indented, lighter marker and text. */
  .c-toc li > ol { flex: 0 0 100%; padding-inline-start: var(--space-6); }
  .c-toc li > ol li::before { inline-size: 0.4em; block-size: 0.4em; border-radius: 0; background: none; border: 1px solid var(--accent); }
  .c-toc li > ol a { font-size: var(--fs-sm); color: var(--ink-muted); min-block-size: 0; padding-block: var(--space-2); }

  /* Linked headings must not stick to the viewport top; the target is subtly marked. */
  .article-body :is(h2, h3) { scroll-margin-block-start: var(--space-16); }
  .article-body :is(h2, h3):target { background: linear-gradient(to right, var(--sponsored-bg), transparent); box-shadow: -0.5rem 0 0 var(--sponsored-bg); }

  @media (prefers-reduced-motion: no-preference) {
    html:has(.c-toc) { scroll-behavior: smooth; }
  }

  /* Not worth the paper. */
  @media print {
    .c-toc { display: none; }
  }
}
