/* ==========================================================================
   SPIDER-VERSE DESIGN SYSTEM — CORE STYLES & RESET
   Based on design.md & PRD.md
   ========================================================================== */

:root {
  /* Core Color Palette */
  --spider-red: #E11D2E;
  --spider-red-glow: rgba(225, 29, 46, 0.4);
  --spider-red-dark: #991B1B;
  --spider-blue: #0A4DFF;
  --spider-blue-glow: rgba(10, 77, 255, 0.35);
  --multiverse-purple: #7C3AED;
  --multiverse-purple-glow: rgba(124, 58, 237, 0.35);
  --venom-black: #050505;
  --dark-surface: #111111;
  --surface-elevated: #18181B;
  --surface-border: rgba(255, 255, 255, 0.09);
  --surface-border-hover: rgba(225, 29, 46, 0.4);
  
  /* Text */
  --text-primary: #FFFFFF;
  --text-secondary: #A1A1AA;
  --text-muted: #71717A;

  /* Accent status colors */
  --threat-omega: #10B981;
  --threat-catastrophic: #DC2626;
  --threat-severe: #F59E0B;
  --threat-high: #EAB308;
  --threat-moderate: #3B82F6;

  /* Typography */
  --font-display: 'Bebas Neue', 'Impact', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Space Grotesk', 'JetBrains Mono', monospace;

  /* Border Radii */
  --radius-card: 24px;
  --radius-button: 999px;
  --radius-image: 28px;
  --radius-container: 36px;
  --radius-pill: 100px;

  /* Shadows */
  --shadow-main: 0 20px 60px rgba(0, 0, 0, 0.7);
  --shadow-red-glow: 0 0 45px rgba(225, 29, 46, 0.35);
  --shadow-blue-glow: 0 0 45px rgba(10, 77, 255, 0.35);
  --shadow-purple-glow: 0 0 45px rgba(124, 58, 237, 0.35);

  /* Transitions */
  --transition-fast: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Global Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-body);
  background-color: var(--venom-black);
  color: var(--text-primary);
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.section-anchor {
  position: relative;
  top: -80px;
  visibility: hidden;
  pointer-events: none;
}

body {
  position: relative;
  background-color: var(--venom-black);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  cursor: default;
}

/* Subtle Comic Halftone & Grain Overlay */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 900;
  opacity: 0.035;
  background-image: radial-gradient(rgba(255, 255, 255, 0.6) 1px, transparent 1px);
  background-size: 4px 4px;
}

/* Background Interactive Canvas */
#spider-universe-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* Custom Selection */
::selection {
  background: var(--spider-red);
  color: #FFFFFF;
}

/* Typography Defaults */
h1, h2, h3, .font-display {
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 0.95;
}

p {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.7;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
  user-select: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* Container & Layout */
.container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 2rem;
}

@media (max-width: 768px) {
  .container {
    padding: 0 1.25rem;
  }
}

/* Section Common Structure */
.section {
  position: relative;
  padding: 8rem 0;
  z-index: 20;
}

@media (max-width: 768px) {
  .section {
    padding: 5rem 0;
  }
}

/* Section Header Tags (Marvel Style) */
.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem 1rem;
  background: rgba(225, 29, 46, 0.12);
  border: 1px solid rgba(225, 29, 46, 0.28);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--spider-red);
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.section-tag .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--spider-red);
  box-shadow: 0 0 10px var(--spider-red);
  animation: pulseDot 2s infinite ease-in-out;
}

.section-title {
  font-size: clamp(2.8rem, 6vw, 4.8rem);
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.section-title span.highlight {
  color: var(--spider-red);
  text-shadow: 0 0 35px var(--spider-red-glow);
}

.section-subtitle {
  font-size: clamp(1rem, 1.3vw, 1.2rem);
  max-width: 680px;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* Custom Spider-Sense Cursor */
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--spider-red);
  box-shadow: 0 0 15px var(--spider-red);
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s, background-color 0.2s, opacity 0.2s;
}

.cursor-follower {
  position: fixed;
  top: 0;
  left: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(225, 29, 46, 0.5);
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: transform 0.08s ease-out, width 0.2s, height 0.2s, border-color 0.2s;
}

/* Spider-Sense Radiation Lines around cursor */
.spider-sense-rays {
  position: absolute;
  inset: -14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  background: 
    conic-gradient(from 0deg, transparent 0deg 30deg, var(--spider-red) 32deg, transparent 34deg 80deg, 
    var(--spider-red) 82deg, transparent 84deg 140deg, var(--spider-red) 142deg, transparent 144deg 200deg,
    var(--spider-red) 202deg, transparent 204deg 260deg, var(--spider-red) 262deg, transparent 264deg 320deg,
    var(--spider-red) 322deg, transparent 324deg 360deg);
  border-radius: 50%;
  mask-image: radial-gradient(circle, transparent 60%, black 100%);
  -webkit-mask-image: radial-gradient(circle, transparent 60%, black 100%);
}

body.cursor-hover .custom-cursor {
  width: 8px;
  height: 8px;
  background: #FFFFFF;
}

body.cursor-hover .cursor-follower {
  width: 58px;
  height: 58px;
  border-color: var(--spider-red);
  background: rgba(225, 29, 46, 0.08);
}

body.cursor-hover .spider-sense-rays {
  opacity: 0.85;
  animation: rotateRays 4s linear infinite;
}

@media (pointer: coarse) {
  .custom-cursor, .cursor-follower {
    display: none !important;
  }
}
