/* A single, lightweight entrance: every layer returns to its static state. */
.flow-intro {
  position: relative;
  isolation: isolate;
  min-block-size: calc(100svh - 108px);
  background:
    radial-gradient(ellipse at 18% 50%, #8300ed24, transparent 66%),
    radial-gradient(ellipse at 84% 46%, #00b5f418, transparent 62%),
    var(--bg);
  overflow: hidden;
  border-block-end: 1px solid var(--line);
}

.flow-screen {
  position: relative;
  z-index: 2;
  min-block-size: inherit;
  display: flex;
  flex-direction: column;
  padding-block: clamp(28px, 3vw, 44px) 28px;
}

.flow-screen-top {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 20px;
}

.flow-screen-index,
.splash-kicker,
.splash-caption {
  font-family: 'Space Grotesk', Arial, sans-serif;
  font-size: .6875rem;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: .14em;
}

.flow-screen-index { color: #bbb5c8; }

.flow-display {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  flex: 1;
  min-block-size: clamp(280px, 30vw, 435px);
  margin-block: 21px 18px;
}

.flow-grid,
.flow-halo,
.flow-streams {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  pointer-events: none;
}

/* The decoration reaches the screen edges while the wordmark stays centered. */
.flow-grid,
.flow-streams {
  left: 50%;
  right: auto;
  inline-size: 100vw;
  translate: -50% 0;
}

.flow-grid {
  z-index: -3;
  opacity: .7;
  background-image: linear-gradient(#b7a2e10b 1px, transparent 1px), linear-gradient(90deg, #b7a2e10b 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at center, #000 12%, transparent 72%);
}

.flow-halo {
  z-index: -2;
}

.flow-streams { z-index: -1; overflow: visible; }
.flow-stream {
  --flow-reveal-length: calc(160vw + 100vh);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.flow-stream-one { stroke: #9b00ff; opacity: .62; }
.flow-stream-two { stroke: #00b5f4; opacity: .4; }
.flow-stream-three { stroke: #cfc0ed; opacity: .19; }

.flow-wordmark {
  position: relative;
  inline-size: min(68%, 760px);
  margin: 0;
  z-index: 2;
}

.flow-wordmark img { inline-size: 100%; block-size: auto; }

.flow-logo-square {
  position: absolute;
  display: block;
  top: 90px;
  right: clamp(28px, 3.5vw, 84px);
  inline-size: clamp(64px, 6vw, 104px);
  block-size: clamp(64px, 6vw, 104px);
  z-index: 1;
  background: #5a0f8e;
  transform: rotate(45deg);
  transform-origin: center;
  pointer-events: none;
}

.flow-logo-square.flow-square-waiting { visibility: hidden; }
.flow-logo-square.flow-square-in-flight { will-change: transform; }

.flow-intro-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin-block-start: 28px;
  padding-block-start: 20px;
  border-block-start: 1px solid var(--line);
}

.flow-intro-actions { display: flex; align-items: center; justify-content: center; }
.flow-intro-actions .button { min-block-size: 50px; padding-block: 12px; }

/* The splash never captures a pointer or prevents document scrolling. */
.brand-splash {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: #09090d;
  pointer-events: none;
  animation: splash-away 1050ms cubic-bezier(.65, 0, .35, 1) both;
}

.splash-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  inline-size: min(75vw, 620px);
  position: relative;
}

.splash-kicker { color: #b8aecb; font-size: .625rem; margin-block-end: 32px; }
.splash-logo { inline-size: 100%; animation: splash-brand-in 650ms cubic-bezier(.2, .7, .2, 1) both; }
.splash-logo img { inline-size: 100%; block-size: auto; }
.splash-flow { inline-size: 100%; block-size: 1px; background: #ffffff18; margin-block-start: 36px; overflow: hidden; }
.splash-flow span { display: block; inline-size: 100%; block-size: 100%; background: linear-gradient(90deg, var(--violet), var(--cyan)); transform-origin: left; animation: splash-line-in 650ms cubic-bezier(.3, .6, .4, 1) both; }
.splash-caption { margin-block-start: 16px; color: #8e879a; font-size: .5625rem; }

.intro-enter .flow-wordmark { animation: flow-brand-reveal 1000ms cubic-bezier(.2, .75, .25, 1) var(--intro-delay, 0ms) both; }
.intro-enter .flow-halo { animation: flow-light-reveal 1700ms ease-out var(--intro-delay, 0ms) both; }
.intro-enter .flow-stream { animation: flow-stream-reveal 1800ms cubic-bezier(.25, .65, .3, 1) calc(var(--intro-delay, 0ms) + 120ms) both; }
.intro-enter .flow-stream-two { animation-delay: calc(var(--intro-delay, 0ms) + 240ms); }
.intro-enter .flow-stream-three { animation-delay: calc(var(--intro-delay, 0ms) + 360ms); }
.intro-enter .flow-screen-top,
.intro-enter .flow-intro-bottom { animation: flow-content-reveal 750ms ease-out calc(var(--intro-delay, 0ms) + 300ms) both; }

@keyframes splash-away {
  0%, 65% { opacity: 1; visibility: visible; }
  100% { opacity: 0; visibility: hidden; pointer-events: none; }
}

@keyframes splash-brand-in {
  from { opacity: 0; transform: translateY(12px) scale(.97); clip-path: inset(0 100% 0 0); }
  to { opacity: 1; transform: none; clip-path: inset(0); }
}

@keyframes splash-line-in {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes flow-brand-reveal {
  from { opacity: 0; transform: translateY(24px) scale(.97); clip-path: inset(0 100% 0 0); }
  to { opacity: 1; transform: none; clip-path: inset(0); }
}

@keyframes flow-light-reveal {
  from { opacity: 0; transform: scale(.65); }
  60% { opacity: 1; }
  to { opacity: 1; transform: none; }
}

@keyframes flow-stream-reveal {
  from { stroke-dasharray: var(--flow-reveal-length); stroke-dashoffset: var(--flow-reveal-length); transform: translateY(16px); }
  99.9% { stroke-dasharray: var(--flow-reveal-length); stroke-dashoffset: 0; transform: none; }
  to { stroke-dasharray: none; stroke-dashoffset: 0; transform: none; }
}

@keyframes flow-content-reveal {
  from { opacity: 0; translate: 0 12px; }
  to { opacity: 1; translate: 0 0; }
}

@media (min-width: 1600px) {
  .flow-display { min-block-size: 490px; }
}

@media (max-width: 760px) {
  .flow-intro { min-block-size: calc(100svh - 88px); }
  .flow-screen { padding-block: 30px 26px; }
  .flow-display { min-block-size: clamp(240px, 47vw, 360px); margin-block: 22px 25px; }
  .flow-wordmark { inline-size: 78%; }
  .flow-intro-bottom { flex-wrap: wrap; margin-block-start: 24px; padding-block-start: 16px; }
}

@media (max-width: 540px) {
  .flow-intro { min-block-size: calc(100svh - 78px); }
  .flow-screen { padding-block: 24px; }
  .flow-screen-top { gap: 10px; }
  .flow-screen-index { font-size: .5625rem; letter-spacing: .1em; white-space: nowrap; }
  .flow-display { min-block-size: clamp(220px, 63vw, 300px); margin-block: 14px 20px; }
  .flow-wordmark { inline-size: 82%; }
  .flow-grid { background-size: 40px 40px; }
  .flow-logo-square { top: 90px; right: 26px; inline-size: 40px; block-size: 40px; }
  .flow-intro-bottom { flex-direction: column; align-items: stretch; gap: 15px; margin-block-start: 22px; }
  .flow-intro-actions .button { padding-inline: 16px; gap: 12px; min-block-size: 48px; font-size: .8125rem; }
  .splash-frame { inline-size: 82vw; }
  .splash-kicker { font-size: .5625rem; margin-block-end: 26px; }
  .splash-flow { margin-block-start: 27px; }
  .splash-caption { font-size: .4375rem; }
}

@media (prefers-reduced-motion: reduce) {
  .brand-splash { display: none !important; }
  .flow-intro *, .flow-intro *::before, .flow-intro *::after { animation: none !important; transition: none !important; }
  .flow-logo-square.flow-square-waiting { visibility: visible; }
}
