/* ── SCU Wiki — Table of Contents ─────────────────────────────────────── */

.scu-wiki-toc {
  display: inline-block;
  min-width: 220px;
  max-width: 420px;
  margin: 0 0 2rem 0;
  padding: 0;
  background: #ffffff;   /* list area is white */
  border: 1px solid #d0d7de;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.5;
  overflow: hidden;
}

/* ── Header bar ── */
.scu-wiki-toc__title {
  display: block;
  padding: 0.55rem 1rem;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #24292f;
  background: #f6f8fa;
  border-bottom: 1px solid #d0d7de;
}

/* ── Top-level ordered list ──
   list-style-position: inside keeps markers inside the box
   (outside markers get clipped by overflow:hidden on the container) */
.scu-wiki-toc__list {
  margin: 0;
  padding: 0.6rem 1rem;
  list-style: decimal inside;
  color: #24292f;
}

.scu-wiki-toc__list > li {
  padding: 0.18rem 0;
  line-height: 1.45;
}

/* ── Sub-list (h3) — indented, alpha ── */
.scu-wiki-toc__sub {
  margin: 0.25rem 0 0.1rem 1.2rem;
  padding: 0;
  list-style: lower-alpha inside;
}

.scu-wiki-toc__sub li {
  padding: 0.12rem 0;
  color: #57606a;
}

/* Third level (h4) — roman numerals */
.scu-wiki-toc__sub .scu-wiki-toc__sub {
  list-style: lower-roman inside;
  margin-left: 1rem;
}

/* ── Links ── */
.scu-wiki-toc a {
  color: #cf4520;
  text-decoration: none;
  font-weight: 400;
}

.scu-wiki-toc a:hover {
  text-decoration: underline;
  color: #a8371a;
}

/* ── Heading anchor icons ─────────────────────────────────────────────── */

h2[id], h3[id], h4[id] {
  position: relative;
}

.scu-wiki-heading-anchor {
  display: inline-flex;
  align-items: center;
  margin-left: 0.4em;
  color: #adb5bd;
  opacity: 0.4;           /* faintly visible always */
  transition: opacity 0.15s ease, color 0.15s ease;
  text-decoration: none !important;
  font-size: 0.8em;
  vertical-align: middle;
  cursor: pointer;
  position: relative;
}

h2[id]:hover .scu-wiki-heading-anchor,
h3[id]:hover .scu-wiki-heading-anchor,
h4[id]:hover .scu-wiki-heading-anchor,
.scu-wiki-heading-anchor:hover {
  opacity: 1;
  color: #cf4520 !important;
}

/* Copied! tooltip */
.scu-wiki-heading-anchor::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 0.4em);
  top: 50%;
  transform: translateY(-50%);
  background: #24292f;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.2em 0.5em;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.scu-wiki-heading-anchor.copied::after {
  opacity: 1;
}

/* ── Estimated read time badge ───────────────────────────────────────── */

.scu-wiki-read-time {
  display: inline-flex;
  align-items: center;
  gap: 0.2em;
  font-size: 0.82rem;
  color: #57606a;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ── CSS custom properties for admin-configurable TOC colors ────────────
   Defaults match the static CSS above; overridden by inline :root vars
   injected by TocFilter when admin has saved custom values.            */
.scu-wiki-toc {
  --toc-bg:          #ffffff;
  --toc-header-bg:   #f6f8fa;
  --toc-border:      #d0d7de;
  --toc-link-color:  #cf4520;
  --toc-link-hover:  #a8371a;
  --toc-text:        #24292f;

  background:    var(--toc-bg);
  border-color:  var(--toc-border);
}

.scu-wiki-toc__title {
  background:    var(--toc-header-bg);
  border-color:  var(--toc-border);
  color:         var(--toc-text);
}

.scu-wiki-toc a       { color: var(--toc-link-color); }
.scu-wiki-toc a:hover { color: var(--toc-link-hover); }
