/* ==================================================
   Automatische inhoudsopgave — Stadsthema
================================================== */
.aow-toc {
  --toc-bg: #fbf8f2;
  --toc-border: #e7dbc2;
  --toc-accent: var(--brand, #b21010);
  --toc-text: var(--text, #222);
  --toc-muted: #8a7f6c;

  position: relative;
  margin: 1.75rem 0 2.25rem;
  padding: 1.25rem 1.5rem 1.1rem;
  background: var(--toc-bg);
  border: 1px solid var(--toc-border);
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(0,0,0,.02), 0 8px 24px -18px rgba(80, 50, 20, .35);
  font-size: var(--fs-card, 16px);
  line-height: 1.4;
}
.aow-toc::before {
  content: "";
  position: absolute; left: -1px; top: 18px; bottom: 18px;
  width: 4px; border-radius: 0 4px 4px 0;
  background: var(--toc-accent);
}

.aow-toc__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  margin-bottom: .6rem;
}
.aow-toc__eyebrow {
  font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--toc-accent);
}
.aow-toc__meta { font-size: 13px; color: var(--toc-muted); }

.aow-toc__list,
.entry-content .aow-toc__list {
  list-style: none; margin: 0; padding: 0;
  font-size: inherit; line-height: inherit;
}
.entry-content .aow-toc__item { margin: 0; }
.aow-toc__item + .aow-toc__item { border-top: 1px dashed var(--toc-border); }

.aow-toc__item a {
  display: flex; align-items: baseline; gap: .85rem;
  padding: .55rem .25rem;
  color: var(--toc-text) !important;
  text-decoration: none !important;
  border-radius: 6px;
  transition: background .15s ease, color .15s ease;
}
.aow-toc__item a:hover,
.aow-toc__item a:focus-visible {
  background: rgba(var(--brand-rgb,178,16,16), .06);
  color: var(--toc-accent) !important;
}
.aow-toc__item a:hover .aow-toc__text { text-decoration: underline; text-underline-offset: 3px; }

.aow-toc__num {
  flex: 0 0 auto;
  min-width: 1.6em;
  font-variant-numeric: tabular-nums;
  font-size: .85em; font-weight: 700;
  color: var(--toc-accent);
  opacity: .85;
}
.aow-toc__text { flex: 1 1 auto; }

/* Inklappen na X items */
.aow-toc__list.is-folded .aow-toc__item--extra { display: none; }
.aow-toc__more {
  display: inline-flex; align-items: center; gap: .4rem;
  margin: .5rem 0 0 .25rem; padding: .35rem 0;
  background: none; border: 0; cursor: pointer;
  font: inherit; font-size: 15px; font-weight: 600;
  color: var(--toc-accent);
}
.aow-toc__more::after { content: "▾"; transition: transform .2s ease; }
.aow-toc__more[aria-expanded="true"]::after { transform: rotate(180deg); }
.aow-toc__more:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Zwevende knop + paneel ---------- */
.aow-toc-fab {
  --toc-accent: var(--brand, #b21010);
  position: fixed; left: 20px; bottom: calc(20px + var(--aow-toc-offset, 0px));
  z-index: 90;
  display: inline-flex; align-items: center; gap: .55rem;
  max-width: min(360px, calc(100vw - 100px));
  padding: .6rem 1rem .6rem .8rem;
  background: #fff; color: #222;
  border: 1px solid #e7dbc2; border-radius: 999px;
  box-shadow: 0 10px 30px -10px rgba(40, 20, 0, .35);
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2;
  cursor: pointer; overflow: hidden;
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.aow-toc-fab.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.aow-toc-fab svg { flex: 0 0 auto; width: 18px; height: 18px; stroke: var(--toc-accent); fill: none; stroke-width: 2; stroke-linecap: round; }
.aow-toc-fab__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aow-toc-fab__count { flex: 0 0 auto; font-weight: 500; color: #8a7f6c; font-variant-numeric: tabular-nums; }
.aow-toc-fab__bar {
  position: absolute; left: 0; bottom: 0; height: 3px;
  width: var(--aow-toc-progress, 0%);
  background: var(--toc-accent);
  transition: width .15s linear;
}

.aow-toc-panel {
  --toc-accent: var(--brand, #b21010);
  position: fixed; left: 20px; bottom: calc(76px + var(--aow-toc-offset, 0px));
  z-index: 91;
  width: min(380px, calc(100vw - 40px));
  max-height: min(60vh, 520px); overflow: auto;
  padding: .9rem .6rem .6rem;
  background: #fff;
  border: 1px solid #e7dbc2; border-radius: 16px;
  box-shadow: 0 24px 60px -20px rgba(40, 20, 0, .45);
  opacity: 0; transform: translateY(10px) scale(.98); transform-origin: bottom left;
  pointer-events: none; visibility: hidden;
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}
.aow-toc-panel.is-open {
  opacity: 1; transform: none; pointer-events: auto; visibility: visible;
  transition: opacity .18s ease, transform .18s ease;
}
.aow-toc-panel__title {
  margin: 0 .6rem .4rem; font-size: 12px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--toc-accent);
}
.aow-toc-panel ol { list-style: none; margin: 0; padding: 0; }
.aow-toc-panel li { margin: 0; }
.aow-toc-panel a {
  display: flex; gap: .7rem; align-items: baseline;
  padding: .5rem .6rem; border-radius: 8px;
  color: #222 !important; text-decoration: none !important;
  font-size: 15px; line-height: 1.35;
}
.aow-toc-panel a:hover { background: #fbf8f2; }
.aow-toc-panel a .aow-toc__num { font-size: 12px; }
.aow-toc-panel a.is-active { background: var(--brand-soft, #fbf2f2); color: var(--toc-accent) !important; font-weight: 600; }

@media (max-width: 768px) {
  .aow-toc { padding: 1rem 1.1rem .9rem; margin: 1.25rem 0 1.75rem; }
  .aow-toc__item a { padding: .6rem .15rem; }   /* ruimer tikvlak */
  .aow-toc-fab { left: 12px; bottom: calc(12px + var(--aow-toc-offset, 0px)); font-size: 14px; }
  .aow-toc-panel {
    left: 0; right: 0; bottom: 0; width: 100%;
    max-height: 70vh; border-radius: 18px 18px 0 0;
    padding: 1rem .75rem calc(1rem + env(safe-area-inset-bottom));
    transform: translateY(100%);
  }
  .aow-toc-panel.is-open { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .aow-toc-fab, .aow-toc-panel, .aow-toc-fab__bar { transition: none; }
}
@media print { .aow-toc-fab, .aow-toc-panel { display: none !important; } }
