/* Smart Energy Management – Stylesheet
   Farben stammen aus dem bisherigen Design (Elementor Global Colors). */

:root {
  --blau-dunkel: #1C244B;
  --blau-text: #324A6D;
  --blau-akzent: #467FF7;
  --orange: #FD9807;
  --hell: #F3F5F8;
  --weiss: #FFFFFF;
  --rahmen: #C8D5DC;
  --breite: 1150px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--blau-text);
  background: var(--weiss);
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--blau-akzent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  color: var(--blau-dunkel);
  line-height: 1.25;
  margin: 1.6em 0 0.5em;
  font-weight: 600;
}
h1 { font-size: 2.1rem; margin-top: 0.4em; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }
h2 + h3, h3 + p.untertitel { margin-top: 0; }

p, ul, ol { margin: 0 0 1em; }
ul, ol { padding-left: 1.4em; }
hr { border: 0; border-top: 1px solid var(--rahmen); margin: 2.5rem 0; }

table { border-collapse: collapse; width: 100%; margin-bottom: 1.5em; }
th, td { border: 1px solid var(--rahmen); padding: 0.5em 0.75em; text-align: left; vertical-align: top; }
th { background: var(--hell); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Buttons ---------- */
.button, button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  vertical-align: middle;
  background: var(--orange);
  color: var(--weiss);
  font: inherit;
  font-weight: 600;
  padding: 0.65em 1.4em;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.button:hover, button.button:hover { background: #e28600; text-decoration: none; }
/* Buttons mit eigener Farbe/Größe (Inline-Style aus dem Editor): Hover durch Abdunkeln */
.button[style]:hover { filter: brightness(0.92); }
.button.sekundaer { background: var(--blau-akzent); }
.button.sekundaer:hover { background: #2f68dd; }

/* ---------- Kopfbereich ---------- */
.kopf {
  background: var(--weiss);
  border-bottom: 1px solid var(--rahmen);
  position: sticky;
  top: 0;
  z-index: 10;
  transition: border-color 0.2s;
}
/* Ganz oben auf der Seite keine Trennlinie (Klasse wird per Skript im Footer gesetzt) */
.kopf.oben { border-bottom-color: transparent; }
.kopf .innen {
  max-width: var(--breite);
  margin: 0 auto;
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.kopf .logo img { height: 64px; width: auto; }
.hauptmenue { margin-left: auto; }
.hauptmenue ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.25rem; flex-wrap: wrap; }
.hauptmenue a {
  display: block;
  padding: 0.5em 0.85em;
  color: var(--blau-dunkel);
  font-weight: 500;
  border-radius: 6px;
}
.hauptmenue a:hover { background: var(--hell); text-decoration: none; }
.hauptmenue li.aktiv a { color: var(--orange); }
.kopf .login { padding: 0.5em 1.2em; }
.menue-schalter { display: none; }
.menue-knopf { display: none; }

@media (max-width: 900px) {
  .kopf .innen { gap: 0.75rem; }
  .menue-knopf {
    display: inline-block;
    margin-left: auto;
    order: 2;
    padding: 0.4em 0.8em;
    border: 1px solid var(--rahmen);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    color: var(--blau-dunkel);
  }
  .kopf .login { order: 3; }
  .hauptmenue { order: 4; flex-basis: 100%; display: none; margin: 0; }
  .menue-schalter:checked ~ .hauptmenue { display: block; }
  .hauptmenue ul { flex-direction: column; padding: 0.5rem 0; }
}

/* ---------- Inhalt ---------- */
main { min-height: 50vh; }

.inhalt {
  max-width: var(--breite);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}
.inhalt > .inhalt { padding: 0; }
.beitrag { max-width: 860px; }
.beitrag .titelbild { border-radius: 10px; margin: 1.5rem 0 2rem; }
.meta { color: #6b7d95; font-size: 0.9rem; margin-bottom: 1.25rem; }

/* Spalten: nebeneinanderliegende Bereiche (z. B. Bild + Text) */
.spalten {
  display: grid;
  gap: 2rem;
  /* align-items: center; */
  margin: 2rem 0;
}
.spalten-2 { grid-template-columns: repeat(2, 1fr); }
.spalten-3 { grid-template-columns: repeat(3, 1fr); }
.spalten-4 { grid-template-columns: repeat(4, 1fr); }
.spalten img { border-radius: 10px; }
.spalten h2:first-child, .spalten h3:first-child { margin-top: 0; }

@media (max-width: 800px) {
  .spalten-2, .spalten-3, .spalten-4 { grid-template-columns: 1fr; }
  .spalten-4 { grid-template-columns: repeat(2, 1fr); }
}

/* Karten (Energiegemeinschaften-Übersicht, Beitragsliste) */
.karten { align-items: stretch; grid-template-columns: repeat(2, 1fr); }
@media (max-width: 800px) { .karten { grid-template-columns: 1fr; } }
.karte {
  background: var(--hell);
  border-radius: 10px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}
.karte h3 { margin-top: 0; }
.karte .untertitel { font-weight: 600; margin-top: -0.4em; }
.karte ul { padding-left: 1.2em; }
.karte li { margin-bottom: 0.5em; }
.karte img { border-radius: 8px; margin: -0.5rem -0.5rem 1rem; width: calc(100% + 1rem); max-width: none; aspect-ratio: 16 / 10; object-fit: cover; }
.karte h3 a { color: var(--blau-dunkel); }
.karte .mehr { font-weight: 600; }
.beitragsliste { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin: 1.5rem 0 2rem; }
@media (max-width: 900px) { .beitragsliste { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .beitragsliste { grid-template-columns: 1fr; } }

/* ---------- Hero (Startseite) ---------- */
.hero {
  max-width: var(--breite);
  margin: 1.5rem auto 0;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.hero-karte {
  position: relative;
  min-height: 340px;
  border-radius: 12px;
  overflow: hidden;
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background-size: cover;
  background-position: center;
  background-color: var(--blau-dunkel);
  color: var(--weiss);
}
.hero-karte::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(28, 36, 75, 0.35) 0%, rgba(28, 36, 75, 0) 70%);
}
.hero-karte > * { position: relative; }
.hero-karte h2 { color: var(--weiss); margin: 0 0 0.4em; font-size: 1.5rem; }
.hero-karte p { font-size: 0.95rem; }
.hero-karte .button { align-self: flex-start; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } .hero-karte { min-height: 260px; } }

/* ---------- Bildraster (mehrere Bilder in einer Reihe, per Admin-Editor einfügbar) ----------
   Aufbau: <div class="bildraster bildraster-4 [bildraster-f43] [bildraster-text-unten|-text-ueber] [bildraster-eng|-weit] [bildraster-eckig] [bildraster-mitte|-rechts]" [style="max-width:75%"]>
             <figure class="bildraster-bild">[<a href="…">]<img src="…" alt="…">[</a>][<figcaption><h3>…</h3><p>…</p></figcaption>]</figure> …
           </div>
   bildraster-2 … bildraster-6 = Bilder pro Reihe; -f169/-f43/-f11/-f32 = einheitliches Bildformat (sonst Originalformat);
   Abstand: -ohne (keiner) / -eng / Standard / -weit. */
.bildraster {
  display: grid;
  gap: 1.25rem;
  margin: 2rem 0;
  align-items: start;
}
.bildraster-2 { grid-template-columns: repeat(2, 1fr); }
.bildraster-3 { grid-template-columns: repeat(3, 1fr); }
.bildraster-4 { grid-template-columns: repeat(4, 1fr); }
.bildraster-5 { grid-template-columns: repeat(5, 1fr); }
.bildraster-6 { grid-template-columns: repeat(6, 1fr); }
.bildraster-eng { gap: 0.5rem; }
.bildraster-weit { gap: 2rem; }
.bildraster-ohne { gap: 0; }
.bildraster-ohne .bildraster-bild { border-radius: 0; }
.bildraster-mitte { margin-left: auto; margin-right: auto; }
.bildraster-rechts { margin-left: auto; }
/* Feste Bildbreite: style="grid-template-columns:repeat(auto-fill, 240px)" – so viele pro Reihe wie Platz ist */
.bildraster-fest.bildraster-mitte { justify-content: center; }
.bildraster-fest.bildraster-rechts { justify-content: end; }
/* Feste Bildhöhe: <img style="height:200px"> */
.bildraster-bild img[style*="height"] { object-fit: cover; }
.bildraster-bild { position: relative; margin: 0; border-radius: 10px; overflow: hidden; }
.bildraster-eckig .bildraster-bild { border-radius: 0; }
.bildraster-bild img { width: 100%; height: auto; display: block; transition: transform 0.25s; }
.bildraster-bild a { display: block; }
.bildraster-bild a:hover img { transform: scale(1.03); }
.bildraster-f169 .bildraster-bild img { aspect-ratio: 16 / 9; object-fit: cover; }
.bildraster-f43 .bildraster-bild img { aspect-ratio: 4 / 3; object-fit: cover; }
.bildraster-f32 .bildraster-bild img { aspect-ratio: 3 / 2; object-fit: cover; }
.bildraster-f11 .bildraster-bild img { aspect-ratio: 1 / 1; object-fit: cover; }
/* Bildunterschrift unter dem Bild */
.bildraster-bild figcaption { padding: 0.6rem 0.15rem 0; font-size: 0.9rem; color: var(--blau-text); }
.bildraster-bild figcaption h3 { color: inherit; font-size: 1rem; margin: 0 0 0.2em; }
.bildraster-bild figcaption p { margin: 0; }
.bildraster-text-unten .bildraster-bild { background: var(--hell); }
.bildraster-text-unten .bildraster-bild figcaption { padding: 0.75rem 1rem 1rem; }
.bildraster-text-unten .bildraster-bild figcaption:not([style]) h3 { color: var(--blau-dunkel); }
/* Bildunterschrift halbtransparent über dem Bild */
.bildraster-text-ueber .bildraster-bild figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 2rem 1rem 0.9rem;
  background: linear-gradient(to top, rgba(28, 36, 75, 0.85) 0%, rgba(28, 36, 75, 0.4) 65%, rgba(28, 36, 75, 0) 100%);
  color: var(--weiss);
}
@media (max-width: 800px) {
  .bildraster { max-width: none !important; }
  .bildraster-3, .bildraster-4, .bildraster-5, .bildraster-6 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .bildraster-2, .bildraster-3, .bildraster-4 { grid-template-columns: 1fr; }
}

/* ---------- Karussell (Bilder mit Text, per Admin-Editor einfügbar) ----------
   Aufbau: <div class="karussell" data-intervall="6000">
             <div class="karussell-folien">
               <figure class="karussell-folie"><img …><figcaption><h3>…</h3><p>…</p></figcaption></figure>
             </div></div>
   Funktioniert ohne JavaScript (wischen/scrollen); /assets/karussell.js ergänzt
   Pfeile, Punkte und automatischen Wechsel.
   Optionen: .karussell-unten = Text unter dem Bild, .karussell-zentriert = Text mittig im Bild; style="max-width:75%" (oder 800px) = Breite;
   .karussell-mitte / .karussell-rechts = Ausrichtung bei reduzierter Breite;
   .karussell-f169 / -f43 / -f11 = Bildformat 16:9, 4:3, 1:1 (Standard 16:7);
   feste Höhe: Klasse .karussell-hoehe und <div class="karussell-folien" style="height:400px">.
   Folie ohne Bild: <figure class="karussell-folie farbe" style="background-color:#324A6D"> (Klasse .hell = dunkler Text);
   eigene Textfarbe: <figcaption style="color:#fd9807"> */
.karussell {
  --format: 16 / 7;
  position: relative;
  margin: 2rem 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--hell);
}
/* Außerhalb des Inhaltsbereichs (direkt in <main>, also über die ganze Bildschirmbreite):
   keine runden Ecken, bündig unter dem Kopfbereich */
main > .karussell { border-radius: 0; margin-top: 0; }
.karussell-mitte { margin-left: auto; margin-right: auto; }
.karussell-rechts { margin-left: auto; }
.karussell-f169 { --format: 16 / 9; }
.karussell-f43 { --format: 4 / 3; }
.karussell-f11 { --format: 1 / 1; }
.karussell-folien {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.karussell-folien::-webkit-scrollbar { display: none; }
.karussell-folie {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  margin: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.karussell-folie img {
  width: 100%;
  aspect-ratio: var(--format);
  object-fit: cover;
  display: block;
}
/* Folie nur mit Farbe (ohne Bild): Text steht direkt auf der Farbfläche */
.karussell-folie.farbe {
  aspect-ratio: var(--format);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background-color: var(--blau-text);
}
.karussell-folie.farbe figcaption { position: static; background: none; }
.karussell-folie.farbe.hell figcaption { color: var(--blau-dunkel); }
/* Feste Höhe: Folien füllen die vorgegebene Höhe der Spur */
.karussell-hoehe .karussell-folie { display: flex; flex-direction: column; }
.karussell-hoehe .karussell-folie img { flex: 1 1 auto; min-height: 0; aspect-ratio: auto; }
.karussell-hoehe .karussell-folie.farbe { aspect-ratio: auto; }

/* Text: Standard = unten über dem Bild; Farbe per style="color:…" am figcaption änderbar (h3 erbt) */
.karussell-folie figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 3.5rem 1.75rem 1.5rem;
  background: linear-gradient(to top, rgba(28, 36, 75, 0.85) 0%, rgba(28, 36, 75, 0.45) 60%, rgba(28, 36, 75, 0) 100%);
  color: var(--weiss);
}
.karussell-folie figcaption h3 { color: inherit; margin: 0 0 0.3em; font-size: 1.35rem; }
.karussell-folie figcaption p { margin: 0; font-size: 0.95rem; max-width: 60ch; }
.karussell-folie figcaption:empty { display: none; }

/* Variante: Text mittig im Bild zentriert */
.karussell-zentriert .karussell-folie figcaption {
  top: 0;
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(28, 36, 75, 0.35);
}
.karussell-zentriert .karussell-folie figcaption p { max-width: 55ch; }
.karussell-zentriert .karussell-folie.farbe { justify-content: center; }
.karussell-zentriert .karussell-folie.farbe figcaption { background: none; }

/* Variante: Text unter dem Bild */
.karussell-unten .karussell-folie figcaption {
  position: static;
  background: none;
  color: var(--blau-text);
  padding: 1.25rem 1.5rem 1.5rem;
}
.karussell-unten .karussell-folie figcaption:not([style]) h3 { color: var(--blau-dunkel); }
.karussell-unten .karussell-folie.farbe figcaption { padding-top: 3.5rem; color: var(--weiss); }
.karussell-unten .karussell-folie.farbe.hell figcaption { color: var(--blau-dunkel); }

/* Bedienelemente (werden per JavaScript eingefügt) */
.karussell-pfeil {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--blau-dunkel);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  z-index: 2;
}
.karussell-pfeil:hover { background: var(--weiss); }
.karussell-pfeil:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.karussell-pfeil.zurueck { left: 1rem; }
.karussell-pfeil.weiter { right: 1rem; }
.karussell-punkte {
  position: absolute;
  left: 0; right: 0; bottom: 0.75rem;
  display: flex; justify-content: center; gap: 0.5rem;
  z-index: 2;
}
.karussell-unten .karussell-punkte { position: static; padding: 0 0 1.25rem; }
.karussell-punkte button {
  width: 11px; height: 11px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.karussell-unten .karussell-punkte button { background: var(--rahmen); }
.karussell-punkte button.aktiv { background: var(--orange); transform: scale(1.25); }
.karussell-punkte button:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
/* Variante "unten": Pfeile klein in der Zeile mit den Punkten */
.karussell-unten .karussell-pfeil { top: auto; bottom: 0.7rem; transform: none; width: 36px; height: 36px; font-size: 1.3rem; box-shadow: none; background: var(--hell); border: 1px solid var(--rahmen); }
.karussell-unten .karussell-pfeil:hover { background: var(--weiss); }

@media (max-width: 700px) {
  .karussell { max-width: none !important; }
  .karussell:not([class*="karussell-f"]) { --format: 4 / 3; }
  .karussell-folie figcaption { padding: 2.5rem 1.1rem 1.6rem; }
  .karussell-folie figcaption h3 { font-size: 1.1rem; }
  .karussell-folie figcaption p { font-size: 0.9rem; }
  .karussell-pfeil { width: 36px; height: 36px; font-size: 1.3rem; }
  .karussell-pfeil.zurueck { left: 0.5rem; }
  .karussell-pfeil.weiter { right: 0.5rem; }
}

/* ---------- Formulare ---------- */
.formular { max-width: 640px; margin: 1rem 0 2rem; }
.formular label { display: block; font-weight: 500; margin-bottom: 0.3em; color: var(--blau-dunkel); }
.formular input[type="text"], .formular input[type="email"], .formular textarea {
  width: 100%;
  font: inherit;
  padding: 0.6em 0.8em;
  border: 1px solid var(--rahmen);
  border-radius: 6px;
  background: var(--weiss);
}
.formular textarea { resize: vertical; }
.formular .zeile { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.formular .zeile input { flex: 1 1 240px; }
.formular .hp { position: absolute; left: -9999px; }
.hinweis { padding: 1rem 1.25rem; border-radius: 8px; margin: 1rem 0; }
.hinweis.ok { background: #e6f6ec; color: #1d6b3a; }
.hinweis.fehler { background: #fdecec; color: #a12727; }

/* ---------- Fußbereich ---------- */
/* Farben kommen als Variablen aus _inc/footer.php (Admin: "Footer"); ohne Angabe Dunkelblau */
.fuss {
  background: var(--fuss-bg, var(--blau-dunkel));
  color: var(--fuss-text, #d5dbea);
  margin-top: 3rem;
  font-size: 0.95rem;
}
.fuss .innen {
  max-width: var(--breite);
  margin: 0 auto;
  padding: 3rem 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: 2fr 1fr 1.4fr;
  gap: 2.5rem;
}
.fuss img { width: 120px; height: auto; margin-bottom: 1rem; background: var(--weiss); padding: 0.5rem; border-radius: 6px; }
.fuss h3 { color: var(--fuss-titel, var(--weiss)); font-size: 1rem; margin: 0 0 0.75em; }
.fuss ul { list-style: none; margin: 0; padding: 0; }
.fuss li { margin-bottom: 0.4em; }
.fuss a { color: var(--fuss-titel, var(--weiss)); }
.fuss a:hover { color: var(--orange); }
.fuss .copyright {
  border-top: 1px solid var(--fuss-linie, rgba(255, 255, 255, 0.15));
  text-align: center;
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
}
@media (max-width: 800px) { .fuss .innen { grid-template-columns: 1fr; gap: 1.5rem; } }
