/*
 * A-OS startup loader (design "A-OS Startup Loader"): the Λ drawn inside its progress ring, the boot's steps, then a
 * greeting and the desktop. Shown by /boot/os-boot.js before any framework code runs; the web OS, the mobile app and
 * the desktop app's own screens all use it. Everything is scoped under .aos-boot.
 */
.aos-boot {
  --b-bg: #07070A; --b-tx: #ECEAEE; --b-mu: #8E8A96; --b-mu2: #5A5662;
  --b-c1: #E0553A; --b-c2: #8B5CF6; --b-c3: #F08A4B; --b-c4: #D06FB0;
  --b-mono: "JetBrains Mono", ui-monospace, monospace;
  position: fixed; inset: 0; z-index: 2147483000;
  display: flex; align-items: center; justify-content: center;
  background: var(--b-bg); color: var(--b-tx);
  font-family: Poppins, system-ui, sans-serif; overflow: hidden;
  transition: opacity 1.1s ease;
}
.aos-boot * { box-sizing: border-box; }
.aos-boot.is-gone { opacity: 0; pointer-events: none; }

/* ambient light */
.aos-boot .b-glow { position: absolute; width: 62vmax; height: 62vmax; border-radius: 50%; filter: blur(90px); opacity: 0; transition: opacity 2.4s ease; }
.aos-boot .b-glow.a { background: radial-gradient(circle, rgba(224,85,58,.22), transparent 60%); left: -14vmax; top: -20vmax; animation: aosb-drift1 18s ease-in-out infinite alternate; }
.aos-boot .b-glow.b { background: radial-gradient(circle, rgba(139,92,246,.22), transparent 60%); right: -16vmax; bottom: -24vmax; animation: aosb-drift2 22s ease-in-out infinite alternate; }
.aos-boot.on .b-glow { opacity: 1; }
@keyframes aosb-drift1 { to { transform: translate(8vmax, 6vmax) scale(1.1); } }
@keyframes aosb-drift2 { to { transform: translate(-6vmax, -8vmax) scale(1.08); } }
.aos-boot .b-dust { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; }

/* the mark */
.aos-boot .b-mark { position: relative; width: 300px; height: 300px; transition: transform 1.1s cubic-bezier(.7,0,.2,1), opacity .8s; }
.aos-boot .b-mark svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.aos-boot .b-track { stroke: #16161B; }
.aos-boot .b-prog { transition: stroke-dashoffset .9s cubic-bezier(.4,0,.2,1), stroke .4s; }
.aos-boot .b-lam-stroke { stroke-dasharray: 432; stroke-dashoffset: 432; }
.aos-boot.on .b-lam-stroke { animation: aosb-draw 1.5s cubic-bezier(.65,0,.35,1) .25s forwards; }
/* warm: the desktop app's screens drew it already — it is simply there */
.aos-boot.warm .b-lam-stroke { animation: none; stroke-dashoffset: 0; }
.aos-boot.warm .b-lam-fill, .aos-boot.warm .b-brand, .aos-boot.warm .b-glow, .aos-boot.warm .b-steps { transition: none; }
@keyframes aosb-draw { to { stroke-dashoffset: 0; } }
.aos-boot .b-lam-fill { opacity: 0; transition: opacity 1s ease .2s; }
.aos-boot.filled .b-lam-fill { opacity: 1; }
.aos-boot .b-shine { transform: translateX(-160px); }
.aos-boot.shining .b-shine { animation: aosb-shine 1.3s cubic-bezier(.5,0,.3,1) forwards; }
@keyframes aosb-shine { to { transform: translateX(180px); } }
.aos-boot .b-pool { position: absolute; left: 50%; top: 76%; width: 190px; height: 34px; margin-left: -95px; border-radius: 50%; background: radial-gradient(ellipse, rgba(139,92,246,.55), rgba(224,85,58,.25) 45%, transparent 70%); filter: blur(14px); opacity: 0; transition: opacity 1.2s ease; }
.aos-boot.filled .b-pool { opacity: .9; animation: aosb-breathe 3.2s ease-in-out infinite; }
@keyframes aosb-breathe { 50% { opacity: .55; transform: scaleX(.88); } }

/* words */
.aos-boot .b-words { position: absolute; left: 0; right: 0; top: calc(50% + 178px); display: flex; flex-direction: column; align-items: center; gap: 14px; transition: opacity .6s; }
.aos-boot .b-brand { font-family: var(--b-mono); font-size: 12px; letter-spacing: .62em; padding-left: .62em; color: #B8B4C0; opacity: 0; transform: translateY(6px); transition: all .9s ease; }
.aos-boot.on .b-brand { opacity: 1; transform: none; transition-delay: 1.2s; }
.aos-boot .b-status { position: relative; height: 22px; width: 520px; max-width: 90vw; text-align: center; overflow: hidden; }
.aos-boot .b-status span { position: absolute; left: 0; right: 0; font-size: 14px; color: var(--b-mu); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: all .5s cubic-bezier(.3,0,.2,1); }
.aos-boot .b-status span.in { opacity: 1; transform: none; }
.aos-boot .b-status span.out { opacity: 0; transform: translateY(-14px); }
.aos-boot .b-status span.wait { opacity: 0; transform: translateY(14px); }
.aos-boot .b-status b { color: var(--b-tx); font-weight: 500; }
.aos-boot .b-steps { display: flex; gap: 8px; opacity: 0; transition: opacity .6s .4s; }
.aos-boot.on .b-steps { opacity: 1; }
.aos-boot .b-steps i { width: 6px; height: 6px; border-radius: 50%; background: #26262C; transition: all .4s; }
.aos-boot .b-steps i.done { background: linear-gradient(135deg, var(--b-c1), var(--b-c2)); }
.aos-boot .b-steps i.now { background: var(--b-tx); box-shadow: 0 0 0 4px rgba(236,234,238,.08); }

/* a note: slow, can't connect, or what to do (the desktop's sign-in) */
.aos-boot .b-note { position: absolute; left: 50%; top: calc(50% + 268px); transform: translate(-50%, 10px); opacity: 0; pointer-events: none; transition: all .5s ease; display: flex; flex-direction: column; align-items: center; gap: 14px; width: 520px; max-width: 90vw; text-align: center; }
.aos-boot .b-note.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.aos-boot .b-note p { margin: 0; font-size: 13px; color: var(--b-mu); line-height: 1.55; }
.aos-boot .b-note p b { color: var(--b-tx); font-weight: 500; }
.aos-boot .b-note code { display: inline-block; margin: 4px 0; padding: 8px 18px; border-radius: 12px; border: 1px solid #2A2A30; background: #111115; font: 600 30px/1.2 var(--b-mono); letter-spacing: .2em; color: var(--b-tx); }
.aos-boot .b-note ol { margin: 0; padding-left: 20px; text-align: left; font-size: 13px; line-height: 1.7; color: var(--b-mu); }
.aos-boot .b-note .b-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.aos-boot .b-btn { height: 38px; padding: 0 16px; border-radius: 12px; border: 1px solid #2A2A30; background: #111115; color: var(--b-tx); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; transition: background .2s, border-color .2s; }
.aos-boot .b-btn:hover { background: #18181D; border-color: #3A3842; }
.aos-boot .b-btn.pri { border: 1.5px solid transparent; background: linear-gradient(#111115, #111115) padding-box, linear-gradient(110deg, var(--b-c1), var(--b-c2) 45%, #3FA85C 75%, var(--b-c3)) border-box; }
.aos-boot .b-btn:focus-visible { outline: 2px solid var(--b-c2); outline-offset: 3px; }

/* greeting, then the desktop */
.aos-boot .b-hello { position: absolute; left: 0; right: 0; top: calc(50% + 172px); text-align: center; font-family: Caveat, cursive; font-size: 44px; color: #ECEAEE; opacity: 0; transform: translateY(10px); transition: all .8s ease; pointer-events: none; }
.aos-boot.greet .b-hello { opacity: 1; transform: none; }
.aos-boot.greet .b-words { opacity: 0; }
.aos-boot.greet .b-prog { filter: drop-shadow(0 0 6px rgba(139,92,246,.8)) drop-shadow(0 0 14px rgba(224,85,58,.35)); }
.aos-boot.reveal .b-mark { transform: translateY(-34vh) scale(.28); opacity: 0; }
.aos-boot.reveal .b-hello { opacity: 0; transform: translateY(-30px); transition-duration: .6s; }

/* can't connect */
.aos-boot.err .b-prog { stroke: #E8806E !important; }
.aos-boot.err .b-lam-fill { opacity: .35; }
.aos-boot.err .b-pool { background: radial-gradient(ellipse, rgba(232,128,110,.45), transparent 70%); }

/* a long note (the desktop's sign-in: a code and steps) — the mark moves up and shrinks to make room */
.aos-boot.tall .b-mark { transform: translateY(-150px) scale(.66); }
.aos-boot.tall .b-words { top: calc(50% + 10px); }
.aos-boot.tall .b-note { top: calc(50% + 100px); }

@media (max-width: 600px) {
  .aos-boot .b-mark { width: 240px; height: 240px; }
  .aos-boot .b-words { top: calc(50% + 146px); }
  .aos-boot .b-hello { top: calc(50% + 140px); }
  .aos-boot .b-note { top: calc(50% + 230px); }
}
@media (max-height: 640px) {
  .aos-boot .b-mark { width: 200px; height: 200px; margin-top: -120px; }
  .aos-boot .b-words { top: calc(50% + 10px); }
  .aos-boot .b-hello { top: calc(50% + 6px); }
  .aos-boot .b-note { top: calc(50% + 96px); }
}
@media (prefers-reduced-motion: reduce) {
  .aos-boot, .aos-boot * { animation-duration: .01ms !important; transition-duration: .2s !important; }
}
