/*
 * Zodinet ID welcome page. Lavender canvas, centered logo, gateway scene and title.
 * Self-contained: this page loads no other stylesheet.
 */

:root {
  --zw-brand: #7b63cf;
  --zw-heading: #21102f;
  --zw-muted: #5c6078;
  --zw-canvas: #faf9ff;
  --zw-lavender: #eee9ff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--zw-heading);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  /* Soft lavender hills on either side, as in the approved welcome design. */
  background:
    radial-gradient(60% 70% at 0% 70%, rgb(226 218 255 / 70%), transparent 70%),
    radial-gradient(55% 65% at 100% 65%, rgb(226 218 255 / 70%), transparent 70%),
    radial-gradient(90% 60% at 50% 0%, var(--zw-lavender), transparent 75%),
    var(--zw-canvas);
  -webkit-font-smoothing: antialiased;
}

.zw-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.zw-main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px 32px;
  text-align: center;
}

.zw-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.zw-logo {
  display: block;
  width: 190px;
  height: auto;
}

.zw-badge {
  padding: 3px 10px;
  font-size: 15px;
  line-height: 22px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--zw-brand);
  background: #e6defe;
  border-radius: 8px;
}

/* Exact 4:3 box (no letterboxing) so the Lottie overlay lines up with the image; it also
   shrinks on short windows to keep the title on screen. */
.zw-art {
  position: relative;
  isolation: isolate;
  width: min(clamp(320px, 46vw, 640px), 100%, calc(clamp(200px, 100dvh - 360px, 480px) * 4 / 3));
  margin-top: 24px;
  animation: zw-enter 400ms ease-out both;
}

.zw-art img {
  display: block;
  width: 100%;
  height: auto;
}

/*
 * Lottie overlay. In zodinet-gateway-glow.json the scene image sits at 61% scale, centred at
 * (480, 376) on a 960x720 canvas, i.e. it covers 883.3x662.5 starting at (38.4, 44.8). These
 * offsets enlarge the player box so that scene lands exactly on the static image underneath.
 */
.zi-lottie {
  position: relative;
}

.zi-lottie-player {
  position: absolute;
  left: -4.343%;
  top: -6.758%;
  width: 108.686%;
  height: 108.686%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 300ms ease;
}

/* Cross-fade from the static picture: the animation's redrawn background differs slightly. */
.zi-lottie picture img {
  transition: opacity 300ms ease;
}

.zi-lottie-player svg {
  display: block;
}

.zi-lottie.is-animated .zi-lottie-player {
  opacity: 1;
}

.zi-lottie.is-animated picture img {
  opacity: 0;
}

.zi-lottie.is-animated + .zw-glow {
  display: none;
}

/* Pause / Play for the looping illustration (shown only while the animation is running). */
.zi-lottie-toggle:not([hidden]) {
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: #5942cf;
  background: rgb(255 255 255 / 88%);
  border: 1px solid #dcd5fb;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgb(75 48 142 / 10%);
  cursor: pointer;
}

.zi-lottie-toggle:hover {
  background: #ffffff;
}

.zi-lottie-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px #ffffff, 0 0 0 6px #6554f5;
}

.zi-lottie-toggle svg {
  display: block;
  width: 18px;
  height: 18px;
}

.zi-lottie-toggle .zi-lottie-toggle-play,
.zi-lottie-toggle.is-paused .zi-lottie-toggle-pause {
  display: none;
}

.zi-lottie-toggle.is-paused .zi-lottie-toggle-play {
  display: block;
}

.zw-glow {
  position: absolute;
  z-index: -1;
  inset: 10% 5% 0;
  pointer-events: none;
  background: radial-gradient(ellipse, rgb(160 133 255 / 38%), transparent 70%);
  opacity: 0.3;
  animation: zw-glow 6s ease-in-out 2;
}

.zw-title {
  margin: 24px 0 0;
  font-size: clamp(28px, 3.4vw, 48px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.zw-subtitle {
  margin: 10px 0 0;
  font-size: clamp(16px, 1.4vw, 20px);
  line-height: 1.45;
  color: var(--zw-muted);
}

.zw-footer {
  padding: 16px 40px 20px;
  font-size: 13px;
  line-height: 20px;
  color: var(--zw-muted);
}

.zw-footer p {
  margin: 0;
}

@media (max-width: 767px) {
  .zw-main {
    padding: 32px 24px 24px;
  }

  .zw-logo {
    width: 150px;
  }

  .zw-badge {
    padding: 2px 8px;
    font-size: 13px;
    line-height: 20px;
  }

  .zw-art {
    width: min(100%, 340px, calc(clamp(140px, 100dvh - 380px, 300px) * 4 / 3));
  }

  .zw-footer {
    padding: 16px 24px 20px;
    text-align: center;
  }
}

@media (max-width: 360px) {
  .zw-main {
    padding-inline: 20px;
  }
}

@keyframes zw-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes zw-glow {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  .zw-art,
  .zw-glow {
    animation: none;
  }
}
