/* About — vertikaler Stapel aus Bild/Text-Rows, ab Desktop abwechselnd links/rechts */

.about {
  display: flex;
  flex-direction: column;
  gap: var(--gap-section);
  padding-block: 0;
}

/* Row übernimmt das frühere .about-Flexverhalten (full-bleed Split): die
   content-width-Regel aus sections/00-base.css (.about > *) für die Row aufheben,
   damit das Bild bis zur Section-Kante reicht. */
.about > .about-row {
  max-width: none;
  margin-inline: 0;
  padding-inline: 0;
}

.about-row {
  display: flex;
  flex-direction: column;
  gap: var(--gap-block);
}

.about-text {
  flex: 1;
  margin-block-start: var(--space-3);
  padding-inline: var(--padding-page);
}

.about-text span {
  display: block;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-primary-text);
  margin-block-end: var(--space-3);
}

.about-text :is(h2, h1) {
  margin-block-end: var(--gap-block);
}

.about-text .btn {
  margin-block-start: var(--gap-block);
}

/* Zwei Knöpfe (primär + sekundär) nebeneinander, bei wenig Platz untereinander */
.about-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-block-start: var(--gap-block);
}

.about-actions .btn {
  margin-block-start: 0;
}

/* Bild flush bis zur Section-Kante (kein Negativmargin → kein Ghost-Scroll). */
.about-row figure {
  flex: 1;
  max-width: none;
  margin: 0;            /* <figure> hat Browser-Default-margin (~1em oben/unten) → vertikale Lücke zwischen den Rows. Komplett raus. */
  padding-inline: 0;
}

.about-row figure img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* Row OHNE Bild (Section\About::figure liefert dann ein leeres <figure></figure>): nicht halb leer stehen lassen.
   Gemessen 05.10.2026 auf der Startseite der Neuinstallation: Text klebte oben/unten am Section-Hintergrund (die
   Zelle hat keinen vertikalen Innenabstand — sonst hält das Bild die Höhe), rechts eine leere Bildhälfte.
   Jetzt: Bildspalte weg, Text einspaltig auf Inhaltsbreite mit Section-Abstand oben/unten. */
.about-row:has(> figure:empty) > figure {
  display: none;
}
.about-row:has(> figure:empty) > .about-text {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-block: var(--gap-section);
}

/* Mehrere Bilder: gestapelt in derselben Grid-Zelle, Crossfade via .active
   (about-slideshow.js). Gleiche Bildmaße empfohlen → kein Höhensprung. */
.about-slideshow {
  display: grid;
}

.about-slideshow img {
  grid-area: 1 / 1;
  opacity: 0;
  transition: opacity 1s ease;
}

.about-slideshow img.active {
  opacity: 1;
}

@media (min-width: 79.5rem), (min-width: 74rem) and (orientation: landscape) {
  /* „Stoß auf Stoß": kein Vertikalabstand zwischen den Rows → die alternierenden Bilder (rechts/links)
     stoßen ohne weißes Band aneinander. */
  .about {
    gap: 0;
  }

  /* Exakt 50/50 über CSS-Grid statt flex: `1fr 1fr` teilt garantiert hälftig (keine min-content-Effekte von
     Bild/Text), ohne Spalten-Lücke → das Bild reicht bündig bis zur Mitte. `align-items: stretch` (Grid-Default)
     zieht beide Zellen auf die volle Row-Höhe, damit das Bild oben/unten ohne Weißfläche an die Row-Kante — und
     damit an das Nachbarbild — stößt. min-width:0 verhindert, dass ein breites Bild die 1fr-Spalte sprengt. */
  .about-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;   /* WICHTIG: Mobile-Basis `gap: var(--gap-block)` zurücksetzen — sie wirkt sonst als Grid-Spaltenlücke
                 und schiebt die Bilder um gap/2 aus der Mitte (der verbliebene „fast"-Gap). */
  }
  .about-text,
  .about-row figure {
    min-width: 0;
  }
  /* Text vertikal zentriert (Zelle ist voll hoch); Mobile-margin-block-start hier raus, es verschöbe die Mitte. */
  .about-text {
    align-self: center;
    margin-block: 0;
  }
  .about-row figure img {
    height: 100%;
  }
  /* Ohne Bild einspaltig (s. oben) — auch in geraden Rows, die sonst den Text in Spalte 2 schieben. */
  .about-row:has(> figure:empty) {
    grid-template-columns: 1fr;
  }
  .about-row:has(> figure:empty) > .about-text {
    grid-column: 1;
  }

  /* Text bündig mit dem Inhaltsraster (02.11.2026, Topimmobilien „Wir sind Claudia & Axel“: auf breiten Fenstern stand der Text am
     Fensterrand, 24px statt 441px wie die übrigen Überschriften) — außen der Rand des Inhaltsbereichs, innen Abstand zum Bild.
     Bild höchstens so hoch wie das Fenster (Hochformat-Fotos wurden bei halber Fensterbreite über 1.200px hoch). */
  .about-row:not(:has(> figure:empty)) > .about-text {
    padding-inline: max(var(--padding-page), calc((100vw - var(--content-width)) / 2 + var(--padding-page))) var(--gap-section);
  }
  .about-row:nth-child(even):not(:has(> figure:empty)) > .about-text {
    padding-inline: var(--gap-section) max(var(--padding-page), calc((100vw - var(--content-width)) / 2 + var(--padding-page)));
  }
  /* Höhe der Zeile = Text mit Abstand oben/unten, mindestens --about-row-min-height (Standard: Bildhälfte quadratisch); das Bild füllt die Fläche nur aus und bestimmt die
     Höhe nicht mit (03.11.2026, Hermeier /ueber-uns: langer Text klebte oben und unten an der Kante, das Bild war auf die Texthöhe
     zugeschnitten; vorher begrenzte max-height Hochformat-Fotos, die bei halber Fensterbreite über 1.200 px hoch wurden). */
  .about-row:not(:has(> figure:empty)) {
    min-height: var(--about-row-min-height, min(50vw, 90vh));   /* Bildhälfte quadratisch wie vor dem 02.11. (Dirk: „diese war mal quadratisch“), höchstens 90 % Fensterhöhe */
  }
  .about-row:not(:has(> figure:empty)) > .about-text {
    padding-block: var(--gap-section);
  }
  .about-row:not(:has(> figure:empty)) > figure {
    position: relative;
  }
  .about-row:not(:has(> figure:empty)) > figure :is(img, video) {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Alternieren: gerade Rows → Bild links, Text rechts (Mobile bleibt feste Lese-Reihenfolge). */
  .about-row:nth-child(even) > .about-text {
    grid-column: 2;
  }
  .about-row:nth-child(even) > figure {
    grid-column: 1;
    grid-row: 1;
  }

  /* Darstellung „Bild zuerst“ (Section-Variante image_first, 03.11.2026): Wechsel umgekehrt — ungerade Zeilen Bild links,
     gerade Text links; der Innenabstand des Textes (außen Inhaltsraster, innen Abstand zum Bild) wandert mit. */
  .about[data-variant="image_first"] .about-row:nth-child(odd):not(:has(> figure:empty)) > .about-text {
    grid-column: 2;
    padding-inline: var(--gap-section) max(var(--padding-page), calc((100vw - var(--content-width)) / 2 + var(--padding-page)));
  }
  .about[data-variant="image_first"] .about-row:nth-child(odd):not(:has(> figure:empty)) > figure {
    grid-column: 1;
    grid-row: 1;
  }
  .about[data-variant="image_first"] .about-row:nth-child(even):not(:has(> figure:empty)) > .about-text {
    grid-column: 1;
    padding-inline: max(var(--padding-page), calc((100vw - var(--content-width)) / 2 + var(--padding-page))) var(--gap-section);
  }
  .about[data-variant="image_first"] .about-row:nth-child(even):not(:has(> figure:empty)) > figure {
    grid-column: 2;
    grid-row: 1;
  }
}

/* =========================================================================
   Breite „Im Inhaltsbereich“ (data-breite="inhalt", 04.11.2026): klassische Bild/Text-Zeile statt Bild bis zum Fensterrand.
   Steht bewusst am Dateiende: Die Vollbreiten-Regeln oben hängen an :not(:has(...)) und tragen viel Gewicht. Hier wird
   überboten (:nth-child(n) mehrfach = reines Gewicht). Gleichziehen reicht nicht: Das figure in :has() zählt als Element mit,
   bei gleichen Klassen verliert die Regel trotz späterer Stelle, und der Text bleibt auf breiten Fenstern schmal.
   ========================================================================= */
.about[data-breite="inhalt"] {
  gap: var(--gap-section);
  padding-block: var(--gap-section);
  background: transparent;
}

.about[data-breite="inhalt"] > .about-row {
  width: 100%;
  max-width: var(--content-width);
  min-height: 0;
  margin-inline: auto;
  padding-inline: var(--padding-page);
}

.about[data-breite="inhalt"] .about-row:nth-child(n):nth-child(n):nth-child(n) > .about-text {
  margin-block: 0;
  padding: 0;
}

.about[data-breite="inhalt"] .about-row:nth-child(n):not(:has(> figure:empty)) > figure {
  position: static;
}

.about[data-breite="inhalt"] .about-row:nth-child(n):not(:has(> figure:empty)) > figure :is(img, video) {
  position: static;
  display: block;
  width: 100%;
  height: auto;
  max-height: 90vh;
  border-radius: var(--radius);
  object-fit: cover;
}

/* Ab Tablet zweispaltig (die volle Breite erst ab 79,5rem): Der Inhaltsbereich braucht keine halbe Fensterbreite je Spalte. */
@media (min-width: 45rem) {
  .about[data-breite="inhalt"] .about-row:not(:has(> figure:empty)) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap-section);
    align-items: center;
  }

  /* Wechsel links/rechts: alle vier Fälle ausdrücklich, damit er schon unterhalb von 79,5rem gilt. */
  .about[data-breite="inhalt"]:not([data-variant="image_first"]) .about-row:nth-child(odd):not(:has(> figure:empty)) > .about-text,
  .about[data-breite="inhalt"][data-variant="image_first"] .about-row:nth-child(even):not(:has(> figure:empty)) > .about-text {
    grid-column: 1;
    grid-row: 1;
  }
  .about[data-breite="inhalt"]:not([data-variant="image_first"]) .about-row:nth-child(odd):not(:has(> figure:empty)) > figure,
  .about[data-breite="inhalt"][data-variant="image_first"] .about-row:nth-child(even):not(:has(> figure:empty)) > figure {
    grid-column: 2;
    grid-row: 1;
  }
  .about[data-breite="inhalt"]:not([data-variant="image_first"]) .about-row:nth-child(even):not(:has(> figure:empty)) > .about-text,
  .about[data-breite="inhalt"][data-variant="image_first"] .about-row:nth-child(odd):not(:has(> figure:empty)) > .about-text {
    grid-column: 2;
    grid-row: 1;
  }
  .about[data-breite="inhalt"]:not([data-variant="image_first"]) .about-row:nth-child(even):not(:has(> figure:empty)) > figure,
  .about[data-breite="inhalt"][data-variant="image_first"] .about-row:nth-child(odd):not(:has(> figure:empty)) > figure {
    grid-column: 1;
    grid-row: 1;
  }
}
