/*
Theme Name: Corporate Theme
Theme URI: https://www.feuerwehr-heidelberg-altstadt.de
Author: Freiwillige Feuerwehr Heidelberg – Abteilung Altstadt
Description: Block theme for the Freiwillige Feuerwehr Heidelberg, Abteilung Altstadt. Side menu in the brand color, yellow warning stripes and slanted labels from the flyer design, Noto Sans (self-hosted), landing-page pattern with emergency box and three image cards. Style variation "Feuerwehrrot" swaps Heidelbeer for fire-brigade red. No external fonts, no JavaScript.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
Version: 2.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: corporate-theme
Tags: full-site-editing, block-patterns, block-styles, left-sidebar, style-variations, custom-logo, editor-style
*/

/*
 * Colors come from the theme.json palette (preset variables), so the
 * style variation "Feuerwehrrot" re-colors everything that uses "primary".
 */

:root {
	--ffa-sidebar-width: 15rem;
	/* The yellow warning stripes from the flyer. */
	--ffa-stripes: repeating-linear-gradient(
		120deg,
		var(--wp--preset--color--accent) 0 0.75rem,
		transparent 0.75rem 1.6rem
	);
	--ffa-tilt: -4deg;
}

.screen-reader-text {
	border: 0;
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important;
}

/* ---------- Slanted label (block style "Label (schräg)") ---------- */

.is-style-label,
.site-brand__name,
.site-brand__unit {
	width: fit-content;
	max-width: 100%;
	padding: 0.15em 0.55em 0.2em;
	background-color: var(--wp--preset--color--dark);
	color: var(--wp--preset--color--background);
	font-style: italic;
	font-weight: 800;
	font-stretch: 87.5%;
	line-height: 1.15;
	transform: rotate(var(--ffa-tilt));
	transform-origin: left center;
}

.is-style-label a,
.site-brand__name a {
	color: inherit;
	text-decoration: none;
}

/* ---------- Yellow stripes (separator block style "Gelbe Streifen") ---------- */

.wp-block-separator.is-style-stripes {
	border: 0;
	height: 1.75rem;
	max-width: none;
	width: auto;
	background: var(--ffa-stripes);
	opacity: 1;
}

.wp-block-separator.is-style-stripes:not(.alignwide):not(.alignfull) {
	width: 100%;
}

/* ---------- Page frame: side menu + content ---------- */

.wp-site-blocks > * {
	margin-block-start: 0;
}

/* Small screens: the side menu becomes a sticky top bar with a burger menu. */
.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: 0;
	z-index: 100;
}

.admin-bar .wp-site-blocks > header.wp-block-template-part {
	top: var(--wp-admin--admin-bar--height, 0px);
}

.site-sidebar {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--30);
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40) calc(var(--wp--preset--spacing--30) + 0.5rem);
}

.site-sidebar::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 0.5rem;
	background: var(--ffa-stripes);
}

.site-sidebar > * {
	margin: 0;
}

.site-brand {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0;
}

.site-brand > * {
	margin: 0;
}

.site-brand__logo {
	margin-bottom: var(--wp--preset--spacing--30);
}

.site-brand__name {
	background-color: var(--wp--preset--color--background);
	color: var(--wp--preset--color--dark);
	text-transform: uppercase;
	font-size: 0.95rem;
}

.site-brand__unit {
	margin-top: -0.05em;
	margin-left: 1.25em;
	font-size: 0.85rem;
}

.site-brand .wp-block-site-logo {
	display: none;
}

/* Navigation (shared). */
.site-sidebar__nav a:hover,
.site-sidebar__nav a:focus-visible,
.site-sidebar__nav .current-menu-item > a {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--accent);
	text-decoration-thickness: 3px;
	text-underline-offset: 0.3em;
}

/* Mobile overlay. */
.site-sidebar .wp-block-navigation__responsive-container.is-menu-open {
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--background);
	padding: var(--wp--preset--spacing--50);
}

.site-sidebar .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	font-size: var(--wp--preset--font-size--large);
	font-weight: 700;
}

/* From 600px (the navigation block's own breakpoint): real side menu. */
@media (min-width: 600px) {
	.wp-site-blocks {
		display: grid;
		grid-template-columns: var(--ffa-sidebar-width) minmax(0, 1fr);
		grid-template-rows: 1fr auto;
		min-height: 100vh;
		/* Keeps the brand color behind the side menu on very long pages. */
		background: linear-gradient(to right, var(--wp--preset--color--primary) var(--ffa-sidebar-width), transparent 0);
	}

	.wp-site-blocks > header.wp-block-template-part {
		grid-column: 1;
		grid-row: 1 / span 2;
		align-self: start;
		height: 100vh;
		overflow-y: auto;
		background-color: var(--wp--preset--color--primary);
	}

	.admin-bar .wp-site-blocks > header.wp-block-template-part {
		height: calc(100vh - var(--wp-admin--admin-bar--height, 0px));
	}

	.wp-site-blocks > :not(header) {
		grid-column: 2;
		min-width: 0;
	}

	.site-sidebar {
		min-height: 100%;
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		gap: var(--wp--preset--spacing--50);
		padding: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40) 0;
	}

	/* Stripes fill the bottom of the side menu. */
	.site-sidebar::after {
		position: static;
		flex: 0 0 7rem;
		height: auto;
		margin: auto calc(-1 * var(--wp--preset--spacing--40)) 0;
	}

	.site-brand .wp-block-site-logo {
		display: block;
	}

	.site-brand__name {
		font-size: 1.05rem;
	}

	.site-brand__unit {
		font-size: 0.95rem;
	}

	.site-sidebar__nav .wp-block-navigation__container {
		gap: 0.35rem;
	}

	.site-sidebar__nav .wp-block-navigation-item__content {
		font-weight: 700;
		padding: 0.2rem 0;
	}

	/* Sub-pages are listed indented below their parent instead of in a fly-out. */
	.site-sidebar .wp-block-navigation .has-child .wp-block-navigation__submenu-container {
		position: static;
		visibility: visible;
		opacity: 1;
		width: auto;
		min-width: 0;
		height: auto;
		overflow: visible;
		border: 0;
		background: transparent;
		color: inherit;
		padding: 0.15rem 0 0.25rem 0.85rem;
		border-left: 2px solid var(--wp--preset--color--accent);
		margin-top: 0.25rem;
	}

	.site-sidebar .wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
		font-weight: 400;
		padding: 0.1rem 0;
	}

	.site-sidebar .wp-block-navigation .wp-block-navigation__submenu-icon {
		display: none;
	}

	.site-sidebar .wp-block-navigation .has-child {
		flex-direction: column;
		align-items: flex-start;
	}
}

@media (min-width: 1280px) {
	:root {
		--ffa-sidebar-width: 17rem;
	}
}

/* ---------- Main ---------- */

.site-main {
	padding-top: var(--wp--preset--spacing--60);
	padding-bottom: var(--wp--preset--spacing--60);
}

.site-main--front {
	padding-top: var(--wp--preset--spacing--50);
}

/* ---------- Landing page: help box ---------- */

.help-box {
	padding: var(--wp--preset--spacing--50);
}

.help-box > * {
	margin-block: 0;
}

.help-box > * + * {
	margin-block-start: var(--wp--preset--spacing--30);
}

.help-box .is-style-label {
	background-color: var(--wp--preset--color--background);
	color: var(--wp--preset--color--dark);
	font-size: var(--wp--preset--font-size--x-large);
	margin-bottom: var(--wp--preset--spacing--40);
}

.help-box__emergency {
	font-size: var(--wp--preset--font-size--large);
	font-weight: 700;
	line-height: 1;
}

.help-box__emergency a {
	display: inline-block;
	margin-left: 0.15em;
	color: var(--wp--preset--color--accent);
	font-size: var(--wp--preset--font-size--huge);
	font-style: italic;
	font-weight: 900;
	letter-spacing: -0.02em;
	text-decoration: none;
	vertical-align: middle;
}

.help-box__emergency a:hover,
.help-box__emergency a:focus-visible {
	color: var(--wp--preset--color--background);
}

.help-box__more a {
	color: var(--wp--preset--color--background);
	font-weight: 700;
	text-decoration-color: var(--wp--preset--color--accent);
	text-decoration-thickness: 3px;
	text-underline-offset: 0.3em;
}

.help-box__more a::after {
	content: " →";
}

.help-box__more a:hover,
.help-box__more a:focus-visible {
	color: var(--wp--preset--color--accent);
}

/* ---------- Landing page: image cards ---------- */

.feature-cards {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--wp--preset--spacing--50);
}

.feature-cards > * {
	margin: 0;
}

@media (min-width: 1000px) {
	.feature-cards {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.feature-card {
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	padding-bottom: 0.25rem;
}

.feature-card > * {
	margin: 0;
}

.feature-card__image {
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background-color: var(--wp--preset--color--surface);
}

.feature-card__image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.feature-card .is-style-label {
	position: relative;
	z-index: 1;
	margin: -1.4em 0 0 0.75rem;
	font-size: var(--wp--preset--font-size--large);
}

.feature-card__more {
	margin-top: var(--wp--preset--spacing--30);
	margin-left: 0.75rem;
	color: var(--wp--preset--color--primary);
	font-weight: 700;
}

.feature-card__more::after {
	content: " →";
}

/*
 * The whole card is clickable: the heading link is stretched over the card
 * (clipped by the card's overflow). Front end only, so the editor stays editable.
 */
:where(body:not(.editor-styles-wrapper)) .feature-card .is-style-label a::after {
	content: "";
	position: absolute;
	inset: -100rem;
}

.feature-card:hover .feature-card__image img {
	transform: scale(1.04);
}

.feature-card:hover .feature-card__more {
	text-decoration: underline;
	text-underline-offset: 0.3em;
}

.feature-card:has(a:focus-visible) {
	outline: 3px solid var(--wp--preset--color--primary);
	outline-offset: 4px;
}

.feature-card .is-style-label a:focus-visible {
	outline: none;
}

/* ---------- Phone number list (list block style "Telefonnummern") ---------- */

.wp-block-list.is-style-phone {
	list-style: none;
	padding-left: 0;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
	gap: var(--wp--preset--spacing--30);
}

.wp-block-list.is-style-phone > li {
	margin: 0;
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
	background-color: var(--wp--preset--color--surface);
	border-left: 6px solid var(--wp--preset--color--accent);
	line-height: 1.45;
}

.wp-block-list.is-style-phone > li strong {
	display: block;
}

.wp-block-list.is-style-phone a[href^="tel:"] {
	color: var(--wp--preset--color--text);
	font-weight: 700;
	white-space: nowrap;
}

/* The first number after the name is the main one. */
.wp-block-list.is-style-phone li > strong + a[href^="tel:"] {
	font-size: var(--wp--preset--font-size--large);
	font-style: italic;
	font-weight: 800;
	text-decoration: none;
}

.wp-block-list.is-style-phone a[href^="tel:"]:hover,
.wp-block-list.is-style-phone a[href^="tel:"]:focus-visible {
	color: var(--wp--preset--color--primary);
	text-decoration: underline;
}

/* ---------- Three columns pattern (cards with text) ---------- */

.three-columns > .wp-block-column {
	background-color: var(--wp--preset--color--surface);
	border-top: 6px solid var(--wp--preset--color--accent);
	padding: var(--wp--preset--spacing--40);
}

.three-columns > .wp-block-column > :first-child {
	margin-top: 0;
}

/* ---------- Blog grid ---------- */

.post-grid .wp-block-post-template {
	gap: var(--wp--preset--spacing--50);
}

.post-grid .wp-block-post {
	background-color: var(--wp--preset--color--surface);
	border-top: 6px solid var(--wp--preset--color--accent);
	padding: var(--wp--preset--spacing--40);
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--20);
}

.post-grid .wp-block-post > * {
	margin: 0;
}

.post-grid .wp-block-post-featured-image {
	margin: calc(-1 * var(--wp--preset--spacing--40)) calc(-1 * var(--wp--preset--spacing--40)) var(--wp--preset--spacing--20);
}

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

.post-grid .wp-block-post-title a {
	color: var(--wp--preset--color--text);
	text-decoration: none;
}

.post-grid .wp-block-post-title a:hover {
	color: var(--wp--preset--color--primary);
}

@media (max-width: 999px) {
	.post-grid .wp-block-post-template.is-layout-grid {
		grid-template-columns: 1fr;
	}
}

.wp-block-query-pagination {
	margin-top: var(--wp--preset--spacing--50);
}

/* ---------- Single posts / pages ---------- */

.entry-meta {
	color: var(--wp--preset--color--text);
	font-size: var(--wp--preset--font-size--small);
}

.post-navigation {
	border-top: 1px solid var(--wp--preset--color--surface);
	padding-top: var(--wp--preset--spacing--40);
}

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

.site-footer {
	position: relative;
	padding-top: calc(var(--wp--preset--spacing--60) + 1.75rem);
	padding-bottom: var(--wp--preset--spacing--40);
	font-size: var(--wp--preset--font-size--small);
}

/* Yellow stripes on black along the top edge. */
.site-footer::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 1.75rem;
	background: var(--ffa-stripes);
}

.site-footer a {
	color: var(--wp--preset--color--background);
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.site-footer a:hover,
.site-footer a:focus-visible {
	color: var(--wp--preset--color--accent);
}

.site-footer__heading {
	color: var(--wp--preset--color--background);
	font-size: var(--wp--preset--font-size--medium);
	font-style: italic;
	font-weight: 800;
	font-stretch: 87.5%;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.site-footer__email a {
	overflow-wrap: anywhere;
}

.site-footer__legal-links {
	list-style: none;
	padding-left: 0;
}

.site-footer__legal-links li + li {
	margin-top: var(--wp--preset--spacing--20);
}

.site-footer .wp-block-social-links.is-style-logos-only .wp-social-link {
	color: var(--wp--preset--color--background);
}

.site-footer .wp-block-social-links.is-style-logos-only .wp-social-link:hover {
	color: var(--wp--preset--color--accent);
}

.site-footer .wp-block-social-links .wp-social-link a {
	text-decoration: none;
	gap: 0.5em;
}

.site-footer .wp-block-social-links .wp-block-social-link-label {
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 700;
}

.site-footer__copyright {
	margin-top: var(--wp--preset--spacing--50);
	padding-top: var(--wp--preset--spacing--30);
	border-top: 1px solid rgb(255 255 255 / 0.2);
	opacity: 0.8;
}
