@import 'tailwindcss';
@import 'tw-animate-css';
@import 'shadcn/tailwind.css';

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

@theme inline {
  --font-heading: var(--font-geist-sans), 'DM Sans', sans-serif;
  --font-sans: var(--font-geist-sans), 'DM Sans', sans-serif;
  --font-mono: var(--font-geist-mono), 'JetBrains Mono', monospace;
  --color-sidebar-ring: var(--sidebar-ring);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar: var(--sidebar);
  --color-chart-5: var(--chart-5);
  --color-chart-4: var(--chart-4);
  --color-chart-3: var(--chart-3);
  --color-chart-2: var(--chart-2);
  --color-chart-1: var(--chart-1);
  --color-ring: var(--ring);
  --color-input: var(--input);
  --color-border: var(--border);
  --color-destructive: var(--destructive);
  --color-accent-foreground: var(--accent-foreground);
  --color-accent: var(--accent);
  --color-muted-foreground: var(--muted-foreground);
  --color-muted: var(--muted);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-secondary: var(--secondary);
  --color-primary-foreground: var(--primary-foreground);
  --color-primary: var(--primary);
  --color-popover-foreground: var(--popover-foreground);
  --color-popover: var(--popover);
  --color-card-foreground: var(--card-foreground);
  --color-card: var(--card);
  --color-foreground: var(--foreground);
  --color-background: var(--background);
  --radius-sm: calc(var(--radius) * 0.6);
  --radius-md: calc(var(--radius) * 0.8);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) * 1.4);
  --radius-2xl: calc(var(--radius) * 1.8);
  --radius-3xl: calc(var(--radius) * 2.2);
  --radius-4xl: calc(var(--radius) * 2.6);
}

/* ── Charcoal / Zinc palette — dark-only ─────────────────── */

:root {
  --background: oklch(0.098 0.003 264);
  --foreground: oklch(0.955 0.004 106);
  --card: oklch(0.17 0.005 264);
  --card-foreground: oklch(0.955 0.004 106);
  --popover: oklch(0.145 0.004 264);
  --popover-foreground: oklch(0.955 0.004 106);
  --primary: oklch(0.695 0.195 48);
  --primary-foreground: oklch(0.098 0.003 264);
  --secondary: oklch(0.185 0.005 264);
  --secondary-foreground: oklch(0.955 0.004 106);
  --muted: oklch(0.185 0.005 264);
  --muted-foreground: oklch(0.62 0.01 264);
  --accent: oklch(0.74 0.155 52);
  --accent-foreground: oklch(0.098 0.003 264);
  --destructive: oklch(0.62 0.22 25);
  --border: oklch(1 0 0 / 12%);
  --input: oklch(1 0 0 / 14%);
  --ring: oklch(0.695 0.195 48);
  --chart-1: oklch(0.695 0.195 48);
  --chart-2: oklch(0.60 0.14 264);
  --chart-3: oklch(0.74 0.155 52);
  --chart-4: oklch(0.50 0.12 264);
  --chart-5: oklch(0.80 0.12 60);
  --radius: 0.5rem;
  --sidebar: oklch(0.145 0.004 264);
  --sidebar-foreground: oklch(0.955 0.004 106);
  --sidebar-primary: oklch(0.695 0.195 48);
  --sidebar-primary-foreground: oklch(0.098 0.003 264);
  --sidebar-accent: oklch(0.185 0.005 264);
  --sidebar-accent-foreground: oklch(0.955 0.004 106);
  --sidebar-border: oklch(1 0 0 / 8%);
  --sidebar-ring: oklch(0.695 0.195 48);
}

.dark {
  --background: oklch(0.098 0.003 264);
  --foreground: oklch(0.955 0.004 106);
  --card: oklch(0.17 0.005 264);
  --card-foreground: oklch(0.955 0.004 106);
  --popover: oklch(0.145 0.004 264);
  --popover-foreground: oklch(0.955 0.004 106);
  --primary: oklch(0.695 0.195 48);
  --primary-foreground: oklch(0.098 0.003 264);
  --secondary: oklch(0.185 0.005 264);
  --secondary-foreground: oklch(0.955 0.004 106);
  --muted: oklch(0.185 0.005 264);
  --muted-foreground: oklch(0.62 0.01 264);
  --accent: oklch(0.74 0.155 52);
  --accent-foreground: oklch(0.098 0.003 264);
  --destructive: oklch(0.62 0.22 25);
  --border: oklch(1 0 0 / 12%);
  --input: oklch(1 0 0 / 14%);
  --ring: oklch(0.695 0.195 48);
  --chart-1: oklch(0.695 0.195 48);
  --chart-2: oklch(0.60 0.14 264);
  --chart-3: oklch(0.74 0.155 52);
  --chart-4: oklch(0.50 0.12 264);
  --chart-5: oklch(0.80 0.12 60);
  --sidebar: oklch(0.145 0.004 264);
  --sidebar-foreground: oklch(0.955 0.004 106);
  --sidebar-primary: oklch(0.695 0.195 48);
  --sidebar-primary-foreground: oklch(0.098 0.003 264);
  --sidebar-accent: oklch(0.185 0.005 264);
  --sidebar-accent-foreground: oklch(0.955 0.004 106);
  --sidebar-border: oklch(1 0 0 / 8%);
  --sidebar-ring: oklch(0.695 0.195 48);
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  body {
    @apply bg-background text-foreground;
  }
  html {
    @apply font-sans;
  }
}

/* ── Background textures ─────────────────────────────────── */

/* Noise grain overlay — apply to a positioned container.
   Content inside must use z-10+ to sit above the grain. */
.bg-noise::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='a'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23a)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  pointer-events: none;
}

/* Constellation network — larger, more visible tiling network pattern */
.bg-network {
  background-image:
    /* Radial vignette for depth */
    radial-gradient(ellipse 80% 80% at 50% 50%, transparent 40%, oklch(0.06 0.002 264 / 60%) 100%),
    /* Cross lines at 30deg for angular variety */
    repeating-linear-gradient(
      30deg,
      oklch(1 0 0 / 2%) 0px,
      oklch(1 0 0 / 2%) 1px,
      transparent 1px,
      transparent 120px
    ),
    /* The main SVG constellation */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400' fill='none'%3E%3C!-- Primary nodes --%3E%3Ccircle cx='30' cy='50' r='2.5' fill='white' opacity='.22'/%3E%3Ccircle cx='144' cy='16' r='2' fill='white' opacity='.18'/%3E%3Ccircle cx='276' cy='84' r='2.5' fill='white' opacity='.2'/%3E%3Ccircle cx='330' cy='170' r='2' fill='white' opacity='.16'/%3E%3Ccircle cx='90' cy='150' r='2' fill='white' opacity='.18'/%3E%3Ccircle cx='210' cy='196' r='2.5' fill='white' opacity='.2'/%3E%3Ccircle cx='50' cy='270' r='2' fill='white' opacity='.18'/%3E%3Ccircle cx='170' cy='316' r='2.5' fill='white' opacity='.22'/%3E%3Ccircle cx='310' cy='290' r='2' fill='white' opacity='.16'/%3E%3Ccircle cx='236' cy='356' r='2' fill='white' opacity='.18'/%3E%3Ccircle cx='104' cy='376' r='2' fill='white' opacity='.2'/%3E%3Ccircle cx='350' cy='44' r='2' fill='white' opacity='.16'/%3E%3Ccircle cx='380' cy='200' r='2' fill='white' opacity='.14'/%3E%3Ccircle cx='0' cy='200' r='2' fill='white' opacity='.14'/%3E%3Ccircle cx='200' cy='0' r='2' fill='white' opacity='.16'/%3E%3Ccircle cx='200' cy='400' r='2' fill='white' opacity='.16'/%3E%3C!-- Secondary micro-nodes --%3E%3Ccircle cx='350' cy='44' r='1' fill='white' opacity='.12'/%3E%3Ccircle cx='60' cy='120' r='1.2' fill='white' opacity='.14'/%3E%3Ccircle cx='280' cy='140' r='1' fill='white' opacity='.1'/%3E%3Ccircle cx='160' cy='240' r='1.2' fill='white' opacity='.12'/%3E%3Ccircle cx='340' cy='340' r='1' fill='white' opacity='.1'/%3E%3Ccircle cx='80' cy='350' r='1.2' fill='white' opacity='.12'/%3E%3C!-- Connection lines --%3E%3Cline x1='30' y1='50' x2='144' y2='16' stroke='white' stroke-width='0.7' opacity='.14'/%3E%3Cline x1='144' y1='16' x2='276' y2='84' stroke='white' stroke-width='0.7' opacity='.13'/%3E%3Cline x1='276' y1='84' x2='330' y2='170' stroke='white' stroke-width='0.7' opacity='.14'/%3E%3Cline x1='90' y1='150' x2='210' y2='196' stroke='white' stroke-width='0.6' opacity='.12'/%3E%3Cline x1='210' y1='196' x2='330' y2='170' stroke='white' stroke-width='0.6' opacity='.11'/%3E%3Cline x1='50' y1='270' x2='170' y2='316' stroke='white' stroke-width='0.7' opacity='.14'/%3E%3Cline x1='170' y1='316' x2='310' y2='290' stroke='white' stroke-width='0.6' opacity='.12'/%3E%3Cline x1='0' y1='200' x2='90' y2='150' stroke='white' stroke-width='0.6' opacity='.11'/%3E%3Cline x1='310' y1='290' x2='380' y2='200' stroke='white' stroke-width='0.6' opacity='.12'/%3E%3Cline x1='200' y1='0' x2='144' y2='16' stroke='white' stroke-width='0.5' opacity='.1'/%3E%3Cline x1='104' y1='376' x2='200' y2='400' stroke='white' stroke-width='0.6' opacity='.11'/%3E%3Cline x1='30' y1='50' x2='90' y2='150' stroke='white' stroke-width='0.6' opacity='.12'/%3E%3Cline x1='50' y1='270' x2='0' y2='200' stroke='white' stroke-width='0.5' opacity='.1'/%3E%3Cline x1='236' y1='356' x2='310' y2='290' stroke='white' stroke-width='0.6' opacity='.11'/%3E%3Cline x1='236' y1='356' x2='200' y2='400' stroke='white' stroke-width='0.5' opacity='.1'/%3E%3Cline x1='350' y1='44' x2='276' y2='84' stroke='white' stroke-width='0.5' opacity='.1'/%3E%3Cline x1='350' y1='44' x2='380' y2='200' stroke='white' stroke-width='0.5' opacity='.1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 400px 400px, 120px 120px, 400px 400px;
}

/* Engineering-style line grid */
.bg-grid-lines {
  background-image:
    linear-gradient(oklch(1 0 0 / 4%) 1px, transparent 1px),
    linear-gradient(90deg, oklch(1 0 0 / 4%) 1px, transparent 1px);
  background-size: 64px 64px;
}

/* ── Entrance animations ─────────────────────────────────── */

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.animate-fade-in-up {
  animation: fade-in-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.animate-fade-in {
  animation: fade-in 0.6s ease both;
}

.anim-delay-1 { animation-delay: 80ms; }
.anim-delay-2 { animation-delay: 160ms; }
.anim-delay-3 { animation-delay: 240ms; }
.anim-delay-4 { animation-delay: 320ms; }
.anim-delay-5 { animation-delay: 400ms; }
.anim-delay-6 { animation-delay: 500ms; }
.anim-delay-7 { animation-delay: 600ms; }
