*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #050a14;
  --fg: #eef2f7;
  --faint: #5b667a;
  --teal: #00B3B8;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* Background: one soft glow that follows the mark, plus grain */
.bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at calc(50% + var(--gx, 0px)) calc(50% + var(--gy, 0px)),
      rgba(0, 120, 215, 0.22) 0, rgba(0, 179, 184, 0.06) 22vmax, transparent 42vmax);
  opacity: 0;
  animation: fade 2.4s ease 0.7s forwards, breathe 8s ease-in-out 3.1s infinite;
}
/* Light ribbons (drawn in main.js) */
.ribbons {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 3s ease;
}
.ribbons.is-on { opacity: 1; }

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.05;
  pointer-events: none;
}

/* Stage */
.stage {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 5vh, 48px);
  padding: 0 16px 7vh; /* lifts the logo slightly above true centre */
}
.mark {
  width: clamp(230px, 36vw, 520px);
}
.mark svg { display: block; width: 100%; height: auto; overflow: visible; }

/* 1. Swoosh outline draws itself */
.swoosh-line path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 1.5s var(--ease) 0.1s forwards, fade-out 0.8s ease 1.5s forwards;
}
/* 2. Gradient fills in */
.swoosh-fill {
  opacity: 0;
  filter: drop-shadow(0 6px 14px rgba(0, 142, 238, 0.4));
  animation: fade 1.1s var(--ease) 0.9s forwards;
}
/* 3. Wordmark slides out from behind the swoosh */
.word {
  opacity: 0;
  transform: translateX(-14px);
  transform-box: fill-box;
  animation: slide 1.2s var(--ease) forwards;
}
.word--top { animation-delay: 1.2s; }
.word--bot { animation-delay: 1.4s; }

/* 4. Tagline boots up letter by letter */
.tagline {
  font-family: 'Poppins', system-ui, sans-serif;
  font-weight: 300;
  font-size: clamp(13px, 1.1vw, 14px);
  letter-spacing: 0.42em;
  margin-right: -0.42em; /* balance trailing spacing so it stays centred */
  text-transform: uppercase;
  color: #9fb4cc;
  text-shadow: 0 0 18px rgba(0, 179, 184, 0.45);
  white-space: nowrap;
}
.tagline .ch {
  --c: #9fb4cc;
  color: var(--c);
  opacity: 0;
  animation: boot 0.5s steps(1) forwards;
  animation-delay: calc(1.6s + var(--i) * 30ms);
}
.tagline .ch:last-child { --c: var(--teal); }

@media (max-width: 640px) {
  .tagline {
    font-size: 13px;
    letter-spacing: 0.34em;
    margin-right: -0.34em;
  }
}

@keyframes boot {
  /* 80% holds the final state too: Safari can stop a hair short of 100% and
     otherwise leaves some letters stuck on the teal step */
  0%        { opacity: 0;   color: var(--c); }
  20%       { opacity: 1;   color: var(--teal); }
  40%       { opacity: 0.2; color: var(--c); }
  60%       { opacity: 1;   color: var(--teal); }
  80%, 100% { opacity: 1;   color: var(--c); }
}
@keyframes draw     { to { stroke-dashoffset: 0; } }
@keyframes fade     { to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes slide    { to { opacity: 1; transform: none; } }
@keyframes breathe  { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .bg, .swoosh-fill, .word, .tagline .ch { opacity: 1; transform: none; }
  .swoosh-line { display: none; }
}
