/*
 * Design System – Basis-Styles
 * Basis-/Element-Regeln (ursprünglich aus Automatic.css 3.3.8 extrahiert).
 * Farben: Bricks > Style Manager > Colors, Palette "acf" (--base = Blau, --primary = Rot, --neutral = Grau).
 * Variablen: Bricks > Style Manager > Variables (Kategorie "Design System").
 * Klassen:   Bricks > Style Manager > Classes (Kategorie "Design System").
 */

[id] {
  scroll-margin-top: var(--offset, 0);
}

:root {
  interpolate-size: allow-keywords;
}

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

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

:where(dd) {
  margin-inline-start: 0;
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }
}

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

body:where(:not(.block-editor-writing-flow, .editor-styles-wrapper)) :where(p, h1, h2, h3, h4, h5, h6, ul, ol, li) {
  margin-block: 0;
}

/* Fließtext-Abstände in Rich-Text (Bricks "Text") und Beitragsinhalt. Werte: Variablen-Kategorie "Design System"
   (--flow-spacing, --heading-spacing, --list-*, --figure-spacing, --blockquote-spacing). Gleiche Regeln: Klasse smart-spacing. */
:is(.brxe-text, .brxe-post-content:where(:not([data-source="bricks"]))) > * + * {
  margin-block-start: var(--flow-spacing);
  margin-block-end: 0;
}

:is(.brxe-text, .brxe-post-content:where(:not([data-source="bricks"]))) > * + :where(h1, h2, h3, h4, h5, h6) {
  margin-block-start: var(--heading-spacing);
}

:is(.brxe-text, .brxe-post-content:where(:not([data-source="bricks"]))) > :is(* + ul, * + ol) {
  margin-block: var(--list-spacing);
}

:is(.brxe-text, .brxe-post-content:where(:not([data-source="bricks"]))) > :is(ul, ol) {
  padding-inline-start: var(--list-indent-spacing);
}

:is(.brxe-text, .brxe-post-content:where(:not([data-source="bricks"]))) > :is(ul, ol) * + li {
  margin-block-start: var(--list-item-spacing);
  margin-block-end: 0;
}

:is(.brxe-text, .brxe-post-content:where(:not([data-source="bricks"]))) > :is(ul, ol) :is(ul, ol) {
  margin-block: var(--list-item-spacing);
  padding-inline-start: var(--nested-list-indent-spacing);
}

:is(.brxe-text, .brxe-post-content:where(:not([data-source="bricks"]))) > :is(ul, ol) :is(ul, ol) li {
  margin-block-start: var(--list-item-spacing);
}

:is(.brxe-text, .brxe-post-content:where(:not([data-source="bricks"]))) > :is(* + figure, * + picture) {
  margin-block: var(--figure-spacing);
}

:is(.brxe-text, .brxe-post-content:where(:not([data-source="bricks"]))) figcaption {
  margin-block: var(--figcaption-spacing);
}

:is(.brxe-text, .brxe-post-content:where(:not([data-source="bricks"]))) > * + blockquote:where(:not(figure > blockquote)) {
  margin-block: var(--blockquote-spacing);
}

:is(.brxe-text, .brxe-post-content:where(:not([data-source="bricks"]))) > blockquote * + * {
  margin-block-start: var(--paragraph-spacing);
  margin-block-end: 0;
}

/* nach Liste/Bild/Zitat kein zusätzlicher Abstand (die haben schon margin-block) */
:is(.brxe-text, .brxe-post-content:where(:not([data-source="bricks"]))) > :is(figure, blockquote, ul, ol):where(:not(:first-child)) + * {
  --paragraph-spacing: 0;
  --flow-spacing: 0;
}

body :where(p:last-of-type) + :is(h1, h2, h3, h4, h5, h6) {
  margin-block-start: 0;
}

/* Hintergrund-Bereiche (bg--*): Text-, Überschrift- und Linkfarben werden als Custom Properties am Bereich selbst
   gesetzt und vererbt. Dadurch gewinnt immer der nächstliegende Bereich, d. h. bg--*-Bereiche lassen sich beliebig
   tief verschachteln (z. B. .bg--light in .bg--dark). Jeder Bereich setzt alle Werte neu (inkl. Links), damit ein
   heller Bereich in einem dunklen die Farben des dunklen nicht erbt. */
.bg--white,
.bg--ultra-light {
  color: var(--bg-ultra-light-text);
  --heading-color: var(--bg-ultra-light-heading);
  --link-color: var(--base);
  --link-color-hover: var(--base-hover);
}

.bg--light {
  color: var(--bg-light-text);
  --heading-color: var(--bg-light-heading);
  --link-color: var(--base);
  --link-color-hover: var(--base-hover);
}

.bg--dark {
  color: var(--bg-dark-text);
  --heading-color: var(--bg-dark-heading);
  --link-color: var(--bg-dark-link);
  --link-color-hover: var(--bg-dark-link-hover);
}

.bg--ultra-dark {
  color: var(--bg-ultra-dark-text);
  --heading-color: var(--bg-ultra-dark-heading);
  --link-color: var(--bg-dark-link);
  --link-color-hover: var(--bg-dark-link-hover);
}

blockquote {
  text-wrap: pretty;
}

body.bricks-is-frontend.bricks-is-frontend :focus {
  outline: none;
  box-shadow: none;
}

body.bricks-is-frontend.bricks-is-frontend :focus-visible {
  outline-style: solid;
  outline-color: var(--focus-color);
  outline-width: var(--focus-width);
  outline-offset: var(--focus-offset);
}

@supports not selector(:focus-visible) {
  body.bricks-is-frontend.bricks-is-frontend :focus {
    outline-style: solid;
    outline-color: var(--focus-color);
    outline-width: var(--focus-width);
    outline-offset: var(--focus-offset);
  }
}

/* Skip-Link (von Bricks ausgegeben, Bricks blendet ihn bis zum Fokus per clip aus). Form über die Button-Regeln unten,
   Farben eigenständig (maximaler Kontrast, unabhängig von btn--primary). Pro Projekt anpassbar über
   --skip-link-background und --skip-link-color. */
.skip-link {
  position: absolute;
  inset-block-start: var(--space-s);
  inset-inline-start: var(--space-s);
  --btn-min-width: fit-content;
  --btn-background: var(--skip-link-background, var(--base));
  --btn-background-hover: var(--btn-background);
  --btn-text-color: var(--skip-link-color, var(--white));
  --btn-text-color-hover: var(--btn-text-color);
  --btn-border-color: var(--btn-background);
  --btn-border-color-hover: var(--btn-background);
  --focus-color: var(--btn-background);
}

/* Section-Padding und Abstände (Section/Container/Block/Div): Bricks > Theme Style > Elemente. */

/* Typografie (Body + Überschriften: Schrift, Größe, Farbe, Gewicht, Zeilenhöhe) und Seitenhintergrund:
   Bricks > Theme Style > Typografie bzw. Allgemein. Hier nur, was der Theme Style nicht abbildet. */
body {
  min-block-size: 100vh;
  text-wrap: var(--text-text-wrap);
}

/* line-height mit ex muss am Element selbst stehen (ex bezieht sich auf dessen Schrift, vererbt würde der px-Wert) */
p,
li {
  line-height: var(--text-line-height);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: var(--heading-text-wrap);
}

body a:where(:not([class*= btn--], .no-linkstyling, .no-linkstyling a, header a)) {
  color: var(--link-color, var(--base));
  font-weight: var(--link-weight, inherit);
  text-decoration: var(--link-decoration, underline);
  text-underline-offset: var(--link-underline-offset, 3px);
  text-decoration-thickness: var(--link-decoration-thickness);
  transition: var(--link-transition, var(--transition));
}

@media (hover: hover) and (pointer: fine) {
  body a:where(:not([class*= btn--], .no-linkstyling, .no-linkstyling a, header a)):hover {
    color: var(--link-color-hover, var(--base-hover));
  }
}

h1 a,
h2 a,
h3 a,
h4 a,
h5 a,
h6 a {
  font-weight: inherit;
  text-decoration: inherit;
  color: currentcolor;
  text-underline-offset: var(--link-underline-offset, 3px);
}

@media (hover: hover) and (pointer: fine) {
  h1 a:hover,
  h2 a:hover,
  h3 a:hover,
  h4 a:hover,
  h5 a:hover,
  h6 a:hover {
    color: currentcolor;
  }
}

[class*="btn--"]:where(:not(.btn--none, .wp-block-button)),
.skip-link {
  background: var(--btn-background);
  color: var(--btn-text-color);
  padding-block: var(--btn-padding-block);
  padding-inline: var(--btn-padding-inline);
  min-inline-size: var(--btn-min-width);
  line-height: var(--btn-line-height);
  font-size: var(--btn-font-size, var(--text-m));
  font-weight: var(--btn-font-weight);
  font-style: var(--btn-font-style);
  text-transform: var(--btn-text-transform);
  letter-spacing: var(--btn-letter-spacing);
  text-decoration: var(--btn-text-decoration);
  border-width: var(--btn-border-width);
  border-style: var(--btn-border-style);
  border-radius: var(--btn-radius);
  border-color: var(--btn-border-color);
  transition: var(--btn-transition, var(--transition));
  justify-content: var(--btn-justify-content, center);
  text-align: var(--btn-text-align, center);
}

@media (hover: hover) and (pointer: fine) {
  [class*="btn--"]:where(:not(.btn--none, .wp-block-button)):hover,
  .skip-link:hover {
    background: var(--btn-background-hover);
    color: var(--btn-text-color-hover);
    border-color: var(--btn-border-color-hover);
    text-decoration: var(--btn-text-decoration-hover);
  }
}

[class*="btn--"]:where(:not(.btn--none, .wp-block-button)):focus,
.skip-link:focus {
  outline-style: solid;
  outline-color: var(--focus-color);
  outline-width: var(--focus-width);
  outline-offset: var(--focus-offset);
}
