/* ==========================================================================
   3. LAYOUT — Container, Raster, Sektionen, Fluss-Helfer
   Mobil-first: Basis = Small, Erweiterung ausschließlich per min-width.
   ========================================================================== */

/* --------------------------------------------------------------------------
   3.1 CONTAINER
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.container--flush {
  padding-inline: 0;
}

/* --------------------------------------------------------------------------
   3.2 RASTER — 12 Spalten ab 760px, darunter einspaltig
   Klassen:
     .col-1 … .col-12              → ab 760px
     .col-md-1 … .col-md-12        → ab 1024px
     .col-lg-1 … .col-lg-12        → ab 1200px
   Ohne Treffer bleibt das Element volle Breite (Default: 1 / -1).
   -------------------------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--grid-gap);
  /* FEINSCHLIFF 9: Zellen strecken immer, damit 3er/4er-Kacheln in einer
     Zeile exakt gleich hoch bleiben. */
  align-items: stretch;
}

/* Basisregel: jede Spaltenklasse ist im Small-Breakpoint volle Breite. */
:is(
  .col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
  .col-7, .col-8, .col-9, .col-10, .col-11, .col-12,
  .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6,
  .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12,
  .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6,
  .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12
) {
  grid-column: 1 / -1;
  min-width: 0;
}

@media (min-width: 760px) {
  .grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .col-1 { grid-column: span 1; }
  .col-2 { grid-column: span 2; }
  .col-3 { grid-column: span 3; }
  .col-4 { grid-column: span 4; }
  .col-5 { grid-column: span 5; }
  .col-6 { grid-column: span 6; }
  .col-7 { grid-column: span 7; }
  .col-8 { grid-column: span 8; }
  .col-9 { grid-column: span 9; }
  .col-10 { grid-column: span 10; }
  .col-11 { grid-column: span 11; }
  .col-12 { grid-column: span 12; }
}

@media (min-width: 1024px) {
  .col-md-1 { grid-column: span 1; }
  .col-md-2 { grid-column: span 2; }
  .col-md-3 { grid-column: span 3; }
  .col-md-4 { grid-column: span 4; }
  .col-md-5 { grid-column: span 5; }
  .col-md-6 { grid-column: span 6; }
  .col-md-7 { grid-column: span 7; }
  .col-md-8 { grid-column: span 8; }
  .col-md-9 { grid-column: span 9; }
  .col-md-10 { grid-column: span 10; }
  .col-md-11 { grid-column: span 11; }
  .col-md-12 { grid-column: span 12; }
}

@media (min-width: 1200px) {
  .col-lg-1 { grid-column: span 1; }
  .col-lg-2 { grid-column: span 2; }
  .col-lg-3 { grid-column: span 3; }
  .col-lg-4 { grid-column: span 4; }
  .col-lg-5 { grid-column: span 5; }
  .col-lg-6 { grid-column: span 6; }
  .col-lg-7 { grid-column: span 7; }
  .col-lg-8 { grid-column: span 8; }
  .col-lg-9 { grid-column: span 9; }
  .col-lg-10 { grid-column: span 10; }
  .col-lg-11 { grid-column: span 11; }
  .col-lg-12 { grid-column: span 12; }
}

/* Praktische Kurzformen für wiederkehrende Kartenraster. */
.grid--2,
.grid--3,
.grid--4 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
}

.grid--4 {
  gap: var(--grid-gap);
}

/* --------------------------------------------------------------------------
   3.4 SEKTIONEN — inklusive Flächen-Tönungen (--tint)
   Verwendung: <section class="section section--mint">
   -------------------------------------------------------------------------- */
.section {
  position: relative;
  /* Eigener Stapelkontext: Deko-Blobs bleiben hinter dem Inhalt und
     können nicht in die vorige Sektion durchscheinen.
     overflow-x:clip schneidet die Blobs seitlich ab, erzeugt aber — anders
     als overflow:hidden — keinen Scrollcontainer und bricht position:sticky
     nicht. Vertikal bleibt alles sichtbar. */
  isolation: isolate;
  overflow-x: clip;
  padding-block: var(--section-y);
}

.section--tight {
  padding-block: var(--s-9);
}

.section--loose {
  padding-block: var(--section-y);
}

.section--flush-top {
  padding-top: 0;
}

.section--flush-bottom {
  padding-bottom: 0;
}

/* Flächen — CI-konform, Rot kommt hier nicht vor */
.section--cream { background-color: var(--c-cream); }
.section--white { background-color: var(--c-white); }
.section--mint { background-color: var(--c-mint); }
.section--mint-light { background-color: var(--c-mint-light); }
.section--sand { background-color: var(--c-sand); }
.section--line { background-color: var(--c-line); }
.section--green {
  background-color: var(--c-green);
  color: var(--c-white);
}
.section--green-deep {
  background-color: var(--c-green-deep);
  color: var(--c-white);
}

/* Auf dunklen Flächen kippen Headlines, Eyebrows und Fließtext um. */
.section--green h1,
.section--green h2,
.section--green h3,
.section--green h4,
.section--green-deep h1,
.section--green-deep h2,
.section--green-deep h3,
.section--green-deep h4 {
  color: var(--c-white);
}

.section--green .lead,
.section--green .prose,
.section--green p,
.section--green-deep .lead,
.section--green-deep .prose,
.section--green-deep p {
  color: var(--c-white-a88);
}

.section--green .eyebrow,
.section--green-deep .eyebrow {
  color: var(--c-white-a72);
}

.section--green a,
.section--green-deep a {
  color: var(--c-white);
  text-decoration-color: var(--c-white-a40);
}

/* Rote Haarlinie als Sektionsabschluss (Motiv aus dem Flyer) */
.section--rule {
  border-top: var(--border-w) solid var(--c-red);
}

/* --------------------------------------------------------------------------
   3.5 SEKTIONS-KOPF
   -------------------------------------------------------------------------- */
.section__head {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  max-width: var(--container-text);
  margin-bottom: var(--s-8);
}

.section__head > .eyebrow + h2,
.section__head > h2 + .lead,
.section__head > .eyebrow + h3 {
  margin-top: 0;
}

.section__head--center {
  text-align: center;
  align-items: center;
  margin-inline: auto;
}

.section__head--center .lead,
.section__head--center .prose,
.section__head--center p {
  margin-inline: auto;
}

.section__head--center .eyebrow {
  text-align: center;
}

/* Zentrierte Headlines brauchen text-wrap: balance, damit die letzte
   Zeile nicht als Einzelwort links hängen bleibt. */
.section__head--center h1,
.section__head--center h2,
.section__head--center h3 {
  text-wrap: balance;
}

.section__head--wide {
  max-width: none;
}

.section__head .link-arrow,
.section__head .btn {
  margin-top: var(--s-2);
}

/* --------------------------------------------------------------------------
   3.6 FLUSS-HELFER — .stack (vertikal) & .cluster (horizontal)
   -------------------------------------------------------------------------- */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.stack--xs { gap: var(--s-2); }
.stack--sm { gap: var(--s-3); }
.stack--md { gap: var(--s-5); }
.stack--lg { gap: var(--s-6); }
.stack--xl { gap: var(--s-8); }

.stack > * {
  min-width: 0;
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
}

.cluster--sm { gap: var(--s-2); }
.cluster--md { gap: var(--s-4); }
.cluster--lg { gap: var(--s-5); }
.cluster--top { align-items: flex-start; }
.cluster--center { justify-content: center; }
.cluster--between { justify-content: space-between; }

/* --------------------------------------------------------------------------
   3.7 SPLIT — zweispaltig, mobil gestapelt
   -------------------------------------------------------------------------- */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--grid-gap);
  align-items: start;
}

.split--center {
  align-items: center;
}

.split--top {
  align-items: start;
}

.split--between {
  align-items: center;
}

@media (min-width: 900px) {
  .split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-9);
  }

  .split--reverse > :first-child {
    order: 2;
  }

  .split--third {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  }
}

/* --------------------------------------------------------------------------
   3.8 RATIO — Bildrahmen mit festem Seitenverhältnis
   Verwendung: <div class="ratio ratio--4-3"><img …></div>
   -------------------------------------------------------------------------- */
.ratio {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  background-color: var(--c-mint-light);
}

.ratio > img,
.ratio > picture > img,
.ratio > svg,
.ratio > .ph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ratio--square { aspect-ratio: 1 / 1; }
.ratio--portrait { aspect-ratio: 3 / 4; }
.ratio--4-3 { aspect-ratio: 4 / 3; }
.ratio--3-2 { aspect-ratio: 3 / 2; }
.ratio--16-9 { aspect-ratio: 16 / 9; }
.ratio--custom { aspect-ratio: var(--ratio, 4 / 3); }

/* Raute — Motiv aus dem Flyer, nur für Hero-Collage / max. 1–2 Bilder */
.ratio--diamond,
.diamond {
  border-radius: 0;
  clip-path: var(--clip-diamond);
}
