/* ==========================================================================
   Werkbank – Inhalts-Typografie (Artikel, Seiten, Projekte).
   Gilt im Frontend (.entry-content) und im Editor (.editor-styles-wrapper),
   damit Backend und Frontend gleich aussehen.
   ========================================================================== */

:where(.entry-content, .editor-styles-wrapper) {
	font-size: 1.125rem;
	line-height: 1.75;
	overflow-wrap: break-word;
}

.editor-styles-wrapper {
	background: var(--color-bg);
	color: var(--color-text);
	font-family: var(--font-sans);
}

:where(.entry-content, .editor-styles-wrapper) > * {
	margin-block: 0;
}

:where(.entry-content, .editor-styles-wrapper) > * + * {
	margin-block-start: 1.25em;
}

/* Überschriften */
:where(.entry-content, .editor-styles-wrapper) :is(h2, h3, h4, h5, h6) {
	margin-block-start: 2.2em;
	margin-block-end: 0;
	scroll-margin-top: 6rem;
}

:where(.entry-content, .editor-styles-wrapper) h2 {
	font-size: var(--fs-xl);
	letter-spacing: -0.025em;
}

:where(.entry-content, .editor-styles-wrapper) h3 {
	font-size: var(--fs-l);
}

:where(.entry-content, .editor-styles-wrapper) h4 {
	font-size: var(--fs-m);
}

:where(.entry-content, .editor-styles-wrapper) :is(h2, h3, h4) + * {
	margin-block-start: 0.75em;
}

/* Links */
:where(.entry-content, .editor-styles-wrapper) a:not(.wp-block-button__link):not(.wp-element-button) {
	color: inherit;
	text-decoration-color: var(--color-accent);
	text-decoration-thickness: 1.5px;
}

:where(.entry-content, .editor-styles-wrapper) a:not(.wp-block-button__link):not(.wp-element-button):hover {
	color: var(--color-accent);
}

/* Listen */
:where(.entry-content, .editor-styles-wrapper) :is(ul, ol):not(.wp-block-gallery):not(.blocks-gallery-grid):not(.wp-block-social-links) {
	padding-left: 1.4em;
}

:where(.entry-content, .editor-styles-wrapper) li + li {
	margin-top: 0.35em;
}

:where(.entry-content, .editor-styles-wrapper) li::marker {
	color: var(--color-accent);
}

/* Zitate */
:where(.entry-content, .editor-styles-wrapper) blockquote,
:where(.entry-content, .editor-styles-wrapper) .wp-block-quote {
	margin-inline: 0;
	padding: 0.2em 0 0.2em 1.4em;
	border-left: 3px solid var(--color-accent);
	font-size: 1.2rem;
	line-height: 1.6;
}

:where(.entry-content, .editor-styles-wrapper) blockquote cite,
:where(.entry-content, .editor-styles-wrapper) .wp-block-quote cite {
	display: block;
	margin-top: 0.6em;
	font-family: var(--font-mono);
	font-size: var(--fs-xs);
	font-style: normal;
	color: var(--color-muted);
}

:where(.entry-content, .editor-styles-wrapper) .wp-block-pullquote {
	border-block: 1px solid var(--color-border);
	padding: 1.5em 0;
	text-align: left;
}

/* Code – dunkle Fläche in beiden Modi */
:where(.entry-content, .editor-styles-wrapper) pre,
:where(.entry-content, .editor-styles-wrapper) .wp-block-code,
:where(.entry-content, .editor-styles-wrapper) .wp-block-preformatted {
	position: relative;
	margin-inline: 0;
	padding: 1.1rem 1.25rem;
	overflow-x: auto;
	background: var(--color-code-bg);
	color: var(--color-code-text);
	border: 1px solid color-mix(in srgb, var(--color-code-bg) 70%, var(--color-border));
	border-radius: var(--radius-s);
	font-family: var(--font-mono);
	font-size: 0.875rem;
	line-height: 1.6;
	tab-size: 4;
	white-space: pre;
}

:where(.entry-content, .editor-styles-wrapper) pre code {
	background: none;
	padding: 0;
	color: inherit;
	font-size: inherit;
	border-radius: 0;
}

:where(.entry-content, .editor-styles-wrapper) :not(pre) > code,
:where(.entry-content, .editor-styles-wrapper) kbd {
	padding: 0.12em 0.4em;
	border-radius: 5px;
	background: var(--color-surface-2);
	border: 1px solid var(--color-border);
	font-family: var(--font-mono);
	font-size: 0.86em;
}

.code-copy {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
	padding: 0.3em 0.6em;
	border: 1px solid rgba(255, 255, 255, 0.15);
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.06);
	color: #c9ced3;
	font-family: var(--font-mono);
	font-size: 0.72rem;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.15s var(--ease);
}

.code-block:hover .code-copy,
.code-copy:focus-visible {
	opacity: 1;
}

.code-block {
	position: relative;
}

.code-copy .icon {
	width: 0.9rem;
	height: 0.9rem;
}

/* Bilder & Figuren */
:where(.entry-content, .editor-styles-wrapper) img {
	border-radius: var(--radius-s);
}

:where(.entry-content, .editor-styles-wrapper) figure {
	margin-inline: 0;
}

:where(.entry-content, .editor-styles-wrapper) figcaption,
:where(.entry-content, .editor-styles-wrapper) .wp-caption-text,
:where(.entry-content, .editor-styles-wrapper) .gallery-caption {
	margin-top: 0.6em;
	font-family: var(--font-mono);
	font-size: var(--fs-xs);
	line-height: 1.5;
	color: var(--color-muted);
	text-align: left;
}

.entry-content .alignwide {
	width: min(100vw - 2 * var(--gutter), var(--width-wide));
	max-width: none;
	margin-inline: calc(50% - min(100vw - 2 * var(--gutter), var(--width-wide)) / 2);
}

.entry-content .alignfull {
	width: 100vw;
	max-width: none;
	margin-inline: calc(50% - 50vw);
}

.entry-content .alignfull img {
	border-radius: 0;
}

:where(.entry-content, .editor-styles-wrapper) .alignleft {
	float: left;
	margin: 0.3em 1.5em 1em 0;
	max-width: 50%;
}

:where(.entry-content, .editor-styles-wrapper) .alignright {
	float: right;
	margin: 0.3em 0 1em 1.5em;
	max-width: 50%;
}

:where(.entry-content, .editor-styles-wrapper) .aligncenter {
	margin-inline: auto;
	display: block;
}

.entry-content::after {
	content: "";
	display: table;
	clear: both;
}

@media (max-width: 40rem) {
	:where(.entry-content, .editor-styles-wrapper) :is(.alignleft, .alignright) {
		float: none;
		max-width: 100%;
		margin: 1em 0;
	}
}

.wp-caption {
	max-width: 100%;
}

/* Galerien (Block + klassisch) */
:where(.entry-content, .editor-styles-wrapper) .gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
	gap: 0.75rem;
}

:where(.entry-content, .editor-styles-wrapper) .gallery-item {
	margin: 0;
}

:where(.entry-content, .editor-styles-wrapper) .gallery br {
	display: none;
}

:where(.entry-content, .editor-styles-wrapper) .gallery img {
	width: 100%;
	height: 100%;
	aspect-ratio: 1;
	object-fit: cover;
}

/* Embeds (YouTube, Vimeo …) */
:where(.entry-content, .editor-styles-wrapper) .wp-block-embed iframe,
:where(.entry-content, .editor-styles-wrapper) > iframe,
:where(.entry-content, .editor-styles-wrapper) p > iframe {
	max-width: 100%;
	border: 0;
	border-radius: var(--radius-s);
}

:where(.entry-content, .editor-styles-wrapper) iframe[src*="youtube"],
:where(.entry-content, .editor-styles-wrapper) iframe[src*="youtu.be"],
:where(.entry-content, .editor-styles-wrapper) iframe[src*="vimeo"] {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
}

:where(.entry-content, .editor-styles-wrapper) video {
	border-radius: var(--radius-s);
}

/* Tabellen */
:where(.entry-content, .editor-styles-wrapper) .wp-block-table,
:where(.entry-content, .editor-styles-wrapper) > table {
	overflow-x: auto;
}

:where(.entry-content, .editor-styles-wrapper) table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--fs-s);
	font-variant-numeric: tabular-nums;
}

:where(.entry-content, .editor-styles-wrapper) :is(th, td) {
	padding: 0.6em 0.8em;
	border-bottom: 1px solid var(--color-border);
	text-align: left;
	vertical-align: top;
}

:where(.entry-content, .editor-styles-wrapper) th {
	font-family: var(--font-mono);
	font-size: var(--fs-xs);
	font-weight: 600;
	color: var(--color-muted);
	border-bottom-color: var(--color-border-strong);
}

:where(.entry-content, .editor-styles-wrapper) .wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
	background: var(--color-surface);
}

/* Sonstiges */
:where(.entry-content, .editor-styles-wrapper) hr,
:where(.entry-content, .editor-styles-wrapper) .wp-block-separator {
	border: 0;
	border-top: 1px solid var(--color-border);
	margin-block: 2.5em;
}

:where(.entry-content, .editor-styles-wrapper) .wp-block-file {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.8rem 1rem;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-s);
	background: var(--color-surface);
}

:where(.entry-content, .editor-styles-wrapper) mark {
	background: var(--color-accent-soft);
	color: inherit;
	padding: 0 0.15em;
}

.page-links {
	margin-top: var(--space-4);
	font-family: var(--font-mono);
	font-size: var(--fs-s);
}
