/* ATOMIS FILE intro (5 s): the client's logo drives in from the left letter by letter and brakes, the red T
   (two halves with a slit - the mark of the logo) lands in its gap, the line follows in three beats, then the
   sign-in page. The stage is the logo's own white field, the letters are the logo's own outlines (portal-logo.php).
   Nothing here shows unless atomis-intro.js put "intro-play" on <html>; every animation waits for "intro-go".
   Timeline (seconds): road .05 | letters .30-1.55 | T 1.22, touchdown 1.66 | line 2.25 / 2.65 / 3.05 | out 4.40-5.00 */

.atomis-intro { display: none; }

html.intro-play,
html.intro-play body { overflow: hidden; }

html.intro-play .atomis-intro {
  display: grid;
  place-items: center;
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  overflow: hidden;
  cursor: pointer;
  color: #1b2060;
  background: radial-gradient(120% 85% at 50% 56%, #ffffff 0%, #ffffff 34%, #eef1f9 72%, #dde3f2 100%);
  --ai-blue: 47, 52, 147;   /* the logo's blue */
  --ai-red: 229, 21, 34;    /* the logo's red */
  --ai-cap: clamp(34px, 9.4vw, 168px); /* cap height of the logo; the wordmark is 7.85 times as wide */
}

/* ---------------------------------------------------------------- lockup */
.atomis-intro__lockup {
  position: relative;
  display: grid;
  justify-items: center;
  width: 100%;
  padding: 0 16px;
  box-sizing: border-box;
}
.atomis-intro__word {
  display: flex;
  align-items: flex-start;
  font-size: var(--ai-cap);   /* 1em = cap height: the letters carry their sizes and gaps in em */
  line-height: 1;
  white-space: nowrap;
}
.atomis-intro__word span {
  display: block;
  flex: none;
  position: relative;
  z-index: 1;
  opacity: 0;
  transform-origin: 50% 97%;  /* the base line (the M's point dips 3 % under it) */
  will-change: transform, opacity, filter;
}
.atomis-intro__word svg { display: block; width: 100%; height: 100%; overflow: visible; }
.atomis-intro__word .ai-t { z-index: 0; }
/* impact light behind the T */
.atomis-intro__word .ai-t::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5.4em;
  height: 5.4em;
  margin: -2.7em 0 0 -2.7em;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--ai-red), .5) 0%, rgba(var(--ai-red), .22) 30%, rgba(var(--ai-red), 0) 66%);
  opacity: 0;
  transform: scale(.1);
  pointer-events: none;
  z-index: -1;
}
/* arrival order: S leads, A closes the convoy; --j is the push each letter takes when the T lands */
.atomis-intro__word span:nth-child(1) { --d: .50s;  --j: -.11em; }
.atomis-intro__word span:nth-child(3) { --d: .435s; --j: .11em; }
.atomis-intro__word span:nth-child(4) { --d: .39s;  --j: .06em; }
.atomis-intro__word span:nth-child(5) { --d: .345s; --j: .03em; }
.atomis-intro__word span:nth-child(6) { --d: .30s;  --j: .014em; }

.atomis-intro__road {
  width: 100%;
  height: 2px;
  margin: calc(var(--ai-cap) * .26) 0 calc(var(--ai-cap) * .24);
  background: linear-gradient(90deg, rgba(var(--ai-blue), 0) 0%, rgba(var(--ai-blue), .38) 18%, rgba(var(--ai-blue), .38) 82%, rgba(var(--ai-blue), 0) 100%);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.atomis-intro__line {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .12em .55em;
  font-family: "Saira", "IBM Plex Sans", system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(20px, 3.3vw, 54px);
  line-height: 1.16;
  letter-spacing: .01em;
  color: #1b2060;
  text-align: center;
}
.atomis-intro__line span { display: inline-block; opacity: 0; }

/* ---------------------------------------------------------------- speed streaks */
.atomis-intro__streaks { position: absolute; inset: 0; pointer-events: none; }
.atomis-intro__streaks::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 70vw;
  height: 26vh;
  margin-top: -13vh;
  opacity: 0;
  background: radial-gradient(ellipse at 70% 50%, rgba(var(--ai-blue), .2) 0%, rgba(var(--ai-blue), .07) 38%, rgba(var(--ai-blue), 0) 68%);
  transform: translate3d(-80vw, 0, 0);
}
.atomis-intro__streaks i {
  position: absolute;
  left: 0;
  top: var(--y);
  width: var(--w, 46vw);
  height: 2px;
  border-radius: 2px;
  opacity: 0;
  background: linear-gradient(90deg, rgba(var(--ai-blue), 0), rgba(var(--ai-blue), .6) 70%, rgb(var(--ai-blue)));
  transform: translate3d(-60vw, 0, 0);
}
.atomis-intro__streaks i:nth-child(1) { --y: 30%; --w: 38vw; --sd: .12s; --st: .52s; height: 3px; }
.atomis-intro__streaks i:nth-child(2) { --y: 41%; --w: 56vw; --sd: .22s; --st: .46s; }
.atomis-intro__streaks i:nth-child(3) { --y: 47%; --w: 30vw; --sd: .38s; --st: .5s; height: 3px; background: linear-gradient(90deg, rgba(var(--ai-red), 0), rgba(var(--ai-red), .7) 70%, rgb(var(--ai-red))); }
.atomis-intro__streaks i:nth-child(4) { --y: 54%; --w: 60vw; --sd: .5s;  --st: .44s; height: 4px; }
.atomis-intro__streaks i:nth-child(5) { --y: 60%; --w: 34vw; --sd: .64s; --st: .5s; }
.atomis-intro__streaks i:nth-child(6) { --y: 36%; --w: 44vw; --sd: .8s;  --st: .5s; height: 1px; }
.atomis-intro__streaks i:nth-child(7) { --y: 66%; --w: 50vw; --sd: .94s; --st: .56s; height: 3px; background: linear-gradient(90deg, rgba(var(--ai-red), 0), rgba(var(--ai-red), .7) 70%, rgb(var(--ai-red))); }
.atomis-intro__streaks i:nth-child(8) { --y: 51%; --w: 40vw; --sd: 1.06s; --st: .5s; height: 1px; }

/* ---------------------------------------------------------------- skip */
.atomis-intro__skip {
  position: absolute;
  right: 20px;
  bottom: 18px;
  padding: 8px 14px;
  font: 500 13px/1 "IBM Plex Sans", system-ui, sans-serif;
  color: rgba(var(--ai-blue), .85);
  background: rgba(255, 255, 255, .7);
  border: 1px solid rgba(var(--ai-blue), .35);
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
}
.atomis-intro__skip:hover { color: rgb(var(--ai-blue)); border-color: rgba(var(--ai-blue), .7); }
.atomis-intro__skip:focus-visible { outline: 2px solid rgb(var(--ai-blue)); outline-offset: 3px; }

/* ---------------------------------------------------------------- choreography */
html.intro-go .atomis-intro { animation: ai-out .6s cubic-bezier(.4, 0, .2, 1) 4.4s both; }
html.intro-go .atomis-intro__lockup { animation: ai-shake .32s linear 1.66s, ai-drift 3.4s linear 1.98s forwards; }
html.intro-go .atomis-intro__road { animation: ai-road .5s cubic-bezier(.2, .8, .2, 1) .05s both, ai-road-hit .6s ease-out 1.66s; }
html.intro-go .atomis-intro__streaks i { animation: ai-streak var(--st, .5s) cubic-bezier(.4, 0, .6, 1) var(--sd, 0s) both; }
html.intro-go .atomis-intro__streaks::before { animation: ai-flare .95s cubic-bezier(.3, 0, .5, 1) .08s both; }
html.intro-go .atomis-intro__word .ai-l { animation: ai-drive 1.05s var(--d, .3s) both, ai-jolt .5s cubic-bezier(.2, .9, .3, 1) 1.66s; }
html.intro-go .atomis-intro__word .ai-t { animation: ai-t-land .8s 1.22s both; }
html.intro-go .atomis-intro__word .ai-t::after { animation: ai-burst .8s cubic-bezier(.1, .7, .2, 1) 1.66s both; }
html.intro-go .atomis-intro__line span { animation: ai-beat .55s cubic-bezier(.2, .8, .2, 1) both; }
html.intro-go .atomis-intro__line span:nth-child(1) { animation-delay: 2.25s; }
html.intro-go .atomis-intro__line span:nth-child(2) { animation-delay: 2.65s; }
html.intro-go .atomis-intro__line span:nth-child(3) { animation-delay: 3.05s; }
html.intro-go .atomis-intro__skip { animation: ai-fade .4s ease .6s both; }
/* the sign-in panel arrives as the intro leaves */
html.intro-go .auth-card { animation: ai-panel .65s cubic-bezier(.2, .8, .2, 1) 4.35s both; }

html.intro-skip .atomis-intro { animation: ai-skip .32s ease both; }
html.intro-skip .auth-card { animation: ai-panel .45s cubic-bezier(.2, .8, .2, 1) both; }

@keyframes ai-drive {
  0% {
    opacity: 0;
    transform: translate3d(-140vw, 0, 0) skewX(28deg) scaleX(1.6);
    filter: blur(12px) drop-shadow(-1.1em 0 .3em rgba(var(--ai-blue), .32));
    animation-timing-function: cubic-bezier(.12, .72, .18, 1);
  }
  10% { opacity: 1; }
  /* braking: the letters pitch forward and bunch up */
  64% {
    transform: translate3d(.16em, 0, 0) skewX(-11deg) scaleX(.93);
    filter: blur(0px) drop-shadow(0 0 0 rgba(var(--ai-blue), 0));
    animation-timing-function: cubic-bezier(.4, 0, .5, 1);
  }
  82% {
    transform: translate3d(-.035em, 0, 0) skewX(3deg) scaleX(1.015);
    animation-timing-function: cubic-bezier(.3, 0, .3, 1);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) skewX(0deg) scaleX(1);
    filter: blur(0px) drop-shadow(0 0 0 rgba(var(--ai-blue), 0));
  }
}
@keyframes ai-jolt {
  0% { transform: translate3d(0, 0, 0); }
  30% { transform: translate3d(var(--j, 0), 0, 0); }
  62% { transform: translate3d(calc(var(--j, 0) * -.25), 0, 0); }
  100% { transform: translate3d(0, 0, 0); }
}
@keyframes ai-t-land {
  0% {
    opacity: 0;
    transform: translate3d(0, -72vh, 0) scale(.9, 1.7);
    filter: blur(8px) brightness(1.25) drop-shadow(0 -.9em .3em rgba(var(--ai-red), .45));
    animation-timing-function: cubic-bezier(.5, 0, .85, .5);
  }
  6% { opacity: 1; }
  /* touchdown, glowing */
  55% {
    transform: translate3d(0, 0, 0) scale(1, 1);
    filter: blur(0px) brightness(1.3) drop-shadow(0 0 .28em rgba(var(--ai-red), .9));
    animation-timing-function: cubic-bezier(.2, .8, .3, 1);
  }
  68% {
    transform: translate3d(0, 0, 0) scale(1.14, .8);
    animation-timing-function: cubic-bezier(.3, 0, .3, 1);
  }
  84% { transform: translate3d(0, 0, 0) scale(.975, 1.05); }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1, 1);
    filter: blur(0px) brightness(1) drop-shadow(0 0 0 rgba(var(--ai-red), 0));
  }
}
@keyframes ai-burst {
  0% { opacity: 0; transform: scale(.1); }
  12% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.5); }
}
@keyframes ai-shake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  18% { transform: translate3d(0, .6vh, 0); }
  44% { transform: translate3d(0, -.35vh, 0); }
  72% { transform: translate3d(0, .16vh, 0); }
}
@keyframes ai-drift {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}
@keyframes ai-road {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@keyframes ai-road-hit {
  0% { box-shadow: 0 0 0 0 rgba(var(--ai-red), 0); }
  14% { box-shadow: 0 0 22px 3px rgba(var(--ai-red), .55); }
  100% { box-shadow: 0 0 0 0 rgba(var(--ai-red), 0); }
}
@keyframes ai-streak {
  0% { opacity: 0; transform: translate3d(-60vw, 0, 0) scaleX(.6); }
  12% { opacity: .9; }
  100% { opacity: 0; transform: translate3d(125vw, 0, 0) scaleX(1.25); }
}
@keyframes ai-flare {
  0% { opacity: 0; transform: translate3d(-80vw, 0, 0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(120vw, 0, 0); }
}
@keyframes ai-beat {
  from { opacity: 0; transform: translate3d(0, .7em, 0); filter: blur(6px); }
  to { opacity: 1; transform: translate3d(0, 0, 0); filter: blur(0); }
}
@keyframes ai-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes ai-panel {
  from { opacity: 0; transform: translate3d(0, 22px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes ai-out {
  from { opacity: 1; visibility: visible; }
  to { opacity: 0; visibility: hidden; }
}
@keyframes ai-skip {
  to { opacity: 0; visibility: hidden; }
}

/* phones: the three beats stack */
@media (max-width: 560px) {
  .atomis-intro__line { flex-direction: column; align-items: center; gap: .18em; }
  .atomis-intro__skip { right: 14px; bottom: 14px; }
}

/* reduced motion: the portal switches every animation off there, so the lockup simply stands still and
   atomis-intro.js closes the intro after 2.6 s */
@media (prefers-reduced-motion: reduce) {
  .atomis-intro__streaks { display: none; }
  .atomis-intro__word span,
  .atomis-intro__line span,
  .atomis-intro__skip { opacity: 1; }
  .atomis-intro__road { transform: none; }
}
