.hero-particles {
  --hero-bg: #000;
  --hero-copy: #f7f8fa;
  --hero-muted: rgba(235, 240, 247, .76);
  position: relative;
  display: grid;
  min-height: 100svh;
  overflow: clip;
  isolation: isolate;
  place-items: start center;
  color: var(--hero-copy);
  background: var(--hero-bg);
}

body:not([data-theme="dark"]) .hero-particles {
  --hero-bg: #fff;
  --hero-copy: #172131;
  --hero-muted: rgba(45, 58, 76, .78);
}

.hero-particles__canvas,
.hero-particles__veil {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-particles__canvas { z-index: -3; display: block; }

.hero-particles__veil {
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 48%, rgba(5, 6, 8, .56) 0 13%, rgba(5, 6, 8, .16) 38%, transparent 68%),
    linear-gradient(180deg, rgba(5, 6, 8, .15), transparent 24%, transparent 72%, #000 100%);
}

body:not([data-theme="dark"]) .hero-particles__veil {
  background:
    radial-gradient(circle at 50% 48%, rgba(248, 250, 252, .78) 0 12%, rgba(248, 250, 252, .42) 38%, transparent 69%),
    linear-gradient(180deg, rgba(248, 250, 252, .25), transparent 26%, transparent 72%, #fff 100%);
}

.hero-particles__content {
  width: min(100% - 48px, 1240px);
  padding: clamp(92px, 12vh, 128px) 0 64px;
  text-align: center;
}

.hero-particles__eyebrow {
  margin: 0 0 20px;
  color: #f48312;
  font-size: clamp(.69rem, .9vw, .8rem);
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.hero-particles .hero-rotating-heading {
  /* Reserviert vom ersten Frame an Platz für die längste, dreizeilige Variante.
     Lead und CTAs springen dadurch beim Schreibwechsel nicht nach unten. */
  height: 3.34em;
  min-height: 3.34em;
  position: relative;
  display: grid;
  grid-template-rows: .96em 2.16em;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  overflow: visible;
  align-content: start;
  color: var(--hero-copy);
  font-size: clamp(2.5rem, 5.5vw, 6rem);
  line-height: .96;
  letter-spacing: -.055em;
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 8px 40px rgba(0, 0, 0, .22);
}

.hero-particles .hero-heading-dynamic {
  display: block;
  grid-row: 2;
  align-self: start;
  width: 100%;
  min-height: 1.05em;
  margin-inline: auto;
  color: var(--hero-copy);
  text-align: center;
  white-space: normal;
}

/* Der Cursor bleibt an der aktiven Textzeile und kann nicht allein umbrechen. */
.hero-particles .hero-heading-dynamic::after { display: none; }
.hero-particles .hero-heading-typed-line { white-space: nowrap; }
.hero-particles .hero-heading-typed-line::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: .82em;
  margin-left: .08em;
  vertical-align: -.02em;
  background: #f48312;
  animation: hero-caret-blink .82s steps(1, end) infinite;
}

html[lang="en"] .hero-particles .hero-heading-dynamic[data-phrase-index="0"],
body[data-lang="en"] .hero-particles .hero-heading-dynamic[data-phrase-index="0"] {
  white-space: nowrap;
}

/* Die längste Aussage besitzt einen festen Zweizeilen-Satz innerhalb des
   dreizeiligen Headline-Rasters (eine feste + zwei dynamische Zeilen). */
.hero-particles .hero-heading-dynamic[data-phrase-index="2"] {
  line-height: 1.08;
  white-space: nowrap;
}

.hero-particles .hero-heading-dynamic[data-phrase-index="2"] br {
  display: block;
}

/* Die feste Einleitung bleibt eine Zeile; die wechselnde Aussage erhält maximal zwei. */
.hero-particles .hero-heading-fixed {
  display: block;
  grid-row: 1;
  align-self: start;
  width: 100%;
  text-align: center;
  white-space: nowrap;
}

.hero-particles__lead {
  max-width: 680px;
  margin: 25px auto 0;
  color: var(--hero-muted);
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.6;
  text-wrap: balance;
}

.hero-particles__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 44px;
}

.hero-particles__actions .button { min-height: 50px; }
.hero-particles__actions .button-secondary {
  border-color: rgba(255, 255, 255, .38);
  color: #fff;
  background: rgba(12, 15, 20, .42);
  backdrop-filter: blur(12px);
}

body:not([data-theme="dark"]) .hero-particles__actions .button-secondary {
  border-color: rgba(31, 41, 55, .25);
  color: #263244;
  background: rgba(255, 255, 255, .66);
}

@media (max-width: 720px) {
  .hero-particles { min-height: 100svh; }
  .hero-particles__content { width: min(100% - 28px, 560px); padding-top: clamp(76px, 11vh, 94px); }
  .hero-particles__eyebrow { margin-bottom: 16px; letter-spacing: .12em; }
  .hero-particles .hero-rotating-heading { height: 3.4em; min-height: 3.4em; font-size: clamp(1.8rem, 9vw, 3.45rem); line-height: 1; }
  .hero-particles .hero-heading-dynamic { min-height: 2.05em; }
  .hero-particles__lead { margin-top: 30px; font-size: .98rem; }
  .hero-particles__actions { display: grid; width: min(100%, 340px); margin: 72px auto 0; }

}

@media (max-height: 680px) {
  .hero-particles__content { padding-top: 76px; padding-bottom: 60px; }
  .hero-particles__eyebrow { margin-bottom: 10px; }
  .hero-particles__lead { margin-top: 12px; }
  .hero-particles__actions { margin-top: 17px; }
}

/* Auch auf kurzen Handydisplays genug Luft zwischen Headline, Lead und CTAs lassen. */
@media (max-width: 720px) and (max-height: 680px) {
  .hero-particles__lead { margin-top: 26px; }
  .hero-particles__actions { margin-top: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-particles .hero-heading-typed-line::after { display: none; animation: none; }
}

