/*
 * NEW CONSENSUS — DESIGN SYSTEM TOKENS
 * Single source of truth for all pages. index.html inlines this same system.
 * Link as the first stylesheet on every page (except index.html which is self-contained).
 */

/* ============================================================
   FONTS
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&family=VT323&display=swap');


/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  /* Fonts */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  /* Backgrounds */
  --black:         #0a0a0a;
  --gray-900:      #111111;
  --gray-800:      #1a1a1a;
  --gray-700:      #222222;
  --gray-600:      #333333;
  --gray-500:      #505050;
  --gray-400:      #707070;
  --gray-300:      #909090;
  --gray-200:      #a0a0a0;
  --gray-100:      #e0e0e0;
  --white:         #ffffff;

  --surface-900:   #141414;
  --surface-850:   #161616;
  --surface-800:   #1d1d1d;
  --border-subtle: #2a2a2a;

  --surface-white-02: rgba(255, 255, 255, 0.02);
  --surface-white-03: rgba(255, 255, 255, 0.03);
  --border-white-06:  rgba(255, 255, 255, 0.06);
  --border-white-08:  rgba(255, 255, 255, 0.08);
  --border-white-12:  rgba(255, 255, 255, 0.12);

  /* Text */
  --text-primary:   #ffffff;
  --text-secondary: #e0e0e0;
  --text-body:      rgba(255, 255, 255, 0.65);
  --text-muted:     #a0a0a0;
  --text-dim:       #909090;
  --text-white-65:  rgba(255, 255, 255, 0.65);

  /* Accent — overridden at runtime by random palette picker in shared-layout.js */
  --accent:    #e7ff00;

  /* Red scale — overridden by palette picker on load */
  --red-500:   #e7ff00;
  --red-400:   #f7ff70;
  --red-300:   #fbff9e;

  /* Full palette (for palette picker) */
  --palette-red-500:    #ff2020;
  --palette-red-400:    #ff4040;
  --palette-red-300:    #ff6060;
  --palette-blue-500:   #0000cc;
  --palette-blue-400:   #0000ff;
  --palette-blue-300:   #3366ff;
  --palette-purple-500: #8b5cf6;
  --palette-purple-400: #a78bfa;
  --palette-purple-300: #c4b5fd;
  --palette-yellow-500: #fff700;
  --palette-yellow-400: #ffec4c;
  --palette-yellow-300: #ffe88c;
  --purple-300:         #c4b5fd;
  --purple-400-soft:    rgba(167, 139, 250, 0.08);
  --amber-500:          #e8b84a;
  --cyan-500:           #00ffff;

  /* Crisis page colors */
  --crisis-ai:      rgb(245, 200, 66);
  --crisis-climate: rgb(74, 222, 128);
  --crisis-fascism: rgb(248, 113, 113);

  /* Two-futures cards */
  --end-rail:         #8b0000;
  --end-rail-glow:    rgba(139, 0, 0, 0.2);
  --begin-rail:       #004d00;
  --begin-rail-corner: #0f6a2e;
  --begin-rail-glow:  rgba(0, 77, 0, 0.22);
  --end-accent:       #ff5b5b;
  --begin-accent:     #5ab86a;

  /* Panic glow */
  --panic-glow-10: rgba(255, 32, 32, 0.10);
  --panic-glow-15: rgba(255, 32, 32, 0.15);
  --panic-glow-20: rgba(255, 32, 32, 0.20);
  --panic-glow-30: rgba(255, 32, 32, 0.30);
  --panic-glow-40: rgba(255, 32, 32, 0.40);
  --panic-glow-50: rgba(255, 32, 32, 0.50);

  /* Flip card */
  --flip-face-grad-start: rgba(12, 12, 12, 0.96);
  --flip-face-grad-end:   rgba(18, 18, 18, 0.9);
  --shadow-card-hover:    0 8px 30px rgba(0, 0, 0, 0.4);
  --overlay-black-10:     rgba(0, 0, 0, 0.1);

  /* Spacing — 4px base unit */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-30: 120px;

  /* Layout */
  --max-width-content:        1280px;
  --nav-height:               64px;
  --space-section-horizontal: 40px;

  /* Borders & radius */
  --radius-none: 0px;
  --radius-sm:   2px;
  --radius-md:   6px;
  --radius-lg:   8px;
  --radius-xl:   14px;
  --radius-pill: 100px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-med:  0.25s ease;
}


/* ============================================================
   BASE RESET
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--black);
  color: var(--gray-100);
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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


/* ============================================================
   COMMON ANIMATIONS
   ============================================================ */
@keyframes flicker {
  0%, 95%, 100% { opacity: 1; }
  96%, 99%      { opacity: 0.85; }
  97%           { opacity: 0.7; }
}

@keyframes blink {
  0%, 49%   { opacity: 1; }
  50%, 100% { opacity: 0; }
}

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

@keyframes pulseGlow {
  0%, 100% {
    box-shadow:
      0 0 20px var(--panic-glow-40),
      0 0 40px var(--panic-glow-30),
      0 0 60px var(--panic-glow-20),
      0 0 80px var(--panic-glow-10);
  }
  50% {
    box-shadow:
      0 0 30px var(--panic-glow-50),
      0 0 50px var(--panic-glow-40),
      0 0 70px var(--panic-glow-30),
      0 0 100px var(--panic-glow-15);
  }
}

@keyframes rgbSplit {
  0%, 88%, 100% { text-shadow: none; }
  90%           { text-shadow: -2px 0 var(--red-400), 2px 0 var(--cyan-500); }
  94%           { text-shadow: 2px 0 var(--red-400), -2px 0 var(--cyan-500); }
}

@keyframes trackingError {
  0%, 85%, 100% { transform: translateX(0); opacity: 1; }
  87%           { transform: translateX(-50px); opacity: 0.5; }
  89%           { transform: translateX(30px); opacity: 0.7; }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 8px var(--red-500), 0 0 16px var(--red-500); }
  50%      { box-shadow: 0 0 16px var(--red-500), 0 0 32px var(--red-500); }
}

@keyframes glitchIn {
  0%   { clip-path: inset(40% 0 61% 0); transform: translate(-20px) skewX(-10deg); }
  20%  { clip-path: inset(92% 0 1% 0);  transform: translate(20px) skewX(10deg); }
  40%  { clip-path: inset(43% 0 1% 0);  transform: translate(-10px); }
  60%  { clip-path: inset(25% 0 58% 0); transform: translate(10px) skewX(5deg); }
  80%  { clip-path: inset(54% 0 7% 0);  transform: translate(-5px); }
  100% { clip-path: inset(0 0 0 0);     transform: translate(0); }
}

@keyframes scanBarMove {
  from { top: -8px; }
  to   { top: 100vh; }
}


/* ============================================================
   VHS OVERLAY
   ============================================================ */
.scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    var(--overlay-black-10) 2px,
    var(--overlay-black-10) 4px
  );
  pointer-events: none;
  z-index: 1000;
}

.scan-bar {
  position: fixed;
  left: 0;
  right: 0;
  height: 8px;
  background: linear-gradient(transparent, var(--surface-white-03), transparent);
  animation: scanBarMove 6s linear infinite;
  pointer-events: none;
  z-index: 1001;
}

.vhs-timestamp {
  position: fixed;
  top: 20px;
  right: 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--red-500);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rec-dot {
  width: 8px;
  height: 8px;
  background: var(--red-500);
  border-radius: 50%;
  animation: blink 1s infinite;
}


/* ============================================================
   HERO — shared pattern
   ============================================================ */
.hero {
  padding: 120px 40px 80px;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--red-300);
  margin-bottom: 20px;
}

.hero-headline {
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 600;
  color: var(--white);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

.hero-subhead {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--gray-200);
  line-height: 1.9;
  max-width: 80ch;
  margin-bottom: 40px;
}

.hero-lead {
  font-family: var(--font-mono);
  font-size: clamp(18px, 2vw, 22px);
  color: var(--white);
  line-height: 1.5;
  margin-bottom: 32px;
  max-width: 80ch;
}


/* ============================================================
   CTA BUTTONS
   ============================================================ */
.cta-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.cta {
  padding: 16px 32px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  transition: all var(--transition-fast);
  display: inline-block;
}

.cta-primary {
  background: var(--red-500);
  border-color: var(--red-500);
  color: var(--white);
}

.cta-primary:hover {
  background: var(--red-400);
  border-color: var(--red-400);
}

.cta-secondary {
  background: transparent;
  border-color: var(--gray-500);
  color: var(--gray-200);
}

.cta-secondary:hover {
  border-color: var(--red-500);
  color: var(--red-400);
}


/* ============================================================
   SECTIONS
   ============================================================ */
.section {
  padding: 80px var(--space-section-horizontal);
  border-top: 1px solid var(--gray-800);
}

.section-head {
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 500;
  color: var(--white);
  margin-bottom: 24px;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.section-body {
  font-size: 16px;
  color: var(--gray-300);
  line-height: 1.8;
  max-width: 680px;
}

.section-body strong {
  color: var(--gray-100);
  font-weight: 500;
}

.section-body em {
  color: var(--red-300);
  font-style: normal;
}

.section-body p + p {
  margin-top: 24px;
}


/* ============================================================
   CARD — base pattern
   ============================================================ */
.card {
  background: var(--surface-white-02);
  border: 1px solid var(--border-white-08);
  padding: 28px;
  transition: all var(--transition-med);
}

.card:hover {
  border-color: var(--red-500);
  background: var(--surface-850);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
}

.card-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.card-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--gray-100);
  margin-bottom: 12px;
}

.card-desc {
  font-size: 14px;
  color: var(--text-white-65);
  line-height: 1.7;
}

.card-link {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  display: inline-block;
  margin-top: auto;
  padding-top: 28px;
}


/* ============================================================
   EYEBROW LABEL
   ============================================================ */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-5);
}


/* ============================================================
   SCROLL FADE — add class="fade-up", JS adds "visible"
   ============================================================ */
.fade-up {
  opacity: 1;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .fade-up { opacity: 1; transform: none; transition: none; }
}


/* ============================================================
   GLITCH / PANIC OVERLAY — shared across pages
   ============================================================ */
.glitch-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--black);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 40px;
  text-align: center;
}

.glitch-overlay.active {
  display: flex;
  animation: glitchIn 0.3s ease-out;
}

.emergency-text {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--red-500);
  text-transform: uppercase;
  letter-spacing: 6px;
  margin-bottom: 48px;
  animation: blink 0.8s infinite;
}

.countdown-big {
  font-family: var(--font-mono);
  font-size: clamp(60px, 15vw, 120px);
  color: var(--white);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.countdown-label-big {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--gray-500);
  margin-top: 16px;
  text-transform: lowercase;
}

.panic-subtext {
  font-size: 15px;
  color: var(--gray-400);
  max-width: 440px;
  margin-top: 48px;
  line-height: 1.8;
}

.panic-subtext strong {
  color: var(--white);
}

.close-glitch {
  position: absolute;
  top: 24px;
  right: 24px;
  background: none;
  border: 1px solid var(--gray-600);
  color: var(--gray-400);
  padding: 10px 20px;
  font-size: 12px;
  font-family: var(--font-mono);
  transition: all var(--transition-fast);
}

.close-glitch:hover {
  border-color: var(--red-500);
  color: var(--red-400);
}


/* ============================================================
   RESPONSIVE BASE
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --space-section-horizontal: 24px;
  }

  .section {
    padding: 60px 24px;
  }

  .hero {
    padding: 80px 24px 48px;
  }

  .hero-headline {
    font-size: clamp(32px, 10vw, 56px);
  }

  .hero-subhead {
    max-width: 100%;
    font-size: 14px;
    line-height: 1.75;
  }
}

@media (max-width: 480px) {
  .cta-row {
    flex-direction: column;
  }

  .cta {
    width: 100%;
    text-align: center;
  }
}
