/* =========================================================================
   AUTOFIT WOTSCHKE – BEITRAGS-DESIGNSYSTEM  ("af-post")   Version 1.0
   -------------------------------------------------------------------------
   Prinzip
   - Alles steckt in einer Gutenberg-GRUPPE mit der CSS-Klasse  af-post.
     Nur was in dieser Gruppe liegt, wird gestaltet. Der Rest des Beitrags
     (Beitragsbild, Titel, Inhaltsverzeichnis, weitere Beiträge) bleibt bei
     Elementor.
   - Die Gruppe formatiert normale Blöcke (Überschriften, Absätze, Listen,
     Bilder, Tabellen, Zitate, Buttons) automatisch im CI.
   - Die Vorlagen (Muster) hängen nur Zusatzklassen  af-…  an Blöcke.
     Ändert man hier eine Regel, ändern sich ALLE Beiträge.

   Farben und Schriften
   - Kommen aus den Elementor-Globals (Kit 6) und haben einen festen
     Fallback auf die CI-Werte. Dadurch sieht das Ergebnis auch im
     Gutenberg-Editor richtig aus, wo Elementor-Variablen fehlen.
   - Nur die geladenen Oswald-Schnitte nutzen: 400, 600, 700.

   Aufbau der Datei
     1  Werkzeugkasten (Variablen)
     2  Grundtypografie
     3  Standard-Blöcke (Listen, Bilder, Zitate, Tabellen, Trenner, Buttons)
     4  Komponenten (Vorlagen)
     5  Mobil und Barrierefreiheit
   ========================================================================= */


/* 1 ── WERKZEUGKASTEN ────────────────────────────────────────────────────── */

.af-post {
  /* Farben (Elementor-Global → Fallback CI-Wert) */
  --af-red:        var(--e-global-color-primary, #C90019);
  --af-red-hover:  var(--e-global-color-1850750, #A50015);
  --af-ink:        var(--e-global-color-f64a188, #3E3D40);  /* Dunkelgrau, Fließtext */
  --af-muted:      var(--e-global-color-fa64ae7, #707173);  /* Mittelgrau, Nebentext */
  --af-grey:       var(--e-global-color-c519b6b, #B1B3B4);  /* Hellgrau, Linien auf Dunkel */
  --af-bg:         var(--e-global-color-01024a5, #F4F4F5);  /* Flächen hell */
  --af-tint:       var(--e-global-color-ddd8780, #FDF0F1);  /* Rot-Tint, Hinweise */
  --af-line:       #E3E3E5;                                 /* Rahmen, Trennlinien */
  --af-white:      #FFFFFF;

  /* Stellschrauben: hier ändern, wirkt in allen Beiträgen */
  --af-h2-color:   var(--af-red);      /* CI: Headlines dunkelrot. Für ruhiger: var(--af-ink) */
  --af-radius:     6px;                /* Karten, Bilder, Boxen */
  --af-radius-sm:  3px;                /* Buttons (wie Elementor-Buttons) */
  --af-gap:        1.25rem;            /* Abstand zwischen Karten/Spalten */
  --af-shadow:     0 6px 24px rgba(62, 61, 64, .10);
  --af-ease:       .2s cubic-bezier(.4, 0, .2, 1);

  /* Schriften: Oswald = Headline-Ersatz für Helvetica Neue Black Condensed */
  --af-font-head:  var(--e-global-typography-2681282-font-family, "Oswald"), "Arial Narrow", sans-serif;
}


/* 2 ── GRUNDTYPOGRAFIE ───────────────────────────────────────────────────── */

.af-post {
  color: var(--af-ink);
  font-size: 16px;                 /* Mobil */
  line-height: 1.7;
  overflow-wrap: break-word;
}
@media (min-width: 768px) {
  .af-post { font-size: 17px; }    /* entspricht "AF Body" im Kit */
}

/* Erstes Element klebt am Anfang, letztes am Ende der Gruppe */
.af-post > :first-child { margin-top: 0; }
.af-post > :last-child  { margin-bottom: 0; }

.af-post p {
  margin: 0 0 1.15em;
  hyphens: auto;                   /* Seite ist lang="de" → saubere Trennung */
}

/* Überschriften. Bewusst nur h2 bis h4 – h1 gehört Elementor. */
.af-post h2,
.af-post h3,
.af-post h4 {
  font-family: var(--af-font-head);
  text-transform: uppercase;
  scroll-margin-top: 1.5rem;       /* Sprung aus dem Inhaltsverzeichnis */
}
.af-post h2 {
  color: var(--af-h2-color);
  font-weight: 700;
  font-size: clamp(1.625rem, 1.25rem + 1.4vw, 2.125rem);
  line-height: 1.1;
  letter-spacing: .005em;
  margin: 2.6em 0 .6em;
}
.af-post h3 {
  color: var(--af-ink);
  font-weight: 600;
  font-size: clamp(1.25rem, 1.1rem + .6vw, 1.5rem);
  line-height: 1.15;
  margin: 2em 0 .5em;
}
.af-post h4 {
  color: var(--af-ink);
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: .06em;
  line-height: 1.2;
  margin: 1.6em 0 .4em;
}
/* Erste Überschrift direkt am Anfang: kein Extra-Abstand */
.af-post > h2:first-child,
.af-post > h3:first-child { margin-top: 0; }

/* Links im Fließtext (Buttons sind ausgenommen) */
.af-post a:not(.wp-block-button__link) {
  color: var(--af-red);
  text-decoration: underline;
  text-underline-offset: .18em;
  text-decoration-thickness: 1px;
  transition: color var(--af-ease);
}
.af-post a:not(.wp-block-button__link):hover {
  color: var(--af-red-hover);
  text-decoration-thickness: 2px;
}

.af-post strong { font-weight: 700; }

/* Gemeinsames Label: Oswald, Versalien, weite Laufweite ("AF Label") */
.af-post .af-eyebrow,
.af-post .af-glance__title,
.af-post .af-note__title,
.af-post .af-card__label {
  font-family: var(--af-font-head);
  font-weight: 600;
  font-size: .875rem;
  letter-spacing: .14em;
  line-height: 1.3;
  text-transform: uppercase;
  hyphens: none;
}


/* 3 ── STANDARD-BLÖCKE ───────────────────────────────────────────────────── */

/* Listen */
.af-post ul,
.af-post ol {
  margin: 0 0 1.4em;
  padding-left: 1.35em;
}
.af-post li { margin-bottom: .5em; hyphens: auto; }
.af-post li:last-child { margin-bottom: 0; }
.af-post ul li::marker { color: var(--af-red); }
.af-post ol li::marker {
  color: var(--af-red);
  font-family: var(--af-font-head);
  font-weight: 700;
}

/* Bilder */
.af-post figure { margin: 2em 0; }
.af-post img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--af-radius);
}
.af-post figcaption {
  margin-top: .6em;
  color: var(--af-muted);
  font-size: .875rem;
  line-height: 1.4;
  text-align: left;
}

/* Zitat / Kundenstimme */
.af-post blockquote,
.af-post .wp-block-quote {
  margin: 2em 0;
  padding: .25em 0 .25em 1.25em;
  border: 0;
  border-left: 4px solid var(--af-red);
}
.af-post blockquote p {
  font-size: 1.2em;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: .6em;
}
.af-post blockquote cite {
  display: block;
  font-family: var(--af-font-head);
  font-style: normal;
  font-size: .875rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--af-muted);
}

/* Tabellen (Preise, Vergleiche) */
.af-post .wp-block-table {
  margin: 2em 0;
  overflow-x: auto;                /* Mobil seitlich scrollbar statt gequetscht */
}
.af-post .wp-block-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95em;
}
.af-post .wp-block-table th,
.af-post .wp-block-table td {
  padding: .75em 1em;
  border: 0;
  border-bottom: 1px solid var(--af-line);
  text-align: left;
  vertical-align: top;
}
.af-post .wp-block-table thead th {
  background: var(--af-ink);
  color: var(--af-white);
  font-family: var(--af-font-head);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-bottom: 0;
}
.af-post .wp-block-table tbody tr:nth-child(even) td { background: var(--af-bg); }
.af-post .wp-block-table figcaption { padding-top: .6em; }

/* Trennlinie */
.af-post hr,
.af-post .wp-block-separator {
  height: 1px;
  max-width: none;
  margin: 3em 0;
  border: 0;
  background: var(--af-line);
  opacity: 1;
}

/* Buttons: gleiche Maße wie die Elementor-Buttons (min-height 52px, Radius 3px) */
.af-post .wp-block-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin: 1.6em 0 0;
}
.af-post .wp-block-button .wp-block-button__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: .9rem 2rem;
  background: var(--af-red);
  color: var(--af-white);
  border: 2px solid var(--af-red);
  border-radius: var(--af-radius-sm);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.2;
  text-decoration: none;
  transition: background var(--af-ease), border-color var(--af-ease),
              color var(--af-ease), transform var(--af-ease), box-shadow var(--af-ease);
}
.af-post .wp-block-button .wp-block-button__link:hover,
.af-post .wp-block-button .wp-block-button__link:focus-visible {
  background: var(--af-red-hover);
  border-color: var(--af-red-hover);
  color: var(--af-white);
  transform: translateY(-2px);
  box-shadow: var(--af-shadow);
}
/* Zweitbutton: Stil "Kontur" im Editor wählen */
.af-post .wp-block-button.is-style-outline .wp-block-button__link {
  background: transparent;
  color: var(--af-ink);
  border-color: var(--af-ink);
}
.af-post .wp-block-button.is-style-outline .wp-block-button__link:hover,
.af-post .wp-block-button.is-style-outline .wp-block-button__link:focus-visible {
  background: var(--af-ink);
  border-color: var(--af-ink);
  color: var(--af-white);
}


/* 4 ── KOMPONENTEN (Vorlagen) ────────────────────────────────────────────── */

/* ── af-lead: Einleitungsabsatz, direkt unter dem Titel ── */
.af-post .af-lead {
  margin: 0 0 1.8em;
  padding-left: 1.1em;
  border-left: 4px solid var(--af-red);
  font-size: 1.2em;
  line-height: 1.6;
}

/* ── af-eyebrow: kleine rote Zeile über einer H2 ──
   Immer direkt vor der Überschrift einsetzen. */
.af-post .af-eyebrow {
  margin: 3em 0 .35em;
  color: var(--af-red);
}
.af-post .af-eyebrow + h2,
.af-post .af-eyebrow + h3 { margin-top: 0; }

/* ── af-glance: "Auf einen Blick"-Box mit Häkchen ── */
.af-post .af-glance {
  margin: 2.2em 0;
  padding: 1.5rem 1.75rem;
  background: var(--af-bg);
  border-left: 5px solid var(--af-red);
  border-radius: 0 var(--af-radius) var(--af-radius) 0;
}
.af-post .af-glance__title {
  margin: 0 0 1rem;
  color: var(--af-ink);
  font-size: 1rem;
}

/* ── af-checklist: Liste mit roten Häkchen (auch in af-glance) ── */
.af-post .af-checklist,
.af-post .af-glance ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.af-post .af-checklist li,
.af-post .af-glance li {
  position: relative;
  margin-bottom: .65em;
  padding-left: 2em;
}
.af-post .af-checklist li::before,
.af-post .af-glance li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .32em;
  width: 1.15em;
  height: 1.15em;
  background: var(--af-red);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.55 18.2 3.8 12.45l1.9-1.9 3.85 3.85 8.75-8.75 1.9 1.9z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.55 18.2 3.8 12.45l1.9-1.9 3.85 3.85 8.75-8.75 1.9 1.9z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ── af-cards: 2–4 Karten nebeneinander (Spalten-Block) ──
   Spalten-Block bekommt af-cards, jede Spalte af-card.
   Auf dem Handy stapeln die Spalten automatisch. */
.af-post .af-cards {
  gap: var(--af-gap);
  margin: 2em 0;
}
.af-post .af-card {
  padding: 1.5rem;
  background: var(--af-white);
  border: 1px solid var(--af-line);
  border-top: 4px solid var(--af-red);
  border-radius: var(--af-radius);
  box-shadow: 0 1px 2px rgba(62, 61, 64, .06);
}
.af-post .af-card__label {
  margin: 0 0 .5rem;
  color: var(--af-red);
}
/* Kartentitel als Absatz, NICHT als Überschrift:
   das Elementor-Inhaltsverzeichnis würde sonst jede Karte auflisten. */
.af-post .af-card__title {
  margin: 0 0 .5rem;
  color: var(--af-ink);
  font-family: var(--af-font-head);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.15;
  text-transform: uppercase;
  hyphens: none;
}
.af-post .af-card > :last-child { margin-bottom: 0; }

/* ── af-media: Text neben Bild (Spalten-Block, 2 Spalten) ──
   Zusatzklasse af-media--reverse dreht die Reihenfolge (Bild rechts). */
.af-post .af-media {
  gap: 2rem;
  margin: 2.2em 0;
  align-items: center;
}
.af-post .af-media figure { margin: 0; }
.af-post .af-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;               /* Bilder unterschiedlicher Formate wirken einheitlich */
}
.af-post .af-media h2,
.af-post .af-media h3 { margin-top: 0; }
@media (min-width: 782px) {
  .af-post .af-media--reverse { flex-direction: row-reverse; }
}

/* ── af-steps: nummerierte Liste als Ablauf ──
   Normale Liste einfügen, Klasse af-steps setzen. Erste Zeile fett = Titel.
   Empfohlen: <strong>Titel</strong><br>Text */
.af-post .af-steps {
  margin: 2em 0;
  padding: 0;
  list-style: none;
  counter-reset: af-step;
}
.af-post .af-steps > li {
  position: relative;
  min-height: 2.75rem;
  margin: 0;
  padding: .1rem 0 1.6rem 4rem;
  counter-increment: af-step;
}
.af-post .af-steps > li:last-child { padding-bottom: 0; }
.af-post .af-steps > li::before {
  content: counter(af-step);
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--af-red);
  color: var(--af-white);
  font-family: var(--af-font-head);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1;
}
/* Verbindungslinie zwischen den Kreisen */
.af-post .af-steps > li::after {
  content: "";
  position: absolute;
  left: calc(1.375rem - 1px);
  top: 3.15rem;
  bottom: .4rem;
  width: 2px;
  background: var(--af-line);
}
.af-post .af-steps > li:last-child::after { display: none; }
.af-post .af-steps > li strong {
  font-family: var(--af-font-head);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: .01em;
  text-transform: uppercase;
}

/* ── af-note: Hinweisbox ──
   Varianten: (Standard) helle Rot-Tönung, af-note--dark = dunkel mit weißer Schrift */
.af-post .af-note {
  margin: 2.2em 0;
  padding: 1.4rem 1.75rem;
  background: var(--af-tint);
  border: 1px solid rgba(201, 0, 25, .22);
  border-radius: var(--af-radius);
}
.af-post .af-note__title {
  margin: 0 0 .5rem;
  color: var(--af-red);
}
.af-post .af-note > :last-child { margin-bottom: 0; }
.af-post .af-note--dark {
  background: var(--af-ink);
  border-color: var(--af-ink);
  color: var(--af-white);
}
.af-post .af-note--dark .af-note__title { color: var(--af-white); }
.af-post .af-note--dark a:not(.wp-block-button__link) { color: var(--af-white); }

/* ── af-stats: Kennzahlen (Spalten-Block, 2–4 Spalten) ── */
.af-post .af-stats {
  gap: 0;
  margin: 2.4em 0;
  padding: 1.5rem 0;
  border-top: 1px solid var(--af-line);
  border-bottom: 1px solid var(--af-line);
}
.af-post .af-stats .wp-block-column {
  padding: .25rem 1.5rem;
  border-left: 1px solid var(--af-line);
  text-align: center;
}
.af-post .af-stats .wp-block-column:first-child { border-left: 0; }
.af-post .af-stat__num {
  margin: 0;
  color: var(--af-red);
  font-family: var(--af-font-head);
  font-weight: 700;
  font-size: clamp(2.25rem, 1.6rem + 2.4vw, 3.25rem);
  line-height: 1.05;
  hyphens: none;
}
.af-post .af-stat__label {
  margin: .35rem 0 0;
  color: var(--af-muted);
  font-size: .95rem;
  line-height: 1.35;
}

/* ── af-faq: Fragen und Antworten (Gruppe mit mehreren "Details"-Blöcken) ── */
.af-post .af-faq {
  margin: 2em 0 2.5em;
  border-top: 1px solid var(--af-line);
}
.af-post .af-faq details {
  margin: 0;
  border-bottom: 1px solid var(--af-line);
}
.af-post .af-faq summary {
  position: relative;
  padding: 1.1em 2.5em 1.1em 0;
  color: var(--af-ink);
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
  list-style: none;
}
.af-post .af-faq summary::-webkit-details-marker { display: none; }
.af-post .af-faq summary::after {
  content: "+";
  position: absolute;
  right: .2em;
  top: 50%;
  transform: translateY(-50%);
  color: var(--af-red);
  font-family: var(--af-font-head);
  font-size: 1.7em;
  font-weight: 400;
  line-height: 1;
}
.af-post .af-faq details[open] summary::after { content: "\2013"; }   /* Gedankenstrich */
.af-post .af-faq summary:hover { color: var(--af-red); }
.af-post .af-faq details > :not(summary) { margin: 0 0 1.1em; }
.af-post .af-faq details > p:last-child { padding-right: 2.5em; }

/* ── af-cta: Handlungsaufforderung am Beitragsende ── */
.af-post .af-cta {
  margin: 3em 0 1em;
  padding: 2.25rem clamp(1.25rem, 4vw, 2.5rem);
  background: var(--af-ink);
  border-top: 4px solid var(--af-red);
  border-radius: var(--af-radius);
  color: var(--af-white);
}
/* Titel als Absatz: taucht nicht im Inhaltsverzeichnis auf */
.af-post .af-cta__title {
  margin: 0 0 .5rem;
  color: var(--af-white);
  font-family: var(--af-font-head);
  font-weight: 700;
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  line-height: 1.1;
  text-transform: uppercase;
  hyphens: none;
}
.af-post .af-cta p { color: rgba(255, 255, 255, .88); }
.af-post .af-cta > :last-child { margin-bottom: 0; }
.af-post .af-cta a:not(.wp-block-button__link) { color: var(--af-white); }
/* Button auf dunklem Grund: weiß mit dunkler Schrift */
.af-post .af-cta .wp-block-button .wp-block-button__link {
  background: var(--af-red);
  border-color: var(--af-red);
}
.af-post .af-cta .wp-block-button.is-style-outline .wp-block-button__link {
  background: transparent;
  color: var(--af-white);
  border-color: var(--af-white);
}
.af-post .af-cta .wp-block-button.is-style-outline .wp-block-button__link:hover,
.af-post .af-cta .wp-block-button.is-style-outline .wp-block-button__link:focus-visible {
  background: var(--af-white);
  border-color: var(--af-white);
  color: var(--af-ink);
}


/* 5 ── MOBIL UND BARRIEREFREIHEIT ────────────────────────────────────────── */

@media (max-width: 781px) {
  .af-post h2 { margin-top: 2.2em; }
  .af-post .af-eyebrow { margin-top: 2.4em; }
  .af-post .af-glance,
  .af-post .af-note { padding: 1.25rem; }
  .af-post .af-media { gap: 1.25rem; }

  /* Kennzahlen: untereinander, Trennlinie oben statt links */
  .af-post .af-stats { padding: .5rem 0; }
  .af-post .af-stats .wp-block-column {
    padding: 1rem 0;
    border-left: 0;
    border-top: 1px solid var(--af-line);
  }
  .af-post .af-stats .wp-block-column:first-child { border-top: 0; }

  /* Buttons über die volle Breite: gut mit dem Daumen zu treffen */
  .af-post .af-cta .wp-block-button,
  .af-post .af-cta .wp-block-button .wp-block-button__link { width: 100%; }
}

/* Tastaturbedienung sichtbar machen */
.af-post a:focus-visible,
.af-post summary:focus-visible,
.af-post .wp-block-button__link:focus-visible {
  outline: 3px solid var(--af-ink);
  outline-offset: 3px;
}
.af-post .af-cta a:focus-visible,
.af-post .af-note--dark a:focus-visible { outline-color: var(--af-white); }

/* Bewegung reduzieren, wenn das Betriebssystem es verlangt */
@media (prefers-reduced-motion: reduce) {
  .af-post * { transition: none !important; }
  .af-post .wp-block-button .wp-block-button__link:hover { transform: none; }
}
