/**
 * GD Theme Tweaks – Inhaltsverzeichnis im Text.
 * Farben und Schrift aus den Tokens des Child-Themes (--afn-*), sonst Ersatzwerte.
 * Hauptpunkte mit Nummernfeld (bei „nummeriert“), Unterpunkte mit kurzem Strich wie im
 * Randverzeichnis. Marken sitzen rechnerisch mittig auf der ersten Zeile: Zeilenhöhe 1,45 →
 * Mitte bei 0,725 em.
 */
html .gd-toc {
	--gd-toc-ink: var(--afn-ink, #231F1C);
	--gd-toc-ink-soft: var(--afn-ink-soft, #5B544C);
	--gd-toc-card: var(--afn-card, #FFFFFF);
	--gd-toc-surface: var(--afn-surface, #ECEAE4);
	--gd-toc-line: var(--afn-line, #DEDAD2);
	--gd-toc-line-strong: var(--afn-line-strong, #C9C4BA);
	--gd-toc-accent: var(--afn-accent, #C2410C);
	--gd-toc-on-accent: var(--afn-on-accent, #FFFFFF);
	--gd-toc-font: var(--afn-font-sans, system-ui, -apple-system, "Segoe UI", sans-serif);
	--gd-toc-font-head: var(--afn-font-head, var(--gd-toc-font));
	--gd-toc-radius: var(--afn-radius, 12px);
	--gd-toc-radius-sm: var(--afn-radius-sm, 8px);

	position: relative;
	margin: 2em 0 2.2em;
	padding: 18px 22px 18px 24px;
	background: var(--gd-toc-card);
	border: 1px solid var(--gd-toc-line);
	border-radius: var(--gd-toc-radius);
	font-family: var(--gd-toc-font);
	overflow: hidden;
}

/* Gruppen, die nur das Verzeichnis umschließen (früher für Schatten/Hintergrund um das Powerkit-
   Verzeichnis angelegt): Hülle neutralisieren, das Verzeichnis bringt seine Karte selbst mit. */
html .wp-block-group:has(> .gd-toc:only-child),
html .wp-block-group:has(> .wp-block-group__inner-container > .gd-toc:only-child) {
	padding: 0 !important;
	border: 0 !important;
	background: none !important;
	box-shadow: none !important;
}

html .wp-block-group:has(> .gd-toc:only-child) > .gd-toc,
html .wp-block-group:has(> .wp-block-group__inner-container > .gd-toc:only-child) .gd-toc {
	margin: 0;
}

/* Feiner Akzent links, wie eine Lesezeichen-Kante */
html .gd-toc::before {
	content: "";
	position: absolute;
	inset: 0 auto 0 0;
	width: 4px;
	background: var(--gd-toc-accent);
}

html .gd-toc__head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 12px;
}

html .gd-toc__title {
	flex: 1 1 auto;
	font-family: var(--gd-toc-font-head);
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -0.005em;
	color: var(--gd-toc-ink);
}

html .gd-toc.is-closed .gd-toc__head {
	margin-bottom: 0;
}

/* Ein-/Ausklappen: kleine Umriss-Taste; Theme-Knopfstile bewusst neutralisiert */
html .gd-toc button.gd-toc__toggle {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	flex: none;
	margin: 0 0 0 auto;
	min-height: 0;
	padding: 4px 9px 4px 11px;
	border: 1px solid var(--gd-toc-line-strong);
	border-radius: 999px;
	background: transparent !important;
	box-shadow: none !important;
	color: var(--gd-toc-ink-soft) !important;
	font-family: var(--gd-toc-font) !important;
	font-size: 12px !important;
	font-weight: 700 !important;
	letter-spacing: 0.06em !important;
	line-height: 1.2 !important;
	text-transform: uppercase !important;
	cursor: pointer;
	transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}

html .gd-toc button.gd-toc__toggle[hidden] {
	display: none;
}

html .gd-toc button.gd-toc__toggle:hover,
html .gd-toc button.gd-toc__toggle:focus-visible {
	border-color: var(--gd-toc-ink);
	color: var(--gd-toc-ink) !important;
}

html .gd-toc .gd-toc__toggle svg {
	transition: transform 0.2s;
}

html .gd-toc.is-closed .gd-toc__toggle svg {
	transform: rotate(180deg);
}

html .gd-toc.is-closed .gd-toc__list {
	display: none;
}

/* Listen */
html .gd-toc ol {
	list-style: none;
	margin: 0;
	padding: 0;
}

html .gd-toc li {
	margin: 0;
	padding: 0;
}

html .gd-toc li::before,
html .gd-toc li::marker {
	content: none;
}

html .gd-toc a {
	color: inherit;
	text-decoration: none;
	background: none;
	box-shadow: none;
	border: 0;
}

html .gd-toc a:hover,
html .gd-toc a:focus-visible {
	color: var(--gd-toc-accent);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

/* Hauptpunkte */
html .gd-toc__list {
	counter-reset: gd-toc;
}

html .gd-toc__list > li {
	position: relative;
	padding: 5px 0 5px 0;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.45;
	color: var(--gd-toc-ink);
}

html .gd-toc.is-numbered .gd-toc__list > li {
	counter-increment: gd-toc;
	padding-left: 34px;
}

html .gd-toc.is-numbered .gd-toc__list > li::before {
	content: counter(gd-toc);
	position: absolute;
	left: 0;
	top: calc(5px + 0.725em - 11px);
	width: 22px;
	height: 22px;
	display: grid;
	place-items: center;
	border-radius: 6px;
	/* !important: Das Child-Theme färbt alle li::before in nummerierten Listen mit !important */
	background: var(--gd-toc-accent) !important;
	color: var(--gd-toc-on-accent);
	font-size: 12px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	line-height: 1;
}

/* Ohne Nummern: kleiner Block in Akzentfarbe */
html .gd-toc:not(.is-numbered) .gd-toc__list > li {
	padding-left: 20px;
}

html .gd-toc:not(.is-numbered) .gd-toc__list > li::before {
	content: "";
	position: absolute;
	left: 0;
	top: calc(5px + 0.725em - 4px);
	width: 8px;
	height: 8px;
	border-radius: 2px;
	background: var(--gd-toc-accent) !important;
}

/* Unterpunkte: eingerückt bis zur Textkante, kurzer Strich */
html .gd-toc__sub {
	margin: 3px 0 2px;
}

html .gd-toc__sub > li {
	position: relative;
	padding: 3px 0 3px 18px;
	font-size: 15px;
	font-weight: 400;
	line-height: 1.45;
	color: var(--gd-toc-ink-soft);
}

html .gd-toc__sub > li::before {
	content: "";
	position: absolute;
	left: 0;
	top: calc(3px + 0.725em - 1px);
	width: 9px;
	height: 2px;
	border-radius: 1px;
	background: color-mix(in srgb, var(--gd-toc-accent) 55%, transparent) !important;
}

html .gd-toc__sub .gd-toc__sub > li {
	font-size: 14px;
}

html .gd-toc__sub > li:hover::before {
	background: var(--gd-toc-accent) !important;
}

@media (max-width: 600px) {
	html .gd-toc {
		padding: 14px 16px 14px 18px;
	}
	html .gd-toc__list > li {
		font-size: 15px;
	}
	html .gd-toc__sub > li {
		font-size: 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	html .gd-toc .gd-toc__toggle,
	html .gd-toc .gd-toc__toggle svg {
		transition: none;
	}
}

@media print {
	html .gd-toc button.gd-toc__toggle {
		display: none;
	}
	html .gd-toc.is-closed .gd-toc__list {
		display: block;
	}
}
