/*
 * WEPRO Förderung Feed — frontend.
 *
 * Every colour, radius and space is a --wdt-* design token with a literal fallback,
 * so the sheet renders correctly on a tenant that has not installed wepro-design-tokens
 * and inherits the brand automatically on one that has.
 */

.wff {
	--wff-gap: var(--wdt-space-md, 1.25rem);

	/*
	 * THE HOST THEME'S SURFACE COMES FIRST, AND THAT IS A DARK-MODE FIX.
	 *
	 * `--wdt-*` is a single light palette: Design Tokens does not re-declare it when
	 * the page switches to a dark surface. A theme that DOES swap (the WEPRO agency
	 * family swaps `--wap-*` under `[data-wap-theme="dark"]`) therefore rendered this
	 * sheet as light-mode islands on a dark page. Measured on the Soluty tenant at
	 * 1440px in dark mode: muted text #6E6C6A on the #12151A page = 2.7:1 against a
	 * 4.5:1 floor, 17 nodes on the archive and 3 on a detail page, and the cards
	 * stayed white rectangles.
	 *
	 * So each local token now reads the host theme first, then `--wdt-*`, then a
	 * literal. Standalone-first is intact in both directions: a tenant without the
	 * agency theme resolves to `--wdt-*` exactly as before, and a tenant without
	 * Design Tokens still gets the literal. Nothing here depends on a plugin or a
	 * theme being loaded — only on a variable being defined if it happens to be.
	 */
	--wff-surface: var(--wap-surface, var(--wdt-color-surface, #fff));
	--wff-surface-alt: var(--wap-surface-alt, var(--wff-surface-alt));
	--wff-border: var(--wap-line, var(--wdt-color-border, #e2e6ea));
	--wff-border-subtle: var(--wap-line-soft, var(--wff-border-subtle));
	--wff-text: var(--wap-ink, var(--wdt-color-text, #1b2733));
	/* `--wap-ink-soft`, not `--wap-ink-faint`: the faint cut is calibrated for large
	   type and this sheet uses muted at .875rem. */
	--wff-muted: var(--wap-ink-soft, var(--wff-muted));
	--wff-radius: var(--wdt-radius-lg, 12px);

	/*
	 * MEASURED 2026-09-13 on this tenant: --wdt-color-primary resolves to #4DB6A0, a
	 * light brand mint. White text on it is ~2.0:1 and it on white is ~2.0:1 — axe
	 * flagged 98 nodes as serious colour-contrast failures. A brand token is not an
	 * ink token, and using it as one is how the whole card grid fails WCAG at once.
	 *
	 * So interactive ink is its OWN variable with an accessible dark default, and the
	 * brand token is used only where it cannot carry text. A tenant may override
	 * --wff-ink, but the default is contrast-safe rather than brand-faithful.
	 */
	/*
	 * NOT `--wap-primary-ink`, and the attempt is recorded so nobody repeats it:
	 * this variable is a FILL that carries white label text, while a theme's
	 * primary-ink is a TEXT colour picked to sit ON a light surface. Reading one
	 * into the other put white on the brand mint in dark mode — measured 2.46:1 on
	 * the filter submit and the official-site link. Its own accessible default is
	 * the point of the variable.
	 */
	--wff-ink: var(--wdt-color-primary-ink, #12463C);        /* white on this: 9.4:1 */
	--wff-ink-hover: var(--wdt-color-primary-ink-hover, #0C332C);
	--wff-primary: var(--wff-ink);

	/*
	 * AND THE SAME VARIABLE WAS ALSO DOING A TEXT JOB.
	 *
	 * `--wff-ink` is a dark green chosen so WHITE sits on it. Three consumers use it
	 * as the text colour instead — the source link on every card, the ghost button
	 * and the current pagination link's neighbours — and on a dark page that is
	 * 1.6:1. A fill colour and a text colour cannot be the same variable once the
	 * surface can invert, so the text role gets its own name.
	 *
	 * It reads the host theme's link ink first, which is the value a theme has
	 * already picked to be legible on whichever surface is current (the WEPRO agency
	 * family swaps it under `[data-wap-theme="dark"]`), and falls back to the fill
	 * colour, which is correct on the light ground this sheet was designed against.
	 */
	--wff-ink-text: var(--wap-link-ink, var(--wdt-color-primary-ink, #12463C));

	color: var(--wff-text);
	font-family: var(--wdt-type-body-family, inherit);
}

.wff * {
	box-sizing: border-box;
}

/* ── Filters ───────────────────────────────────────────────── */

.wff__filters {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wff-gap);
	align-items: flex-end;
	padding: var(--wdt-space-md, 1.25rem);
	margin: 0 0 var(--wdt-space-lg, 2rem);
	background: var(--wff-surface-alt);
	border: 1px solid var(--wff-border);
	border-radius: var(--wff-radius);
}

.wff__filter {
	display: flex;
	flex-direction: column;
	gap: .35rem;
	margin: 0;
	min-width: 0;
	flex: 1 1 12rem;
}

.wff__filter label {
	font-size: var(--wdt-type-small-size, .875rem);
	font-weight: 600;
	color: var(--wff-muted);
}

.wff__filter select {
	width: 100%;
	max-width: 100%;
	padding: .55rem .7rem;
	border: 1px solid var(--wff-border);
	border-radius: var(--wdt-radius-md, 8px);
	background: var(--wff-surface);
	color: var(--wff-text);
	font: inherit;
}

.wff__filter--actions {
	flex: 0 0 auto;
}

.wff__button {
	display: inline-block;
	padding: .6rem 1.15rem;
	border: 1px solid var(--wff-primary);
	border-radius: var(--wdt-radius-pill, 999px);
	background: var(--wff-primary);
	color: #fff;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: var(--wdt-transition, all .2s ease);
}

.wff__button:hover,
.wff__button:focus {
	background: var(--wff-ink-hover);
	border-color: var(--wff-ink-hover);
	color: #fff;
}

.wff__button--ghost {
	background: transparent;
	color: var(--wff-ink-text);
}

.wff__button--ghost:hover,
.wff__button--ghost:focus {
	background: var(--wff-primary);
	color: #fff;
}

.wff :focus-visible {
	outline: 2px solid var(--wff-primary);
	outline-offset: 2px;
}

/* ── Grid and cards ────────────────────────────────────────── */

.wff__count {
	margin: 0 0 var(--wdt-space-sm, .75rem);
	color: var(--wff-muted);
	font-size: var(--wdt-type-small-size, .875rem);
}

.wff__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
	gap: var(--wff-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.wff-card {
	display: flex;
	flex-direction: column;
	gap: var(--wdt-space-sm, .75rem);
	padding: var(--wdt-space-md, 1.25rem);
	background: var(--wff-surface);
	border: 1px solid var(--wff-border);
	border-radius: var(--wff-radius);
	box-shadow: var(--wdt-shadow-sm, 0 1px 2px rgba(16, 24, 40, .05));
}

.wff-card__title {
	margin: 0;
	font-size: 1.0625rem;
	line-height: 1.35;
	font-family: var(--wdt-type-heading-family, inherit);
}

.wff-card__title a {
	color: inherit;
	text-decoration: none;
}

.wff-card__title a:hover,
.wff-card__title a:focus {
	text-decoration: underline;
}

.wff-badge {
	display: inline-block;
	margin-inline-start: .4rem;
	padding: .1rem .4rem;
	border-radius: var(--wdt-radius-sm, 4px);
	background: var(--wff-surface-alt);
	color: var(--wff-muted);
	font-size: .6875rem;
	font-weight: 700;
	letter-spacing: .04em;
	vertical-align: middle;
}

.wff-card__summary,
.wff-detail__summary {
	margin: 0;
	color: var(--wff-muted);
	font-size: var(--wdt-type-small-size, .9375rem);
	line-height: 1.55;
}

.wff-card__facts,
.wff-detail__facts {
	display: grid;
	gap: .35rem;
	margin: 0;
}

.wff-card__fact,
.wff-detail__fact {
	display: grid;
	grid-template-columns: minmax(7rem, 34%) 1fr;
	gap: .5rem;
	font-size: var(--wdt-type-small-size, .875rem);
}

.wff-card__fact dt,
.wff-detail__fact dt {
	margin: 0;
	color: var(--wff-muted);
	font-weight: 600;
}

.wff-card__fact dd,
.wff-detail__fact dd {
	margin: 0;
	overflow-wrap: anywhere;
}

.wff-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem 1rem;
	justify-content: space-between;
	align-items: baseline;
	margin: auto 0 0;
	padding-top: var(--wdt-space-sm, .75rem);
	border-top: 1px solid var(--wff-border-subtle);
	font-size: .8125rem;
}

.wff-card__checked {
	color: var(--wff-muted);
}

.wff-card__source {
	color: var(--wff-ink-text);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* The request link: a real target (44 px) on a phone, the same ink as the source link. */
.wff-card__request {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--wff-ink-text);
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ── Detail ────────────────────────────────────────────────── */

.wff-detail__lang {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem;
	align-items: baseline;
	margin: 0 0 var(--wdt-space-md, 1.25rem);
	color: var(--wff-muted);
	font-size: var(--wdt-type-small-size, .875rem);
}

.wff-detail__facts {
	margin: var(--wdt-space-md, 1.25rem) 0;
	padding: var(--wdt-space-md, 1.25rem);
	background: var(--wff-surface-alt);
	border-radius: var(--wff-radius);
	gap: .5rem;
}

.wff-detail__cta {
	margin: var(--wdt-space-md, 1.25rem) 0 0;
}

.wff-detail__licence,
.wff__disclaimer,
.wff__attribution-eu {
	margin: var(--wdt-space-sm, .75rem) 0 0;
	color: var(--wff-muted);
	font-size: .8125rem;
	line-height: 1.55;
}

.wff__disclaimer {
	margin-top: var(--wdt-space-lg, 2rem);
	padding-top: var(--wdt-space-sm, .75rem);
	border-top: 1px solid var(--wff-border-subtle);
}

/* ── Empty state and attribution ───────────────────────────── */

.wff-empty {
	padding: var(--wdt-space-lg, 2rem);
	background: var(--wff-surface-alt);
	border: 1px dashed var(--wff-border);
	border-radius: var(--wff-radius);
	text-align: center;
}

.wff-empty h2 {
	margin: 0 0 .5rem;
	font-family: var(--wdt-type-heading-family, inherit);
}

.wff-empty p {
	margin: 0 auto;
	max-width: 46rem;
	color: var(--wff-muted);
	line-height: 1.6;
}

.wff-empty__stale {
	margin-top: .75rem !important;
	font-size: .8125rem;
}

.wff__attribution {
	margin-top: var(--wdt-space-lg, 2rem);
	font-size: .8125rem;
	color: var(--wff-muted);
}

.wff__attribution-title {
	margin: 0 0 .4rem;
	font-size: .875rem;
	color: var(--wff-text);
}

.wff__attribution ul {
	margin: 0;
	padding-inline-start: 1.1rem;
	line-height: 1.6;
}

.wff__attribution a {
	color: inherit;
}

@media (max-width: 40rem) {
	.wff__filters {
		flex-direction: column;
		align-items: stretch;
	}

	.wff-card__fact,
	.wff-detail__fact {
		grid-template-columns: 1fr;
		gap: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wff__button {
		transition: none;
	}
}

/* ── Archive page chrome (plugin template) ─────────────────── */

.wff-archive__inner {
	max-width: var(--wdt-container-max, 74rem);
	margin: 0 auto;
	padding: clamp(2rem, 6vw, 4.5rem) clamp(1rem, 4vw, 2rem);
}

.wff-archive__header {
	margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.wff-archive__title {
	margin: 0 0 .75rem;
	font-family: var(--wdt-type-heading-family, inherit);
	font-size: clamp(1.75rem, 4vw, 2.75rem);
	line-height: 1.15;
}

.wff-archive__intro {
	margin: 0;
	max-width: 56rem;
	color: var(--wff-muted);
	font-size: clamp(1rem, 1.4vw, 1.0625rem);
	line-height: 1.65;
}

/* ── Pagination ────────────────────────────────────────────── */

.wff__pagination {
	display: flex;
	flex-wrap: wrap;
	gap: .4rem;
	justify-content: center;
	margin: var(--wdt-space-lg, 2rem) 0 0;
}

.wff__pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5rem;
	padding: .45rem .7rem;
	border: 1px solid var(--wff-border);
	border-radius: var(--wdt-radius-md, 8px);
	color: var(--wff-ink-text);
	font-size: var(--wdt-type-small-size, .875rem);
	font-weight: 600;
	text-decoration: none;
	line-height: 1.2;
}

.wff__pagination .page-numbers:hover,
.wff__pagination .page-numbers:focus {
	background: var(--wff-surface-alt);
}

.wff__pagination .page-numbers.current {
	background: var(--wff-ink);
	border-color: var(--wff-ink);
	color: #fff;
}

.wff__pagination .page-numbers.dots {
	border-color: transparent;
}

/* 1.1.0 — page-watch entries: fit badges and the unreachable note. */
.wff-card__themes {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .35rem;
	margin: 0 0 .75rem;
}

.wff-card__themes-label {
	color: var(--wff-muted);
	font-size: .8125rem;
}

.wff-badge.wff-badge--theme {
	display: inline-flex;
	align-items: center;
	min-height: 28px; /* WCAG 2.5.8: at least 24 x 24 px per target */
	margin-inline-start: 0;
	padding: .2rem .6rem;
	border: 1px solid var(--wff-border);
	background: var(--wff-surface);
	color: var(--wff-ink-text);
	font-size: .75rem;
	font-weight: 600;
	letter-spacing: 0;
	text-decoration: none;
}

a.wff-badge--theme:hover,
a.wff-badge--theme:focus-visible {
	border-color: var(--wff-primary);
	text-decoration: underline;
}

a.wff-badge--theme:focus-visible {
	outline: 2px solid var(--wff-primary);
	outline-offset: 2px;
}

.wff-card__warn {
	display: block;
	flex-basis: 100%;
	color: var(--wff-muted);
	font-size: .8125rem;
	font-style: italic;
}
