:root {
  --bg: #FBFCFE;
  --surface: #F1F5FB;
  --ink: #061B4F;
  --azure: #0B7CFF;
  --azure-soft: #3B8FFF;
  --hairline: #E2E8F0;

  --logo-glow: rgba(11,124,255,0.45);
  --ring-color: rgba(11,124,255,0.55);

  --grid-dot: rgba(6,27,79,0.07);
  --blob-1: rgba(11,124,255,0.20);
  --blob-2: rgba(6,27,79,0.10);
  --blob-3: rgba(59,143,255,0.16);
  --blob-4: rgba(99,102,241,0.10);
  --vignette: radial-gradient(ellipse at center, transparent 55%, rgba(6,27,79,0.08) 100%);

  --topline: linear-gradient(90deg, transparent, rgba(11,124,255,0.55), transparent);
  --ambient: conic-gradient(from 0deg,
    rgba(11,124,255,0.10), transparent 25%,
    rgba(99,102,241,0.08), transparent 55%,
    rgba(11,124,255,0.10), transparent 85%);
}

html[data-theme="dark"], body[data-theme="dark"] {
  --bg: #050B1F;
  --surface: #07112B;
  --ink: #FFFFFF;
  --azure: #3B8FFF;
  --azure-soft: #60A5FA;
  --hairline: #143064;

  --logo-glow: rgba(59,143,255,0.55);
  --ring-color: rgba(96,165,250,0.55);

  --grid-dot: rgba(255,255,255,0.06);
  --blob-1: rgba(59,143,255,0.26);
  --blob-2: rgba(11,124,255,0.20);
  --blob-3: rgba(99,102,241,0.18);
  --blob-4: rgba(168,85,247,0.10);
  --vignette: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.55) 100%);

  --topline: linear-gradient(90deg, transparent, rgba(96,165,250,0.7), transparent);
  --ambient: conic-gradient(from 0deg,
    rgba(59,143,255,0.14), transparent 25%,
    rgba(168,85,247,0.10), transparent 55%,
    rgba(59,143,255,0.14), transparent 85%);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ============ background fx layers ============ */
.fx {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient {
  position: absolute;
  width: 180vmax;
  height: 180vmax;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--ambient);
  filter: blur(60px);
  opacity: 0.7;
  animation: spin 90s linear infinite;
}
@keyframes spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}

.grid {
  position: absolute;
  inset: -2px;
  background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1.5px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at center, black 35%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 35%, transparent 80%);
  animation: gridShift 40s linear infinite;
}
@keyframes gridShift {
  from { background-position: 0 0; }
  to   { background-position: 280px 280px; }
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(85px);
  will-change: transform;
}
.blob.b1 {
  width: 640px; height: 640px;
  background: var(--blob-1);
  top: -180px; left: -160px;
  animation: drift1 22s ease-in-out infinite;
}
.blob.b2 {
  width: 540px; height: 540px;
  background: var(--blob-2);
  bottom: -200px; right: -120px;
  animation: drift2 28s ease-in-out infinite;
}
.blob.b3 {
  width: 460px; height: 460px;
  background: var(--blob-3);
  top: 28%; left: 58%;
  animation: drift3 18s ease-in-out infinite;
}
.blob.b4 {
  width: 380px; height: 380px;
  background: var(--blob-4);
  top: 60%; left: 12%;
  animation: drift4 32s ease-in-out infinite;
}
@keyframes drift1 {
  0%, 100% { transform: translate(0,0) scale(1); }
  50%      { transform: translate(80px, 60px) scale(1.08); }
}
@keyframes drift2 {
  0%, 100% { transform: translate(0,0) scale(1); }
  50%      { transform: translate(-60px, -90px) scale(1.06); }
}
@keyframes drift3 {
  0%, 100% { transform: translate(0,0) scale(1); }
  33%      { transform: translate(-110px, 50px) scale(1.1); }
  66%      { transform: translate(60px, -40px) scale(0.95); }
}
@keyframes drift4 {
  0%, 100% { transform: translate(0,0) scale(1); }
  50%      { transform: translate(70px, -60px) scale(1.07); }
}

#fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* horizontal scan line at the top */
.topline {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1.5px;
  overflow: hidden;
  opacity: 0.7;
}
.topline::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--topline);
  transform: translateX(-100%);
  animation: scan 6s ease-in-out infinite;
}
@keyframes scan {
  0%   { transform: translateX(-100%); }
  60%  { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}

.vignette {
  position: absolute;
  inset: 0;
  background: var(--vignette);
}

/* ============ centered stage ============ */
.stage {
  position: relative;
  z-index: 2;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.logo {
  position: relative;
  width: clamp(160px, 24vw, 280px);
  height: clamp(160px, 24vw, 280px);
  display: grid;
  place-items: center;
  animation: float 7s ease-in-out infinite;
}

.logo::before {
  content: '';
  position: absolute;
  inset: -32%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--logo-glow) 0%, transparent 60%);
  filter: blur(22px);
  animation: pulse 4.5s ease-in-out infinite;
  z-index: -1;
}

.logo-rings {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}
.ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--ring-color);
  opacity: 0;
  animation: ping 4.8s cubic-bezier(0.18, 0.6, 0.2, 1) infinite;
}
.ring.r1 { animation-delay: 0s; }
.ring.r2 { animation-delay: 1.6s; }
.ring.r3 { animation-delay: 3.2s; }
@keyframes ping {
  0%   { transform: scale(1);   opacity: 0.5; }
  85%  { transform: scale(2.4); opacity: 0; }
  100% { transform: scale(2.4); opacity: 0; }
}

.logo-mark {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 24px 48px rgba(11,124,255,0.28));
  transition: transform 0.3s ease, filter 0.3s ease, opacity 0.35s ease;
  user-select: none;
  -webkit-user-drag: none;
  position: absolute;
  inset: 0;
}
.logo:hover .logo-mark { transform: scale(1.04); }

body[data-theme="light"] .logo-dark  { opacity: 0; }
body[data-theme="light"] .logo-light { opacity: 1; }
body[data-theme="dark"]  .logo-light { opacity: 0; }
body[data-theme="dark"]  .logo-dark  { opacity: 1; }

/* arrow draw-in animation (single shape revealed by an animated clipPath rect)
   1) nothing visible
   2) arrow grows from the M-side outward to the tip
   3) hold
   4) fade off
   5) silently reset and loop */
.arrow-shape {
  opacity: 1;
  animation: arrow-fade 8s ease-in-out infinite;
}
.arrow-clip-rect {
  width: 0;
  animation: arrow-clip-grow 8s ease-in-out infinite;
}
@keyframes arrow-clip-grow {
  0%   { width: 0; }
  50%  { width: 290px; }
  90%  { width: 290px; }
  100% { width: 0; }
}
@keyframes arrow-fade {
  0%   { opacity: 1; }
  75%  { opacity: 1; }
  90%  { opacity: 0; }
  100% { opacity: 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}
@keyframes pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.10); }
}

/* ============ theme toggle ============ */
.theme-toggle {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover { background: var(--surface); transform: translateY(-1px); }

@media (prefers-reduced-motion: reduce) {
  .blob, .ambient, .grid, .topline::before,
  .logo, .logo::before, .ring,
  .arrow-shape, .arrow-clip-rect { animation: none; }
  .arrow-shape { opacity: 1; }
  .arrow-clip-rect { width: 290px; }
}
