/* Core welcome splash (apps/platform-web/views/partials/core-splash.ejs), first /admin page only.
   Story: the two brackets of the CORE logo "[ O ]" fly in and lock around the O, the star ignites
   in the core, five nodes start orbiting – one per area the administration configures – and the
   areas light up one after another. Colours only from the ZIQAVO tokens. Style attributes are
   blocked by the CSP, so staggering uses :nth-child rules. SVG parts move through wrapper <g>
   elements because a CSS transform would replace their transform attribute. */

html.core-splash-open {
  overflow: hidden;
}

.core-splash {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #effbf6;
  background: var(--ziqavo-gradient);
  font-family: "DM Sans", "Segoe UI", Arial, sans-serif;
  cursor: pointer;
  animation:
    core-splash-in 0.5s ease-out both,
    core-splash-out 0.6s ease-in 9.4s forwards;
}

.core-splash.is-leaving {
  animation: core-splash-leave 0.55s cubic-bezier(0.6, 0, 0.8, 0.2) forwards;
  pointer-events: none;
}

/* Background: drifting aurora and a perspective grid floor. */
.core-splash__aurora {
  position: absolute;
  inset: -25%;
  background:
    radial-gradient(closest-side at 50% 38%, rgb(70 245 173 / 0.24), transparent),
    radial-gradient(closest-side at 22% 70%, rgb(18 161 127 / 0.28), transparent),
    radial-gradient(closest-side at 80% 25%, rgb(10 107 107 / 0.45), transparent);
  filter: blur(40px);
  animation: core-splash-aurora 12s ease-in-out infinite alternate;
}

.core-splash__grid {
  position: absolute;
  left: -50%;
  right: -50%;
  bottom: 0;
  height: 70%;
  background-image:
    linear-gradient(rgb(70 245 173 / 0.24) 1px, transparent 1px),
    linear-gradient(90deg, rgb(70 245 173 / 0.24) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: perspective(600px) rotateX(58deg);
  transform-origin: bottom;
  mask-image: linear-gradient(to top, #000 0%, transparent 75%);
  animation: core-splash-grid 3s linear infinite;
}

/* Stage */
.core-splash__stage {
  position: relative;
  display: grid;
  justify-items: center;
  gap: clamp(0.6rem, 2.2vh, 1.4rem);
  max-width: 46rem;
  padding: 0 1rem;
  text-align: center;
}

/* Emblem: the CORE logo with orbit rings and five orbiting nodes. */
.core-splash__emblem {
  position: relative;
  display: grid;
  place-items: center;
  /* Height-bound so the whole stage fits short screens; nodes are placed in container units. */
  width: clamp(7.5rem, min(30vw, 22vh), 15rem);
  aspect-ratio: 984 / 756;
  margin: clamp(2.25rem, 7vh, 4rem) 0 clamp(1rem, 4vh, 2.5rem);
  container-type: inline-size;
}

.core-splash__mark {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.core-splash__o {
  transform-box: fill-box;
  transform-origin: center;
  animation: core-splash-o 0.8s cubic-bezier(0.2, 1.5, 0.4, 1) 0.25s both;
}

.core-splash__bracket {
  animation: core-splash-bracket-left 0.9s cubic-bezier(0.2, 1.25, 0.35, 1) 0.6s both;
}

.core-splash__bracket--right {
  animation-name: core-splash-bracket-right;
}

.core-splash__star {
  transform-box: fill-box;
  transform-origin: center;
  animation:
    core-splash-ignite 0.9s cubic-bezier(0.2, 1.6, 0.4, 1) 1.35s both,
    core-splash-pulse 2.4s ease-in-out 2.4s infinite;
}

.core-splash__glow {
  transform-box: fill-box;
  transform-origin: center;
  animation: core-splash-glow 1.2s ease-out 1.35s both;
}

.core-splash__ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 104%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border: 1px dashed rgb(70 245 173 / 0.35);
  border-radius: 50%;
  animation:
    core-splash-fade 1s ease 1.5s both,
    core-splash-spin 16s linear infinite;
}

.core-splash__ring--outer {
  width: 130%;
  border-style: dotted;
  border-color: rgb(159 191 187 / 0.25);
  animation:
    core-splash-fade 1s ease 1.7s both,
    core-splash-spin 26s linear infinite reverse;
}

/* Five nodes on the outer orbit (Module, Benutzer, Berechtigungen, Integrationen, AI-Assistent). */
.core-splash__nodes {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  animation:
    core-splash-fade 0.8s ease 1.9s both,
    core-splash-spin 26s linear 1.9s infinite;
}

.core-splash__node {
  --angle: 0deg;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.7rem;
  height: 0.7rem;
  margin: -0.35rem 0 0 -0.35rem;
  border-radius: 50%;
  background: var(--ziqavo-mint);
  box-shadow: 0 0 0.75rem rgb(42 255 179 / 0.8);
  transform: rotate(var(--angle)) translateX(68cqi) rotate(calc(-1 * var(--angle)));
  animation: core-splash-node 0.6s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

.core-splash__node:nth-child(1) {
  --angle: -90deg;
  animation-delay: 2.3s;
}
.core-splash__node:nth-child(2) {
  --angle: -18deg;
  animation-delay: 2.6s;
}
.core-splash__node:nth-child(3) {
  --angle: 54deg;
  animation-delay: 2.9s;
}
.core-splash__node:nth-child(4) {
  --angle: 126deg;
  animation-delay: 3.2s;
}
.core-splash__node:nth-child(5) {
  --angle: 198deg;
  animation-delay: 3.5s;
}

/* Text */
.core-splash__eyebrow {
  margin: 0;
  color: var(--ziqavo-mint);
  font:
    700 0.8rem/1 Manrope,
    "Segoe UI",
    sans-serif;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  animation: core-splash-tracking 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) 1.5s both;
}

.core-splash__title {
  margin: 0;
  color: #effbf6;
  font:
    800 clamp(2rem, 6vw, 3.6rem) / 1.05 Manrope,
    "Segoe UI",
    sans-serif;
  letter-spacing: -0.03em;
  text-wrap: balance;
  animation: core-splash-rise 0.9s cubic-bezier(0.2, 1.2, 0.4, 1) 1.8s both;
}

.core-splash__lead {
  margin: 0;
  max-width: 34rem;
  color: #9fbfbb;
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  line-height: 1.5;
  animation: core-splash-rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 2.1s both;
}

/* Areas: light up in sync with the orbiting nodes. */
.core-splash__areas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 0.65rem;
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
}

.core-splash__area {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem 0.45rem 0.65rem;
  border: 1px solid rgb(159 191 187 / 0.3);
  border-radius: 999px;
  color: #9fbfbb;
  font-weight: 500;
  animation: core-splash-area 0.6s ease both;
}

.core-splash__area-icon {
  width: 0.85rem;
  height: 0.85rem;
  background: currentColor;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
}

.core-splash__area:nth-child(1) {
  animation-delay: 2.3s;
}
.core-splash__area:nth-child(2) {
  animation-delay: 2.6s;
}
.core-splash__area:nth-child(3) {
  animation-delay: 2.9s;
}
.core-splash__area:nth-child(4) {
  animation-delay: 3.2s;
}
.core-splash__area:nth-child(5) {
  animation-delay: 3.5s;
}

/* Call to action and auto-dismiss progress. */
.core-splash__cta {
  margin-top: 0.5rem;
  padding: 0.7rem 1.6rem;
  border: 0;
  border-radius: 999px;
  background: var(--ziqavo-mint);
  color: var(--ziqavo-abyss);
  font:
    700 1rem/1 Manrope,
    "Segoe UI",
    sans-serif;
  box-shadow: 0 0 0 0 rgb(70 245 173 / 0.5);
  animation:
    core-splash-rise 0.6s cubic-bezier(0.2, 1.3, 0.4, 1) 4s both,
    core-splash-ping 2s ease-out 4.6s infinite;
}

.core-splash__cta:focus-visible,
.core-splash__skip:focus-visible {
  outline: 3px solid #effbf6;
  outline-offset: 3px;
}

.core-splash__progress {
  width: min(16rem, 60vw);
  height: 3px;
  border-radius: 3px;
  background: rgb(239 251 246 / 0.12);
  overflow: hidden;
  animation: core-splash-fade 0.4s ease 4.1s both;
}

.core-splash__progress::before {
  content: "";
  display: block;
  height: 100%;
  background: var(--ziqavo-accent-gradient);
  transform: scaleX(0);
  transform-origin: left;
  animation: core-splash-progress 5.3s linear 4.1s forwards;
}

.core-splash__skip {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid rgb(159 191 187 / 0.35);
  border-radius: 999px;
  background: transparent;
  color: #9fbfbb;
  font-size: 0.85rem;
  animation: core-splash-fade 0.6s ease 0.8s both;
}

.core-splash__skip:hover {
  color: #effbf6;
  border-color: #effbf6;
}

/* Platform signature: ZIQAVO logo, unchanged asset, bottom centre with clear space. */
.core-splash__brand {
  position: absolute;
  bottom: clamp(1.5rem, 5vh, 3rem);
  left: 50%;
  width: clamp(96px, 9vw, 120px);
  height: auto;
  translate: -50% 0;
  animation: core-splash-rise 1s cubic-bezier(0.2, 0.8, 0.2, 1) 2.4s both;
}

/* Room for the ZIQAVO signature only on tall screens. */
@media (min-height: 881px) {
  .core-splash__stage {
    padding-bottom: 8rem;
  }
}

@media (max-height: 880px) {
  .core-splash__brand {
    display: none;
  }
}

@media (max-height: 560px) {
  .core-splash__lead {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .core-splash {
    display: none;
  }
}

@keyframes core-splash-in {
  from {
    opacity: 0;
  }
}
@keyframes core-splash-out {
  to {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}
@keyframes core-splash-leave {
  to {
    opacity: 0;
    transform: scale(1.06);
    filter: blur(6px);
  }
}
@keyframes core-splash-aurora {
  to {
    transform: translate(-5%, 4%) rotate(-10deg) scale(1.1);
  }
}
@keyframes core-splash-grid {
  to {
    background-position: 0 64px;
  }
}
@keyframes core-splash-fade {
  from {
    opacity: 0;
  }
}
@keyframes core-splash-spin {
  to {
    rotate: 360deg;
  }
}

@keyframes core-splash-o {
  from {
    opacity: 0;
    transform: scale(0.3);
    filter: blur(8px);
  }
}

/* SVG user units: the brackets start far outside and lock in with a small overshoot. */
@keyframes core-splash-bracket-left {
  from {
    opacity: 0;
    transform: translateX(-900px) rotate(-12deg);
  }
  70% {
    opacity: 1;
    transform: translateX(24px);
  }
}
@keyframes core-splash-bracket-right {
  from {
    opacity: 0;
    transform: translateX(900px) rotate(12deg);
  }
  70% {
    opacity: 1;
    transform: translateX(-24px);
  }
}

@keyframes core-splash-ignite {
  from {
    opacity: 0;
    transform: scale(0) rotate(-180deg);
  }
  60% {
    opacity: 1;
    transform: scale(1.5) rotate(20deg);
  }
}

@keyframes core-splash-pulse {
  50% {
    transform: scale(1.15);
    filter: drop-shadow(0 0 18px rgb(42 255 179 / 0.9));
  }
}

@keyframes core-splash-glow {
  from {
    opacity: 0;
    transform: scale(0.2);
  }
  50% {
    opacity: 1;
    transform: scale(1.6);
  }
}

@keyframes core-splash-node {
  from {
    opacity: 0;
    scale: 0;
  }
}

@keyframes core-splash-tracking {
  from {
    opacity: 0;
    letter-spacing: 1em;
    filter: blur(4px);
  }
}

@keyframes core-splash-rise {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
}

@keyframes core-splash-area {
  from {
    opacity: 0.35;
    transform: translateY(0.5rem);
  }
  to {
    opacity: 1;
    color: #effbf6;
    border-color: rgb(70 245 173 / 0.6);
    background: rgb(70 245 173 / 0.1);
  }
}

@keyframes core-splash-progress {
  to {
    transform: scaleX(1);
  }
}

@keyframes core-splash-ping {
  70%,
  100% {
    box-shadow: 0 0 0 0.9rem rgb(70 245 173 / 0);
  }
}
