/* =====================================================================
   SyncoSendo · "alive" login heading
   - "Log in" letters rise in, then a colour glint sweeps across them
   - two sync dots meet under the title and become a line
   - "Welcome back." types itself out
   - a quiet backdrop of file packets flowing in toward the card
   Uses the app's own tokens, so Day / Night mode just work.
   The app's global prefers-reduced-motion rule already switches all of
   this off for people who ask for less motion.
   ===================================================================== */

/* keep the auth content above the backdrop canvas */
body.auth-mode .auth-brand,
body.auth-mode .auth-card,
body.auth-mode .auth-foot { position: relative; z-index: 1; }

.al-canvas {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  opacity: 0; transition: opacity 1.2s var(--ease);
}
.al-canvas.on { opacity: 1; }
.al-canvas.front { z-index: 5; }          /* documents fly out in front of the login box */

/* --- login pressed: the box fades out while the papers fly ------------ */
.auth-brand.al-leaving,
.auth-card.al-card.al-leaving,
.auth-foot.al-leaving { animation: al-leave .7s ease forwards; pointer-events: none; }
.auth-brand.al-leaving img, .auth-brand.al-leaving > span { animation: none; }
.auth-brand.al-back,
.auth-card.al-card.al-back,
.auth-foot.al-back { animation: al-lift .5s var(--ease) both; }

/* --- after login: the app fades in ------------------------------------ */
/* uses the separate `translate` property, so the app's own transforms
   (for example the mobile sidebar sliding in and out) are left alone */
body.al-enter .sidebar { animation: al-enter-side .7s var(--ease) both; }
body.al-enter .topbar  { animation: al-enter-fade .6s var(--ease) .12s both; }
body.al-enter .view    { animation: al-enter-up .75s var(--ease) .22s both; }
@keyframes al-enter-side { from { opacity: 0; translate: -18px 0; } to { opacity: 1; translate: none; } }
@keyframes al-enter-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes al-enter-up   { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: none; } }
@keyframes al-leave { to { opacity: 0; transform: scale(.96); filter: blur(2px); } }

/* --- brand: soft pop of the logo --------------------------------------- */
.auth-brand.al-brand img { animation: al-pop .8s var(--ease) both; }
.auth-brand.al-brand > span { animation: al-fade .6s var(--ease) .15s both; }   /* the wordmark as a whole (its letters are spans too) */

/* --- card: lift in ------------------------------------------------------ */
.auth-card.al-card { animation: al-lift .7s var(--ease) .1s both; }

/* --- title letters ------------------------------------------------------ */
.al-title { display: flex; flex-wrap: wrap; cursor: default; }
.al-ch {
  display: inline-block;
  will-change: transform, opacity, filter;
  animation:
    al-rise .75s var(--ease) calc(var(--i) * 55ms + 250ms) both,
    al-glint 1s ease-in-out calc(var(--i) * 70ms + 1100ms) 1;
}
/* after the intro: a playful wave on hover */
.al-title.al-ready .al-ch { animation: none; }
.al-title.al-ready:hover .al-ch { animation: al-wave .6s var(--ease) calc(var(--i) * 40ms) 1; }

/* --- the sync line ------------------------------------------------------ */
.al-sync {
  position: relative;
  width: 72px; height: 3px;
  margin: 10px 0 2px;
}
.al-sync::before {                       /* the line that joins them */
  content: ""; position: absolute; inset: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary-icon), var(--hover-accent));
  transform: scaleX(0); transform-origin: center;
  animation: al-grow .55s var(--ease) 1.25s forwards;
}
.al-sync::after {                        /* a shine that travels along it */
  content: ""; position: absolute; top: -1px; bottom: -1px; width: 18px;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.85), transparent);
  opacity: 0;
  animation: al-shine 5s ease-in-out 2.4s infinite;
}
.al-dot {
  position: absolute; top: 50%;
  width: 7px; height: 7px; margin-top: -3.5px;
  border-radius: 50%;
}
.al-dot.a { left: 0;  background: var(--primary-icon);  animation: al-meet-a .8s var(--ease) .55s forwards; }
.al-dot.b { right: 0; background: var(--hover-accent);  animation: al-meet-b .8s var(--ease) .55s forwards; }

/* --- "Welcome back." typing --------------------------------------------- */
.auth-card .sub.al-sub { min-height: 1.4em; }
.al-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.al-caret {
  display: inline-block; width: 2px; height: 1em;
  margin-left: 2px; vertical-align: -2px;
  background: var(--hover-accent); border-radius: 1px;
  animation: al-blink 1s steps(1) infinite;
}
.al-caret.done { animation: al-blink 1s steps(1) 2, al-fade-out .4s ease 2s forwards; }

/* --- keyframes ---------------------------------------------------------- */
@keyframes al-rise {
  0%   { opacity: 0; transform: translateY(18px) rotate(6deg) scale(.9); filter: blur(6px); }
  60%  { opacity: 1; transform: translateY(-4px) rotate(-1deg) scale(1.03); filter: blur(0); }
  100% { opacity: 1; transform: none; filter: none; }
}
@keyframes al-glint {
  0%, 100% { color: inherit; }
  45%      { color: var(--hover-accent); text-shadow: 0 0 14px color-mix(in srgb, var(--hover-accent) 45%, transparent); }
}
@keyframes al-wave {
  0%, 100% { transform: none; }
  40%      { transform: translateY(-6px); color: var(--primary-text); }
}
@keyframes al-meet-a {
  0%   { transform: translateX(0) scale(1); }
  70%  { transform: translateX(32.5px) scale(1.25); }
  100% { transform: translateX(32.5px) scale(0); opacity: 0; }
}
@keyframes al-meet-b {
  0%   { transform: translateX(0) scale(1); }
  70%  { transform: translateX(-32.5px) scale(1.25); }
  100% { transform: translateX(-32.5px) scale(0); opacity: 0; }
}
@keyframes al-grow  { to { transform: scaleX(1); } }
@keyframes al-shine {
  0%   { left: -18px; opacity: 0; }
  10%  { opacity: 1; }
  30%  { left: 72px; opacity: 0; }
  100% { left: 72px; opacity: 0; }
}
@keyframes al-pop  { 0% { opacity: 0; transform: scale(.6) rotate(-12deg); } 60% { opacity: 1; transform: scale(1.08) rotate(3deg); } 100% { transform: none; } }
@keyframes al-fade { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
@keyframes al-lift { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes al-blink { 50% { opacity: 0; } }
@keyframes al-fade-out { to { opacity: 0; } }

/* In Night mode the shine is softer */
:root[data-theme="dark"] .al-sync::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent);
}
