/* XOUNOX brand system — light/dark responsive theme */
:root {
  /* Default: LIGHT theme */
  --background: 210 30% 98%;
  --foreground: 220 30% 10%;

  --card: 0 0% 100%;
  --card-foreground: 220 30% 10%;

  --popover: 0 0% 100%;
  --popover-foreground: 220 30% 10%;

  --primary: 30 93% 54%;              /* #f7941e brand orange */
  --primary-foreground: 210 40% 98%;

  --secondary: 210 36% 47%;           /* #4c75a3 brand blue */
  --secondary-foreground: 210 40% 98%;

  --muted: 210 20% 92%;
  --muted-foreground: 215 15% 40%;

  --accent: 30 93% 54%;
  --accent-foreground: 210 40% 98%;

  --destructive: 0 84% 60%;
  --destructive-foreground: 210 40% 98%;

  --border: 210 20% 86%;
  --input: 210 20% 86%;
  --ring: 30 93% 54%;

  --radius: 0.5rem;

  --brand-orange: 30 93% 54%;
  --brand-blue: 210 36% 47%;
  --brand-blue-light: 210 46% 62%;
  --brand-orange-glow: 30 93% 60%;

  --grid: 210 20% 70% / 0.15;
}

.dark {
  color-scheme: dark;
  /* Dark override theme */
  --background: 220 30% 6%;
  --foreground: 210 40% 96%;

  --card: 220 30% 9%;
  --card-foreground: 210 40% 96%;

  --popover: 220 30% 9%;
  --popover-foreground: 210 40% 96%;

  --primary: 30 93% 54%;
  --primary-foreground: 220 40% 8%;

  --secondary: 210 36% 47%;
  --secondary-foreground: 210 40% 98%;

  --muted: 220 20% 14%;
  --muted-foreground: 215 20% 68%;

  --accent: 30 93% 54%;
  --accent-foreground: 220 40% 8%;

  --destructive: 0 84% 60%;
  --destructive-foreground: 210 40% 98%;

  --border: 220 20% 16%;
  --input: 220 20% 16%;
  --ring: 30 93% 54%;

  --grid: 210 30% 18% / 0.35;
}

/* Base style setups */
html {
  scroll-behavior: smooth;
}
body {
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  overflow-x: hidden;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  transition: background-color 0.3s ease, color 0.3s ease;
}

::selection {
  background: hsl(var(--brand-orange) / 0.4);
  color: hsl(var(--foreground));
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: hsl(var(--background));
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, hsl(var(--brand-orange)), hsl(var(--brand-blue)));
  border-radius: 8px;
}

/* === Animated background layers === */
.bg-grid {
  background-image:
    linear-gradient(hsl(var(--grid)) 1px, transparent 1px),
    linear-gradient(90deg, hsl(var(--grid)) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 85%);
}

.bg-noise::before {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.35 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.4'/></svg>");
  opacity: 0.05; pointer-events: none; mix-blend-mode: overlay;
}

/* Scanning HUD line */
.scan-line {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.scan-line::after {
  content: ""; position: absolute; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, hsl(var(--brand-orange) / 0.9), transparent);
  filter: blur(1px);
  animation: scan 6s linear infinite;
}
@keyframes scan {
  0% { top: -5%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 105%; opacity: 0; }
}

/* Shockwave burst used on page enter */
.shockwave {
  position: fixed; inset: 0; pointer-events: none; z-index: 60;
}
.shockwave::before,
.shockwave::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 40px; height: 40px; border-radius: 999px;
  transform: translate(-50%, -50%) scale(0);
  border: 2px solid hsl(var(--brand-orange) / 0.8);
  animation: shock 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.shockwave::after {
  border-color: hsl(var(--brand-blue-light) / 0.9);
  animation-delay: 0.12s;
}
@keyframes shock {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; border-width: 3px; }
  60% { opacity: 0.6; border-width: 2px; }
  100% { transform: translate(-50%, -50%) scale(70); opacity: 0; border-width: 1px; }
}

/* Glitch text */
.glitch { position: relative; display: inline-block; }
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; left: 0; top: 0; width: 100%;
  overflow: hidden;
}
.glitch::before {
  color: hsl(var(--brand-orange));
  transform: translate(2px, 0);
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
  animation: glitchA 3.6s infinite steps(1);
  mix-blend-mode: multiply;
}
.glitch::after {
  color: hsl(var(--brand-blue-light));
  transform: translate(-2px, 0);
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
  animation: glitchB 3.6s infinite steps(1);
  mix-blend-mode: multiply;
}

.dark .glitch::before, .dark .glitch::after {
  mix-blend-mode: screen;
}

@keyframes glitchA {
  0%,92%,100% { transform: translate(0,0); }
  93% { transform: translate(3px,-2px); }
  95% { transform: translate(-4px,1px); }
  97% { transform: translate(2px,2px); }
}
@keyframes glitchB {
  0%,90%,100% { transform: translate(0,0); }
  91% { transform: translate(-3px,1px); }
  94% { transform: translate(4px,-1px); }
  96% { transform: translate(-2px,2px); }
}

/* Orbit ring */
.orbit { animation: orbit 24s linear infinite; transform-origin: center; }
.orbit-rev { animation: orbit 32s linear infinite reverse; }
@keyframes orbit { to { transform: rotate(360deg); } }

/* Marquee */
.marquee { display: flex; overflow: hidden; }
.marquee-track { display: flex; gap: 3rem; animation: marquee 30s linear infinite; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* Reveal on mount */
@keyframes rise {
  from { opacity: 0; transform: translateY(28px); filter: blur(6px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
.rise { animation: rise 0.9s cubic-bezier(0.16,1,0.3,1) both; }

/* Pulse ring */
@keyframes ping-ring {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(2.6); opacity: 0; }
}
.ping-ring { animation: ping-ring 2.4s cubic-bezier(0,0,0.2,1) infinite; }

/* Beam sweep */
@keyframes beam {
  0% { transform: translateX(-120%) skewX(-20deg); }
  100% { transform: translateX(220%) skewX(-20deg); }
}
.beam::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, hsl(var(--brand-orange) / 0.25), transparent);
  animation: beam 3.5s ease-in-out infinite;
}

/* Terminal blink */
@keyframes blink { 50% { opacity: 0; } }
.blink { animation: blink 1s steps(1) infinite; }

/* Data flow lines */
@keyframes flow-x {
  from { stroke-dashoffset: 400; }
  to { stroke-dashoffset: 0; }
}
.flow-line { stroke-dasharray: 8 12; animation: flow-x 4s linear infinite; }

/* Card tilt hover */
.tilt { transition: transform 0.5s cubic-bezier(0.2,0.9,0.2,1), box-shadow 0.5s; }
.tilt:hover { transform: perspective(900px) rotateX(4deg) rotateY(-6deg) translateY(-6px); box-shadow: 0 30px 60px -20px hsl(var(--brand-orange) / 0.25); }

/* Neon border */
.neon-border { position: relative; }
.neon-border::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: linear-gradient(120deg, hsl(var(--brand-orange)), hsl(var(--brand-blue-light)), hsl(var(--brand-orange)));
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: sheen 6s linear infinite;
  pointer-events: none;
}
@keyframes sheen { to { background-position: 300% 0; } }

/* Corner readouts */
.hud-corner {
  position: absolute; width: 22px; height: 22px;
  border: 2px solid hsl(var(--brand-orange));
}
.hud-corner.tl { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.hud-corner.tr { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.hud-corner.bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.hud-corner.br { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
