/* Kras app splash — eerste paint + exit (gekoppeld aan index.html markup) */

#app-loading {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0)
    env(safe-area-inset-left, 0);
  background:
    radial-gradient(ellipse 100% 70% at 50% -15%, rgba(45, 143, 95, 0.28) 0%, transparent 58%),
    radial-gradient(ellipse 55% 45% at 92% 88%, rgba(91, 168, 212, 0.2) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 8% 92%, rgba(124, 92, 191, 0.14) 0%, transparent 50%),
    linear-gradient(168deg, #ebe6df 0%, #e8f4ee 38%, #faf9f7 100%);
  transition: opacity 0.15s ease;
}

#app-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

#app-loading.splash-exit {
  animation: kras-splash-exit 0.55s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

@keyframes kras-splash-exit {
  0% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
  45% {
    opacity: 1;
    transform: scale(1.02);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: scale(1.08);
    filter: blur(14px);
  }
}

#app-loading .splash-aurora {
  position: absolute;
  inset: -30%;
  background: conic-gradient(
    from 200deg at 50% 50%,
    rgba(45, 143, 95, 0.15),
    rgba(91, 168, 212, 0.12),
    rgba(124, 92, 191, 0.1),
    rgba(45, 143, 95, 0.15)
  );
  animation: kras-splash-aurora 12s linear infinite;
  opacity: 0.65;
  pointer-events: none;
}

@keyframes kras-splash-aurora {
  to {
    transform: rotate(360deg);
  }
}

#app-loading .splash-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(45, 143, 95, 0.2);
  pointer-events: none;
}

#app-loading .splash-ring--1 {
  width: min(88vmin, 420px);
  height: min(88vmin, 420px);
  animation: kras-splash-ring-in 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#app-loading .splash-ring--2 {
  width: min(68vmin, 320px);
  height: min(68vmin, 320px);
  border-color: rgba(91, 168, 212, 0.25);
  animation: kras-splash-ring-in 1s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both,
    kras-splash-ring-spin 10s linear 0.5s infinite;
}

@keyframes kras-splash-ring-in {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes kras-splash-ring-spin {
  to {
    transform: scale(1) rotate(360deg);
  }
}

#app-loading .splash-stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 1.5rem;
  animation: kras-splash-stage-in 0.85s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}

@keyframes kras-splash-stage-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#app-loading .logo-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.75rem 2rem 1.5rem;
  border-radius: 1.75rem;
  border: 1px solid rgba(20, 18, 16, 0.07);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 28px 64px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

#app-loading .logo {
  width: 7.5rem;
  height: auto;
  object-fit: contain;
}

#app-loading .wordmark {
  margin: 0.65rem 0 0;
  font-family: 'Nunito Sans', -apple-system, sans-serif;
  font-weight: 900;
  font-size: clamp(1.5rem, 5vw, 1.85rem);
  letter-spacing: -0.04em;
  color: #141210;
  line-height: 1.1;
}

#app-loading .wordmark span {
  background: linear-gradient(120deg, #2d8f5f, #5ba8d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

#app-loading .tagline {
  margin: 0.35rem 0 0;
  font-family: 'Caveat', 'Nunito Sans', cursive;
  font-size: 1.4rem;
  font-weight: 600;
  color: #2d8f5f;
}

#app-loading .splash-loader {
  margin-top: 1.25rem;
  display: flex;
  gap: 0.35rem;
  align-items: center;
  justify-content: center;
}

#app-loading .splash-loader span {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #2d8f5f;
  animation: kras-splash-dot 1.2s ease-in-out infinite;
}

#app-loading .splash-loader span:nth-child(2) {
  animation-delay: 0.15s;
  background: #5ba8d4;
}

#app-loading .splash-loader span:nth-child(3) {
  animation-delay: 0.3s;
  background: #7c5cbf;
}

@keyframes kras-splash-dot {
  0%, 80%, 100% {
    opacity: 0.35;
    transform: translateY(0) scale(0.85);
  }
  40% {
    opacity: 1;
    transform: translateY(-6px) scale(1);
  }
}

#app-loading .loading-text {
  margin-top: 0.85rem;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b635c;
  font-family: 'Nunito Sans', -apple-system, sans-serif;
}

#app-loading .splash-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  overflow: hidden;
  background: rgba(45, 143, 95, 0.1);
}

#app-loading .splash-progress-bar {
  height: 100%;
  width: 38%;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, #2d8f5f, #5ba8d4, #7c5cbf, #2d8f5f);
  background-size: 200% 100%;
  animation: kras-splash-progress 1.4s ease-in-out infinite;
}

@keyframes kras-splash-progress {
  0% {
    transform: translateX(-120%);
    background-position: 0% 50%;
  }
  100% {
    transform: translateX(380%);
    background-position: 100% 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  #app-loading .splash-aurora,
  #app-loading .splash-ring,
  #app-loading .splash-loader span,
  #app-loading .splash-progress-bar {
    animation: none !important;
  }

  #app-loading.splash-exit {
    animation-duration: 0.25s !important;
  }
}
