/* ============================================
   DESIGN SYSTEM
   High-contrast, disciplined, grid-based
   ============================================ */

:root {
  /* Color System */
  --color-black: #000000;
  --color-white: #FFFFFF;
  --color-blue: #0080FF;
  --color-gray-dark: #1A1A1A;
  --color-gray-mid: #666666;
  --color-gray-light: #E5E5E5;

  /* Spacing Scale (8px base) */
  --space-1: 0.5rem;   /* 8px */
  --space-2: 1rem;     /* 16px */
  --space-3: 1.5rem;   /* 24px */
  --space-4: 2rem;     /* 32px */
  --space-5: 3rem;     /* 48px */
  --space-6: 4rem;     /* 64px */
  --space-8: 6rem;     /* 96px */
  --space-12: 9rem;    /* 144px */

  /* Typography Scale */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace;

  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg: 1.125rem;   /* 18px */
  --text-xl: 1.25rem;    /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 2rem;      /* 32px */
  --text-4xl: 2.5rem;    /* 40px */
  --text-5xl: 3rem;      /* 48px */
  --text-6xl: 4rem;      /* 64px */

  /* Line Heights */
  --leading-tight: 1.2;
  --leading-snug: 1.4;
  --leading-normal: 1.6;
  --leading-relaxed: 1.8;

  /* Grid */
  --grid-max: 1200px;
  --grid-gutter: var(--space-4);
}

/* ============================================
   RESET & BASE
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-white);
  background-color: var(--color-black);
  overflow-x: hidden;
  position: relative;
}

.grid-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(0, 128, 255, 0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 128, 255, 0.3) 1px, transparent 1px);
  background-size: 50px 50px;
  z-index: 0;
  pointer-events: none;
}

@keyframes gridGlitch {
  0%, 80% {
    transform: translate(0, 0);
    opacity: 1;
    filter: none;
  }
  82% {
    transform: translate(5px, 5px);
    opacity: 1;
    filter: hue-rotate(0deg) saturate(3);
  }
  84% {
    transform: translate(-7px, 3px);
    opacity: 1;
    filter: hue-rotate(120deg) saturate(4);
  }
  86% {
    transform: translate(6px, -6px);
    opacity: 1;
    filter: hue-rotate(240deg) saturate(5);
  }
  88% {
    transform: translate(-5px, -4px);
    opacity: 1;
    filter: hue-rotate(180deg) saturate(4);
  }
  90% {
    transform: translate(3px, 2px);
    opacity: 1;
    filter: hue-rotate(60deg) saturate(3);
  }
  92% {
    transform: translate(-3px, 4px);
    opacity: 1;
    filter: hue-rotate(300deg) saturate(4);
  }
  94% {
    transform: translate(4px, -3px);
    opacity: 1;
    filter: hue-rotate(150deg) saturate(3);
  }
  96%, 100% {
    transform: translate(0, 0);
    opacity: 1;
    filter: none;
  }
}

@keyframes rgbGlitch {
  0%, 80% {
    text-shadow: none;
    filter: none;
  }
  82% {
    text-shadow:
      -5px 0 0 rgba(255, 0, 255, 1),
      5px 0 0 rgba(0, 255, 255, 1),
      0 0 20px rgba(255, 0, 0, 0.8);
    filter: hue-rotate(0deg) brightness(1.5);
  }
  84% {
    text-shadow:
      7px 0 0 rgba(255, 255, 0, 1),
      -7px 0 0 rgba(0, 255, 0, 1),
      0 0 30px rgba(0, 255, 255, 0.9);
    filter: hue-rotate(90deg) brightness(2);
  }
  86% {
    text-shadow:
      -6px 0 0 rgba(255, 0, 0, 1),
      6px 0 0 rgba(0, 255, 255, 1),
      0 -4px 0 rgba(255, 255, 0, 0.8),
      0 4px 0 rgba(255, 0, 255, 0.8),
      0 0 40px rgba(255, 255, 255, 1);
    filter: hue-rotate(180deg) saturate(3) brightness(2.5);
  }
  88% {
    text-shadow:
      8px 0 0 rgba(0, 255, 0, 1),
      -8px 0 0 rgba(255, 0, 255, 1),
      0 0 50px rgba(255, 255, 0, 1);
    filter: hue-rotate(270deg) saturate(4) brightness(2);
  }
  90% {
    text-shadow:
      -4px 0 0 rgba(255, 0, 255, 0.9),
      4px 0 0 rgba(0, 255, 255, 0.9),
      0 0 30px rgba(255, 255, 255, 0.8);
    filter: hue-rotate(45deg) saturate(2) brightness(1.8);
  }
  92% {
    text-shadow:
      6px 0 0 rgba(255, 100, 0, 1),
      -6px 0 0 rgba(0, 255, 200, 1),
      0 0 35px rgba(255, 0, 255, 0.9);
    filter: hue-rotate(315deg) saturate(3) brightness(2.2);
  }
  94% {
    text-shadow:
      -5px 0 0 rgba(100, 255, 0, 1),
      5px 0 0 rgba(255, 0, 100, 1),
      0 0 25px rgba(0, 255, 255, 0.8);
    filter: hue-rotate(135deg) saturate(3) brightness(1.9);
  }
  96%, 100% {
    text-shadow: none;
    filter: none;
  }
}

.glitch-text {
  animation: rgbGlitch 7s infinite;
  position: relative;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
}

h1 {
  font-size: var(--text-5xl);
  font-weight: 700;
}

h2 {
  font-size: var(--text-4xl);
}

h3 {
  font-size: var(--text-3xl);
}

h4 {
  font-size: var(--text-2xl);
}

p {
  line-height: var(--leading-relaxed);
}

a {
  color: var(--color-blue);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.7;
}

code, pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* ============================================
   LAYOUT
   ============================================ */

.container {
  max-width: var(--grid-max);
  margin: 0 auto;
  padding: 0 var(--grid-gutter);
  position: relative;
  z-index: 1;
}

.section {
  padding: var(--space-12) 0;
}

/* ============================================
   GRID SYSTEM
   ============================================ */

.grid {
  display: grid;
  gap: var(--grid-gutter);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  /* Stack hero section on mobile */
  .hero-grid {
    grid-template-columns: 1fr !important;
  }

  h1 {
    font-size: var(--text-4xl);
  }
}

/* ============================================
   UTILITIES
   ============================================ */

.blue {
  color: var(--color-blue);
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  letter-spacing: 0.02em;
}

.upper {
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.border-top {
  border-top: 1px solid var(--color-gray-dark);
}

.border-bottom {
  border-bottom: 1px solid var(--color-gray-dark);
}

/* Sharp edges, no border radius */
button,
input,
textarea,
select {
  border-radius: 0;
}

/* ============================================
   COMPONENTS
   ============================================ */

.btn {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-blue);
  color: var(--color-blue);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
}

.btn:hover {
  background: var(--color-blue);
  color: var(--color-black);
  opacity: 1;
}

/* ============================================
   ANIMATIONS
   (Only when reinforcing clarity)
   ============================================ */

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

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 10px var(--color-blue),
                0 0 20px var(--color-blue);
  }
  50% {
    box-shadow: 0 0 15px var(--color-blue),
                0 0 30px var(--color-blue);
  }
}

.btn-glow {
  animation: glow 2s ease-in-out infinite;
  will-change: box-shadow;
}
