/*
 * Intro-Loader (nur Startseite, siehe inc/loader.php)
 * Ablauf: Kontur zeichnen (0–1,7 s) → Schrift füllen (1,6–2,3 s) → nach oben wegfahren (2,4–3,2 s).
 */

html.ek-loading {
  overflow: hidden;
}

html.ek-loader-skip #ek-loader {
  display: none;
}

#ek-loader {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 2rem;
  background-color: var(--wp--preset--color--base);
  transition: transform 0.8s cubic-bezier(0.76, 0, 0.24, 1);
  will-change: transform;
  /* Notbremse, falls das Skript nicht läuft */
  animation: ek-loader-failsafe 0s linear 5s forwards;
}

#ek-loader.is-leaving {
  transform: translateY(-100%);
}

#ek-loader svg {
  width: min(78vw, 560px);
  height: auto;
  overflow: visible;
}

/* Füllung: Original-Pfade (inc/loader.php) */
#ek-loader .ek-fill {
  fill-opacity: 0;
}

/* Kontur: jeder Teilpfad einzeln, pathLength="1" = Länge dieses Teilpfads */
#ek-loader .ek-stroke path {
  fill: none;
  stroke: var(--wp--preset--color--heading);
  stroke-width: 6;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  animation: ek-draw 1.5s cubic-bezier(0.37, 0, 0.63, 1) forwards;
}

#ek-loader .ek-stroke.logo-shadow path {
  animation-delay: 0.2s;
}

#ek-loader .ek-fill.logo-front {
  animation: ek-fill 0.5s ease 1.6s forwards;
}

#ek-loader .ek-fill.logo-shadow {
  animation: ek-fill 0.5s ease 1.8s forwards;
}

#ek-loader .ek-stroke.logo-front {
  animation: ek-stroke-out 0.5s ease 1.6s forwards;
}

#ek-loader .ek-stroke.logo-shadow {
  animation: ek-stroke-out 0.5s ease 1.8s forwards;
}

@keyframes ek-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes ek-fill {
  to { fill-opacity: 1; }
}

@keyframes ek-stroke-out {
  to { opacity: 0; }
}

@keyframes ek-loader-failsafe {
  to { visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  #ek-loader {
    transition: opacity 0.4s ease;
  }

  #ek-loader.is-leaving {
    transform: none;
    opacity: 0;
  }

  #ek-loader .ek-fill {
    animation: none;
    fill-opacity: 1;
  }

  #ek-loader .ek-stroke {
    display: none;
  }
}
