/* Shared ZIQAVO brand splash (apps/platform-web/views/partials/brand-splash.ejs): the welcome after the
   first login (variant --welcome) and the first-run setup intro (variant --setup). Story: stars drift
   in from the night sky and gather around the ZIQAVO logo, which rises in a slowly turning orbit; the
   title appears word by word, then three cards. Always the dark brand stage. Colours only from the
   ZIQAVO tokens; the logo itself is never recoloured or filtered. Style attributes are blocked by the
   CSP, so staggering uses :nth-child rules. */

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

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

/* Welcome: a click anywhere closes it, and it fades out by itself after the countdown. */
.brand-splash--welcome {
  cursor: pointer;
  animation:
    brand-splash-in 0.6s ease-out both,
    brand-splash-out 0.7s ease-in 13.4s forwards;
}

/* The user is reading the cards: stop the auto fade-out and the countdown. */
.brand-splash--welcome.is-held {
  animation: none;
}

.brand-splash.is-held .brand-splash__progress::before {
  animation-play-state: paused;
}

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

/* Background: drifting aurora and a night sky of four-pointed stars. */
.brand-splash__aurora {
  position: absolute;
  inset: -25%;
  background:
    radial-gradient(closest-side at 50% 30%, rgb(70 245 173 / 0.2), transparent),
    radial-gradient(closest-side at 18% 75%, rgb(18 161 127 / 0.3), transparent),
    radial-gradient(closest-side at 85% 70%, rgb(10 107 107 / 0.45), transparent);
  filter: blur(40px);
  animation: brand-splash-aurora 14s ease-in-out infinite alternate;
}

.brand-splash__sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.brand-splash__star {
  --x: 50vw;
  --y: 50vh;
  --tx: 0px;
  --ty: 0px;
  --size: 12px;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: var(--size);
  background: var(--ziqavo-mint);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  opacity: 0;
  animation:
    brand-splash-star 2.4s cubic-bezier(0.3, 0, 0.2, 1) both,
    brand-splash-twinkle 2.8s ease-in-out infinite;
}

/* Start position (x/y) and where each star settles around the logo (tx/ty, relative to the start). */
.brand-splash__star:nth-child(1) {
  --x: 6vw;
  --y: 12vh;
  --tx: 30vw;
  --ty: 8vh;
  animation-delay: 0.2s, 2.6s;
}
.brand-splash__star:nth-child(2) {
  --x: 92vw;
  --y: 8vh;
  --tx: -30vw;
  --ty: 12vh;
  --size: 16px;
  animation-delay: 0.35s, 2.9s;
}
.brand-splash__star:nth-child(3) {
  --x: 14vw;
  --y: 82vh;
  --tx: 22vw;
  --ty: -58vh;
  --size: 9px;
  animation-delay: 0.5s, 3.1s;
}
.brand-splash__star:nth-child(4) {
  --x: 88vw;
  --y: 78vh;
  --tx: -24vw;
  --ty: -56vh;
  animation-delay: 0.6s, 3.3s;
}
.brand-splash__star:nth-child(5) {
  --x: 50vw;
  --y: 96vh;
  --tx: 7vw;
  --ty: -78vh;
  --size: 8px;
  animation-delay: 0.75s, 3.5s;
}
.brand-splash__star:nth-child(6) {
  --x: 2vw;
  --y: 45vh;
  --tx: 38vw;
  --ty: -24vh;
  --size: 10px;
  animation-delay: 0.9s, 2.7s;
}
.brand-splash__star:nth-child(7) {
  --x: 97vw;
  --y: 40vh;
  --tx: -40vw;
  --ty: -22vh;
  --size: 14px;
  animation-delay: 1s, 3s;
}
.brand-splash__star:nth-child(8) {
  --x: 30vw;
  --y: 2vh;
  --tx: 12vw;
  --ty: 22vh;
  --size: 7px;
  animation-delay: 1.15s, 3.2s;
}
.brand-splash__star:nth-child(9) {
  --x: 70vw;
  --y: 3vh;
  --tx: -12vw;
  --ty: 24vh;
  --size: 9px;
  animation-delay: 1.25s, 2.8s;
}
.brand-splash__star:nth-child(10) {
  --x: 24vw;
  --y: 60vh;
  --tx: 0px;
  --ty: 0px;
  --size: 6px;
  animation-delay: 1.4s, 3.4s;
}
.brand-splash__star:nth-child(11) {
  --x: 76vw;
  --y: 62vh;
  --tx: 0px;
  --ty: 0px;
  --size: 7px;
  animation-delay: 1.5s, 2.9s;
}
.brand-splash__star:nth-child(12) {
  --x: 10vw;
  --y: 30vh;
  --tx: 0px;
  --ty: 0px;
  --size: 5px;
  animation-delay: 1.6s, 3.6s;
}
.brand-splash__star:nth-child(13) {
  --x: 90vw;
  --y: 25vh;
  --tx: 0px;
  --ty: 0px;
  --size: 6px;
  animation-delay: 1.7s, 3.1s;
}
.brand-splash__star:nth-child(14) {
  --x: 60vw;
  --y: 88vh;
  --tx: 0px;
  --ty: 0px;
  --size: 5px;
  animation-delay: 1.8s, 3.3s;
}

/* Stage */
.brand-splash__stage {
  position: relative;
  display: grid;
  justify-items: center;
  gap: clamp(0.75rem, 2.2vh, 1.25rem);
  width: min(56rem, 100%);
  padding: 4rem 1rem 3rem;
  text-align: center;
}

.brand-splash__emblem {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(130px, 18vw, 190px);
  aspect-ratio: 1;
  margin-bottom: 0.5rem;
}

.brand-splash__halo {
  position: absolute;
  inset: -30%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(42 255 179 / 0.32), transparent);
  animation:
    brand-splash-fade 1s ease 1.2s both,
    brand-splash-pulse 3.2s ease-in-out 2.2s infinite;
}

.brand-splash__orbit {
  position: absolute;
  inset: -14%;
  border: 1px dashed rgb(70 245 173 / 0.4);
  border-radius: 50%;
  animation:
    brand-splash-fade 1s ease 1.4s both,
    brand-splash-spin 18s linear infinite;
}

.brand-splash__logo {
  position: relative;
  width: 100%;
  height: auto;
  animation: brand-splash-rise 1.2s cubic-bezier(0.2, 1.2, 0.4, 1) 1s both;
}

.brand-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: brand-splash-tracking 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) 1.8s both;
}

.brand-splash__title {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 0.28em;
  margin: 0;
  color: #effbf6;
  font:
    800 clamp(2rem, 6vw, 3.75rem) / 1.1 Manrope,
    "Segoe UI",
    sans-serif;
  letter-spacing: -0.03em;
}

.brand-splash__word {
  display: inline-block;
  animation: brand-splash-word 0.8s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}

.brand-splash__word:nth-child(1) {
  animation-delay: 2.1s;
}
.brand-splash__word:nth-child(2) {
  animation-delay: 2.25s;
}
.brand-splash__word:nth-child(3) {
  animation-delay: 2.4s;
}
.brand-splash__word:nth-child(4) {
  animation-delay: 2.55s;
}
.brand-splash__word:nth-child(5) {
  animation-delay: 2.7s;
}

.brand-splash__name {
  color: var(--ziqavo-mint);
}

.brand-splash__lead {
  max-width: 38rem;
  margin: 0;
  color: #9fbfbb;
  font-size: 1.05rem;
  animation: brand-splash-rise 0.8s ease 3.1s both;
}

.brand-splash__lead strong {
  color: #effbf6;
}

/* First steps */
.brand-splash__steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.75rem;
  width: 100%;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.brand-splash__step {
  animation: brand-splash-rise 0.7s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}

.brand-splash__step:nth-child(1) {
  animation-delay: 3.6s;
}
.brand-splash__step:nth-child(2) {
  animation-delay: 3.85s;
}
.brand-splash__step:nth-child(3) {
  animation-delay: 4.1s;
}

.brand-splash__card {
  display: grid;
  gap: 0.25rem;
  height: 100%;
  padding: 1rem 1.1rem;
  border: 1px solid rgb(159 191 187 / 0.28);
  border-radius: 0.9rem;
  background: rgb(4 22 29 / 0.45);
  color: #effbf6;
  text-align: left;
  text-decoration: none;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease,
    background-color 0.2s ease;
}

a.brand-splash__card:hover,
a.brand-splash__card:focus-visible {
  border-color: var(--ziqavo-mint);
  background: rgb(70 245 173 / 0.08);
  color: #effbf6;
  transform: translateY(-2px);
}

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

.brand-splash__card-icon {
  width: 1rem;
  height: 1rem;
  margin-bottom: 0.25rem;
  background: var(--ziqavo-mint);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
}

.brand-splash__card-title {
  font:
    700 1rem/1.3 Manrope,
    "Segoe UI",
    sans-serif;
}

.brand-splash__card-text {
  color: #9fbfbb;
  font-size: 0.875rem;
}

.brand-splash__cta {
  margin-top: 0.75rem;
  padding: 0.75rem 1.8rem;
  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:
    brand-splash-rise 0.6s cubic-bezier(0.2, 1.3, 0.4, 1) 4.4s both,
    brand-splash-ping 2.2s ease-out 5s infinite;
}

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

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

.brand-splash__skip {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 1;
  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: brand-splash-fade 0.6s ease 0.8s both;
}

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

/* Setup: a short hint under the cards (duration, what to have at hand). */
.brand-splash__note {
  max-width: 34rem;
  margin: 0.25rem 0 0;
  color: #c4dcd8;
  font-size: 0.95rem;
  animation: brand-splash-rise 0.7s ease 4.3s both;
}

@media (prefers-reduced-motion: reduce) {
  /* The welcome only greets; without motion it is skipped. */
  .brand-splash--welcome {
    display: none;
  }

  /* The setup intro carries information: shown at once and without any movement. */
  .brand-splash--setup,
  .brand-splash--setup *,
  .brand-splash--setup *::before {
    animation: none !important;
    transition: none !important;
  }
}

@keyframes brand-splash-in {
  from {
    opacity: 0;
  }
}
@keyframes brand-splash-out {
  to {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}
@keyframes brand-splash-leave {
  to {
    opacity: 0;
    transform: scale(1.05);
    filter: blur(6px);
  }
}
@keyframes brand-splash-aurora {
  to {
    transform: translate(-5%, 4%) rotate(-10deg) scale(1.1);
  }
}
@keyframes brand-splash-fade {
  from {
    opacity: 0;
  }
}
@keyframes brand-splash-spin {
  to {
    rotate: 360deg;
  }
}
@keyframes brand-splash-pulse {
  50% {
    transform: scale(1.12);
    opacity: 0.7;
  }
}
@keyframes brand-splash-progress {
  to {
    transform: scaleX(1);
  }
}

@keyframes brand-splash-star {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.2) rotate(0deg);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0.9;
    transform: translate(var(--tx), var(--ty)) scale(1) rotate(180deg);
  }
}

@keyframes brand-splash-twinkle {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.6);
  }
}

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

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

@keyframes brand-splash-word {
  from {
    opacity: 0;
    transform: translateY(0.6em) rotate(-4deg);
    filter: blur(6px);
  }
}

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