/* ============================================
 * JW BASE – GLOBAL CSS
 * Reset, Base Elements, Layout, Buttons, Forms, Accessibility
 * ============================================ */

/* ── Reset ── */

*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	scroll-behavior: smooth;
	-webkit-text-size-adjust: 100%;
	-moz-text-size-adjust: 100%;
	text-size-adjust: 100%;
	font-size:100%;
}

body {
	min-height: 100vh;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	overflow-x: hidden;
}

img,
picture,
video,
canvas,
svg {
	display: block;
	max-width: 100%;
	height: auto;
}

input,
button,
textarea,
select {
	font: inherit;
	color: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
	overflow-wrap: break-word;
}

ul,
ol {
	list-style: none;
}

a {
	color: inherit;
	text-decoration: none;
}

table {
	border-collapse: collapse;
	width: 100%;
}


/* ── Layout Variabeln (Fluid) ── */
:root {
	--jw-wrapper-width: 82vw;
	--jw-wrapper-max: 2100px;
}

/* ── Micro-Spacing (component-level, nicht im Editor) ── */
:root {
	--jw-space-2:  0.125rem; /* 2px  */
	--jw-space-4:  0.25rem;  /* 4px  */
	--jw-space-6:  0.375rem; /* 6px  */
	--jw-space-8:  0.5rem;   /* 8px  */
	--jw-space-10: 0.625rem; /* 10px */
	--jw-space-12: 0.75rem;  /* 12px */
	--jw-space-16: 1rem;     /* 16px */
	--jw-space-20: 1.25rem;  /* 20px */
	--jw-space-24: 1.5rem;   /* 24px */
}
@media (max-width: 1680px) { :root { --jw-wrapper-width: 86vw; } }
@media (max-width: 1200px) { :root { --jw-wrapper-width: 90vw; } }
@media (max-width: 992px) {  :root { --jw-wrapper-width: 92vw; } }
@media (max-width: 768px) {  :root { --jw-wrapper-width: 94vw; } }
@media (max-width: 576px) {  :root { --jw-wrapper-width: 100%; } }

/* ── Layout ── */

.wrapper {
	width: var(--jw-wrapper-width);
	max-width: var(--jw-wrapper-max);
	margin-inline: auto;
}

@media (max-width: 576px) {
	.wrapper {
		padding-inline: var(--jw-space-24);
	}
}

.wrapper--narrow {
	max-width: 48rem;
}

.site-main {
	min-height: 60vh;
}




/* ── Typography ── */

h1, h2, h3, h4, h5, h6 {
	line-height: 1.2;
	font-weight: 400;
}

/* wp_kses_post() entfernt jeden CSS-Wert mit "(" (u. a. var()) aus dem style-Attribut
   der Inhalte – die font-size aus dem jw_fontsize-TinyMCE-Button geht dadurch bei jedem
   Frontend-Render verloren. Klasse bleibt erhalten → hier als Fallback definieren. */
.has-small-font-size    { font-size: var(--wp--preset--font-size--small); }
.has-medium-font-size   { font-size: var(--wp--preset--font-size--medium); }
.has-large-font-size    { font-size: var(--wp--preset--font-size--large); line-height: 1.3; }
.has-x-large-font-size  { font-size: var(--wp--preset--font-size--x-large); line-height: 1.2; }
.has-xx-large-font-size { font-size: var(--wp--preset--font-size--xx-large); line-height: 1.1; }

p + p {
	margin-top: 1em;
}

strong, b {
	font-weight: 700;
}

em, i {
	font-style: italic;
}


/* ── Links ── */

.post-card__title a {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
	transition: color 0.2s ease;
}

.post-card__title a:hover {
	color: var(--wp--preset--color--secondary);
}


/* ── Buttons ── */

.button,
button[type="submit"],
input[type="submit"],
.forminator-button-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	padding: 0.8em 1.6em;
	border: 2px solid var(--wp--preset--color--primary);
	border-radius: 0;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	cursor: pointer;
	transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
	-webkit-appearance: none;
	appearance: none;
	text-decoration: none;
}

.button:hover,
.button:focus-visible,
button[type="submit"]:hover,
input[type="submit"]:hover,
.forminator-button-submit:hover,
.forminator-button-submit:focus-visible {
	background: var(--wp--preset--color--primary-dark-900, var(--wp--preset--color--dark));
	border-color: var(--wp--preset--color--primary-dark-900, var(--wp--preset--color--dark));
	color: var(--wp--preset--color--white);
}

/* White solid: bg=white, border=white, text=primary */
.button--white {
	background: var(--wp--preset--color--white);
	border-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--primary);
}

.button--white:hover,
.button--white:focus-visible {
	background: var(--wp--preset--color--primary);
	border-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
}

/* Outline Primary: bg=transparent, border=primary, text=primary */
.button--outline {
	background: transparent;
	color: var(--wp--preset--color--primary);
}

.button--outline:hover,
.button--outline:focus-visible {
	background: var(--wp--preset--color--primary);
	border-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
}

/* Outline White: bg=transparent, border=white, text=white */
.button--outline-white {
	background: transparent;
	border-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--white);
}

.button--outline-white:hover,
.button--outline-white:focus-visible {
	background: var(--wp--preset--color--white);
	border-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--primary);
}


/* ── Forms ── */

input[type="text"],
input[type="email"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="password"],
textarea,
select {
	width: 100%;
	padding: 0.7em 1em;
	border: 1px solid var(--wp--preset--color--medium, #767676);
	border-radius: 0;
	background: var(--wp--preset--color--white);
	font-size: var(--wp--preset--font-size--medium);
	transition: border-color 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

input:focus,
textarea:focus,
select:focus {
	outline: 2px solid var(--wp--preset--color--secondary);
	outline-offset: 2px;
	border-color: var(--wp--preset--color--secondary);
}

select {
	padding-right: 2.5em;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23767676' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.8em center;
	background-size: 1em;
}

label {
	display: block;
	margin-bottom: 0.25em;
	font-weight: 700;
}

/* Forminator zeigt Admins/Formular-Managern einen "Formular bearbeiten"-Link direkt im
   gerenderten Formular (class-render-form.php, edit_module_link()) – kein offizieller
   Hook zum Deaktivieren, nur global via forminator_admin_cap (sperrt Backend-Zugriff). */
.forminator-edit-module {
	display: none;
}


/* ── Images ── */

figure {
	margin: 0;
}

figcaption {
	margin-top: 0.5em;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--medium);
}

/* Fancybox-Trigger: Selektor deckt sich mit dem JS-Binding in fancybox-init.js */
[data-fancybox],
.fancybox {
	cursor: zoom-in;
}


/* ── Accessibility ── */

.visually-hidden,
.sr-only {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.skip-to-content {
	position: fixed;
	top: -100%;
	left: 50%;
	transform: translateX(-50%);
	z-index: 100000;
	padding: 0.8em 1.6em;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
	font-weight: 700;
	text-decoration: none;
	transition: top 0.2s ease;
}

.skip-to-content:focus {
	top: 1rem;
}

/* Focus styles */
:focus-visible {
	outline: 2px solid var(--wp--preset--color--secondary);
	outline-offset: 2px;
}

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

/* ── Post Card Grid ── */

.post-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
	gap: var(--wp--preset--spacing--xs);
	margin-block: var(--wp--preset--spacing--s);
}

.post-card {
	display: flex;
	flex-direction: column;
}

.post-card__image {
	display: block;
	aspect-ratio: 16 / 10;
	overflow: hidden;
}

.post-card__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}

.post-card:hover .post-card__image img {
	transform: scale(1.03);
}

.post-card__content {
	padding-top: var(--jw-space-12);
}

.post-card__title {
	font-size: var(--wp--preset--font-size--large);
	margin-bottom: 0.25em;
}

.post-card__date {
	display: block;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--medium);
	margin-bottom: 0.5em;
}

.post-card__excerpt {
	font-size: var(--wp--preset--font-size--medium);
}


/* ── Pagination ── */

.pagination {
	margin-block: var(--wp--preset--spacing--s);
}

.pagination .nav-links {
	display: flex;
	gap: 0.5em;
	justify-content: center;
	align-items: center;
}

.pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5em;
	height: 2.5em;
	padding: 0.25em 0.5em;
	border: 1px solid var(--wp--preset--color--medium);
	text-decoration: none;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.pagination .page-numbers.current,
.pagination .page-numbers:hover {
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
	border-color: var(--wp--preset--color--primary);
}


/* ── 404 ── */

.error-404 {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 60vh;
	text-align: center;
}

.error-404__title {
	font-size: clamp(6rem, -2.565rem + 13.383vw, 15rem);
	line-height: 1;
	font-weight: 700;
	opacity: 0.1;
}

.error-404__text {
	margin-block: var(--jw-space-12) var(--jw-space-24);
	font-size: var(--wp--preset--font-size--large);
}

.error-404 .search-form {
	max-width: 30rem;
	margin: 0 auto var(--jw-space-24);
}


/* ── Search Results ── */

.search-results__header {
	padding-block: var(--wp--preset--spacing--s);
}

.search-results__empty {
	padding-block: var(--wp--preset--spacing--s);
	text-align: center;
}

.search-results__empty .search-form {
	max-width: 30rem;
	margin: var(--jw-space-24) auto 0;
}


/* ── Archive ── */

.archive-header {
	padding-block: var(--wp--preset--spacing--s);
}

.archive-description {
	margin-top: var(--jw-space-12);
	font-size: var(--wp--preset--font-size--large);
	color: var(--wp--preset--color--medium);
}


/* ── Post Single ── */

.post-header {
	padding-block: var(--wp--preset--spacing--s) var(--wp--preset--spacing--xs);
}

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

.post-meta {
	margin-top: var(--jw-space-12);
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--medium);
}

/* ── Body Lock (for modals/menus) ── */

body.menu-open,
body.fancybox-lock {
	overflow: hidden;
}


/* ── Footer ── */

.site-footer {
	padding-block: 0;
	border-top: 1px solid var(--wp--preset--color--light);
}

.footer__inner {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: var(--jw-space-12);
}

.footer__nav-list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--jw-space-12);
}

.footer__nav-list a {
	transition: color 0.2s ease;
}

.footer__nav-list a:hover {
	color: var(--wp--preset--color--secondary);
}

.footer__copyright {
	color: var(--wp--preset--color--medium);
}


/* ── Back to Top ── */

.back-to-top {
	position: fixed;
	right: var(--jw-space-24);
	bottom: var(--jw-space-24);
	z-index: 90;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 3rem;
	height: 3rem;
	color: var(--wp--preset--color--white);
	background: var(--wp--preset--color--primary);
	/* Versteckt bis über eine volle Viewport-Höhe gescrollt (JS toggelt .is-visible) */
	opacity: 0;
	visibility: hidden;
	transform: translateY(var(--jw-space-8));
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s, background-color 0.25s ease;
}

.back-to-top.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	pointer-events: auto;
	transition: opacity 0.25s ease, transform 0.25s ease, background-color 0.25s ease;
}

.back-to-top:hover,
.back-to-top:focus-visible {
	background: var(--wp--preset--color--primary-dark-900, var(--wp--preset--color--dark));
}

.back-to-top svg {
	width: 1.5rem;
	height: 1.5rem;
}

@media (max-width: 576px) {
	.back-to-top {
		right: var(--jw-space-16);
		bottom: var(--jw-space-16);
	}
}


/* ── Module Heading ── */

.module-heading {
	display: flex;
	flex-direction: column;
	margin-bottom: var(--mh-spacing, var(--wp--preset--spacing--m));
}

.module-heading__eyebrow {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.05em;
	margin: 0 0 var(--wp--preset--spacing--s);
}

.module-heading__divider {
	border: none;
	border-top: 1px solid currentColor;
	margin: 0 0 var(--wp--preset--spacing--xs);
	opacity: 0.2;
}

.module-heading__row {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--jw-space-8);
}

.module-heading__headline {
	margin: 0;
	flex: 1;
	max-width: 75%;
}

.module-heading__button {
	flex-shrink: 0;
}

@media (max-width: 768px) {
	.module-heading__row {
		flex-direction: column;
		align-items: flex-start;
		gap: var(--jw-space-4);
	}

	.module-heading__headline {
		max-width: none;
	}
}


/* ── Block Background Utilities ── */
/* .has-bg--{slug} wird dynamisch per PHP aus theme.json generiert → inc/helpers.php */

/* Bild-Hintergrund als echtes <img> in .block-bg (responsive via srcset).
   isolation: isolate hält das z-index:-1-Layer im Block, Content bleibt darüber. */
.has-bg-image {
	position: relative;
	isolation: isolate;
}

.block-bg {
	position: absolute;
	inset: 0;
	z-index: -1;
	overflow: hidden;
}

.block-bg__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: var(--bg-img-pos, center center);
}

.block-bg--overlay .block-bg__img {
	filter: grayscale(1);
}

.block-bg__overlay {
	position: absolute;
	inset: 0;
	--block-overlay-color: #000;
	background: linear-gradient(
		135deg,
		var(--block-overlay-color) 0%,
		color-mix(in srgb, var(--block-overlay-color), transparent 65%) 100%
	);
}

