/* Floating table-of-contents widget (#table-of-contents): its own
 * structure plus this site's color/position overrides. */


/* Floating TOC widget */
#table-of-contents {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1000;

  width: 280px;
  max-height: calc(100vh - 2rem);

  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);

  overflow: hidden;
}

/* Heading bar */
#table-of-contents > h2 {
  margin: 0;
  padding: 0.75rem 1rem;

  font-size: 0.95rem;
  font-weight: 600;

  cursor: pointer;
  user-select: none;

  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Menu icon */
#table-of-contents > h2::before {
  content: "☰";
  font-size: 1rem;
  line-height: 1;
}

/* Collapsed body by default */
#text-table-of-contents {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

/* Show body on hover or keyboard focus */
#table-of-contents:hover #text-table-of-contents,
#table-of-contents:focus-within #text-table-of-contents {
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
}

/* TOC list styling */
#text-table-of-contents ul {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0.75rem 0.75rem;
}

#text-table-of-contents ul ul {
  padding-left: 1rem;
}

#text-table-of-contents li {
  margin: 0.25rem 0;
}

#text-table-of-contents a {
  display: block;
  padding: 0.25rem 0.35rem;

  color: #333;
  text-decoration: none;
  line-height: 1.35;
  border-radius: 6px;
}

#text-table-of-contents a:hover {
  background: #f2f2f2;
}

/* Clear the slim nav bar above — it now spans the full page width. */
#table-of-contents {
  top: 4rem;
  max-height: calc(100vh - 5rem);

  background: var(--site-paper);
  border: none;
  box-shadow: 0 1px 2px rgba(27, 31, 35, 0.05), 0 6px 20px rgba(27, 31, 35, 0.08);
}

#table-of-contents > h2 {
  font-family: var(--site-serif);
  color: var(--site-ink);
}

#table-of-contents > h2::before {
  color: var(--site-accent);
}

#text-table-of-contents a {
    font-family: var(--site-sans);
    font-size: 0.9rem;
  color: var(--site-dim);
}

#text-table-of-contents a:hover {
  background: var(--site-mono-tint);
  color: var(--site-accent);
}
