/* ==========================================================================
   BLOCK STYLES — core blocks with a theme look (inc/block-styles.php)
   --------------------------------------------------------------------------
   Loaded on the site AND as an editor style, so the selectors are not
   scoped to .entry-content (the editor canvas has none). Specificity is
   raised with the block class (.wp-block-group / .wp-block-list) to beat
   WordPress' layout margins and the prose rules in content.css without
   !important. Tokens only: dark mode follows by itself, the editor is light.

   .is-style-sac-hinweis   group      «Aktuell» box (like the Anmeldung tile)
   .is-style-sac-adresse   paragraph  address tile (like the fact tiles)
   .is-style-sac-links     list       one tile per link (rebuilt in PHP on the site)
   .is-style-sac-covers    group      grid of covers (image → PDF, caption below)
   .is-style-sac-link-arrow button    «Querverweis» (.sac-xref, components.css)
   .sac-iconlist           block      «Icon-Liste» (sac/iconliste, own block)

   (The SAC-Tourenportal is a block of its own: components.css, TOURENPORTAL.)
   ========================================================================== */

:root {
	/* Theme icons (assets/icons/ui, 24 grid, stroke 1.6) as masks — one
	   colour, from background; decorative (no text for screen readers).
	   Paths copied from the icon file: update them when the icon changes. */
	--sac-mask-pin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21 C12 21 18.8 15 18.8 9.8 A6.8 6.8 0 0 0 5.2 9.8 C5.2 15 12 21 12 21 Z'/%3E%3Ccircle cx='12' cy='9.8' r='2.4'/%3E%3C/svg%3E");
}

/* --- Hinweis: status first, one hint, buttons ----------------------------- */
/* Flex column + gap instead of the group's flow margins (blockGap). */
.wp-block-group.is-style-sac-hinweis {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	padding: var(--space-4) var(--space-5);
	background: var(--c-section);
	border: 1px solid var(--c-border);
	border-left: 3px solid var(--c-accent);
}

.wp-block-group.is-style-sac-hinweis > * {
	margin-block: 0;
}

.wp-block-group.is-style-sac-hinweis > .wp-block-buttons {
	gap: var(--space-2) var(--space-3);
	margin-top: calc(var(--space-4) - var(--space-3)); /* space-4 above the buttons */
}

.is-style-sac-hinweis strong {
	color: var(--c-heading);
}

/* Small buttons, like the Anmeldung tile's (.sac-btn--sm). */
.wp-block-group.is-style-sac-hinweis .wp-block-button__link {
	min-height: 2.5rem;
	padding: var(--space-2) var(--space-5);
	font-size: var(--fs-xs);
}

/* --- Adresse: tile with a pin, first line = name/building ----------------- */
.is-style-sac-adresse {
	position: relative;
	width: fit-content;
	max-width: 100%;
	padding: var(--space-4) var(--space-5) var(--space-4) calc(var(--space-5) + 1rem + var(--space-3));
	line-height: 1.5;
	background: var(--c-surface);
	border: 1px solid var(--c-border);
	overflow-wrap: anywhere;
}

.is-style-sac-adresse::before {
	content: "";
	position: absolute;
	top: calc(var(--space-4) + (1lh - 1rem) / 2); /* centred on the first line */
	left: var(--space-5);
	width: 1rem;
	height: 1rem;
	background: var(--c-accent-text);
	-webkit-mask: var(--sac-mask-pin) center / contain no-repeat;
	mask: var(--sac-mask-pin) center / contain no-repeat;
}

.is-style-sac-adresse::first-line {
	font-weight: 700;
	color: var(--c-heading);
}

/* Mail and phone icon in front of the link (inc/block-styles.php). */
.is-style-sac-adresse .sac-adresse__icon {
	display: inline-block;
	width: 1.15em;
	height: 1.15em;
	margin-right: 0.4em;
	vertical-align: -0.22em;
	color: var(--c-text);
}

/* Mail icon in front of e-mail links in running text (inc/block-styles.php).
   Ink in the heading colour, accent red — like the other content icons. */
.sac-mailto__icon {
	display: inline-block;
	width: 1.1em;
	height: 1.1em;
	margin-right: 0.3em;
	vertical-align: -0.2em;
	color: var(--c-heading);
}

/* --- Linkliste: one tile per link ---------------------------------------- */
/* Site (inc/block-styles.php rebuilds each item): icon (document /
   outside link / page), title + description, «PDF» or the domain on the
   right; the whole tile is the link. Editor (no rebuild): the same tiles,
   title and description as typed. */
.wp-block-list.is-style-sac-links {
	display: grid;
	gap: var(--space-2);
	padding: 0;
	list-style: none;
}

.wp-block-list.is-style-sac-links > li {
	position: relative;
	margin: 0; /* cancels .entry-content li + li */
	padding: var(--space-3) var(--space-4);
	font-size: var(--fs-sm);
	color: var(--c-text-muted);
	background: var(--c-surface);
	border: 1px solid var(--c-border);
	transition: border-color var(--dur-1) ease, background-color var(--dur-1) ease;
}

/* Editor: the title as typed (the item's text sits in a div there). */
.is-style-sac-links > li > div > a:first-child {
	font-size: var(--fs-body);
	font-weight: 600;
	color: var(--c-heading);
	text-decoration: none;
}

/* Site: the rebuilt tile. */
.wp-block-list.is-style-sac-links > .sac-linkrow {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	column-gap: var(--space-4);
}

/* Ink dark, the accent part red (two-tone icon set, components.css ICONS). */
.sac-linkrow__icon {
	display: flex;
	color: var(--c-heading);
}

.sac-linkrow__icon svg {
	width: 1.25rem;
}

.sac-linkrow__text {
	display: grid;
	gap: 0.15rem;
	line-height: 1.45;
}

.sac-linkrow__link {
	font-size: var(--fs-body);
	font-weight: 600;
	line-height: var(--lh-snug);
	color: var(--c-heading);
	text-decoration: none;
	transition: color var(--dur-1) ease;
}

/* Stretched link: the whole tile is clickable, announced once. */
.sac-linkrow__link::after {
	content: "";
	position: absolute;
	inset: 0;
}

.sac-linkrow__meta {
	font-family: var(--font-mono);
	font-size: var(--fs-xs);
	letter-spacing: 0.02em;
	white-space: nowrap;
}

.wp-block-list.is-style-sac-links > .sac-linkrow:hover:where(:not(.sac-touch *)),
.wp-block-list.is-style-sac-links > .sac-linkrow:active {
	background: var(--c-section);
	border-color: var(--c-border-strong);
}

.sac-linkrow:hover:where(:not(.sac-touch *)) .sac-linkrow__link,
.sac-linkrow:active .sac-linkrow__link {
	color: var(--c-link-hover);
}

.sac-linkrow:has(.sac-linkrow__link:focus-visible) {
	outline: 2px solid var(--c-focus);
	outline-offset: 2px;
}

.sac-linkrow__link:focus-visible {
	outline: 0;
}

/* Block «Datei» as a tile (inc/block-styles.php): file blocks in a row
   close up like one list. */
.entry-content > .sac-filelist + .sac-filelist {
	--flow: var(--space-2);
}

/* Phones: «PDF» / domain moves under the text. */
@media (max-width: 479.98px) {
	.sac-linkrow__meta {
		grid-column: 2;
		margin-top: var(--space-1);
	}
}

/* --- Titelbilder: a grid of covers (e.g. the Rossberg-Echo archive) ------- */
/* Image blocks linked to the PDF, caption «1/2026» (inserts as links in the
   caption). Covers in A4 proportion, cropped from the top if a scan differs;
   a hairline and a soft shadow make them read as printed issues. Hover: the
   shadow deepens and the cover lifts 2px (no zoom). */
.wp-block-group.is-style-sac-covers {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.5rem), 1fr));
	gap: var(--space-6) var(--space-4);
}

.wp-block-group.is-style-sac-covers > * {
	margin: 0;
}

.is-style-sac-covers .wp-block-image a {
	display: block;
}

.is-style-sac-covers .wp-block-image img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 210 / 297;
	object-fit: cover;
	object-position: top;
	border: 1px solid var(--c-border);
	box-shadow: 0 1px 2px rgb(13 26 44 / 0.08), 0 8px 18px -10px rgb(13 26 44 / 0.35);
	transition: box-shadow var(--dur-2) ease, translate var(--dur-2) var(--ease-out);
}

.is-style-sac-covers .wp-block-image a:hover:where(:not(.sac-touch *)) img,
.is-style-sac-covers .wp-block-image a:active img {
	translate: 0 -2px;
	box-shadow: 0 2px 4px rgb(13 26 44 / 0.1), 0 14px 24px -12px rgb(13 26 44 / 0.45);
}

.is-style-sac-covers .wp-block-image figcaption {
	margin: var(--space-2) 0 0;
	font-family: var(--font-mono);
	font-size: var(--fs-xs);
	line-height: 1.5;
	letter-spacing: 0.02em;
	text-align: start;
	color: var(--c-text-muted);
}

/* The issue number first, in the heading colour. */
.is-style-sac-covers .wp-block-image figcaption strong {
	font-weight: 700;
	color: var(--c-heading);
}

/* --- Querverweis (.is-style-sac-link-arrow): in components.css with .sac-xref,
   which it shares (components.css is loaded in the editor as well). */

/* ==========================================================================
   ICON-LISTE (blocks/iconliste, blocks/iconliste-eintrag)
   Entries with an icon on a tile, a bold title and a short grey line —
   instead of bullet points. 1 | 2 | 3 columns, hairlines between rows and
   columns. Columns follow the width the list really has (container query
   on .sac-iconlist-wrap, the block wrapper), not the screen — so it works
   in the text column, in a «Hinweis» box and full width alike:
     narrow (< 34rem, phones)  one column, icon left of the text
     2 columns                 from 38rem, icon left of the text
     3 columns                 from 34rem, icon ABOVE the text (cards) —
                               three columns are too narrow for icon + text
                               side by side. An entry with a link is
   clickable as a whole (stretched title link, arrow). Icons: pictograms
   (46–52px on a red-tinted tile, never below 40px) or UI icons
   (28–32px), two colours.
   ========================================================================== */

.sac-iconlist-wrap {
	container: sac-iconlist / inline-size;
}

.sac-iconlist {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	margin: 0; /* the wrapper takes the text flow's spacing */
	padding: 0;
	list-style: none;
	border-top: 1px solid var(--c-border);
}

.sac-iconlist > .sac-iconlist__item {
	position: relative;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: start; /* tile and title start on one line, however long the text */
	align-content: start; /* no stretched rows in taller neighbours' rows */
	column-gap: var(--space-4);
	margin: 0; /* cancels .entry-content li + li */
	padding: var(--space-4) var(--space-2) var(--space-4) 0;
	border-bottom: 1px solid var(--c-border);
	transition: background-color var(--dur-1) ease;
}

/* The icon tile: the soft red tint of the action pills with its hairline —
   it stands out on white, on grey sections and in a «Hinweis» box (all
   grey before, so the tile vanished there). */
.sac-iconlist__icon {
	display: grid;
	place-items: center;
	width: 3.75rem;
	height: 3.75rem;
	color: var(--c-heading);
	background: var(--c-accent-tint);
	border: 1px solid var(--c-accent-tint-line);
}

.sac-iconlist__icon .sac-icon {
	width: 1.75rem;
}

.sac-iconlist__icon .sac-pikto {
	width: 2.9rem;
	min-width: 2.5rem;
}

@media (min-width: 640px) {
	.sac-iconlist__icon {
		width: 4.25rem;
		height: 4.25rem;
	}

	.sac-iconlist__icon .sac-icon {
		width: 2rem;
	}

	.sac-iconlist__icon .sac-pikto {
		width: 3.25rem;
	}
}

.sac-iconlist__body {
	display: grid;
	gap: 0.1rem;
	min-width: 0;
}

.sac-iconlist__title {
	font-size: var(--fs-body);
	font-weight: 700;
	line-height: var(--lh-snug);
	color: var(--c-heading);
	text-decoration: none;
	transition: color var(--dur-1) ease;
}

.sac-iconlist__text {
	font-size: var(--fs-sm);
	line-height: 1.45;
	color: var(--c-text-muted);
}

/* Ort, Tag, Zeit under the text: one per line, small UI icon at the top
   of its line (long places wrap under the text, not under the icon); a
   hairline above each line, none below the last. */
.sac-iconlist__facts {
	display: grid;
	margin-top: var(--space-3);
	font-size: var(--fs-sm);
	line-height: 1.45;
	color: var(--c-text);
}

.sac-iconlist__fact {
	display: flex;
	align-items: flex-start;
	gap: var(--space-3);
	padding: var(--space-2) 0;
	border-top: 1px solid var(--c-border);
}

.sac-iconlist__fact:last-child {
	padding-bottom: 0;
}

.sac-iconlist__fact svg {
	flex: none;
	width: 1rem;
	margin-top: 0.15em; /* first line of text */
}

/* With a link: the whole entry is clickable, announced once. */
.sac-iconlist__link::after {
	content: "";
	position: absolute;
	inset: 0;
}

.sac-iconlist__go {
	display: flex;
	color: var(--c-heading);
}

.sac-iconlist__go svg {
	width: 1rem;
	transition: transform var(--dur-2) var(--ease-out);
}

.sac-iconlist__item.has-link:hover:where(:not(.sac-touch *)),
.sac-iconlist__item.has-link:active {
	background: var(--c-surface-2);
}

.sac-iconlist__item.has-link:hover:where(:not(.sac-touch *)) .sac-iconlist__title,
.sac-iconlist__item.has-link:active .sac-iconlist__title {
	color: var(--c-link-hover);
}

.sac-iconlist__item.has-link:hover:where(:not(.sac-touch *)) .sac-iconlist__go svg,
.sac-iconlist__item.has-link:active .sac-iconlist__go svg {
	transform: translateX(3px);
}

.sac-iconlist__item:has(.sac-iconlist__link:focus-visible) {
	outline: 2px solid var(--c-focus);
	outline-offset: 2px;
}

.sac-iconlist__link:focus-visible {
	outline: 0;
}

/* The arrow stays centred in its row. */
.sac-iconlist__go {
	align-self: center;
}

/* Two columns: a hairline left of every second entry. */
@container sac-iconlist (min-width: 38rem) {
	.sac-iconlist.sac-iconlist--2 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.sac-iconlist.sac-iconlist--2 > .sac-iconlist__item:nth-child(2n) {
		padding-left: var(--space-5);
		border-left: 1px solid var(--c-border);
	}

	.sac-iconlist.sac-iconlist--2 > .sac-iconlist__item:nth-child(2n + 1) {
		padding-right: var(--space-5);
	}
}

/* Option «Icon über dem Text» (sac-iconlist--oben): the icon on its own row
   at every width, title and text below (arrow next to the text). */
.sac-iconlist.sac-iconlist--oben > .sac-iconlist__item {
	grid-template-columns: minmax(0, 1fr) auto;
	row-gap: var(--space-3);
}

.sac-iconlist.sac-iconlist--oben .sac-iconlist__icon {
	grid-column: 1 / -1;
}

.sac-iconlist.sac-iconlist--oben .sac-iconlist__go {
	align-self: end;
}

/* Three columns: cards — icon on top, title and text below (arrow next to
   the text), a hairline between the columns. */
@container sac-iconlist (min-width: 34rem) {
	.sac-iconlist.sac-iconlist--3 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.sac-iconlist.sac-iconlist--3 > .sac-iconlist__item {
		grid-template-columns: minmax(0, 1fr) auto;
		row-gap: var(--space-3);
		padding: var(--space-5);
		border-left: 1px solid var(--c-border);
	}

	.sac-iconlist.sac-iconlist--3 > .sac-iconlist__item:nth-child(3n + 1) {
		padding-left: 0;
		border-left: 0;
	}

	.sac-iconlist.sac-iconlist--3 > .sac-iconlist__item:nth-child(3n) {
		padding-right: var(--space-2);
	}

	.sac-iconlist.sac-iconlist--3 .sac-iconlist__icon {
		grid-column: 1 / -1;
	}

	.sac-iconlist.sac-iconlist--3 .sac-iconlist__go {
		align-self: end;
	}
}
