/* Bloxi – Theme "Basis"
   Alle Farben und Schriften kommen aus CSS-Custom-Properties, die im
   Admin unter Design gesetzt werden. Blockklassen beginnen mit .bx-. */

/* Grundgestaltung (Schrift, Farben, Bilder, Kopf- und Fußbereich).
   Zwei Regeln dafür:
   1. Sie steht in :where() und hat damit die Spezifität 0. Eigenes CSS
      einer Website – eingefügt unter Design oder mitgebracht beim Import –
      gewinnt dadurch immer, auch mit einem schlichten "body { … }" oder
      "footer { … }". Vorher schlug body.bx-body jede solche Regel.
   2. Trägt der body die Klasse bx-ohne-grundstil, entfällt sie ganz. Das
      ist für Websites, die ihr komplettes CSS selbst mitbringen: dort
      soll nichts von der Vorlage durchscheinen. Die Bloxi-Bausteine
      (.bx-…) behalten ihre Gestaltung in beiden Fällen. */

:where(body:not(.bx-ohne-grundstil)),
:where(body:not(.bx-ohne-grundstil)) *,
:where(body:not(.bx-ohne-grundstil)) *::before,
:where(body:not(.bx-ohne-grundstil)) *::after { box-sizing: border-box; }

:where(.bx-ohne-grundstil [class*="bx-"]:not(.bx-main, .bx-site-header, .bx-site-footer)),
:where(.bx-ohne-grundstil [class*="bx-"]:not(.bx-main, .bx-site-header, .bx-site-footer)) *,
:where(.bx-ohne-grundstil [class*="bx-"]:not(.bx-main, .bx-site-header, .bx-site-footer)) *::before,
:where(.bx-ohne-grundstil [class*="bx-"]:not(.bx-main, .bx-site-header, .bx-site-footer)) *::after { box-sizing: border-box; }

:where(.bx-ohne-grundstil [class*="bx-"]:not(.bx-main, .bx-site-header, .bx-site-footer)) img {
  max-width: 100%; height: auto; display: block;
}

html { -webkit-text-size-adjust: 100%; }

/* Bringt eine importierte Kopf- oder Fußzeile ihr eigenes <header> bzw.
   <footer> mit (etwa <header class="kopf">), wird die äußere Hülle des
   Layouts unsichtbar. Sonst griffe "header { padding: … }" aus dem CSS der
   Website zweimal – an der Hülle und am Original-Element. */
.bx-ohne-grundstil .bx-site-header:has(> header),
.bx-ohne-grundstil .bx-site-footer:has(> footer) { display: contents; }

:where(body.bx-body:not(.bx-ohne-grundstil)) {
  margin: 0;
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: var(--fs-base, 17px);
  line-height: var(--lh-base, 1.65);
  color: var(--c-text, #1b1f27);
  background: var(--c-bg, #fff);
  -webkit-font-smoothing: antialiased;
}

:where(body:not(.bx-ohne-grundstil)) img,
:where(body:not(.bx-ohne-grundstil)) video,
:where(body:not(.bx-ohne-grundstil)) iframe { max-width: 100%; }
:where(body:not(.bx-ohne-grundstil)) img { height: auto; display: block; }

:where(body:not(.bx-ohne-grundstil)) a { color: var(--c-accent, #1f5eff); }

.bx-container {
  width: 100%;
  max-width: var(--container, 1140px);
  margin-inline: auto;
  padding-inline: 20px;
}

/* --- Layout-Blöcke --- */

.bx-section { padding-block: var(--space-section, 72px); }
.bx-section--full > .bx-row { padding-inline: 20px; }

/* Importierte Wrapper sollen keinen Theme-Abstand erben */
.bx-section--nospace { padding-block: 0; }

.bx-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: stretch;
}

.bx-col {
  flex: 1 1 0%;
  min-width: 0;
}

.bx-spacer { width: 100%; }

.bx-divider {
  border: 0;
  border-top: 1px solid var(--c-border, #e2e5ea);
  margin-block: 24px;
}

/* --- Inhaltsblöcke --- */

.bx-heading {
  font-family: var(--font-heading, inherit);
  line-height: 1.2;
  margin: 0 0 .5em;
  text-wrap: balance;
}

h1.bx-heading { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.25rem); }
h2.bx-heading { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.35rem); }
h3.bx-heading { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.7rem); }

.bx-text > :first-child { margin-top: 0; }
.bx-text > :last-child { margin-bottom: 0; }
.bx-text p { margin: 0 0 1em; }

.bx-list { margin: 0 0 1em; padding-left: 1.25em; }
.bx-list li { margin-bottom: .35em; }

.bx-image figcaption {
  font-size: .875em;
  color: var(--c-muted, #5c6572);
  margin-top: .6em;
}

.bx-button {
  display: inline-block;
  padding: .8em 1.6em;
  border-radius: var(--radius, 10px);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: transform .12s ease, opacity .12s ease;
}

.bx-button:hover { transform: translateY(-1px); }
.bx-button:focus-visible { outline: 2px solid var(--c-accent, #1f5eff); outline-offset: 3px; }

.bx-button--primary {
  background: var(--c-accent, #1f5eff);
  color: var(--c-accent-contrast, #fff);
}

.bx-button--secondary {
  background: var(--c-surface, #f5f6f8);
  color: var(--c-text, #1b1f27);
}

.bx-button--outline {
  border: 1.5px solid currentColor;
  color: var(--c-accent, #1f5eff);
}

.bx-button--link {
  padding: 0;
  color: var(--c-accent, #1f5eff);
  text-decoration: underline;
}

/* Gegen Link-Regeln einer importierten Website.
   Deren CSS färbt oft alle Links mit Regeln wie
     a:not(.btn):not(.nav-link):not(footer a) { color: …; border-bottom: … }
   – stärker als .bx-button--primary. Ein Bloxi-Knopf hatte dann schwarze
   Schrift auf Blau und einen fremden Unterstrich. Die folgenden Regeln
   wiederholen nur die umkämpften Angaben mit mehr Gewicht (vier Klassen;
   die :not()-Teile treffen nie und dienen nur dem Gewicht). Was im Zahnrad
   eingestellt ist (#id), gewinnt weiterhin. */
.bx-button:not(.bx-_):not(.bx-__) { text-decoration: none; border-bottom: 0; }
.bx-button.bx-button--primary:not(.bx-_):not(.bx-__) { color: var(--c-accent-contrast, #fff); }
.bx-button.bx-button--secondary:not(.bx-_):not(.bx-__) { color: var(--c-text, #1b1f27); }
.bx-button.bx-button--outline:not(.bx-_):not(.bx-__),
.bx-button.bx-button--outline:not(.bx-_):not(.bx-__):hover { color: var(--c-accent, #1f5eff); border: 1.5px solid currentColor; }
.bx-button.bx-button--link:not(.bx-_):not(.bx-__) { color: var(--c-accent, #1f5eff); text-decoration: underline; }

/* --- Einbettungen --- */

.bx-embed iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--radius, 10px);
  display: block;
}

/* --- Header / Footer / Navigation --- */

.bx-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  flex-wrap: wrap;
}

.bx-brand {
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--c-text, #1b1f27);
}

.bx-nav { display: flex; gap: 20px; flex-wrap: wrap; }

.bx-nav a {
  text-decoration: none;
  color: var(--c-muted, #5c6572);
  font-weight: 500;
}

.bx-nav a[aria-current="page"], .bx-nav a:hover { color: var(--c-text, #1b1f27); }

/* Ohne Klasse bx-ohne-grundstil – oder wenn statt einer Komponente der
   eingebaute Kopf/Fuß steht (…--vorlage) */
:where(body:not(.bx-ohne-grundstil) .bx-site-header, .bx-site-header--vorlage) { border-bottom: 1px solid var(--c-border, #e2e5ea); }

:where(body:not(.bx-ohne-grundstil) .bx-site-footer, .bx-site-footer--vorlage) {
  border-top: 1px solid var(--c-border, #e2e5ea);
  padding-block: 32px;
  color: var(--c-muted, #5c6572);
  font-size: .925rem;
  margin-top: auto;
}

/* --- Responsive --- */

@media (max-width: 1024px) {
  .bx-row--stack-tablet { flex-direction: column; }
  .bx-section { padding-block: calc(var(--space-section, 72px) * .75); }
}

@media (max-width: 767px) {
  .bx-row--stack-mobile, .bx-row--stack-tablet { flex-direction: column; }
  .bx-section { padding-block: calc(var(--space-section, 72px) * .55); }
  .bx-container { padding-inline: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --- Vorschau-Hinweis --- */

.bx-preview-flag {
  position: fixed;
  inset-block-end: 16px;
  inset-inline-start: 16px;
  z-index: 99999;
  background: #10203a;
  color: #fff;
  font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 10px 14px;
  border-radius: 999px;
  box-shadow: 0 6px 24px rgb(16 32 58 / .28);
  pointer-events: none;
}

/* ---------------------------------------------------------------
   Kontaktformular
   --------------------------------------------------------------- */

.bx-form { max-width: 42rem; }

.bx-form__feld { margin-bottom: 1.1rem; }

.bx-form__feld label {
  display: block;
  margin-bottom: .35rem;
  font-weight: 600;
  font-size: .95rem;
}

.bx-form__feld input,
.bx-form__feld textarea {
  width: 100%;
  padding: .7rem .85rem;
  font: inherit;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  box-sizing: border-box;
}

.bx-form__feld textarea { resize: vertical; min-height: 8rem; }

.bx-form__feld input:focus,
.bx-form__feld textarea:focus {
  outline: 2px solid var(--c-accent);
  outline-offset: 1px;
  border-color: var(--c-accent);
}

/* Rot erst, nachdem der Besucher im Feld war oder absenden wollte
   (:user-invalid). Die frühere Regel input:invalid:not(:placeholder-shown)
   griff bei Feldern ohne Platzhalter – also bei allen – sofort: leere
   Pflichtfelder standen schon beim Laden der Seite rot umrandet da. */
.bx-form__feld input:user-invalid,
.bx-form__feld textarea:user-invalid { border-color: #b8352f; }

.bx-form__pflicht { color: var(--c-accent); }

.bx-form__hinweis {
  margin: 1rem 0;
  font-size: .87rem;
  color: var(--c-muted);
}

.bx-form__senden { margin-top: .5rem; }

.bx-form__danke,
.bx-form__fehler {
  padding: 1rem 1.15rem;
  border-radius: 8px;
  border: 1px solid;
  margin: 0 0 1rem;
}

.bx-form__danke {
  background: #e7f4ee;
  border-color: #bfe0d0;
  color: #1f5c42;
}

.bx-form--danke .bx-form__danke { margin: 0; }

.bx-form__fehler {
  background: #fceceb;
  border-color: #f0c8c5;
  color: #8f2a25;
}

/* Die Falle für automatische Einsendungen. Nicht display:none – manche
   Bots überspringen genau das. So steht sie im Layout, ist aber für
   Menschen und Screenreader unerreichbar. */
.bx-form__falle {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Untermenüs. Öffnen bei Hover und bei Tastaturfokus – reines CSS, damit die
   Navigation auch ohne JavaScript vollständig bedienbar bleibt. */

.bx-nav__gruppe { position: relative; display: inline-block; }

.bx-nav__unter {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  min-width: 11rem;
  margin: 0;
  padding: .4rem 0;
  list-style: none;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  box-shadow: 0 8px 24px -14px rgb(0 0 0 / .4);
  opacity: 0;
  visibility: hidden;
  transition: opacity .12s ease;
}

.bx-nav__gruppe:hover .bx-nav__unter,
.bx-nav__gruppe:focus-within .bx-nav__unter { opacity: 1; visibility: visible; }

.bx-nav__unter a { display: block; padding: .45rem 1rem; white-space: nowrap; }

@media (max-width: 700px) {
  .bx-nav__gruppe { display: block; }
  .bx-nav__unter {
    position: static;
    opacity: 1;
    visibility: visible;
    min-width: 0;
    margin: .2rem 0 .4rem .9rem;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: none;
  }
  .bx-nav__unter a { padding: .3rem 0; }
}

@media (prefers-reduced-motion: reduce) {
  .bx-nav__unter { transition: none; }
}

/* Platzhalter für leere Container. Erscheint ausschließlich in der
   Editorvorschau – auf der fertigen Website gibt der Renderer ihn nicht aus. */
.bx-leerbox {
  min-height: 64px;
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
  border: 2px dashed rgb(37 99 235 / .35);
  border-radius: 6px;
  color: #6b7280;
  font: 500 13px/1.4 system-ui, sans-serif;
  text-align: center;
}

/* --- Bildergalerie ---------------------------------------------------
   Die Anordnung steht im CSS, nicht im JavaScript: So sitzt die Galerie
   schon beim ersten Bild richtig und springt nicht nach. Die Spaltenzahl
   und der Abstand kommen als Variablen vom Block selbst. */

.bx-galerie {
  --bx-galerie-spalten: 3;
  --bx-galerie-luft: 12px;
  margin: 0 0 1em;
}

.bx-galerie__stueck { margin: 0; }

/* Direkt auf der obersten Ebene einer Seite, nicht in einem Abschnitt:
   dort gibt es keinen Seitenrand, und die Galerie stieße an beide
   Fensterränder. Gilt nur für die Galerie – bestehende Seiten verschieben
   sich dadurch nicht. */
.bx-main > .bx-galerie {
  max-width: var(--container, 1140px);
  margin-inline: auto;
  padding-inline: 20px;
  box-sizing: border-box;
}

.bx-galerie__stueck img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius, 10px);
}

.bx-galerie figcaption {
  font-size: .875em;
  color: var(--c-muted, #5c6572);
  margin-top: .5em;
}

/* Collage: jedes Bild behält seine Form, die Spalten füllen sich von
   selbst. Kein Skript, kein Nachrücken beim Laden. */
.bx-galerie--mosaik {
  columns: var(--bx-galerie-spalten);
  column-gap: var(--bx-galerie-luft);
}

.bx-galerie--mosaik .bx-galerie__stueck {
  break-inside: avoid;
  margin-bottom: var(--bx-galerie-luft);
}

/* Raster: alle Bilder auf dasselbe Quadrat geschnitten. */
.bx-galerie--raster {
  display: grid;
  grid-template-columns: repeat(var(--bx-galerie-spalten), 1fr);
  gap: var(--bx-galerie-luft);
}

.bx-galerie--raster .bx-galerie__stueck img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* Eine Reihe: nebeneinander, bei Bedarf umbrechend. */
.bx-galerie--reihe {
  display: flex;
  flex-wrap: wrap;
  gap: var(--bx-galerie-luft);
}

.bx-galerie--reihe .bx-galerie__stueck {
  flex: 1 1 160px;
  max-width: 100%;
}

.bx-galerie__link {
  display: block;
  cursor: zoom-in;
}

.bx-galerie__link:focus-visible {
  outline: 2px solid var(--c-accent, #1f5eff);
  outline-offset: 3px;
}

.bx-galerie__link img { transition: opacity .15s ease; }
.bx-galerie__link:hover img { opacity: .88; }

@media (max-width: 1024px) {
  .bx-galerie--mosaik { columns: 2; }
  .bx-galerie--raster { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
  .bx-galerie--mosaik { columns: 1; }
  .bx-galerie--raster { grid-template-columns: 1fr; }
  .bx-galerie--reihe .bx-galerie__stueck { flex-basis: 100%; }
}

/* --- Großansicht ----------------------------------------------------- */

.bx-gross {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  background: rgba(12, 14, 18, .92);
}

.bx-gross[hidden] { display: none; }

body.bx-gross-offen { overflow: hidden; }

.bx-gross__rahmen {
  margin: 0;
  max-width: min(1100px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.bx-gross__rahmen img {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  border-radius: var(--radius, 10px);
  display: block;
}

.bx-gross figcaption {
  color: #f2f3f5;
  font-size: .95rem;
  text-align: center;
  margin: 0;
}

.bx-gross__zu,
.bx-gross__pfeil {
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
  flex: none;
}

.bx-gross__zu {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  font-size: 28px;
}

.bx-gross__pfeil {
  width: 52px;
  height: 52px;
  font-size: 34px;
}

.bx-gross__zu:hover,
.bx-gross__pfeil:hover { background: rgba(255, 255, 255, .28); }

.bx-gross__zu:focus-visible,
.bx-gross__pfeil:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.bx-gross__zaehler {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  color: #c8ccd3;
  font-size: .85rem;
  margin: 0;
}

@media (max-width: 767px) {
  .bx-gross { padding: 10px; gap: 4px; }
  .bx-gross__pfeil { width: 40px; height: 40px; font-size: 26px; }
  .bx-gross__rahmen img { max-height: 70vh; }
}
