/* ============================================================
   Base — design tokens, reset, ambient background, typography
   ============================================================ */

:root {
  --navy-950: #06122c;
  --navy-900: #0a1a3d;
  --navy-800: #102451;
  --navy-700: #16336f;
  --blue-600: #2453d4;
  --blue-500: #386bf6;
  --blue-400: #6a8dff;
  --blue-200: #c3d3ff;
  --blue-100: #e6edff;
  --blue-50: #f2f6ff;

  --ink: #0b1a33;
  --muted: #586a8b;
  --muted-strong: #40536f;
  --line: rgba(16, 36, 81, 0.12);
  --line-strong: rgba(16, 36, 81, 0.2);

  --success: #0f7a55;
  --success-bg: rgba(15, 122, 85, 0.1);
  --danger: #c4204a;
  --danger-bg: rgba(196, 32, 74, 0.09);
  --warning: #a06400;

  --glass: rgba(255, 255, 255, 0.7);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --glass-border: rgba(255, 255, 255, 0.9);

  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;

  --shadow-card: 0 24px 60px -34px rgba(9, 25, 60, 0.45);
  --shadow-soft: 0 10px 26px -18px rgba(9, 25, 60, 0.5);
  --shadow-button: 0 16px 30px -16px rgba(36, 83, 212, 0.7);

  --font: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Inter",
    "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --ease-out: cubic-bezier(0.22, 0.8, 0.24, 1);
  --ease-spring: cubic-bezier(0.2, 0.9, 0.2, 1.15);
  --page-width: 1240px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 12% -10%, #ffffff 0%, rgba(255, 255, 255, 0) 60%),
    radial-gradient(900px 600px at 100% 0%, #dfe9ff 0%, rgba(223, 233, 255, 0) 62%),
    radial-gradient(900px 700px at 50% 110%, #e3ecff 0%, rgba(227, 236, 255, 0) 65%),
    linear-gradient(180deg, #f8fbff 0%, #eef4ff 55%, #e9f0ff 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.015em;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

svg {
  display: block;
}

::selection {
  background: rgba(56, 107, 246, 0.22);
}

:focus-visible {
  outline: 3px solid rgba(56, 107, 246, 0.5);
  outline-offset: 2px;
}

/* ---------- Ambient background ---------- */

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: orbFloat 18s var(--ease-out) infinite alternate;
}

.orb-a {
  width: 460px;
  height: 460px;
  top: -140px;
  left: -100px;
  background: radial-gradient(circle at 35% 35%, #a9c3ff, rgba(169, 195, 255, 0) 70%);
}

.orb-b {
  width: 520px;
  height: 520px;
  top: 8%;
  right: -180px;
  background: radial-gradient(circle at 50% 50%, #cfe0ff, rgba(207, 224, 255, 0) 70%);
  animation-delay: -6s;
}

.orb-c {
  width: 600px;
  height: 600px;
  bottom: -280px;
  left: 38%;
  background: radial-gradient(circle at 50% 50%, #b9cdff, rgba(185, 205, 255, 0) 72%);
  animation-delay: -11s;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(16, 36, 81, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 36, 81, 0.045) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 78%);
  opacity: 0.5;
}

@keyframes orbFloat {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(36px, -28px, 0) scale(1.08);
  }
}

/* ---------- Utilities ---------- */

[hidden] {
  display: none !important;
}

.glass {
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.86) 0%, rgba(255, 255, 255, 0.58) 100%);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  box-shadow: var(--shadow-card);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--navy-900);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  transition: top 0.2s var(--ease-out);
}

.skip-link:focus-visible {
  top: 12px;
}

.noscript {
  margin: 24px auto;
  max-width: 640px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 600;
  text-align: center;
}

/* ---------- Shared animations ---------- */

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes itemIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

@keyframes pulseDot {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(56, 107, 246, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(56, 107, 246, 0);
  }
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(220%);
  }
}

@keyframes shake {
  10%,
  90% {
    transform: translateX(-1px);
  }
  20%,
  80% {
    transform: translateX(2px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-3px);
  }
  40%,
  60% {
    transform: translateX(3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
