/* ikii — splash screen.
   Drop in as-is. Two themes: .ikii-splash--ink (dark) and .ikii-splash--sand (light).
   The smile is a STATE, not a timed step: add .is-ready to .ikii-splash when the app
   has finished loading, wait 520ms, then hand off. Nothing here is scoped to
   [data-theme] — the splash is the same in every theme. */

.ikii-splash {
  position: fixed;
  inset: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-family: 'Fredoka', system-ui, sans-serif;
  z-index: 9999;
}
.ikii-splash--ink  { background: #1B1A24; }
.ikii-splash--sand { background: #F4F1EA; }

/* ---------- ambient shapes ---------- */
.ikii-splash__shape {
  position: absolute;
  animation: ikii-drift 8s ease-in-out infinite;
}
.ikii-splash__shape--a { top: -60px; left: -70px; width: 240px; height: 240px; border-radius: 70px; --r: -8deg; animation-duration: 9s; }
.ikii-splash__shape--b { top: 118px; right: -34px; width: 116px; height: 116px; border-radius: 34px; --r: 12deg; animation-duration: 7.5s; animation-delay: .6s; }
.ikii-splash__shape--c { bottom: 176px; left: -30px; width: 132px; height: 132px; border-radius: 999px; animation-duration: 8.5s; animation-delay: 1.1s; }
.ikii-splash__shape--d { top: 214px; left: 46px; width: 34px; height: 34px; border-radius: 999px; background: #F2C044; animation-duration: 6.5s; animation-delay: .3s; }
.ikii-splash__shape--e { bottom: 318px; right: 34px; width: 46px; height: 46px; --r: 18deg; animation-duration: 7s; animation-delay: .9s; }
.ikii-splash__shape--e::before,
.ikii-splash__shape--e::after { content: ''; position: absolute; border-radius: 5px; background: #8654BE; }
.ikii-splash__shape--e::before { top: 19px; left: 0; width: 46px; height: 10px; }
.ikii-splash__shape--e::after { left: 18px; top: 0; width: 10px; height: 46px; }

.ikii-splash--ink  .ikii-splash__shape--a { background: #2A2836; }
.ikii-splash--ink  .ikii-splash__shape--b { background: #3A66AE; }
.ikii-splash--ink  .ikii-splash__shape--c { border: 12px solid #2A2836; }
.ikii-splash--sand .ikii-splash__shape--a { background: #FFFDF8; }
.ikii-splash--sand .ikii-splash__shape--b { background: #4C82D9; }
.ikii-splash--sand .ikii-splash__shape--c { border: 14px solid #E4DFD4; }
.ikii-splash--sand .ikii-splash__shape--e::before,
.ikii-splash--sand .ikii-splash__shape--e::after { background: #A874E6; }

/* ---------- centre stack ---------- */
.ikii-splash__stack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}
.ikii-splash__mark { position: relative; display: grid; place-items: center; }

.ikii-splash__ring {
  position: absolute;
  width: 172px; height: 172px;
  border-radius: 999px;
  border: 3px solid #FB6340;
  animation: ikii-ring 1.7s ease-out .5s infinite;
}

/* pop and bob live on separate wrappers — both animate transform */
.ikii-splash__pop { animation: ikii-pop .78s cubic-bezier(.34, 1.4, .64, 1) both; }
.ikii-splash__bob { animation: ikii-bob 2.4s ease-in-out .62s infinite; }

.ikii-splash__head {
  position: relative;
  width: 148px; height: 148px;
  border-radius: 43px;
  background: #FB6340;
  box-shadow: 0 11px 0 #D64A2B;
}
.ikii-splash__eye {
  position: absolute;
  top: 61px;
  width: 42px; height: 48px;
  border-radius: 21px;
  background: #FFFDF8;
  display: grid;
  place-items: center;
  animation: ikii-blink 5s ease-in-out .62s infinite;
}
.ikii-splash__eye--l { left: 23px; }
.ikii-splash__eye--r { right: 23px; }
.ikii-splash__pupil {
  width: 20px; height: 20px;
  border-radius: 999px;
  background: #1B1A24;
  animation: ikii-scan 5s ease-in-out .62s infinite;
}
.ikii-splash__mouth {
  position: absolute;
  left: 51px; top: 115px;
  width: 46px; height: 23px;
  border-radius: 0 0 46px 46px;
  background: #1B1A24;
  transform: scaleY(0);
  transform-origin: top center;
  opacity: 0;
}

/* ---------- wordmark + tagline ---------- */
.ikii-splash__type { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.ikii-splash__wordmark {
  width: 134px;
  animation: ikii-rise .6s cubic-bezier(.34, 1.4, .64, 1) .34s both;
}
.ikii-splash__tagline {
  font: 400 11px/1 'DM Mono', ui-monospace, monospace;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: #86818F;
  animation: ikii-rise .6s cubic-bezier(.34, 1.4, .64, 1) .5s both;
}

/* ---------- loader dots ---------- */
.ikii-splash__dots {
  position: absolute;
  bottom: 74px; left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 12px;
}
.ikii-splash__dots > span {
  width: 12px; height: 12px;
  border-radius: 999px;
  animation: ikii-dot 1.2s ease-in-out infinite;
}
.ikii-splash__dots > span:nth-child(2) { animation-delay: .15s; }
.ikii-splash__dots > span:nth-child(3) { animation-delay: .3s; }
.ikii-splash--ink  .ikii-splash__dots > span { background: #FB6340; }
.ikii-splash--sand .ikii-splash__dots > span { background: #1B1A24; }

/* ---------- READY: the smile ---------- */
.ikii-splash.is-ready .ikii-splash__mouth {
  animation: ikii-smile .2s cubic-bezier(.34, 1.4, .64, 1) forwards;
}
.ikii-splash.is-ready .ikii-splash__bob {
  animation: ikii-cheer .52s cubic-bezier(.34, 1.4, .64, 1) both;
}
.ikii-splash.is-ready .ikii-splash__eye { animation: none; }
.ikii-splash.is-ready .ikii-splash__pupil { animation: none; }
.ikii-splash.is-ready .ikii-splash__dots { opacity: 0; transition: opacity .18s linear; }

/* ---------- leaving ---------- */
.ikii-splash.is-leaving { opacity: 0; transition: opacity .26s linear; pointer-events: none; }

/* ---------- keyframes ---------- */
@keyframes ikii-pop {
  0% { transform: translateY(26px) scale(.62); opacity: 0 }
  55% { transform: translateY(0) scale(1.07); opacity: 1 }
  72% { transform: translateY(0) scale(.97) }
  100% { transform: translateY(0) scale(1); opacity: 1 }
}
@keyframes ikii-bob {
  0%, 40%, 100% { transform: translateY(0) }
  20% { transform: translateY(-8px) }
}
@keyframes ikii-cheer {
  0% { transform: translateY(0) }
  46% { transform: translateY(-17px) }
  100% { transform: translateY(0) }
}
@keyframes ikii-smile {
  0% { transform: scaleY(0); opacity: 0 }
  70% { transform: scaleY(1.18); opacity: 1 }
  100% { transform: scaleY(1); opacity: 1 }
}
@keyframes ikii-blink {
  0%, 30%, 36%, 66%, 72%, 100% { transform: scaleY(1) }
  33%, 34.4%, 69%, 70.4% { transform: scaleY(.1) }
}
@keyframes ikii-scan {
  0%, 16% { transform: translateX(0) }
  30%, 44% { transform: translateX(5px) }
  56%, 72% { transform: translateX(-4px) }
  82%, 100% { transform: translateX(0) }
}
@keyframes ikii-rise {
  0% { opacity: 0; transform: translateY(18px) }
  100% { opacity: 1; transform: translateY(0) }
}
@keyframes ikii-ring {
  0% { transform: scale(.72); opacity: .55 }
  70%, 100% { transform: scale(1.5); opacity: 0 }
}
@keyframes ikii-drift {
  0%, 100% { transform: translate(0, 0) rotate(var(--r, 0deg)) }
  50% { transform: translate(0, -16px) rotate(calc(var(--r, 0deg) + 5deg)) }
}
@keyframes ikii-dot {
  0%, 100% { transform: translateY(0); opacity: .35 }
  45% { transform: translateY(-9px); opacity: 1 }
}

@media (prefers-reduced-motion: reduce) {
  .ikii-splash__shape,
  .ikii-splash__ring,
  .ikii-splash__bob,
  .ikii-splash__eye,
  .ikii-splash__pupil,
  .ikii-splash__dots > span { animation: none !important; }
  .ikii-splash.is-ready .ikii-splash__bob { animation: none !important; }
  .ikii-splash.is-ready .ikii-splash__mouth { transform: scaleY(1); opacity: 1; animation: none !important; }
}
