/*
 * The sign-in page: the family's front door (ifc-viewer AuthScreen and AppShellLoading, which copy
 * expense-sheet and ai_ui), with the board's bar (ai_apps_home). White page, four slow blurred bubbles, the vyzn
 * logo as the way back to the board, one headline, pill actions.
 */

body.auth {
  background: #fff;
}

/* --- sign-in running: the app's bar and a quiet ring (ifc-viewer AppShellLoading) ----------------- */

.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 70% 45% at 90% -10%, rgba(29, 52, 97, 0.1), transparent 62%),
    radial-gradient(ellipse 55% 45% at 0% 105%, rgba(248, 180, 0, 0.07), transparent 60%), var(--paper);
}
/* The bar is the app's own (base.css dmp-bar and assets/bar.css .bar, .left): same height, padding and gaps,
   so nothing moves when the app takes over. */
.auth-shell-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--bar);
  padding: 0 12px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
}
/* The vyzn logo, back to the board (bar.css .logo). The SVG carries its own clear space: the margins trim its
   box to the "v", and the focus ring is drawn around the whole mark. */
.auth-shell-home,
.auth-home {
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  border-radius: 6px;
}
.auth-shell-home:focus-visible,
.auth-home:focus-visible {
  outline: none;
}
.auth-shell-home:focus-visible::after,
.auth-home:focus-visible::after {
  content: "";
  position: absolute;
  inset: -3.4px -3px -9.8px;
  border-radius: 6px;
  box-shadow: 0 0 0 2px var(--ring);
  outline: 2px solid transparent; /* high contrast draws no shadow, but colours this */
  pointer-events: none;
}
/* The link's box is only the v: a finger gets the whole mark and a little more. */
.auth-shell-home::before,
.auth-home::before {
  content: "";
  position: absolute;
  inset: -16px -8px;
}
.auth-shell-logo {
  flex: none;
  width: 84px;
  max-width: none;
  height: 44px;
  margin: -14.6px -13px -16.52px;
  user-select: none;
}
.auth-shell-divider {
  flex: none;
  width: 1px;
  height: 20px;
  background: var(--hairline);
}
.auth-shell-name {
  flex: none;
  color: var(--heading);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transform: translateY(calc(6.44px - 0.317em));
}
/* The ring in the middle; the line of a slow sign-in below it, so the ring does not move when it appears. */
.auth-shell-main {
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  justify-items: center;
  height: calc(100vh - var(--bar));
  height: calc(100dvh - var(--bar));
}
.auth-shell-busy {
  grid-row: 2;
}
/* Hidden for the first 400 ms, so a quick sign-in shows the bar alone. */
.auth-shell-wait {
  display: block;
  animation: auth-wait 0.2s var(--ease) 0.4s both;
}
/* The family's in-panel ring: 16 px, 2 px, navy at 15% with a navy top. */
.auth-shell-wait .spinner {
  display: block;
  width: 16px;
  height: 16px;
  border-color: rgba(29, 52, 97, 0.15);
  border-top-color: var(--navy);
  animation-duration: 1s;
}
/* A sign-in that gets no answer: after 9 s a line and two ways on. 9 s, not 8: when the trip to Auth0 hangs, auth.js shows
   the Sign in button after 8 s, and this must not flash just before it. Hidden until then, also for the keyboard and
   screen readers. The wait starts again whenever the waiting page is shown again. */
.auth-shell-late {
  grid-row: 3;
  padding: 24px;
  text-align: center;
}
.auth-shell-late .auth-actions {
  margin-top: 24px;
}
.auth-shell-late-text {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.625;
  text-wrap: balance;
}
.auth-late {
  animation: auth-late 0.2s var(--ease) 9s both;
}
/* Without JavaScript nothing is running: the line below says so. No ring, no "Signing in…" and no "Still signing in". */
body:has(.auth-noscript) .auth-shell-main {
  display: none;
}
@media (max-width: 759.98px) {
  .auth-shell-bar {
    gap: 6px;
  }
  .auth-shell-home {
    margin-right: 8px;
  }
}
@media (min-width: 640px) {
  .auth-shell-bar {
    padding: 0 24px;
  }
}

/* --- the screen ---------------------------------------------------------------------------------- */

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
}
/* The board's sign-in bar (ai_apps_home globals.css .vyznaries-auth > header): 64 px plus the hairline, the
   content in the board's column (1280 px wide, 16 px at the sides, 24 px from 640 px), so the logo stays where it
   is when someone goes back to vyzn'aries. */
.auth-header {
  position: relative;
  z-index: 2;
  display: flex;
  flex: none;
  align-items: center;
  height: 65px;
  padding: 0 calc(max(0px, (100% - 1280px) / 2) + 16px);
  border-bottom: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
}
/* The plain vyzn wordmark, letters --wm high (20 px, 26 px from 640 px, as on the board). In the file
   (595.28 x 311.81) the letters lie at x 90-505 and y 98-245, the v at y 103.5-194.8; --wm is 147 of those
   units. The margins trim the box to the v, so the bar centres the logo on the v and the letters start at
   the column's edge. */
.auth-home {
  --wm: 20px;
}
.auth-logo {
  flex: none;
  width: calc(var(--wm) * 4.04952);
  max-width: none;
  height: calc(var(--wm) * 2.12116);
  margin: calc(var(--wm) * -0.70408) calc(var(--wm) * -0.61415) calc(var(--wm) * -0.79599) calc(var(--wm) * -0.61224);
  user-select: none;
}
/* Around the letters: a little above the v, the tail of the y below it, plus 3 px. */
.auth-home:focus-visible::after {
  inset: calc(var(--wm) * -0.0374 - 3px) -3px calc(var(--wm) * -0.3415 - 3px);
}
@media (min-width: 640px) {
  .auth-header {
    padding: 0 calc(max(0px, (100% - 1280px) / 2) + 24px);
  }
  .auth-home {
    --wm: 26px;
  }
}
.auth-main {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
}
.auth-title {
  color: var(--navy);
  font-size: clamp(30px, 5.5vw, 56px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.auth-body {
  max-width: 60ch;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.625;
}
.auth-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.auth-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 36px;
}
.auth-action {
  display: inline-flex;
  align-items: center;
  height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
  transition: all 200ms ease-out;
}
.auth-action--primary {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 6px 20px -6px rgba(29, 52, 97, 0.12);
}
.auth-action--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 60px -24px rgba(29, 52, 97, 0.22);
}
.auth-action--primary:active {
  transform: translateY(0);
}
.auth-action--ghost {
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--navy);
}
.auth-action--ghost:hover {
  background: rgba(236, 237, 255, 0.6);
}
.auth-action:disabled {
  opacity: 0.65;
  pointer-events: none;
}
.auth-noscript {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 2000;
  margin: 0;
  padding: 16px;
  background: var(--cream);
  color: var(--navy);
  text-align: center;
}

/* High contrast: the dark button keeps an edge, and the ring still shows that it turns. */
@media (forced-colors: active) {
  .auth-action--primary {
    border: 1px solid ButtonText;
  }
  .auth-shell-wait .spinner {
    forced-color-adjust: none;
    border-color: GrayText;
    border-top-color: CanvasText;
  }
}

/* --- the bubbles: outer element = pointer parallax (auth.js), inner blob = slow drift ------------- */

.auth-bubbles {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.auth-bubble {
  position: absolute;
  will-change: transform;
  transition: transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}
.auth-bubble__blob {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  filter: blur(clamp(28px, 4vw, 64px));
  animation: auth-drift var(--dur, 32s) ease-in-out var(--delay, 0s) infinite alternate;
}
.auth-bubble--lavender .auth-bubble__blob {
  background: radial-gradient(circle at 36% 34%, #ecedff 0%, rgba(228, 230, 255, 0.75) 42%, rgba(236, 237, 255, 0) 70%);
}
.auth-bubble--cream .auth-bubble__blob {
  background: radial-gradient(circle at 40% 38%, #ffeed2 0%, rgba(255, 233, 198, 0.72) 44%, rgba(255, 238, 210, 0) 70%);
}
.auth-bubble--periwinkle .auth-bubble__blob {
  background: radial-gradient(circle at 34% 36%, rgba(180, 180, 216, 0.75) 0%, rgba(180, 180, 216, 0.32) 46%, rgba(180, 180, 216, 0) 70%);
}
.auth-bubble--sun .auth-bubble__blob {
  background: radial-gradient(circle at 38% 34%, rgba(255, 203, 79, 0.32) 0%, rgba(255, 227, 161, 0.16) 48%, rgba(255, 244, 224, 0) 72%);
}
.auth-bubble:nth-child(1) {
  top: -24vmax;
  right: -18vmax;
  width: 62vmax;
  height: 62vmax;
}
.auth-bubble:nth-child(1) .auth-bubble__blob {
  --dur: 38s;
  --delay: -6s;
}
.auth-bubble:nth-child(2) {
  top: 22%;
  left: -24vmax;
  width: 54vmax;
  height: 54vmax;
}
.auth-bubble:nth-child(2) .auth-bubble__blob {
  --dur: 44s;
  --delay: -18s;
}
.auth-bubble:nth-child(3) {
  right: -4vw;
  bottom: -16vmax;
  width: 42vmax;
  height: 42vmax;
}
.auth-bubble:nth-child(3) .auth-bubble__blob {
  --dur: 30s;
  --delay: -11s;
}
.auth-bubble:nth-child(4) {
  top: 4%;
  left: 18vw;
  width: 28vmax;
  height: 28vmax;
}
.auth-bubble:nth-child(4) .auth-bubble__blob {
  --dur: 26s;
  --delay: -3s;
}

@keyframes auth-drift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(3vmax, -2.2vmax, 0) scale(1.06);
  }
  100% {
    transform: translate3d(-2.2vmax, 2.8vmax, 0) scale(0.96);
  }
}
@keyframes auth-wait {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
@keyframes auth-late {
  0% {
    visibility: hidden;
    opacity: 0;
  }
  100% {
    visibility: visible;
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-bubble {
    transition: none;
  }
  .auth-bubble__blob {
    animation: none;
  }
  /* The spinner still waits its 400 ms (waiting is not motion), then appears without a fade. */
  .auth-shell-wait {
    animation-delay: 0.4s !important;
  }
  .auth-late {
    animation-delay: 9s !important;
  }
}
