/*
 * The past congresses' pages, single and list (D-43), and an editor style: loaded only there
 * (functions.php), so every other inner page keeps page.css alone (K-04).
 */

/*
 * A past congress (D-43): the band carries the edition, the dates and venue and the years. Beside
 * the text the rail holds the poster, enlarged on click and downloadable, and under it the page's
 * sections and the way back to every congress, which stay in view while the page scrolls. Below
 * 1100px the poster follows the introduction instead (savtek-core's Edition_Poster prints a copy
 * for each place, and each shows at its own widths) and the rail keeps only the way back.
 */

/* Its title is the congress's name and year: the H1 size of pages, not an announcement's. */
.single-savtek_edition .savtek-page-hero .wp-block-post-title {
	font-size: min(var(--wp--preset--font-size--xx-large), var(--savtek-fit-cap, 100vw));
	line-height: 1;
	max-width: 24ch;
}

.savtek-edition-hero .savtek-years {
	margin-block-start: clamp(1.5rem, 2.5vw, 1.75rem);
}

@media (min-width: 1100px) {

	/* The poster scrolls away with the page; the sections and the way back stay in view under the header. */
	.savtek-edition-rail {
		align-items: stretch;
		align-self: stretch;
		display: flex;
		flex-direction: column;
		max-height: none;
		overflow: visible;
		position: static;
	}

	/* A half-filled entry, whose rail holds neither the poster nor the sections, reads in one column, the way back below it. */
	.savtek-edition-layout:not(:has(.savtek-edition-poster.is-rail, .savtek-rail__nav)) {
		grid-template-columns: minmax(0, 1fr);
	}

	.savtek-edition-rail__sticky {
		max-height: calc(100vh - var(--savtek-header-height) - 2.5rem - var(--wp-admin--admin-bar--height, 0px));
		overflow-y: auto;
		overscroll-behavior: contain;
		position: sticky;
		scrollbar-width: thin;
		top: calc(var(--savtek-header-height) + 1.5rem + var(--wp-admin--admin-bar--height, 0px));
	}

	.savtek-edition-poster.is-inline {
		display: none;
	}
}

/* 1099.98px, so a window between 1099 and 1100 px wide shows one of the two (Edition_Poster::HIDDEN_AT). */
@media (max-width: 1099.98px) {

	.savtek-edition-poster.is-rail {
		display: none;
	}
}

/* Where the rail follows the text, the sections are left out, as on pages; the way back stays. */
@container savtek-rail (min-width: 17.5rem) {

	.savtek-edition-rail .savtek-rail__nav {
		display: none;
	}
}

.savtek-edition-rail__back {
	font-size: 0.9375rem;
	font-weight: 600;
	margin: 0;
}

.savtek-edition-rail__back a {
	align-items: center;
	display: inline-flex;
	gap: 0.5rem;
	min-height: 2.75rem;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.savtek-edition-rail__back a::before {
	content: "←";
	content: "←" / "";
}

/* The poster: the page as printed, with the card shadow. */
/* The poster's picture fills its figure, whose width and height core's enlarge button is placed by. */
.savtek-edition-poster picture {
	display: block;
}

.savtek-edition-poster > .wp-block-image {
	margin: 0;
}

.savtek-edition-poster img {
	border: 1px solid var(--wp--custom--border-color);
	border-radius: var(--wp--custom--radius-sm);
	box-shadow: var(--wp--custom--shadow-card);
	box-sizing: border-box;
	display: block;
	height: auto;
	width: 100%;
}

/* Core's enlarge button, shown at all times as a round badge, so the poster reads as something to open. */
.savtek-edition-poster .savtek-edition-poster__image.wp-lightbox-container button.lightbox-trigger:not(.has-background) {
	backdrop-filter: none;
	background-color: rgb(255 255 255 / 96%);
	border-radius: 50%;
	box-shadow: 0 1px 3px rgb(16 27 41 / 25%);
	color: var(--wp--preset--color--contrast);
	height: 2.25rem;
	opacity: 1;
	width: 2.25rem;
}

.savtek-edition-poster .lightbox-trigger svg {
	height: 0.875rem;
	width: 0.875rem;
}

.savtek-edition-poster .lightbox-trigger path {
	fill: currentcolor;
}

.savtek-edition-poster__download {
	align-items: center;
	column-gap: 0.5rem;
	display: inline-flex;
	flex-wrap: wrap;
	font-size: 0.9375rem;
	font-weight: 600;
	margin-top: 0.5rem;
	min-height: 2.75rem;
	text-decoration: none;
}

.savtek-edition-poster__download svg {
	flex: none;
}

/* Only the words are underlined, not the file's type and size, which go below them in a narrow column. */
.savtek-edition-poster__label {
	text-decoration: underline;
	text-underline-offset: 3px;
	white-space: nowrap;
}

.savtek-edition-poster__meta {
	color: var(--wp--preset--color--muted);
	font-weight: 400;
}

/* A PDF the server could not draw: its name in a card that opens it. */
.savtek-edition-poster__file {
	align-items: center;
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--custom--border-color);
	border-radius: var(--wp--custom--radius);
	box-sizing: border-box;
	color: var(--wp--preset--color--contrast);
	display: flex;
	font-weight: 600;
	gap: 0.85rem;
	line-height: 1.35;
	min-height: 4.5rem;
	padding: 0.85rem 1rem;
	text-decoration: none;
}

.savtek-edition-poster__file::before {
	align-items: center;
	background: var(--wp--custom--accent-tint);
	border-radius: var(--wp--custom--radius-sm);
	color: var(--savtek-accent-text);
	content: "PDF";
	content: "PDF" / "";
	display: flex;
	flex: none;
	font-size: 0.75rem;
	font-weight: 700;
	height: 3.25rem;
	justify-content: center;
	width: 2.75rem;
}

.savtek-edition-poster__file:hover {
	border-color: var(--wp--custom--border-strong);
}

:is(.savtek-prose, .savtek-edition-opening) > .savtek-edition-poster.is-inline {
	margin-block-start: 1.75rem;
	max-width: 100%;
	width: min(15rem, 60vw);
}

:is(.savtek-prose, .savtek-edition-opening) > .savtek-edition-poster.is-inline.has-no-preview {
	width: 22rem;
}

/* From 600px up to the rail's width, the poster beside the introduction (Edition_Poster::SIZES). */
@media (min-width: 600px) and (max-width: 1099.98px) {

	.savtek-edition-opening:has(> .savtek-edition-poster.is-inline:not(.has-no-preview)) {
		align-items: start;
		column-gap: var(--wp--preset--spacing--50);
		display: grid;
		grid-template-columns: minmax(0, 1fr) 13rem;
	}

	.savtek-edition-opening > .savtek-edition-poster.is-inline:not(.has-no-preview) {
		margin-block-start: 0;
		width: auto;
	}
}

/* The introduction's first paragraph as a page's lead (style.css's savtek-lead). */
.savtek-edition-section.is-intro > p:first-child {
	color: var(--wp--preset--color--contrast);
	font-size: clamp(1.1rem, 1rem + 0.4vw, 1.25rem);
	line-height: 1.55;
}

/*
 * Its sections read as an archive: a hairline over each heading; the introduction, and a section
 * that comes first, without one. The sections block (ADR-0025) holds them, or the post content of
 * an entry saved before it.
 */
:is(.wp-block-post-content, .savtek-edition-sections) > .savtek-edition-section:not(.is-intro) {
	border-top: 1px solid var(--wp--custom--border-color);
	margin-block-start: var(--wp--preset--spacing--60);
	padding-top: var(--wp--preset--spacing--50);
}

:is(.wp-block-post-content, .savtek-edition-sections) > .savtek-edition-section:first-child,
.savtek-edition-sections > .savtek-edition-section.is-legacy {
	border-top: 0;
	margin-block-start: 0;
	padding-top: 0;
}

.savtek-edition-sections > .savtek-edition-section.is-legacy:not(:first-child) {
	margin-block-start: var(--wp--preset--spacing--60);
}

/* Where the poster shows in the rail, the section after the hidden narrow-screen copy comes first. */
@media (min-width: 1100px) {

	.savtek-edition-sections > .savtek-edition-poster.is-inline:first-child + .savtek-edition-section {
		border-top: 0;
		margin-block-start: 0;
		padding-top: 0;
	}
}

/* A section on a background of its own (paper, the edition color's light tint or night) is a band. */
.savtek-edition-sections > .savtek-edition-section.has-background {
	border-radius: var(--wp--custom--radius);
	border-top: 0;
	padding: clamp(1.5rem, 1rem + 2vw, 2.5rem);
}

.savtek-edition-section.is-background-tint {
	background-color: var(--wp--custom--accent-tint);
}

.savtek-edition-section.has-background > :first-child {
	margin-block-start: 0;
}

/* The page text's heading sizes (page.css's savtek-prose), which the editor's root does not carry. */
.savtek-edition-section > h2 {
	font-size: min(clamp(1.5rem, 1.25rem + 0.7vw, 1.875rem), var(--savtek-fit-cap, 100vw));
}

.savtek-edition-part > h3 {
	font-size: 1.3125rem;
}

/* Running text keeps the reading width inside the sections too. */
:is(.savtek-edition-section, .savtek-edition-part) > :is(p, .wp-block-list:not([class*="is-style-"])) {
	max-width: 40rem;
}

.savtek-edition-section > .savtek-edition-part + .savtek-edition-part {
	margin-block-start: var(--wp--preset--spacing--50);
}

/* An entry written before the sections: a hairline over each heading of its text. */
.single-savtek_edition .wp-block-post-content > h2 {
	border-top: 1px solid var(--wp--custom--border-color);
	padding-top: var(--wp--preset--spacing--40);
}

.single-savtek_edition .wp-block-post-content > h2:first-child {
	border-top: 0;
	padding-top: 0;
}

/* A past congress's figures ("In numbers"): large numbers in the edition color, two to a row, four from 782px. */
.savtek-edition-section .savtek-figures {
	display: grid;
	gap: 1.5rem;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 782px) {

	.savtek-edition-section .savtek-figures {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.savtek-edition-section .savtek-figures > *,
.savtek-edition-section .savtek-figure > * {
	margin: 0;
}

/* Each figure is its column, so its value shrinks to its widest "word" there (--savtek-fit, inc/fit.php), as headings do. */
.savtek-edition-section .savtek-figure {
	container-type: inline-size;
}

.savtek-edition-section .savtek-figure__value {
	color: var(--wp--preset--color--accent);
	font-family: var(--wp--preset--font-family--display);
	font-size: min(clamp(2.25rem, 1.6rem + 2.4vw, 3.5rem), calc(100cqi / var(--savtek-fit, 1)));
	font-variant-numeric: tabular-nums lining-nums;
	font-weight: 800;
	letter-spacing: -0.03em;
	line-height: 0.9;
}

.savtek-edition-section .savtek-figure__label {
	color: var(--wp--preset--color--muted);
	font-size: 0.9375rem;
	margin-top: 0.75rem;
}

/* On night the figures take the edition color's light tone; a chosen color is made readable there by the plugin. */
.savtek-edition-section.is-style-section-navy .savtek-figure__value:not(.has-text-color) {
	color: var(--wp--custom--accent-on-dark);
}

/* The "cards" look: each figure on a card of its own. */
.savtek-edition-section.is-variant-cards .savtek-figure {
	background-color: var(--wp--preset--color--base);
	border: 1px solid var(--wp--custom--border-color);
	border-radius: var(--wp--custom--radius);
	box-shadow: var(--wp--custom--shadow-soft);
	padding: 1.25rem 1.25rem 1.5rem;
}

.savtek-edition-section.is-variant-cards.is-style-section-navy .savtek-figure {
	background-color: var(--wp--custom--panel);
	border-color: var(--wp--custom--on-dark-line);
	box-shadow: none;
}

/* The past congresses as a list: the year, the edition and its facts, the year's logo. */
.savtek-edition-list .wp-block-post-template {
	border-top: 1px solid var(--wp--custom--border-color);
	list-style: none;
	margin: 0;
	padding: 0;
}

.savtek-edition-list .wp-block-post {
	align-items: center;
	border-bottom: 1px solid var(--wp--custom--border-color);
	column-gap: var(--wp--preset--spacing--50);
	display: grid;
	grid-template-columns: 9.5rem minmax(0, 1fr) 16.25rem;
	margin: 0;
	padding-block: var(--wp--preset--spacing--50);
	position: relative;
}

.savtek-edition-list .wp-block-post > * {
	margin: 0;
}

.savtek-edition-list .savtek-edition-list__year {
	color: var(--wp--preset--color--accent);
	font-family: var(--wp--preset--font-family--display);
	font-size: clamp(2rem, 1.5rem + 1.2vw, 2.5rem);
	font-variant-numeric: tabular-nums;
	font-weight: 800;
	letter-spacing: -0.01em;
	line-height: 1;
	white-space: nowrap;
}

.savtek-edition-list .savtek-edition-list__body {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.savtek-edition-list .savtek-edition-list__body > * {
	margin: 0;
}

.savtek-edition-list .wp-block-post:not(:has(.savtek-edition-list__logo)) .savtek-edition-list__body {
	grid-column: 2 / -1;
}

.savtek-edition-list .savtek-edition-list__label {
	color: var(--wp--preset--color--muted);
	font-size: 0.875rem;
	font-weight: 500;
}

.savtek-edition-list .savtek-edition-list__title {
	font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.75rem);
	font-weight: 700;
	letter-spacing: 0;
	line-height: 1.2;
}

.savtek-edition-list__title a {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.savtek-edition-list__title a:hover {
	text-decoration: underline;
}

.wp-site-blocks .savtek-edition-list__title a::before {
	content: "";
	inset: 0;
	position: absolute;
}

.savtek-edition-list .savtek-edition-list__meta {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
}

.savtek-edition-list .wp-block-post-excerpt__excerpt {
	margin: 0;
	max-width: 42rem;
}

/* The year's logo, whole on a white plate; without one, the wordmark between the brochure's side bands (inc/editions.php). */
.savtek-edition-list .savtek-edition-list__logo {
	align-items: center;
	aspect-ratio: 16 / 10;
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--custom--border-color);
	border-radius: var(--wp--custom--radius);
	box-sizing: border-box;
	display: flex;
	justify-content: center;
	overflow: hidden;
	padding: 1.125rem;
	position: relative;
}

.savtek-edition-list .savtek-edition-list__logo img {
	height: 100%;
	object-fit: contain;
	width: 100%;
}

/*
 * The wordmark keeps its share of the plate at every width (about 70 % of it, from the display
 * face's advance widths, as inc/fit.php measures them), so it never touches the bands.
 */
.savtek-edition-list .savtek-edition-list__logo.is-wordmark {
	container-type: inline-size;
	padding: 0;
}

.savtek-edition-list__band {
	height: 100%;
	position: absolute;
	top: 0;
	width: 13%;
}

.savtek-edition-list__band.is-start {
	left: 0;
}

.savtek-edition-list__band.is-end {
	right: 0;
}

/* The congress's own blue, as the posters print it, whatever the edition color. */
.savtek-edition-list__logo.is-wordmark {
	--savtek-brand-blue: #0069b4;
}

.savtek-edition-list__band polygon {
	fill: color-mix(in srgb, var(--savtek-brand-blue) 45%, var(--wp--preset--color--base));
}

.savtek-edition-list__band path {
	stroke: var(--wp--preset--color--base);
}

.savtek-edition-list__word {
	color: var(--savtek-brand-blue);
	font-family: var(--wp--preset--font-family--display);
	font-size: 8cqi;
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1;
	white-space: nowrap;
}

.savtek-edition-list__word.is-year {
	color: var(--wp--preset--color--muted);
	margin-inline-start: 0.3em;
}

/* Up to the rail's width, the year above the text and a smaller plate beside both (LIST_LOGO_SIZES). */
@media (min-width: 782px) and (max-width: 1099.98px) {

	.savtek-edition-list .wp-block-post {
		grid-template-areas: "year logo" "body logo";
		grid-template-columns: minmax(0, 1fr) 12rem;
		row-gap: 0.5rem;
	}

	.savtek-edition-list .savtek-edition-list__year {
		grid-area: year;
	}

	.savtek-edition-list .savtek-edition-list__body {
		grid-area: body;
	}

	.savtek-edition-list .savtek-edition-list__logo {
		grid-area: logo;
	}

	.savtek-edition-list .wp-block-post:not(:has(.savtek-edition-list__logo)) .savtek-edition-list__body {
		grid-column: 1 / -1;
	}
}

@media (max-width: 781px) {

	.savtek-edition-list .wp-block-post {
		grid-template-columns: minmax(0, 1fr);
		row-gap: 0.75rem;
	}

	.savtek-edition-list .savtek-edition-list__year {
		font-size: 2rem;
	}

	.savtek-edition-list .wp-block-post:not(:has(.savtek-edition-list__logo)) .savtek-edition-list__body {
		grid-column: auto;
	}

	.savtek-edition-list .savtek-edition-list__logo {
		margin-top: 0.25rem;
		width: min(13.75rem, 100%);
	}
}

/*
 * Logos in a grid, as past congress entries written before their sections list their sponsors:
 * white tiles, the logo contained. Nothing writes this group any more; the rules stay while such
 * entries exist, and the sections use the gallery style "Logos" (logos.css).
 */
.savtek-logo-grid .wp-block-image {
	align-items: center;
	background: var(--wp--preset--color--base);
	border-radius: var(--wp--custom--radius);
	box-shadow: var(--wp--custom--shadow-soft);
	display: flex;
	justify-content: center;
	margin: 0;
	min-height: 7rem;
	padding: 1rem;
}

.savtek-logo-grid .wp-block-image img {
	border-radius: 0;
	max-height: 4rem;
	object-fit: contain;
	width: auto;
}
