@import "tailwindcss" source(none);
@source "../src";
@import "tw-animate-css";

@custom-variant dark (&:is(.dark *));

@theme inline {
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --radius-2xl: calc(var(--radius) + 8px);
  --radius-3xl: calc(var(--radius) + 12px);
  --radius-4xl: calc(var(--radius) + 16px);
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-destructive-foreground: var(--destructive-foreground);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --color-ring-offset-background: var(--background);
  --color-surface: var(--surface);
  --color-glow: var(--glow);
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "DM Sans", ui-sans-serif, system-ui, sans-serif;
}

:root {
  --radius: 0.75rem;

  /* Deep navy canvas with electric cyan accent */
  --background: oklch(0.17 0.035 258);
  --foreground: oklch(0.97 0.005 250);
  --surface: oklch(0.22 0.037 258);
  --card: oklch(0.22 0.037 258);
  --card-foreground: oklch(0.97 0.005 250);
  --popover: oklch(0.22 0.037 258);
  --popover-foreground: oklch(0.97 0.005 250);
  --primary: oklch(0.8 0.15 200);
  --primary-foreground: oklch(0.17 0.035 258);
  --glow: oklch(0.88 0.13 195);
  --secondary: oklch(0.27 0.04 258);
  --secondary-foreground: oklch(0.97 0.005 250);
  --muted: oklch(0.26 0.035 258);
  --muted-foreground: oklch(0.72 0.02 250);
  --accent: oklch(0.3 0.06 250);
  --accent-foreground: oklch(0.97 0.005 250);
  --destructive: oklch(0.62 0.21 25);
  --destructive-foreground: oklch(0.98 0 0);
  --border: oklch(0.32 0.035 255);
  --input: oklch(0.3 0.035 255);
  --ring: oklch(0.8 0.15 200);

  --gradient-hero: radial-gradient(
      110% 90% at 70% 0%,
      color-mix(in oklab, var(--primary) 22%, transparent),
      transparent 60%
    ),
    linear-gradient(180deg, oklch(0.19 0.04 258), oklch(0.15 0.03 258));
  --gradient-accent: linear-gradient(120deg, var(--primary), oklch(0.72 0.16 262));
  --shadow-elevated: 0 24px 60px -28px color-mix(in oklab, var(--primary) 45%, transparent);
}

@layer base {
  * {
    border-color: var(--color-border);
  }

  body {
    background-color: var(--color-background);
    color: var(--color-foreground);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
  }

  h1,
  h2,
  h3,
  h4 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
  }
}

@utility hero-surface {
  background-image: var(--gradient-hero);
}

@utility text-gradient {
  background-image: var(--gradient-accent);
  background-clip: text;
  color: transparent;
}

@utility panel {
  background-color: color-mix(in oklab, var(--surface) 80%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  transition:
    border-color 0.25s ease,
    transform 0.25s ease,
    box-shadow 0.25s ease;

  &:hover {
    border-color: color-mix(in oklab, var(--primary) 55%, transparent);
    transform: translateY(-3px);
    box-shadow: var(--shadow-elevated);
  }
}

@utility grid-lines {
  background-image:
    linear-gradient(to right, color-mix(in oklab, var(--border) 60%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in oklab, var(--border) 60%, transparent) 1px, transparent 1px);
  background-size: 72px 72px;
}

/* ------------------------------ HUD / orbit ----------------------------- */
.hud-stage {
  filter: drop-shadow(0 0 40px color-mix(in oklab, var(--primary) 22%, transparent));
}

.hud-ring {
  fill: none;
  stroke: color-mix(in oklab, var(--primary) 30%, transparent);
  stroke-width: 1;
  stroke-dasharray: 4 10;
  transform-origin: 180px 180px;
  animation: hud-spin 40s linear infinite;
}
.hud-ring-slow {
  animation-duration: 60s;
  animation-direction: reverse;
  stroke-dasharray: 2 14;
}
.hud-ring-faint {
  stroke: color-mix(in oklab, var(--primary) 14%, transparent);
  stroke-dasharray: 1 22;
  animation-duration: 90s;
}

.hud-link {
  stroke: color-mix(in oklab, var(--primary) 45%, transparent);
  stroke-width: 1;
  stroke-dasharray: 140;
  stroke-dashoffset: 140;
  animation: hud-draw 2.4s ease-out forwards, hud-flicker 5s ease-in-out infinite 2.4s;
}

.hud-orbit .hud-node {
  animation: hud-pulse 3s ease-in-out infinite;
}
.hud-orbit .hud-node:nth-child(2n) {
  animation-delay: 0.6s;
}
.hud-orbit .hud-node:nth-child(3n) {
  animation-delay: 1.2s;
}

.hud-node {
  fill: var(--glow);
  filter: drop-shadow(0 0 8px color-mix(in oklab, var(--glow) 70%, transparent));
  transition: r 0.25s ease;
}

.hud-hub {
  transform-origin: 180px 180px;
  animation: hud-pulse 3.4s ease-in-out infinite;
}

.hud-hub-halo {
  fill: none;
  stroke: color-mix(in oklab, var(--glow) 45%, transparent);
  stroke-width: 1.5;
  transform-origin: 180px 180px;
  animation: hud-halo 3.4s ease-in-out infinite;
}

.hud-label {
  position: absolute;
  translate: -50% -50%;
  border-radius: 999px;
  border: 1px solid color-mix(in oklab, var(--primary) 35%, transparent);
  background: color-mix(in oklab, var(--surface) 85%, transparent);
  padding: 0.25rem 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  transition: color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.hud-label:hover {
  color: var(--foreground);
  border-color: color-mix(in oklab, var(--primary) 70%, transparent);
  box-shadow: 0 0 18px color-mix(in oklab, var(--primary) 35%, transparent);
}
@keyframes holo-scan {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 0 120px;
  }
}


@keyframes hud-spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes hud-draw {
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes hud-flicker {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}
@keyframes hud-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.92;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}
@keyframes hud-halo {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.14);
    opacity: 0.1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hud-ring,
  .hud-orbit,
  .hud-hub,
  .hud-hub-halo,
  .hud-link {
    animation: none;
    stroke-dashoffset: 0;
  }
}

/* --------------------------- HUD floating widgets ----------------------- */
.hud-widget {
  border-radius: 0.9rem;
  border: 1px solid color-mix(in oklab, var(--primary) 28%, transparent);
  background: color-mix(in oklab, var(--surface) 78%, transparent);
  backdrop-filter: blur(10px);
  padding: 0.75rem 1rem;
  min-width: 9.5rem;
  box-shadow: 0 0 26px color-mix(in oklab, var(--primary) 14%, transparent);
  animation: hud-float 6s ease-in-out infinite;
}
.hud-widget:nth-child(2n) {
  animation-delay: 1.5s;
}
.hud-value {
  transition: opacity 0.3s ease;
}

@keyframes hud-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.live-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--glow);
  box-shadow: 0 0 10px var(--glow);
  animation: hud-pulse 1.6s ease-in-out infinite;
}

/* ------------------- user-controlled reduced motion --------------------- */
[data-motion="reduced"] .hud-ring,
[data-motion="reduced"] .hud-orbit,
[data-motion="reduced"] .hud-orbit .hud-node,
[data-motion="reduced"] .hud-hub,
[data-motion="reduced"] .hud-hub-halo,
[data-motion="reduced"] .hud-link,
[data-motion="reduced"] .hud-widget,
[data-motion="reduced"] .live-dot,
[data-motion="reduced"] .animate-fade-in,
[data-motion="reduced"] .hover-scale {
  animation: none !important;
  transition: none !important;
  stroke-dashoffset: 0 !important;
  transform: none !important;
}
[data-motion="reduced"] video {
  display: none;
}
