/* ---- margin TOC -------------------------------------------------- */
#TOC {
  /* Tune these two only. */
  --toc-inset: 1rem;   /* gap from the page's left edge   */
  --toc-gap:   2rem;   /* gap between TOC and body text   */

  float: left;
  clear: left;
  width: calc(12.5vw - var(--toc-inset) - var(--toc-gap));
  max-width: 15rem;
  margin-left: calc(-12.5vw + var(--toc-inset));
  margin-top: 4rem;
  margin-bottom: 2rem;
  padding: 0;
  text-align: left;
  position: sticky;
  top: 1.5rem;

  /* stop long entries spilling into the text column */
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Index link and Contents summary share one look. */
#TOC .toc-home-link,
#TOC .toc-title {
  display: block;
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: normal;
  font-style: normal;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
  text-decoration: none;
  color: inherit;
  opacity: 0.55;
}

#TOC .toc-home-link { margin-bottom: 0.6rem; }

#TOC .toc-home-link:hover,
#TOC .toc-home-link:focus,
#TOC .toc-title:hover {
  opacity: 0.9;
  text-decoration: none;
}

#TOC .toc-title { cursor: pointer; list-style: none; }
#TOC .toc-title::-webkit-details-marker { display: none; }
#TOC .toc-details[open] > .toc-title { opacity: 0.85; }

/* entries */
#TOC .toc-body ul {
  list-style: none;
  margin: 0.35rem 0 0 0;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1.35;
}
#TOC .toc-body ul ul { padding-right: 0.9em; padding-left: 0; font-size: 0.92em; }
#TOC .toc-body li { margin: 0.15rem 0; }
#TOC .toc-body a { text-decoration: none; color: inherit; opacity: 0.75; }
#TOC .toc-body a:hover,
#TOC .toc-body a:focus { opacity: 1; text-decoration: underline; }
#TOC .toc-num { opacity: 0.5; font-variant-numeric: tabular-nums; }

h1, h2, h3, h4, h5, h6 { scroll-margin-top: 1.5rem; }

@media (max-width: 1150px) {
  #TOC {
    float: none;
    width: 100%;
    max-width: none;
    margin: 0 0 2rem 0;
    padding: 0;
    position: static;
    max-height: none;
    overflow: visible;
    overflow-wrap: normal;
    hyphens: manual;
    text-align: left;
  }
  #TOC .toc-home-link {
    margin: 0 0 0.6rem 0;
    padding-top: 0.6rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0);
    padding-bottom: 0.5rem;
  }
  #TOC .toc-body { columns: 2; column-gap: 2rem; padding-bottom: 1rem; }
}

@media (max-width: 760px) { #TOC .toc-body { columns: 1; } }
@media print { #TOC { display: none; } }
