/* Barrierefreies Glossar
 * Farben über Custom Properties anpassbar, z. B. im Child-Theme:
 *   :root { --bfg-accent: #c00; }
 * Ohne --bfg-accent wird --icon des Themes verwendet – und zwar der Wert, der am
 * jeweiligen Begriff gilt (also auch kategorieabhängige Farben).
 */
.bfg-term,
.bfg-info {
	--bfg-c: var(--bfg-accent, var(--icon, currentColor));
}

:root {
	--bfg-tip-bg: #fff;
	--bfg-tip-fg: #000;
	--bfg-tip-border: #767676; /* 4.5:1 auf Weiß */
	--bfg-target-bg: rgba(255, 220, 0, .25);
}

/* ---------- Begriff im Text ---------- */

a.bfg-term.bfg-term,
span.bfg-term {
	color: inherit;
	text-decoration: none;
	border-bottom: 2px dashed var(--bfg-c);
	cursor: help;
}

a.bfg-term.bfg-term:hover {
	border-bottom-style: solid;
}

.bfg-term:focus-visible {
	outline: 2px solid var(--bfg-c);
	outline-offset: 2px;
	border-radius: 2px;
}

/* ---------- Info-Icon hinter Überschriften ---------- */

.bfg-info {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;  /* Zielgröße ≥ 24 × 24 px (WCAG 2.5.8) */
	min-height: 24px;
	vertical-align: middle;
	position: relative;
	top: -.35em; /* leicht hochgestellt, wie ein Fußnotenzeichen */
	color: var(--bfg-c);
	text-decoration: none;
	cursor: help;
	border-radius: 50%;
}

.bfg-info .bfg-info-icon {
	width: .75em;
	height: .75em;
	min-width: 18px;
	min-height: 18px;
}

.bfg-info:hover .bfg-info-icon circle:first-child {
	fill: currentColor;
	fill-opacity: .15;
}

.bfg-info:focus-visible {
	outline: 2px solid var(--bfg-c);
	outline-offset: 2px;
}

.bfg-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Tooltip ---------- */

.bfg-tip {
	position: absolute;
	z-index: 100000;
	box-sizing: border-box;
	max-width: min(22rem, calc(100vw - 16px));
	padding: .75rem 1rem;
	background: var(--bfg-tip-bg);
	color: var(--bfg-tip-fg);
	border: 1px solid var(--bfg-tip-border);
	border-radius: 6px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
	font-size: .9rem;
	font-style: normal;
	font-weight: 400;
	line-height: 1.5;
	text-align: left;
	hyphens: auto;
	overflow-wrap: break-word;
}

.bfg-tip[hidden] {
	display: none;
}

/* Pfeil */
.bfg-tip::before {
	content: "";
	position: absolute;
	left: var(--bfg-arrow-x, 50%);
	width: 10px;
	height: 10px;
	background: inherit;
	border: inherit;
	border-width: 1px 0 0 1px;
	transform: translateX(-50%) rotate(45deg);
}

.bfg-tip[data-placement="bottom"]::before {
	top: -6px;
}

.bfg-tip[data-placement="top"]::before {
	bottom: -6px;
	transform: translateX(-50%) rotate(225deg);
}

@media (prefers-reduced-motion: no-preference) {
	.bfg-tip {
		animation: bfg-fade .12s ease-out;
	}

	@keyframes bfg-fade {
		from { opacity: 0; }
		to   { opacity: 1; }
	}
}

@media (forced-colors: active) {
	.bfg-tip::before {
		display: none;
	}
}

/* ---------- Glossar-Seite ---------- */

.bfg-az ul {
	display: flex;
	flex-wrap: wrap;
	gap: .35rem;
	margin: 0 0 2rem;
	padding: 0;
	list-style: none;
}

.bfg-az a {
	display: inline-block;
	min-width: 2.75rem; /* Zielgröße ≥ 24 px (WCAG 2.5.8) */
	padding: .5rem;
	text-align: center;
	border: 1px solid currentColor;
	border-radius: 4px;
	text-decoration: none;
}

.bfg-az a:hover,
.bfg-az a:focus-visible {
	text-decoration: underline;
}

.bfg-glossary dl {
	margin: 0 0 2rem;
}

.bfg-glossary dt {
	margin-top: 1.5rem;
	font-weight: 700;
	scroll-margin-top: 6rem; /* Platz für feste Kopfzeilen */
}

.bfg-glossary dt dfn {
	font-style: normal;
}

.bfg-glossary dd {
	margin: .25rem 0 0;
}

.bfg-glossary dd > :last-child {
	margin-bottom: 0;
}

.bfg-glossary dt:target,
.bfg-glossary dt:target + dd {
	background: var(--bfg-target-bg);
	outline: 4px solid var(--bfg-target-bg);
}

.bfg-alts {
	font-size: .9em;
	font-style: italic;
}

.bfg-letter > :is(h2, h3, h4) {
	scroll-margin-top: 6rem;
}
