/*
 * The loading page: what shows while this app loads and checks the session, so going from the new
 * chat app (/home) to a page here is not a blank white page. The chat app's own splash (its
 * AuthSplash): the TDX logo (the V2 design file's master lockup) with the motion guide's "Towers" animation under it, centred, no
 * words; it fades in only once the wait passes 300ms, so a quick load never flashes it. Under reduced
 * motion the blocks hold still.
 *
 * Generated from the chat app's ThinkingTowers.tsx numbers (brightfield-tdx-frontend), so the two
 * animate alike. Static CSS because index.html draws it before any script runs (#root holds it until
 * React renders); AppSplash.tsx draws the same markup while the app fetches its instance key.
 */
.tdx-splash {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff;
  /* Over the page and its footer while the session loads (SessionSplash), MUI's dialogs (1300) too. */
  z-index: 1400;
  animation: tdx-splash-appear 200ms cubic-bezier(0.23, 1, 0.32, 1) 300ms backwards;
}
@keyframes tdx-splash-appear { from { opacity: 0; } }
.tdx-splash-logo { display: block; width: 100px; }
.tdx-splash-towers { position: relative; width: 72px; height: 72px; isolation: isolate; }
.tdx-splash-towers img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tdx-splash-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@keyframes tdx-towers-travel-0 {
  0% { transform: translate(0%, 0%); }
  16.667% { transform: translate(0%, 0%); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  23.667% { transform: translate(19.922%, 9.805%); }
  41.667% { transform: translate(19.922%, 9.805%); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  48.667% { transform: translate(0%, 19.746%); }
  66.667% { transform: translate(0%, 19.746%); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  73.667% { transform: translate(-19.902%, 9.824%); }
  91.667% { transform: translate(-19.902%, 9.824%); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  98.667% { transform: translate(0%, 0%); }
  100% { transform: translate(0%, 0%); }
}

@keyframes tdx-towers-layering-0 {
  0% { z-index: 1; }
  22% { z-index: 2; }
  38% { z-index: 3; }
  77.333% { z-index: 2; }
  94.667% { z-index: 1; }
  100% { z-index: 1; }
}

.tdx-splash-towers img:nth-child(1) {
  z-index: 1;
  animation: tdx-towers-travel-0 5000ms linear infinite, tdx-towers-layering-0 5000ms step-end infinite;
}

@keyframes tdx-towers-travel-1 {
  0% { transform: translate(0%, 0%); }
  8.333% { transform: translate(0%, 0%); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  15.333% { transform: translate(-19.883%, 9.961%); }
  33.333% { transform: translate(-19.883%, 9.961%); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  40.333% { transform: translate(-39.766%, 0%); }
  58.333% { transform: translate(-39.766%, 0%); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  65.333% { transform: translate(-19.883%, -9.824%); }
  83.333% { transform: translate(-19.883%, -9.824%); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  90.333% { transform: translate(0%, 0%); }
  100% { transform: translate(0%, 0%); }
}

@keyframes tdx-towers-layering-1 {
  0% { z-index: 2; }
  10.667% { z-index: 3; }
  38% { z-index: 2; }
  55.333% { z-index: 1; }
  94.667% { z-index: 2; }
  100% { z-index: 2; }
}

.tdx-splash-towers img:nth-child(2) {
  z-index: 2;
  animation: tdx-towers-travel-1 5000ms linear infinite, tdx-towers-layering-1 5000ms step-end infinite;
}

@keyframes tdx-towers-travel-2 {
  0% { transform: translate(0%, 0%); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  7% { transform: translate(-19.902%, -9.941%); }
  25% { transform: translate(-19.902%, -9.941%); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  32% { transform: translate(0%, -19.766%); }
  50% { transform: translate(0%, -19.766%); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  57% { transform: translate(19.902%, -9.941%); }
  75% { transform: translate(19.902%, -9.941%); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  82% { transform: translate(0%, 0%); }
  100% { transform: translate(0%, 0%); }
}

@keyframes tdx-towers-layering-2 {
  0% { z-index: 3; }
  10.667% { z-index: 2; }
  22% { z-index: 1; }
  55.333% { z-index: 2; }
  77.333% { z-index: 3; }
  100% { z-index: 3; }
}

.tdx-splash-towers img:nth-child(3) {
  z-index: 3;
  animation: tdx-towers-travel-2 5000ms linear infinite, tdx-towers-layering-2 5000ms step-end infinite;
}

@media (prefers-reduced-motion: reduce) {
  .tdx-splash-towers img { animation: none; }
}
