/* ============================================================
   Artificial Intelligence — Landing Page
   Author: Senior Frontend Engineer
   Notes:
     - Single stylesheet, organized in logical sections.
     - Uses CSS custom properties for the color system.
     - Animations are GPU-friendly (transform / opacity).
     - Honors prefers-reduced-motion.
   ============================================================ */

/* -------------------- Tokens (KAIA palette) -------------------- */
:root {
  /* Base */
  --c-bg-0:   #05070D;             /* deepest base */
  --c-bg-1:   #0A0F1C;             /* slightly lighter layer */

  /* Accents */
  --c-cyan:   #00FFC6;             /* primary KAIA green/cyan */
  --c-cyan-2: #00E6B8;             /* secondary cyan */
  --c-blue:   #00A3FF;             /* electric blue */
  --c-purple: #7A5CFF;             /* soft purple */

  /* Text */
  --c-text:        #E6EDF3;
  --c-text-muted:  #9AA4B2;
  --c-text-soft:   #5B6472;

  /* Gradient identity */
  --grad-primary:   linear-gradient(135deg, #00FFC6 0%, #00A3FF 100%);
  --grad-secondary: linear-gradient(135deg, #00FFC6 0%, #7A5CFF 100%);
  --glow-cyan:      0 0 80px rgba(0, 255, 198, 0.18);

  /* Spacing */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --space-6: 4.5rem;

  /* Radii */
  --radius-pill: 999px;

  /* Typography */
  --font-base: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-base);
  color: var(--c-text);
  background: var(--c-bg-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; padding: 0; margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* Selection + focus */
::selection { background: rgba(255, 255, 255, 0.25); color: #fff; }

:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
  border-radius: 4px;
}

/* -------------------- Background system -------------------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--c-bg-0);
}

/* Layered dark base + radial accent washes (cyan / electric blue / purple).
   The radial bubbles slide via `bgShift` so the whole field breathes. */
.bg__gradient {
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(circle at 70% 30%, rgba(0, 255, 198, 0.12), transparent 45%),
    radial-gradient(circle at 18% 78%, rgba(122,  92, 255, 0.14), transparent 55%),
    radial-gradient(circle at 90% 85%, rgba(0, 163, 255, 0.10), transparent 50%),
    linear-gradient(135deg, #0A0F1C 0%, #05070D 50%, #0A0F1C 100%);
  background-size: 200% 200%;
  animation: bgShift 22s ease-in-out infinite;
}

.bg__noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image:
    radial-gradient(rgba(255,255,255,0.6) 1px, transparent 1px);
  background-size: 3px 3px;
}

@keyframes bgShift {
  0%   { background-position:   0%   0%; }
  50%  { background-position: 100% 100%; }
  100% { background-position:   0%   0%; }
}

/* -------------------- Page wrapper (no card border) --------------------
   The dark gradient now lives on .bg (full-screen). The page is just
   a transparent flex container that holds the nav and hero.
*/
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* -------------------- Lens flare bokeh -------------------- */
/*
 * Bokeh circles — the soft, out-of-focus light spots in the reference.
 * Each .bokeh__dot is a circular gradient: a soft outer falloff, a brighter
 * core, and a faint inner highlight ring (typical lens-flare bokeh look).
 * Each circle drifts and pulses independently with its own duration/delay.
 */
.bokeh {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.bokeh__dot {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  mix-blend-mode: screen;
  will-change: transform, opacity;
  /* Default: cyan-dominant bokeh (KAIA primary). */
  background:
    radial-gradient(circle at 50% 50%,
      rgba(255, 255, 255, 0.50) 0%,
      rgba(  0, 255, 198, 0.45) 22%,
      rgba(  0, 230, 184, 0.22) 48%,
      rgba(  0, 163, 255, 0.10) 75%,
      rgba(  0,   0,   0, 0)    100%);
  filter: blur(8px);
  opacity: 0.75;
}

/* Color variants — keep the field rich without HTML changes */
.bokeh__dot:nth-child(3n+2) {
  /* Electric-blue dominant */
  background:
    radial-gradient(circle at 50% 50%,
      rgba(255, 255, 255, 0.45) 0%,
      rgba(  0, 163, 255, 0.45) 22%,
      rgba(  0, 130, 220, 0.22) 50%,
      rgba(122,  92, 255, 0.08) 78%,
      rgba(  0,   0,   0, 0)    100%);
}

.bokeh__dot:nth-child(3n+3) {
  /* Soft purple dominant */
  background:
    radial-gradient(circle at 50% 50%,
      rgba(255, 255, 255, 0.40) 0%,
      rgba(122,  92, 255, 0.45) 22%,
      rgba(100,  72, 235, 0.22) 50%,
      rgba(  0, 255, 198, 0.06) 78%,
      rgba(  0,   0,   0, 0)    100%);
}

/* Per-dot positions, sizes, and animations */
.b1  { width: 380px; height: 380px; top:  4%;  left:  6%;  filter: blur(22px); opacity: .55; animation: drift1  18s ease-in-out infinite, pulse1 7s ease-in-out infinite; }
.b2  { width: 220px; height: 220px; top: 12%;  left: 22%;  filter: blur(10px); opacity: .85; animation: drift2  22s ease-in-out infinite, pulse2 9s ease-in-out infinite; }
.b3  { width: 140px; height: 140px; top:  6%;  left: 38%;  filter: blur(6px);  opacity: .9;  animation: drift1  20s ease-in-out infinite reverse, pulse1 6s ease-in-out infinite; }
.b4  { width: 460px; height: 460px; top:  2%;  right: -4%; filter: blur(30px); opacity: .55; animation: drift2  26s ease-in-out infinite, pulse2 11s ease-in-out infinite; }
.b5  { width: 260px; height: 260px; top: 26%;  right: 18%; filter: blur(14px); opacity: .7;  animation: drift1  24s ease-in-out infinite, pulse1 8s ease-in-out infinite; }
.b6  { width: 180px; height: 180px; top: 38%;  left: 14%;  filter: blur(8px);  opacity: .75; animation: drift2  19s ease-in-out infinite reverse, pulse2 7s ease-in-out infinite; }
.b7  { width: 320px; height: 320px; top: 48%;  left: 30%;  filter: blur(24px); opacity: .55; animation: drift1  28s ease-in-out infinite, pulse1 12s ease-in-out infinite; }
.b8  { width: 110px; height: 110px; top: 58%;  left: 52%;  filter: blur(4px);  opacity: .9;  animation: drift2  16s ease-in-out infinite, pulse2 5s ease-in-out infinite; }
.b9  { width: 240px; height: 240px; top: 52%;  right: 24%; filter: blur(14px); opacity: .65; animation: drift1  22s ease-in-out infinite reverse, pulse1 9s ease-in-out infinite; }
.b10 { width: 360px; height: 360px; bottom: -6%; left: 14%; filter: blur(28px); opacity: .55; animation: drift2  30s ease-in-out infinite, pulse2 13s ease-in-out infinite; }
.b11 { width: 180px; height: 180px; bottom:  6%; left: 44%; filter: blur(10px); opacity: .75; animation: drift1  20s ease-in-out infinite, pulse1 7s ease-in-out infinite; }
.b12 { width: 130px; height: 130px; bottom: 18%; left: 60%; filter: blur(6px);  opacity: .85; animation: drift2  18s ease-in-out infinite reverse, pulse2 6s ease-in-out infinite; }
.b13 { width: 300px; height: 300px; bottom:  4%; right: 8%; filter: blur(22px); opacity: .55; animation: drift1  26s ease-in-out infinite, pulse1 10s ease-in-out infinite; }
.b14 { width: 90px;  height: 90px;  top: 32%;   left: 48%;  filter: blur(3px);  opacity: .95; animation: drift2  14s ease-in-out infinite, pulse2 4s ease-in-out infinite; }
.b15 { width: 70px;  height: 70px;  top: 70%;   left: 18%;  filter: blur(2px);  opacity: .95; animation: drift1  12s ease-in-out infinite reverse, pulse1 5s ease-in-out infinite; }
.b16 { width: 200px; height: 200px; top: 18%;   right: 36%; filter: blur(12px); opacity: .7;  animation: drift2  21s ease-in-out infinite, pulse2 8s ease-in-out infinite; }

/* Drift trajectories — each dot moves on a slightly different path */
@keyframes drift1 {
  0%   { transform: translate3d(0, 0, 0)        scale(1);    }
  25%  { transform: translate3d(40px, -20px, 0) scale(1.06); }
  50%  { transform: translate3d(20px, -50px, 0) scale(1.1);  }
  75%  { transform: translate3d(-20px, -25px, 0) scale(1.04); }
  100% { transform: translate3d(0, 0, 0)        scale(1);    }
}
@keyframes drift2 {
  0%   { transform: translate3d(0, 0, 0)        scale(1);    }
  25%  { transform: translate3d(-30px, 20px, 0) scale(1.08); }
  50%  { transform: translate3d(-10px, 40px, 0) scale(1.12); }
  75%  { transform: translate3d(20px, 15px, 0)  scale(1.05); }
  100% { transform: translate3d(0, 0, 0)        scale(1);    }
}

/* Brightness / opacity pulses — fade in/out softly so the field feels alive */
@keyframes pulse1 {
  0%, 100% { opacity: var(--o, 0.65); }
  50%      { opacity: calc(var(--o, 0.65) + 0.15); }
}
@keyframes pulse2 {
  0%, 100% { opacity: var(--o, 0.7); }
  50%      { opacity: calc(var(--o, 0.7) - 0.2); }
}

/* -------------------- Long horizontal lens streak -------------------- */
.lens-streak {
  position: absolute;
  top: 38%;
  left: -10%;
  width: 130%;
  height: 4px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(0, 255, 198, 0)    10%,
    rgba(0, 255, 198, 0.30) 35%,
    rgba(0, 230, 184, 0.55) 50%,
    rgba(0, 163, 255, 0.30) 65%,
    rgba(122, 92, 255, 0)   90%,
    transparent             100%
  );
  filter: blur(3px);
  opacity: 0.4;
  transform: rotate(-8deg);
  pointer-events: none;
  mix-blend-mode: screen;
  animation: streak 14s ease-in-out infinite;
}

@keyframes streak {
  0%, 100% { opacity: 0.25; transform: translateX(-2%) rotate(-8deg); }
  50%      { opacity: 0.55; transform: translateX(2%)  rotate(-8deg); }
}

/* -------------------- Decorative circuit lines -------------------- */
.circuit {
  position: absolute;
  width: 60%;
  max-width: 720px;
  height: auto;
  opacity: 0.6;
  pointer-events: none;
}
.circuit--top    { top: 6%;    left: 8%;  }
.circuit--bottom { bottom: 4%; right: 4%; transform: scale(-1, -1); }

.circuit path { stroke-dashoffset: 0; animation: dash 12s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -200; } }

/* -------------------- Navigation -------------------- */
.nav {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(20px, 3.2vw, 36px) clamp(24px, 5vw, 64px);
  gap: var(--space-3);
}

.nav__hamburger {
  width: 44px;
  height: 36px;
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px 4px;
  border-radius: 6px;
  transition: transform 0.3s var(--ease-out), background 0.3s var(--ease-out);
}
.nav__hamburger:hover { background: rgba(255, 255, 255, 0.08); }
.nav__hamburger span {
  display: block;
  height: 2px;
  width: 100%;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.35s var(--ease-out), opacity 0.25s var(--ease-out);
}

.nav__links ul {
  display: flex;
  gap: clamp(28px, 5vw, 80px);
  align-items: center;
}
.nav__links a {
  position: relative;
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  padding: 6px 2px;
  transition: color 0.25s var(--ease-out);
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1.5px;
  background: var(--grad-primary);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.4s var(--ease-out);
}
.nav__links a:hover,
.nav__links a:focus-visible { color: var(--c-text); }
.nav__links a:hover::after,
.nav__links a:focus-visible::after { transform: scaleX(1); }

/* -------------------- Mobile menu -------------------- */
.mobile-menu {
  position: fixed;
  top: 0; left: 0;
  height: 100dvh;
  width: min(82vw, 360px);
  background:
    radial-gradient(circle at 0% 0%, rgba(0, 255, 198, 0.10), transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(122, 92, 255, 0.12), transparent 60%),
    linear-gradient(160deg, #0A0F1C, #05070D);
  z-index: 50;
  padding: 80px 32px 32px;
  transform: translateX(-105%);
  transition: transform 0.45s var(--ease-out);
  box-shadow: 8px 0 40px rgba(0, 0, 0, 0.55), var(--glow-cyan);
  border-right: 1px solid rgba(0, 255, 198, 0.12);
}
.mobile-menu[aria-hidden="false"] { transform: translateX(0); }

.mobile-menu__close {
  position: absolute;
  top: 18px; right: 22px;
  font-size: 2rem;
  line-height: 1;
  color: #fff;
  opacity: 0.85;
  transition: transform 0.3s var(--ease-out);
}
.mobile-menu__close:hover { transform: rotate(90deg); opacity: 1; }

.mobile-menu ul { display: flex; flex-direction: column; gap: 22px; }
.mobile-menu a {
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 500;
  color: #fff;
  padding: 6px 0;
  display: block;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-out);
}
.menu-backdrop.is-visible { opacity: 1; pointer-events: auto; }

/* -------------------- Hero -------------------- */
.hero {
  position: relative;
  z-index: 2;
  flex: 1;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: clamp(32px, 5vw, 80px);
  padding: clamp(20px, 4vw, 56px) clamp(24px, 6vw, 96px) clamp(40px, 6vw, 96px);
}

.hero__text { max-width: 620px; }

/* Hero Title — 48–64px */
.hero__title {
  font-weight: 800;
  font-size: clamp(3rem, 5.5vw, 4rem);
  line-height: 1.05;
  margin: 0 0 var(--space-2);
  letter-spacing: -0.02em;
  color: var(--c-text);
}
.hero__title .line { display: block; }

/* Subtitle — 20–24px */
.hero__subtitle {
  font-weight: 400;
  font-size: clamp(1.25rem, 1.8vw, 1.5rem);
  margin: 0 0 var(--space-4);
  color: var(--c-text-muted);
  letter-spacing: 0.005em;
}

/* Body — 16–18px */
.hero__copy {
  font-size: clamp(1rem, 1.1vw, 1.125rem);
  color: var(--c-text-muted);
  max-width: 480px;
  margin: 0 0 var(--space-5);
  line-height: 1.7;
}

/* Gradient text utility — used to highlight key phrases */
.text-gradient {
  background: var(--grad-secondary);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
          color: transparent;
}

/* CTA — outline pill with gradient border + cyan glow on hover.
   The "border" is faked with a layered background so we can animate
   from a subtle white outline into the full primary gradient. */
.cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 36px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--c-text);
  /* Two-layer background-clip trick: the gradient ring sits on the
     border-box, the dark fill sits on the padding-box. */
  background:
    linear-gradient(#0A0F1C, #0A0F1C) padding-box,
    linear-gradient(135deg, rgba(0,255,198,0.55), rgba(122,92,255,0.55)) border-box;
  border: 1.5px solid transparent;
  overflow: hidden;
  transition:
    transform 0.35s var(--ease-out),
    box-shadow 0.35s var(--ease-out),
    background 0.35s var(--ease-out),
    color 0.35s var(--ease-out);
}
.cta::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--grad-primary);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
  pointer-events: none;
  z-index: 0;
}
.cta:hover {
  transform: translateY(-2px) scale(1.03);
  color: #05070D;
  box-shadow:
    0 0 0 4px rgba(0, 255, 198, 0.10),
    0 14px 28px rgba(0, 0, 0, 0.45),
    0 0 32px rgba(0, 255, 198, 0.45);
}
.cta:hover::before { opacity: 1; }
.cta span { position: relative; z-index: 1; }

/* -------------------- Hero visual / brain -------------------- */
.hero__visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  will-change: transform;
}

.brain {
  position: relative;
  width: min(560px, 90%);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Real 3D perspective for the .brain__label inside */
  perspective: 900px;
  perspective-origin: 50% 50%;
}

#brain-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Wrapper sets perspective context + sits on top of the canvas */
.brain__label {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transform-style: preserve-3d;
}

/* The actual "Ai" element — real 3D rotation in CSS, with a layered
   text-shadow that fakes a soft polygonal extrusion behind the text.
   Result: always crisp, always white, never deforms. */
.brain__label-3d {
  display: inline-block;
  font-weight: 800;
  font-size: clamp(4rem, 9vw, 7.6rem);
  letter-spacing: -0.02em;
  color: #fff;
  user-select: none;
  transform-style: preserve-3d;
  transform-origin: 50% 55%;
  /* Stacked shadows = fake polygonal extrusion + cyan outer glow */
  text-shadow:
    1px  1px 0 rgba(168, 245, 224, 0.55),
    2px  2px 0 rgba(120, 230, 200, 0.45),
    3px  3px 0 rgba( 60, 215, 180, 0.35),
    4px  4px 0 rgba(  0, 200, 160, 0.25),
    5px  5px 0 rgba(  0, 180, 140, 0.18),
    0 0 40px rgba(  0, 255, 198, 0.50);
  /* Initial transform — JS overrides this every frame with the
     idle wobble + mouse parallax (see scripts/brain.js). */
  transform: rotateY(0deg) rotateX(0deg);
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .brain__label-3d { transform: none !important; }
}

.brain__glow {
  position: absolute;
  inset: 8%;
  background:
    radial-gradient(circle at 60% 50%, rgba(0, 255, 198, 0.30), transparent 60%),
    radial-gradient(circle at 30% 70%, rgba(122, 92, 255, 0.20), transparent 60%);
  filter: blur(40px);
  z-index: 0;
  border-radius: 50%;
  animation: pulse 6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%      { opacity: 0.9; transform: scale(1.05); }
}

/* -------------------- Entrance animations -------------------- */
.line {
  opacity: 0;
  transform: translateY(28px);
  animation: rise 0.9s var(--ease-out) forwards;
}
.line--1 { animation-delay: 0.10s; }
.line--2 { animation-delay: 0.22s; }
.line--3 { animation-delay: 0.36s; }
.line--4 { animation-delay: 0.52s; }
.line--5 { animation-delay: 0.68s; }

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

.hero__visual {
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  animation: rise 1.1s 0.4s var(--ease-out) forwards;
}

/* -------------------- Responsive -------------------- */
@media (max-width: 980px) {
  .nav { padding: 22px 28px; }
  .nav__links { display: none; }
  .nav__hamburger { display: inline-flex; }

  .hero {
    grid-template-columns: 1fr;
    text-align: left;
    padding: 16px 28px 40px;
    gap: 12px;
  }
  .hero__visual { order: -1; min-height: 280px; }
  .brain { width: min(380px, 80%); }
  .hero__text { max-width: 100%; }
}

@media (min-width: 981px) {
  .nav__hamburger { display: none; }
}

@media (max-width: 600px) {
  .page { margin: 10px; min-height: calc(100vh - 20px); }
  .hero { padding: 12px 22px 36px; }
  .hero__title { font-size: clamp(2.2rem, 9vw, 3.4rem); }
  .hero__subtitle { font-size: 1.4rem; margin-bottom: 22px; }
  .cta { padding: 12px 28px; font-size: 0.72rem; }
  .brain { width: min(320px, 86%); }
  .circuit { display: none; }
}

/* -------------------- Reduced motion -------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .line, .hero__visual { opacity: 1; transform: none; }
}
