/* The sources list's table of contents. It uses the list's own colours (--bg, --ink, --soft, --rule,
   --red). By default it is a button in the corner that opens a panel; once toc.js has run and the
   screen is wide enough to have room beside the list, it stands open there instead. */
.toc { position: fixed; z-index: 5; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); font: 14px/1.3 Helvetica, Arial, sans-serif; }
.toc summary { list-style: none; cursor: pointer; display: block; padding: 11px 16px; background: var(--ink); color: var(--bg); font-weight: 700; box-shadow: 0 4px 18px rgba(0, 0, 0, .28); user-select: none; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: "↑"; margin-left: 10px; }
.toc details[open] summary::after { content: "×"; }
.toc summary:focus-visible, .toc a:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.toc .panel { position: absolute; right: 0; bottom: calc(100% + 8px); width: min(300px, calc(100vw - 32px)); max-height: min(70vh, 540px); overflow-y: auto; padding: 6px 0; background: var(--bg); border: 1px solid var(--rule); box-shadow: 0 8px 30px rgba(0, 0, 0, .28); }
.toc a { display: block; padding: 8px 16px; color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--red); }
.toc a[aria-current] { color: var(--red); box-shadow: inset 3px 0 0 var(--red); }
.toc .back { margin-bottom: 4px; padding-bottom: 11px; border-bottom: 1px solid var(--rule); font-weight: 700; }

@media (min-width: 1320px) {
  .toc.wide { right: auto; bottom: auto; top: 40px; left: calc(50% - 430px - 252px); width: 224px; }
  .toc.wide summary { padding: 0 16px 10px; background: none; color: var(--soft); box-shadow: none; pointer-events: none; font: 700 12px/1 Menlo, monospace; letter-spacing: .1em; text-transform: uppercase; }
  .toc.wide summary::after, .toc.wide details[open] summary::after { content: none; }
  .toc.wide .panel { position: static; width: auto; max-height: calc(100vh - 110px); padding: 0; background: none; border: 0; box-shadow: none; }
  .toc.wide a { padding: 6px 16px; }
}
@media print { .toc { display: none; } }
