/**
 * JottKaDe – globale Ergänzungen zu theme.json.
 *
 * Hier stehen nur Regeln, die theme.json nicht abbilden kann.
 * Farben, Schriften und Abstände kommen immer aus den Presets,
 * damit Änderungen unter „Design → Stile“ überall wirken.
 */

/* ---------- Grundlagen ---------- */

html {
	scroll-padding-top: 6rem;
	-webkit-text-size-adjust: 100%;
}

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	font-optical-sizing: auto;
	text-rendering: optimizeLegibility;
}

::selection {
	background-color: var(--wp--preset--color--secondary);
	color: var(--wp--preset--color--contrast);
}

h1, h2, h3, h4,
.wp-block-post-title {
	text-wrap: balance;
}

p,
li,
figcaption {
	text-wrap: pretty;
}

/* ---------- Links ---------- */

a {
	text-decoration-thickness: 1px;
	text-underline-offset: 0.22em;
	transition:
		color var(--wp--custom--motion--duration) var(--wp--custom--motion--easing),
		text-decoration-color var(--wp--custom--motion--duration) var(--wp--custom--motion--easing);
}

/* ---------- Buttons ---------- */

.wp-element-button,
.wp-block-button__link {
	transition:
		background-color var(--wp--custom--motion--duration) var(--wp--custom--motion--easing),
		color var(--wp--custom--motion--duration) var(--wp--custom--motion--easing),
		border-color var(--wp--custom--motion--duration) var(--wp--custom--motion--easing);
}

.wp-block-button.is-style-outline > .wp-block-button__link {
	border: 1px solid currentColor;
	padding: calc(0.8em - 1px) calc(1.4em - 1px);
}

.wp-block-button.is-style-outline > .wp-block-button__link:hover,
.wp-block-button.is-style-outline > .wp-block-button__link:focus-visible {
	background-color: var(--wp--preset--color--contrast);
	border-color: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
}

/* ---------- Fokus: gut sichtbar, nur bei Tastaturbedienung ---------- */

:where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 3px;
	border-radius: 2px;
}

:where(.wp-element-button, .wp-block-button__link):focus-visible {
	outline-offset: 3px;
	border-radius: var(--wp--custom--radius--button);
}

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

header.wp-block-template-part {
	position: sticky;
	top: 0;
	z-index: 100;
	border-bottom: 1px solid var(--wp--preset--color--border);
}

/*
 * Der halbtransparente Hintergrund liegt auf einem Pseudo-Element.
 * Ein backdrop-filter direkt am Header würde das mobile Vollbild-Menü
 * (position: fixed) auf die Header-Höhe begrenzen.
 */
header.wp-block-template-part::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background-color: var(--wp--preset--color--base);
	pointer-events: none;
}

@supports (background-color: color-mix(in srgb, red 50%, transparent)) and ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	header.wp-block-template-part::before {
		background-color: color-mix(in srgb, var(--wp--preset--color--base) var(--wp--custom--header--background-opacity), transparent);
		-webkit-backdrop-filter: saturate(1.4) blur(14px);
		backdrop-filter: saturate(1.4) blur(14px);
	}
}

/* Unter der Admin-Leiste andocken. Auf kleinen Bildschirmen scrollt die Admin-Leiste mit. */
.admin-bar header.wp-block-template-part {
	top: var(--wp-admin--admin-bar--height, 0px);
}

@media (max-width: 600px) {
	.admin-bar header.wp-block-template-part {
		top: 0;
	}
}

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

/* ---------- Beitrags-Metadaten ---------- */

.jk-post-meta {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--x-small);
}

.jk-post-meta > * {
	margin: 0;
}

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

.jk-footer {
	font-size: var(--wp--preset--font-size--small);
}

.jk-footer .wp-block-site-title {
	font-size: var(--wp--preset--font-size--medium);
}

/* Menülinks erben die Textfarbe des Navigationsblocks (im Site Editor einstellbar).
   Der Login-Link wird optisch angeglichen. */
.jk-footer .wp-block-loginout a {
	color: var(--wp--preset--color--muted);
	text-decoration: none;
}

.jk-footer .wp-block-loginout a:hover,
.jk-footer .wp-block-loginout a:focus-visible {
	color: var(--wp--preset--color--contrast);
	text-decoration: underline;
}

.jk-footer-nav {
	font-weight: 400;
}

/* ---------- Touch-Geräte: ausreichend große Klickflächen ---------- */

@media (pointer: coarse) {
	.jk-footer-links a,
	.wp-block-post-navigation-link a,
	.wp-block-query-pagination a {
		display: inline-block;
		padding-block: 0.625rem;
	}
}

/* ---------- Bewegung ---------- */

@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

@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;
	}
}

/* ---------- Editor: Hinweis auf manuelle Beitragsauswahl ---------- */

/* Das Attribut setzt nur der Editor. Im Frontend greift diese Regel nie. */
[data-jk-selection] {
	position: relative;
}

[data-jk-selection]::before {
	content: attr(data-jk-selection);
	display: block;
	width: fit-content;
	margin-bottom: 0.75rem;
	padding: 0.25rem 0.625rem;
	border-radius: 999px;
	background: var(--wp--preset--color--secondary);
	color: var(--wp--preset--color--contrast);
	font-size: 0.8125rem;
	font-weight: 500;
	line-height: 1.4;
}
