/*
 * Marla OS – Grundklassen nach der Designsystem-Blaupause.
 *
 * Marla OS ist blank (ab 0.4.0): Diese Datei enthält nur Technik und Layout-Werkzeug –
 * Grundlage, Abstände, Raster, Flächen- und Schriftgrößen-Klassen als Verweise auf die Tokens,
 * Fotos, Sticky-Header und Navigation. Keine Gestaltung: Buttons, Karten, FAQ, Icons,
 * Header- und Footer-Aufbau entwirft jedes Projekt selbst in assets/css/projekt.css.
 * Werte kommen aus der theme.json des Child-Themes.
 *
 * Breakpoints wie Elementor: Tablet bis 1024px, Mobil bis 767px.
 */

/* ---------- Grundlage ---------- */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.wp-site-blocks { padding: 0; }
.wp-site-blocks :where(p, h1, h2, h3, h4, h5, h6, ul, ol, dl, figure, blockquote) { margin: 0; }
:where(.wp-site-blocks) img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 3px solid var(--color-brand-primary); outline-offset: 3px; border-radius: 4px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
html { scroll-padding-top: calc(var(--header-height, 80px) + 16px); }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Editor: Sektionen volle Breite wie auf der Seite (statt Inhaltsbreite für Fließtext) */
.editor-styles-wrapper .is-root-container > :is(.section, .announcement, .site-header, .site-footer) { max-width: none; }

/* Template-Parts ohne eigenen Kasten, damit position:sticky im Header wirkt */
.marla-contents { display: contents; }

/* Fließtext auf normalen Seiten und Beiträgen (Templates mit Titel) */
.prose { max-width: calc(var(--measure) + 6rem); }
.prose > * + * { margin-block-start: 1em; }
.prose > :is(h2, h3, h4) { margin-block-start: 1.6em; }
.prose :where(ul, ol) { padding-inline-start: 1.25em; }

/* ---------- Layout ---------- */
.section { padding: var(--section-l) var(--gutter); overflow-x: clip; }
.section-l { padding-top: var(--section-l); padding-bottom: var(--section-l); }
.section-m { padding-top: var(--section-m); padding-bottom: var(--section-m); }
.section-s { padding-top: var(--section-s); padding-bottom: var(--section-s); }
.container { width: 100%; max-width: var(--container); margin-inline: auto; display: flex; flex-direction: column; gap: var(--space-2xl); }
.measure { max-width: var(--measure); display: flex; flex-direction: column; gap: var(--space-m); }
.stack { display: flex; flex-direction: column; gap: var(--space-m); }
.stack-s { display: flex; flex-direction: column; gap: var(--space-s); }
.stack-l { display: flex; flex-direction: column; gap: var(--space-l); }
.stack-xl { display: flex; flex-direction: column; gap: var(--space-xl); }
.lines, .wp-block-buttons.lines { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.gutter { padding-inline: var(--gutter); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-s); }

.split { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--space-xl); row-gap: var(--space-2xl); align-items: start; }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
.align-center { align-items: center; } .align-stretch { align-items: stretch; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-m); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-xl); flex-wrap: wrap; }

/* ---------- Flächen ---------- */
.bg-default { background: var(--color-surface-default); }
.bg-alt { background: var(--color-surface-alt); }
.bg-dark { background: var(--color-surface-dark); color: var(--color-text-on-dark-muted); }
.bg-primary { background: var(--color-brand-primary); color: var(--color-text-heading); }
.bg-dark :is(h1, h2, h3, h4, h5, h6, .display, .h1, .h2, .h3, .h4) { color: var(--color-text-on-dark); }

/* ---------- Typografie ---------- */
.display, .h1, .h2, .h3, .h4 { font-family: var(--font-heading); color: var(--color-text-heading); margin: 0; }
.display { font-size: var(--font-size-display); line-height: .95; }
.h1 { font-size: var(--font-size-h1); line-height: 1; }
.h2 { font-size: var(--font-size-h2); line-height: 1.02; }
.h3 { font-size: var(--font-size-h3); line-height: 1.1; }
.h4 { font-size: var(--font-size-h4); line-height: 1.15; }
.text-l { font-size: var(--font-size-text-l); line-height: 1.55; }
.text-m { font-size: var(--font-size-text-m); line-height: 1.65; }
.text-s { font-size: var(--font-size-text-s); line-height: 1.55; }
.text-xs { font-size: var(--font-size-text-xs); line-height: 1.45; }
.text-m-bold { font-size: var(--font-size-text-m); line-height: 1.5; font-weight: 600; color: var(--color-text-heading); }
.mark { color: var(--color-brand-primary); }
/* Textfarbe aus dem Editor (Hervorheben-Werkzeug) ohne gelben Browser-Hintergrund */
mark.has-inline-color { background: transparent; }
.text-on-dark { color: var(--color-text-on-dark); }
.text-muted { color: var(--color-text-muted); }

/* ---------- Fotos ----------
 * Bild-Block mit Klasse „photo“ füllt seine Fläche (Format über Klasse, z. B. photo-4-3),
 * bleibt so auch in gesperrten Sektionen über „Ersetzen“ austauschbar. */
.wp-block-image.photo { margin: 0; overflow: hidden; }
.wp-block-image.photo img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ---------- Header und Navigation ---------- */
.site-header { position: sticky; top: 0; z-index: 50; }
.admin-bar .site-header { top: var(--wp-admin--admin-bar--height, 32px); }

/* Navigation klappt wie Elementor bei 1024px ein (WordPress selbst erst bei 600px). */
@media (min-width: 600px) and (max-width: 1024px) {
	.site-header .wp-block-navigation__responsive-container-open:not(.always-shown) { display: flex; }
	.site-header .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) { display: none; }
}

/* ---------- Badge „Powered by / Läuft auf Marla OS“ (inc/badge.php) ----------
   Übernimmt die Textfarbe des Footers, passt so auf dunkle und helle Flächen. */
.marla-badge {
	display: inline-flex; align-items: center; gap: 0;
	padding: 6px 14px 6px 9px; border-radius: 999px;
	border: 1px solid color-mix(in srgb, currentColor 16%, transparent);
	background: color-mix(in srgb, currentColor 4%, transparent);
	color: inherit; font-family: inherit; line-height: 1; white-space: nowrap;
	text-decoration: none; transition: border-color .2s ease;
}
.marla-badge:hover, .marla-badge:focus-visible { border-color: color-mix(in srgb, #ff6b4a 60%, transparent); color: inherit; }
.marla-badge__zeichen { width: 22px; height: 22px; flex: none; margin-right: 10px; display: block; }
/* Beide Wörter auf einer Grundlinie, egal welche Schrift die Website nutzt */
.marla-badge__text { display: inline-flex; align-items: baseline; gap: 5px; line-height: 1; }
.marla-badge__vorne { font-size: 12px; font-weight: 400; opacity: .65; }
.marla-badge__name { font-size: 13px; font-weight: 600; letter-spacing: .01em; }
/* Nur in der Editor-Vorschau, wenn die Echtheitsprüfung (inc/echtheit.php) nicht bestanden ist */
.marla-badge-hinweis { margin: 0; padding: 6px 10px; border: 1px dashed currentColor; border-radius: 6px; font-size: 12px; opacity: .7; }

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
	.split { grid-template-columns: minmax(0, 1fr); }
	.split > [class*="span-"] { grid-column: auto; }
	.grid, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Mobil ---------- */
@media (max-width: 767px) {
	.grid, .grid-2, .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; }
}
