/* Navigation menu of the markdown blocks with `design: toc: true`
   (layouts/partials/blox/markdown.html, static/js/page-toc.js). */

:root { --toc-top: 5rem; --toc-accent: #2563eb; }
.dark { --toc-accent: #60a5fa; }

html { scroll-padding-top: calc(var(--toc-top) + 0.5rem); }

/* Small screens: a sticky bar of links above the text. */
.page-toc {
  position: sticky; top: var(--toc-top); z-index: 20;
  margin: 0 -1.5rem 1rem; padding: 0.5rem 1.5rem;
  background: rgba(255, 255, 255, 0.95); border-bottom: 1px solid #e5e7eb;
  font-size: 0.9rem;
}
.dark .page-toc { background: rgba(17, 24, 39, 0.95); border-color: #374151; }
.page-toc-title, .page-toc-top, .page-toc li.toc-h3 { display: none; }
.page-toc ul { display: flex; gap: 1.25rem; overflow-x: auto; white-space: nowrap; margin: 0; padding: 0; list-style: none; }
.page-toc a { color: #4b5563; text-decoration: none; }
.dark .page-toc a { color: #9ca3af; }
.page-toc a:hover { color: var(--toc-accent); }
.page-toc a.active { color: var(--toc-accent); font-weight: 600; }

/* Wide screens: a sticky column on the left. */
@media (min-width: 1024px) {
  .page-toc-layout { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 3rem; }
  .page-toc-main { grid-column: 2; grid-row: 1; }
  .page-toc {
    grid-column: 1; grid-row: 1; align-self: start;
    margin: 6rem 0 0; padding: 0 0 0 1rem;
    background: none; border: 0; border-left: 2px solid #e5e7eb;
  }
  .dark .page-toc { background: none; border-color: #374151; }
  .page-toc-title { display: block; margin-bottom: 0.6rem; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #6b7280; }
  .page-toc ul { display: block; white-space: normal; }
  .page-toc li { margin: 0.35rem 0; line-height: 1.3; }
  .page-toc li.toc-h3 { display: block; padding-left: 0.9rem; font-size: 0.85rem; }
  .page-toc-top { display: block; margin-top: 1.2rem; font-size: 0.8rem; }
}

/* Copyable anchor next to the headings. */
.page-toc-content :is(h2, h3) { position: relative; }
.page-toc-content .heading-anchor {
  margin-left: 0.4em; font-weight: 400; color: #9ca3af; text-decoration: none; opacity: 0;
  transition: opacity 0.15s;
}
.page-toc-content :is(h2, h3):hover .heading-anchor, .page-toc-content .heading-anchor:focus { opacity: 1; }

/* Tables: smaller text, horizontal scroll on small screens. */
.page-toc-content table { font-size: 0.8em; }
@media (max-width: 767px) { .page-toc-content table { display: block; overflow-x: auto; } }
.page-toc-content td { vertical-align: top; }
.page-toc-content tbody td:first-child, .page-toc-content thead th:first-child { padding-left: 0.6em; }
/* Session tables (rows with a date): keep dates and links on one line, give the topic room. */
.page-toc-content tr:has(time) td:nth-child(2), .page-toc-content tr:has(time) td:nth-child(3),
.page-toc-content tr:has(time) td:last-child { white-space: nowrap; }
.page-toc-content tr:has(time) td:nth-child(4) { min-width: 16em; }
.page-toc-content tr.session-past td { color: inherit; }
.page-toc-content tr.session-next { background: rgba(37, 99, 235, 0.08); }
.page-toc-content tr.session-next td:first-child { box-shadow: inset 3px 0 0 var(--toc-accent); }
.page-toc-content tr.session-upcoming td { color: #9ca3af; }

/* Summary box at the top of the page. */
.page-toc-content .glance {
  margin: 1.5rem 0 2rem; padding: 0.4rem 1.4rem 0.6rem; border-radius: 0.5rem;
  border: 1px solid #dbeafe; border-left: 4px solid var(--toc-accent); background: #f8fafc;
}
.dark .page-toc-content .glance { border-color: #1e3a8a; border-left-color: var(--toc-accent); background: rgba(30, 41, 59, 0.5); }
.page-toc-content .glance h2 { margin-top: 0.8em; font-size: 1.15em; }
.page-toc-content .glance ul { margin-top: 0.3em; }
.page-toc-content .glance li { margin: 0.2em 0; }

/* Collapsible troubleshooting entries. */
.page-toc-content details { margin: 0.6em 0; padding: 0.5em 1em; border: 1px solid #e5e7eb; border-radius: 0.4rem; }
.dark .page-toc-content details { border-color: #374151; }
.page-toc-content summary { cursor: pointer; font-weight: 600; }
.page-toc-content details[open] summary { margin-bottom: 0.5em; }
