/* Hero-WebGL: Buehne, Fallback-Steuerung und Layout der Startsektion. */

#hero-gl {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  pointer-events: none;
}

.hero-gl-pending #hero-gl,
.hero-gl-on #hero-gl {
  display: block;
}

#hero-gl canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.hero-gl-on #hero-gl canvas {
  opacity: 1;
}

/* Solange die Sequenz laden koennte, bleibt das 2D-Netz aus. */
.hero-gl-pending .start-hero .hero3d,
.hero-gl-on .start-hero .hero3d {
  display: none;
}

/* Der HTML-Text startet unsichtbar und wird von GSAP am Ende der Sequenz
   eingeblendet. Er steht die ganze Zeit im DOM - Crawler und KI-Agenten
   lesen ihn also unabhaengig von der Animation.
   Failsafe: falls das Skript haengt, taucht er nach 12 s trotzdem auf. */
.hero-gl-pending .start-hero .desktop-view .content-wrapper > *,
.hero-gl-on .start-hero .desktop-view .content-wrapper > * {
  opacity: 0;
  animation: hero-gl-failsafe 0s linear 12s forwards;
}

@keyframes hero-gl-failsafe {
  to { opacity: 1; }
}

.hero-gl-off .start-hero .desktop-view .content-wrapper > *,
.hero-gl-done .start-hero .desktop-view .content-wrapper > * {
  opacity: 1;
  animation: none;
}

/* Mit laufender 3D-Szene rutscht der Textblock nach unten,
   damit Logo und "IT-KRUG" die obere Bildhaelfte bekommen. */
@media (min-width: 992px) {
  .hero-gl-pending .start-hero,
  .hero-gl-on .start-hero {
    align-items: flex-end;
  }

  .hero-gl-pending .start-hero > .container,
  .hero-gl-on .start-hero > .container {
    position: relative;
    z-index: 2;
    padding-bottom: 7vh;
  }

  /* "IT-KRUG" steht bereits monumental in 3D im Bild -
     die HTML-Headline tritt bewusst zurueck. */
  .hero-gl-on .start-hero .mbr-section-title {
    font-size: 2.75rem;
    margin-bottom: 12px;
  }

  .hero-gl-on .start-hero .mbr-text {
    width: 100%;
    max-width: 62ch;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-gl-pending .start-hero .desktop-view .content-wrapper > * {
    opacity: 1;
    animation: none;
  }
}
