/*
Theme Name: Campax Blocks
Template: twentytwentyfive
Description: Campax on top of the default block theme. Tokens (colours, type, spacing, radii, widths) live in
theme.json; this file holds only what theme.json cannot express. Classes of the old site's content are in content.css.
Version: 0.3.0
*/

/*
Design rules: one centred text column (contentSize) and one wide frame (wideSize) for header, footer, grids,
galleries and full-width bands. Surfaces (cards, boxes, images) use the small radius; controls (buttons, fields,
filter links, menu items) are round and 40px high (24px line, 7px padding, 1px border). Headings are black, Campax
blue is the one accent (links, buttons, focus).
*/

/* ---------- Base ---------- */

/* The parent theme refers to its own colour slugs (hovered button text, focus outline, separators). */
:root {
	--wp--preset--color--base: var(--wp--preset--color--white);
	--wp--preset--color--contrast: var(--wp--preset--color--campax-text);
	--wp--preset--color--accent-4: var(--wp--preset--color--campax-text);
	--wp--preset--color--accent-6: var(--wp--preset--color--campax-rule);
}

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Selected text: Campax blue on light surfaces, the light surface colour on dark ones. */
::selection {
	background: var(--wp--preset--color--campax-blue-deep);
	color: var(--wp--preset--color--white);
}

:is(
	.wp-block-button:not(.is-style-outline) .wp-block-button__link,
	.has-campax-blue-deep-background-color,
	.has-campax-blue-dark-background-color,
	.has-campax-purple-background-color,
	.has-campax-text-background-color,
	.has-black-background-color
)::selection,
:is(
	.wp-block-button:not(.is-style-outline) .wp-block-button__link,
	.has-campax-blue-deep-background-color,
	.has-campax-blue-dark-background-color,
	.has-campax-purple-background-color,
	.has-campax-text-background-color,
	.has-black-background-color
) ::selection {
	background: var(--wp--preset--color--campax-light);
	color: var(--wp--preset--color--campax-blue-dark);
}

/* Long German words break instead of widening the page; headings wrap in balanced lines. */
:root :is(h1, h2, h3, h4, h5, h6) {
	overflow-wrap: break-word;
	text-wrap: balance;
}

:is(p, li, figcaption, blockquote) {
	text-wrap: pretty;
}

/*
Header sizes from the theme.json tokens. The logo (parts/header.html) has the width of the logo token and the ratio of
its file. The donate button, a control, sits in the middle of the header row, whose height is the larger of logo and
control.
*/
:root {
	--campax-logo-width: var(--wp--custom--logo--width);
	--campax-logo-height: calc(var(--campax-logo-width) * var(--wp--custom--logo--ratio));
	--campax-header-row-height: max(var(--campax-logo-height), var(--wp--custom--control--height));
	--campax-sticky-offset: 0px;
	scroll-padding-top: calc(var(--campax-sticky-offset) + var(--wp--preset--spacing--40));
}

/* From 600px the donate button stays at the top on scroll, so anchor links stop below its lower edge. */
@media (min-width: 600px) {
	:root {
		--campax-sticky-offset: calc(var(--wp--preset--spacing--30) + (var(--campax-header-row-height) + var(--wp--custom--control--height)) / 2);
	}
}

/* Old content wraps whole headings in <strong>, which would set them heavier than all other headings. */
:is(h1, h2, h3, h4, h5, h6) strong {
	font-weight: inherit;
}

:is(.wp-block-post-date, .wp-block-table, time) {
	font-variant-numeric: tabular-nums;
}

/* Links have no underline (Campax blue has 3.3:1 against the text, WCAG technique G183); hover adds it. */
a,
.wp-element-button {
	transition-property: color, background-color, border-color, box-shadow, text-decoration-color;
	transition-duration: 0.15s;
	transition-timing-function: ease-out;
}

/* One focus ring for every control, for keyboard focus only (:focus-visible), white on the blue band. */
.wp-site-blocks :focus-visible {
	outline: var(--wp--custom--line--thick) solid var(--wp--preset--color--campax-blue-deep);
	outline-offset: var(--wp--custom--focus--offset);
}

.wp-site-blocks .has-campax-blue-deep-background-color :focus-visible {
	outline-color: var(--wp--preset--color--white);
}

/* Core outlines every :focus, also after a click or tap; pointer focus stays without a ring. */
.wp-site-blocks :focus:not(:focus-visible) {
	outline: none;
}

/* The focus ring of a linked image follows the corners of the image. */
:is(.wp-block-image, .wp-block-post-featured-image) a {
	border-radius: var(--wp--preset--border-radius--small);
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* ---------- Layout ---------- */

/*
Collections use the wide frame inside the text column: post grids and galleries. The heading right above a
collection and a link-only paragraph right below it ("Alle News") line up with it.
*/
.is-layout-constrained > :is(.wp-block-query, .wp-block-gallery, .wp-block-group:has(> .wp-block-query, > .wp-block-gallery)),
.is-layout-constrained > .wp-block-heading:has(+ :is(.wp-block-query, .wp-block-gallery)),
.is-layout-constrained > :is(.wp-block-query, .wp-block-gallery) + p:has(> a:only-child) {
	max-width: var(--wp--style--global--wide-size);
}

/* Core lets the images of an incomplete last gallery row grow to the full width. */
.wp-block-gallery.has-nested-images figure.wp-block-image {
	flex-grow: 0;
}

/* A hidden heading takes no room, so the block after it needs no gap either. */
.screen-reader-text + * {
	margin-block-start: 0;
}

/* Full-width bands (campaign, ACT) and the sections of the front page. */
:is(.campaign-hero, .act-section).alignfull {
	padding-block: var(--wp--preset--spacing--70);
}

.front-sections > * + *,
main > h2:is(.wp-block-heading, .wp-block-query-title) {
	margin-block-start: var(--wp--preset--spacing--70);
}

/* Embeds (Flickr, YouTube, Vimeo) are surfaces with the corners of images. */
.wp-block-embed__wrapper {
	overflow: hidden;
	border-radius: var(--wp--preset--border-radius--small);
}

/* A Flickr album shows its cover image until Flickr's script replaces it with a slideshow of the same size. */
.wp-block-embed.wp-has-aspect-ratio .wp-block-embed__wrapper img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* ---------- Controls: buttons, fields, chips ---------- */

.wp-element-button {
	white-space: nowrap;
}

/* On a phone a long label ("En savoir plus et signer la pétition") wraps instead of widening the page. */
@media (max-width: 480px) {
	.wp-element-button {
		white-space: normal;
		text-wrap: balance;
	}
}

/* The second button style: an outline, for the less important of two actions; white on the blue band. */
.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background) {
	padding: var(--wp--custom--control--padding-block) var(--wp--custom--control--padding-inline);
	border: var(--wp--custom--line--thin) solid currentColor;
	background-color: transparent;
	color: var(--wp--preset--color--campax-blue-deep);
}

:is(.has-campax-blue-deep-background-color, .white-on-turq) .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background) {
	color: var(--wp--preset--color--white);
}

.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background):is(:hover, :focus-visible) {
	border-color: var(--wp--preset--color--campax-blue-dark);
	background-color: var(--wp--preset--color--campax-blue-dark);
	color: var(--wp--preset--color--white);
}

/* Search: a round field with 3:1 against the page (WCAG 1.4.11) and a round 40px icon button. */
.wp-block-search__input {
	border-color: var(--wp--preset--color--campax-grey);
}

.wp-block-search__button-inside .wp-block-search__inside-wrapper {
	--search-inset: 4px;
	padding: var(--search-inset);
	border: var(--wp--custom--line--thin) solid var(--wp--preset--color--campax-grey);
	border-radius: var(--wp--preset--border-radius--pill);
	background: var(--wp--preset--color--white);
}

.wp-block-search__button-inside .wp-block-search__input {
	border: 0;
}

.wp-block-search__button.has-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--wp--custom--control--height);
	min-width: var(--wp--custom--control--height);
	height: var(--wp--custom--control--height);
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: var(--wp--preset--border-radius--pill);
	background: var(--wp--preset--color--campax-blue-deep);
	color: var(--wp--preset--color--white);
}

.wp-block-search__button.has-icon:is(:hover, :focus-visible) {
	background: var(--wp--preset--color--campax-blue-dark);
}

main .wp-block-search {
	--search-max-width: 30rem;
	max-width: var(--search-max-width);
}

/* ---------- Header ---------- */

/*
Three columns: logo left, donate button right, and between them, centred, the menu, the language switch and the search
from 1280px, or the donate button with the menu button at the right below. Below 1280px the French labels no longer
fit, so the menu button takes over (core does that only below 600px) and the language switch and the search move into
the opened menu, where a second copy of both lives.
*/
.site-header .header-row {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	column-gap: var(--wp--preset--spacing--20);
}

.site-header .site-logo,
.site-header .site-logo :is(a, img) {
	margin: 0;
	border-radius: 0;
}

/* The logo takes its height from the header sizes at the top, so the row height does not wait for the image. */
.site-header .site-logo img {
	height: var(--campax-logo-height);
}

.site-header .header-donate {
	justify-self: end;
}

.site-header .wp-block-navigation-item__content {
	border-radius: var(--wp--preset--border-radius--pill);
}

/* Core sets black text on submenus and on the opened menu. */
.site-header .wp-block-navigation:not(.has-background) :is(.wp-block-navigation__submenu-container, .wp-block-navigation__responsive-container.is-menu-open) {
	color: var(--wp--preset--color--campax-text);
}

.site-header .main-navigation .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__container > .wp-block-navigation-item:is(:hover, :focus-within) > .wp-block-navigation-item__content,
.site-header .language-switch .wp-block-navigation-item__content:is(:hover, :focus-visible) {
	background: var(--wp--preset--color--campax-light);
}

.site-header .wp-block-navigation-item__content:hover {
	text-decoration: none;
}

/* Submenus float: no frame, a soft shadow, the small radius. */
.wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__submenu-container {
	padding: var(--wp--preset--spacing--20);
	border: 0;
	border-radius: var(--wp--preset--border-radius--small);
	box-shadow: var(--wp--preset--shadow--float);
}

.wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__submenu-container .wp-block-navigation-item__content:is(:hover, :focus-visible) {
	background: var(--wp--preset--color--campax-light);
	text-decoration: none;
}

/* Core also shows a submenu on hover; here only the state of its arrow does, so a click closes it under the pointer. */
.site-header .wp-block-navigation .has-child > .wp-block-navigation-submenu__toggle[aria-expanded="false"] ~ .wp-block-navigation__submenu-container {
	visibility: hidden;
	opacity: 0;
	width: 0;
	height: 0;
	overflow: hidden;
}

/* Submenu arrows: a 24px target (WCAG 2.5.8) instead of the 8px icon. */
.wp-block-navigation .wp-block-navigation__submenu-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: content-box;
	min-width: var(--wp--custom--target--minimum);
	min-height: var(--wp--custom--target--minimum);
	border-radius: var(--wp--preset--border-radius--pill);
}

/* Menu items, language codes and menu buttons are 40px high like all controls; the current language is underlined. */
.site-header :is(.main-navigation, .language-switch) .wp-block-navigation__container {
	gap: 0;
}

.site-header .main-navigation .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content {
	--menu-item-padding: 0.625rem;
	padding-inline: var(--menu-item-padding);
}

/*
The submenu arrow sits in the right padding of its label, so the hover surface and the focus ring of the label cover
both; a focused arrow shows the ring of its label.
*/
.site-header .main-navigation .wp-block-navigation__container > .has-child > .wp-block-navigation-item__content {
	padding-right: calc(var(--wp--custom--target--minimum) + var(--wp--custom--spacing--medium));
}

.site-header .main-navigation .wp-block-navigation__container > .has-child > .wp-block-navigation-submenu__toggle {
	position: relative;
	z-index: 1;
	margin-left: calc(-1 * var(--wp--custom--target--minimum) - var(--wp--custom--spacing--medium) / 2);
}

.site-header .main-navigation .has-child:has(> .wp-block-navigation-submenu__toggle:focus-visible) > .wp-block-navigation-item__content {
	outline: var(--wp--custom--line--thick) solid var(--wp--preset--color--campax-blue-deep);
	outline-offset: var(--wp--custom--focus--offset);
}

.site-header .main-navigation .has-child > .wp-block-navigation-submenu__toggle:focus-visible {
	outline: none;
}

.site-header .main-navigation .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content,
.site-header .language-switch .wp-block-navigation-item__content,
.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: var(--wp--custom--control--height);
	min-height: var(--wp--custom--control--height);
	border-radius: var(--wp--preset--border-radius--pill);
}

/* The current page, and the menu item whose submenu holds it, are underlined like the current language. */
.site-header .current-lang > .wp-block-navigation-item__content span,
.site-header .main-navigation .wp-block-navigation-item:is(.current-menu-ancestor, :has(> [aria-current="page"])) > .wp-block-navigation-item__content .wp-block-navigation-item__label {
	text-decoration: underline;
	text-decoration-thickness: var(--wp--custom--line--thick);
	text-underline-offset: var(--wp--custom--underline--offset);
}

/*
Submenus: items in sentence case, so long labels stay readable and the two levels differ. A submenu lists the
sections of its page first; the class is-group-start separates the other pages that follow.
*/
.site-header .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	text-transform: none;
}

.wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	white-space: nowrap;
}

.site-header .wp-block-navigation__submenu-container .is-group-start {
	margin-top: var(--wp--preset--spacing--20);
	padding-top: var(--wp--preset--spacing--20);
	border-top: var(--wp--custom--line--thin) solid var(--wp--preset--color--campax-rule);
}

/*
A menu link (inc/header.php sets the class) or a button to another site shows an arrow. Screen readers get the hint
instead of the arrow; a browser without alternative text for `content` reads the arrow.
*/
:root { --external-link-hint: " (externe Website)"; }
:lang(fr) { --external-link-hint: " (site externe)"; }
:lang(it) { --external-link-hint: " (sito esterno)"; }

.site-header .is-external .wp-block-navigation-item__label::after,
.wp-block-button__link[href^="http" i]:not([href*="//campax.org" i], [href*="//www.campax.org" i])::after {
	content: "\2197";
	content: "\2197" / var(--external-link-hint);
	--external-arrow-gap: 0.25em;
	margin-left: var(--external-arrow-gap);
}

/*
Header search: the button keeps its place, and the open field fades in around it and over the language switch, so
button and field share one border and nothing moves. Core opens and closes it; these rules replace its width
animation and its frame.
*/
.site-header .header-search {
	--search-field-width: 15rem;
	--search-field-end: calc(var(--wp--custom--control--height) + 4px);
	position: relative;
	width: var(--wp--custom--control--height);
	height: var(--wp--custom--control--height);
}

.site-header .header-search .wp-block-search__inside-wrapper {
	width: var(--wp--custom--control--height) !important;
	height: var(--wp--custom--control--height);
	padding: 0 !important;
	border: 0 !important;
}

.site-header .header-search .wp-block-search__button {
	position: relative;
	z-index: 6;
}

.site-header .header-search .wp-block-search__input {
	position: absolute;
	top: 0;
	right: 0;
	z-index: 5;
	box-sizing: border-box;
	width: calc(var(--search-field-width) + var(--wp--custom--control--height)) !important;
	height: var(--wp--custom--control--height);
	padding: 0 var(--search-field-end) 0 var(--wp--preset--spacing--30) !important;
	border: var(--wp--custom--line--thin) solid var(--wp--preset--color--campax-grey);
	border-radius: var(--wp--preset--border-radius--pill);
	background: var(--wp--preset--color--white);
	transition-property: opacity, translate;
	transition-duration: 0.15s;
}

.site-header .header-search.wp-block-search__searchfield-hidden .wp-block-search__input {
	visibility: hidden;
	opacity: 0;
	translate: var(--wp--preset--spacing--20) 0;
}

.site-header .main-navigation :is(.menu-search, .menu-languages) {
	display: none;
}

@media (max-width: 1279px) {
	.site-header .main-navigation .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}

	.site-header .main-navigation .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}

	.site-header .header-tools > :is(.language-switch, .header-search) {
		display: none;
	}

	.site-header .header-tools {
		display: contents;
	}

	.site-header .header-row {
		grid-template-columns: 1fr auto auto;
	}

	.site-header .header-donate {
		grid-column: 2;
		grid-row: 1;
	}

	.site-header .main-navigation {
		grid-column: 3;
		grid-row: 1;
		justify-self: end;
	}

	.site-header .main-navigation .is-menu-open :is(.menu-search, .menu-languages) {
		display: flex;
	}

	.site-header .main-navigation .is-menu-open .menu-search {
		width: 100%;
	}

	/*
	The three language links sit along the bottom edge of the opened menu. The list fills the screen height and keeps
	room for them, so on a short screen the menu scrolls instead of running under the links.
	*/
	.site-header .main-navigation .is-menu-open :is(.wp-block-navigation__responsive-close, .wp-block-navigation__responsive-dialog) {
		display: flex;
		flex: 1 0 auto;
		flex-direction: column;
	}

	/* Core splits the list around the search form; the last part holds the language links. */
	.site-header .main-navigation .is-menu-open :is(.wp-block-navigation__responsive-container-content, .wp-block-navigation__container:last-child) {
		flex: 1 0 auto;
	}

	.site-header .main-navigation .is-menu-open .wp-block-navigation__container:last-child {
		padding-bottom: calc(var(--wp--custom--control--height) + var(--wp--preset--spacing--40));
	}

	.site-header .main-navigation .is-menu-open .menu-languages {
		position: absolute;
		bottom: 0;
		margin: 0;
	}

	.site-header .main-navigation .is-menu-open .menu-languages:nth-last-child(3) {
		left: 0;
	}

	.site-header .main-navigation .is-menu-open .menu-languages:nth-last-child(2) {
		left: var(--wp--custom--control--height);
	}

	.site-header .main-navigation .is-menu-open .menu-languages:nth-last-child(1) {
		left: calc(2 * var(--wp--custom--control--height));
	}
}

/* The opened menu: no hover surfaces, submenus closed until their arrow opens them (see inc/header.php). */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item.has-child {
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
}

.wp-block-navigation__responsive-container.is-menu-open .has-child > .wp-block-navigation__submenu-container {
	flex-basis: 100%;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-submenu__toggle:not([aria-expanded="true"]) + .wp-block-navigation__submenu-container {
	display: none;
}

/* Core hides the submenu arrows in the opened menu; they are the only way to open a submenu there. */
.site-header .wp-block-navigation__responsive-container.is-menu-open .has-child > .wp-block-navigation__submenu-icon {
	display: inline-flex;
	--menu-arrow-overlap: -12px;
	--menu-arrow-nudge: 0.125rem;
	min-width: var(--wp--custom--target--touch);
	min-height: var(--wp--custom--target--touch);
	margin: var(--menu-arrow-overlap) 0 var(--menu-arrow-overlap) calc(-1 * var(--wp--custom--target--touch) - var(--menu-arrow-nudge));
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .has-child > .wp-block-navigation-item__content {
	padding-right: calc(var(--wp--custom--target--touch) + var(--wp--custom--spacing--fine));
}

/*
When the page scrolls (class is-scrolled, inc/header.php), the donate button stays at the top right and the rest of
the header fades out. Phones keep the header in the page.
*/
@media (min-width: 600px) {
	.wp-site-blocks > header.wp-block-template-part {
		position: sticky;
		top: var(--wp-admin--admin-bar--height, 0px);
		z-index: 20;
	}

	.site-header {
		background: var(--wp--preset--color--white);
		transition: background-color 0.2s;
	}

	.site-header :is(.site-logo, .main-navigation, .language-switch, .header-search) {
		transition-property: opacity, visibility;
		transition-duration: 0.2s;
	}

	.site-header.is-scrolled {
		background-color: transparent;
		pointer-events: none;
	}

	.site-header.is-scrolled :is(.site-logo, .main-navigation, .language-switch, .header-search) {
		opacity: 0;
		visibility: hidden;
	}

	.site-header.is-scrolled .header-donate {
		pointer-events: auto;
	}

	.site-header.is-scrolled .header-donate .wp-block-button__link {
		box-shadow: var(--wp--preset--shadow--float);
	}
}

@media (max-width: 599px) {
	:root {
		--campax-logo-width: var(--wp--custom--logo--width-phone);
	}

	.site-header .site-logo img {
		max-width: var(--campax-logo-width);
	}

	.site-header .header-donate .wp-element-button {
		--donate-phone-padding: 0.875rem;
		padding-inline: var(--donate-phone-padding);
		font-size: var(--wp--preset--font-size--small);
	}
}

/* ---------- Footer ---------- */

.site-footer .footer-links {
	--footer-link-gap: 0.4rem;
	margin-block-start: 0;
	padding-left: 0;
	list-style: none;
}

.site-footer .footer-links li + li {
	margin-block-start: var(--footer-link-gap);
}

@media (max-width: 599px) {
	.site-footer .footer-links {
		display: grid;
		grid-template-rows: repeat(3, auto);
		grid-auto-flow: column;
		gap: var(--footer-link-gap) var(--wp--preset--spacing--40);
	}

	.site-footer .footer-links li,
	.site-footer .footer-links li + li {
		margin-block-start: 0;
	}
}

/* Stacked contact links need 24px between them (WCAG 2.5.8). */
.site-footer .footer-contact {
	line-height: 1.8;
}

/* Social icons: a 40px target each; the row moves left so the first icon lines up with the text. */
.footer-social {
	--social-inset: 8px;
	gap: 0 !important;
	margin-left: calc(-1 * var(--social-inset));
}

.footer-social .wp-block-social-link-anchor {
	padding: var(--social-inset);
	border-radius: var(--wp--preset--border-radius--pill);
}

/* Core enlarges social icons on hover; here they keep their size and get a round white surface on the light footer. */
.footer-social .wp-social-link:hover {
	transform: none;
}

.footer-social .wp-block-social-link-anchor:is(:hover, :focus-visible) {
	background: var(--wp--preset--color--white);
}

/* ---------- Content ---------- */

/*
One box style: every content block with a background (group, column, paragraph, heading, list) gets the same padding
and the small radius. Buttons keep their own shape; a separator uses its background as the colour of its line.
*/
.wp-block-post-content .has-background:not(.alignfull, .wp-block-button__link, .wp-block-separator),
.wp-block-post-content .wp-block-cover:not(.alignfull) {
	padding: var(--wp--preset--spacing--40);
	border-radius: var(--wp--preset--border-radius--small);
}

.wp-block-quote {
	padding-left: var(--wp--preset--spacing--40);
	border-left: var(--wp--custom--line--thick) solid var(--wp--preset--color--campax-rule);
}

.wp-block-quote cite {
	display: block;
	margin-top: var(--wp--custom--spacing--medium);
	font-style: normal;
	font-weight: 700;
}

.wp-block-table :is(td, th) {
	border-color: var(--wp--preset--color--campax-rule);
}

.wp-block-group.table-of-contents {
	padding: var(--wp--preset--spacing--40);
	border-radius: var(--wp--preset--border-radius--small);
	background: var(--wp--preset--color--campax-light);
	font-size: var(--wp--preset--font-size--small);
}

.wp-block-group.table-of-contents :is(h2, h3, h4) {
	margin-top: 0;
	font-size: var(--wp--preset--font-size--medium);
}

/* Kicker: a short label above a title (campaign type, post topics, error code), led by a Campax blue line. */
.kicker {
	--kicker-line-height: 1.75rem;
	--kicker-mark-width: 2rem;
	--kicker-mark-height: 3px;
	margin-block-end: 0;
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	line-height: var(--kicker-line-height);
	letter-spacing: var(--wp--custom--letter-spacing--label);
	text-transform: uppercase;
}

/* Topic links reach 24px (WCAG 2.5.8) also when they wrap onto a second line. */
.kicker a {
	padding-block: var(--wp--custom--spacing--fine);
}

.kicker::before {
	content: "";
	display: inline-block;
	width: var(--kicker-mark-width);
	height: var(--kicker-mark-height);
	margin-inline-end: var(--wp--custom--spacing--medium);
	vertical-align: middle;
	background: var(--wp--preset--color--campax-blue);
}

.kicker .wp-block-post-terms__separator {
	margin-inline-end: var(--wp--custom--spacing--medium);
}

:root .kicker + * {
	margin-block-start: var(--wp--preset--spacing--20);
}

/* Post header: topics, title, date and author; the post image only when the content shows no image of its own. */
.post-header .wp-block-post-title {
	margin-block-end: 0;
}

.post-meta-line {
	gap: var(--wp--preset--spacing--40);
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--campax-muted);
}

.post-header :is(.post-meta-line, .wp-block-post-featured-image) {
	margin-block-start: var(--wp--preset--spacing--40);
}

main:has(.wp-block-post-content :is(.wp-block-image, .wp-block-cover, .wp-block-gallery, .wp-block-media-text, img)) .post-header .wp-block-post-featured-image {
	display: none;
}

/* Post cards: image, title, date and excerpt in the quiet colour; a card without image shows the logo. */
.post-card > * + * {
	margin-block-start: var(--wp--preset--spacing--20);
}

.post-card > .wp-block-post-featured-image + * {
	margin-block-start: var(--wp--preset--spacing--30);
}

.post-card .wp-block-post-title {
	font-size: var(--wp--preset--font-size--large);
}

/* Image and title of a post lead to the same post, so a pointer on the image underlines the title too. */
.wp-block-post:has(.wp-block-post-featured-image a:hover) .wp-block-post-title a {
	text-decoration: underline;
}

.post-card :is(.wp-block-post-date, .wp-block-post-excerpt) {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--campax-muted);
}

.post-card .wp-block-post-featured-image:has(.campax-default-card-image) {
	aspect-ratio: 4 / 3;
	background: var(--wp--preset--color--campax-light);
}

/* The link fills the image box, so the logo sits in its centre. */
.post-card .wp-block-post-featured-image:has(.campax-default-card-image) > a {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
}

.post-card .campax-default-card-image {
	width: 55%;
	height: auto;
}

/* Timeline: posts with the date above each title on one thin line (Meilensteine). */
.timeline .wp-block-post-template {
	--timeline-dot: 10px;
	--timeline-dot-top: 0.45em;
	padding-left: var(--wp--preset--spacing--40);
	border-left: var(--wp--custom--line--thick) solid var(--wp--preset--color--campax-rule);
}

.timeline .wp-block-post-template > li {
	position: relative;
}

.timeline .wp-block-post-template > li + li {
	margin-block-start: var(--wp--preset--spacing--40);
}

.timeline .wp-block-post-template > li::before {
	content: "";
	position: absolute;
	top: var(--timeline-dot-top);
	left: calc(-1 * var(--wp--preset--spacing--40) - (var(--timeline-dot) + var(--wp--custom--line--thick)) / 2);
	width: var(--timeline-dot);
	height: var(--timeline-dot);
	border-radius: 50%;
	background: var(--wp--preset--color--campax-blue);
}

.timeline .wp-block-post-date {
	color: var(--wp--preset--color--campax-muted);
}

/* The caption of the image in the lightbox (inc/lightbox.php), along the bottom edge. */
.wp-lightbox-overlay .lightbox-caption {
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	z-index: 2000001; /* above the backdrop of core (2000000) */
	margin: 0;
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--50);
	font-size: var(--wp--preset--font-size--small);
	text-align: center;
	color: var(--wp--preset--color--campax-muted);
	background: var(--wp--preset--color--white);
}

.wp-lightbox-overlay .lightbox-caption:empty {
	display: none;
}

/*
Team galleries (Über uns): a list of people, each with a portrait on the left and name, role and description on the
right; two columns on wide screens.
*/
.wp-block-gallery.has-nested-images.team-gallery {
	--team-column-min: 26rem;
	--team-portrait: 8rem;
	display: grid;
	align-items: start;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--team-column-min)), 1fr));
	gap: var(--wp--preset--spacing--40);
}

.wp-block-gallery.has-nested-images.team-gallery figure.wp-block-image:not(#individual-image) {
	display: grid;
	grid-template-columns: var(--team-portrait) 1fr;
	align-items: start;
	column-gap: var(--wp--preset--spacing--30);
	width: auto;
	margin: 0;
}

/* The portrait is as high as the text beside it, at least square; size containment keeps it from setting the height. */
.wp-block-gallery.has-nested-images.team-gallery figure.wp-block-image:not(#individual-image) img {
	align-self: stretch;
	height: auto;
	min-height: var(--team-portrait);
	contain: size;
}

.wp-block-gallery.team-gallery figure.wp-block-image:has(figcaption)::before {
	content: none;
}

.wp-block-gallery.has-nested-images.team-gallery figure.wp-block-image figcaption {
	position: static;
	max-height: none;
	overflow: visible;
	padding: 0;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
	text-align: left;
	text-shadow: none;
	color: var(--wp--preset--color--campax-muted);
	background: none;
}

.wp-block-gallery.team-gallery figure.wp-block-image figcaption strong {
	font-family: var(--wp--preset--font-family--montserrat);
	font-weight: 600;
	color: var(--wp--preset--color--campax-text);
}
