/* =============================================================
   AUSBAUSTUFEN — Sticky-Collapse-Scroll-Baustein (Neubau)
   Mechanik aus dem „Solution-Scroll-Section"-Baustein, neu
   eingekleidet ins Mein-Zuhause-Design (Inter, Navy-Gradient,
   mz-/lp-Tokens). Gescopt unter .stufen — kein globaler
   Reset, kein eigenes :root, damit keine anderen Sections
   beeinflusst werden.
   ============================================================= */

.stufen {
  position: relative;
  /* Navy-Anmutung wie .lp-trust-band */
  background:
    radial-gradient(ellipse at 20% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 48%),
    linear-gradient(145deg,
      var(--lp-navy-soft, #1E2F51) 0%,
      var(--lp-navy-2, #183054) 50%,
      var(--lp-navy, #0F172A) 100%);
  color: #ffffff;
  padding: 96px 0 104px;
  /* Sticky-Stack braucht ein nicht geclipptes Section-Element */
  overflow: visible;
}

.stufen__head {
  max-width: 760px;
  margin: 0 0 56px;
}

.stufen__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.48);
  margin: 0 0 18px;
}
.stufen__eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: rgba(255, 255, 255, 0.32);
  flex-shrink: 0;
}

.stufen__title {
  font-family: "Inter", sans-serif;
  font-size: clamp(1.65rem, 2.6vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin: 0 0 16px;
}

.stufen__lead {
  font-size: clamp(1.02rem, 1.4vw, 1.2rem);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.72);
  max-width: 60ch;
  margin: 0;
}

/* „Warum massiv bauen" — kompakte Vorteils-Leiste unter dem Head */
.stufen__benefits {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
}
.stufen__benefit {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
}
.stufen__benefit .material-symbols-outlined {
  font-size: 20px;
  color: rgba(255, 255, 255, 0.9);
}

/* ---- Zeilen-Grundlayout (Mobile-first, gestapelte Liste) ---- */
.stufen-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.stufen-row {
  position: relative;
}

.stufen-row__inner {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 32px 0;
}
.stufen-row:last-child .stufen-row__inner {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.stufen-row__content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.stufen-row__head {
  display: flex;
  align-items: baseline;
  gap: 20px;
}

.stufen-row__index {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
}

.stufen-row__title {
  font-family: "Inter", sans-serif;
  font-size: clamp(1.5rem, 2.6vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #ffffff;
  margin: 0;
}

.stufen-row__text {
  font-size: 1.02rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.62);
  margin: 0;
}

/* ---- Visual (Foto im gerahmten Container) ---- */
.stufen-row__visual {
  width: 100%;
}

.stufen-frame {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 50px 100px -50px rgba(0, 0, 0, 0.7);
  aspect-ratio: 3 / 4;
}

.stufen-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* dezenter Verlauf von unten für Tiefe/Lesbarkeit */
.stufen-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0) 55%, rgba(15, 23, 42, 0.35) 100%);
  pointer-events: none;
}

/* =============================================================
   STICKY-BÜHNE (Desktop ≥ 981px)
   Fünf Zeilen leben in EINER angepinnten Stage. Der Scroll-
   Fortschritt verteilt die Höhe per --row-p (via JS). Genau eine
   Zeile ist groß/offen, die übrigen sind kompakt gecroppt.
   Mathematik für 5 Zeilen: 5·12% (inaktiv) + 40% (aktiv) = 100%.
   ============================================================= */
@media (min-width: 900px) {
  .stufen-stage-track {
    position: relative;
    height: 300vh;
  }

  .stufen-stage {
    position: sticky;
    top: 100px;            /* unter dem fixierten Header (~80–94px) */
    height: 84vh;
    overflow: hidden;
  }

  .stufen-rows {
    height: 100%;
  }

  .stufen-row {
    overflow: hidden;
    flex: 0 0 calc(12% + var(--row-p, 0) * 40%);
    transition: flex-basis 0.1s linear;
  }

  .stufen-row:last-child .stufen-row__inner {
    border-bottom: none;
  }

  .stufen-row__inner {
    padding-top: 22px;
    padding-bottom: 40px;
  }

  .stufen-row__content {
    grid-template-columns: minmax(220px, 0.9fr) minmax(260px, 1.3fr) minmax(220px, 0.95fr);
    align-items: start;
    gap: 20px clamp(2.5rem, 4.5vw, 4.5rem);
  }

  /* Titel dimmt bei inaktiven Zeilen */
  .stufen-row__title {
    opacity: calc(0.5 + var(--row-p, 0) * 0.5);
    will-change: opacity;
  }

  /* Beschreibung: gedämpft → fast weiß, sanfter Aufbau von unten */
  .stufen-row__text {
    opacity: calc(0.3 + var(--row-p, 0) * 0.6);
    transform: translateY(calc((1 - var(--row-p, 0)) * 14px));
    will-change: opacity, transform;
  }

  /* Index dimmt leicht bei inaktiven Zeilen */
  .stufen-row__index {
    opacity: calc(0.45 + var(--row-p, 0) * 0.55);
  }

  /* Visual füllt die zur Verfügung stehende Zeilenhöhe */
  .stufen-row__visual {
    height: 100%;
  }
  .stufen-frame {
    height: 100%;
    aspect-ratio: auto;
  }
}

/* ---- Reduced-Motion: kein Pinning, normale Liste ---- */
@media (min-width: 900px) and (prefers-reduced-motion: reduce) {
  .stufen-stage-track { height: auto; }
  .stufen-stage { position: static; height: auto; overflow: visible; }
  .stufen-row { overflow: visible; flex: 1 1 auto; }
  .stufen-row__title,
  .stufen-row__text,
  .stufen-row__index { opacity: 1; transform: none; will-change: auto; }
  .stufen-frame { aspect-ratio: 16 / 10; height: auto; }
}

@media (max-width: 899px) {
  .stufen-frame { aspect-ratio: 16 / 10; }
}

/* =============================================================
   CTA am Ende des Effekts (Kontakt-Popup + Quiz)
   ============================================================= */
.stufen-cta {
  margin-top: 72px;
  padding-top: 56px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
}

.stufen-cta__title {
  font-family: "Inter", sans-serif;
  font-size: clamp(1.5rem, 2.4vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #ffffff;
  margin: 0 0 14px;
}

.stufen-cta__text {
  font-size: clamp(1rem, 1.3vw, 1.15rem);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7);
  max-width: 52ch;
  margin: 0 auto 32px;
}

.stufen-cta__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

@media (max-width: 640px) {
  .stufen-cta__actions { flex-direction: column; align-items: stretch; }
  .stufen-cta__actions .lp-hero__btn { justify-content: center; }
}
