/* ═══════════════════════════════════════════════════════════
   SWARM — 8-Bit Retro Arcade Stylesheet
   Inspired by Space Invaders, Pac-Man & the golden arcade era
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

:root {
  --neon-green:   #39ff14;
  --neon-cyan:    #00ffff;
  --neon-magenta: #ff00ff;
  --neon-yellow:  #ffe600;
  --neon-red:     #ff3131;
  --neon-orange:  #ff8c00;
  --neon-blue:    #4d4dff;
  --ghost-pink:   #ffb8ff;
  --ghost-red:    #ff0000;
  --ghost-cyan:   #00ffff;
  --ghost-orange: #ffb852;
  --bg-dark:      #0a0a0a;
  --bg-cabinet:   #111111;
  --border-pixel: #333333;
  --text-dim:     #666666;
  --text-body:    #cccccc;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Press Start 2P', monospace;
  background: var(--bg-dark);
  color: var(--text-body);
  line-height: 2;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ── CRT Screen Effect ─────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.15) 0px,
    rgba(0,0,0,0.15) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 9999;
}

body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 60%,
    rgba(0,0,0,0.4) 100%
  );
  pointer-events: none;
  z-index: 9998;
}

/* ── Screen Wrapper ────────────────────────────────────────── */
.screen {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  position: relative;
}

/* ── Pixel Border Box ──────────────────────────────────────── */
.pixel-box {
  border: 4px solid var(--neon-cyan);
  padding: 1.5rem;
  margin: 1.5rem 0;
  position: relative;
  background: rgba(0, 255, 255, 0.03);
  image-rendering: pixelated;
}

.pixel-box::before {
  content: '';
  position: absolute;
  top: -8px; left: -8px; right: -8px; bottom: -8px;
  border: 2px solid rgba(0, 255, 255, 0.2);
  pointer-events: none;
}

.pixel-box--green  { border-color: var(--neon-green); background: rgba(57, 255, 20, 0.03); }
.pixel-box--green::before { border-color: rgba(57, 255, 20, 0.2); }
.pixel-box--magenta { border-color: var(--neon-magenta); background: rgba(255, 0, 255, 0.03); }
.pixel-box--magenta::before { border-color: rgba(255, 0, 255, 0.2); }
.pixel-box--yellow { border-color: var(--neon-yellow); background: rgba(255, 230, 0, 0.03); }
.pixel-box--yellow::before { border-color: rgba(255, 230, 0, 0.2); }
.pixel-box--red { border-color: var(--neon-red); background: rgba(255, 49, 49, 0.03); }
.pixel-box--red::before { border-color: rgba(255, 49, 49, 0.2); }

/* ── Navigation ────────────────────────────────────────────── */
.nav-bar {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem 0;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--border-pixel);
  margin-bottom: 2rem;
}

.nav-link {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.65rem;
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.6rem 1rem;
  border: 2px solid var(--border-pixel);
  transition: all 0.1s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
}

.nav-link:hover,
.nav-link--active {
  color: var(--neon-yellow);
  border-color: var(--neon-yellow);
  box-shadow: 0 0 10px rgba(255, 230, 0, 0.3);
}

.nav-link::before {
  content: '> ';
  opacity: 0;
  transition: opacity 0.1s;
}

.nav-link:hover::before,
.nav-link--active::before {
  opacity: 1;
}

/* ── Headings ──────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: 'Press Start 2P', monospace;
  text-transform: uppercase;
}

h1 {
  font-size: 1.8rem;
  color: var(--neon-green);
  text-shadow: 0 0 20px rgba(57, 255, 20, 0.5), 0 0 40px rgba(57, 255, 20, 0.2);
  text-align: center;
  margin-bottom: 0.5rem;
  letter-spacing: 0.15em;
}

h2 {
  font-size: 1rem;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px dashed var(--border-pixel);
}

h3 {
  font-size: 0.75rem;
  color: var(--neon-yellow);
  margin: 1.5rem 0 0.75rem;
}

h4 {
  font-size: 0.65rem;
  color: var(--neon-magenta);
  margin: 1rem 0 0.5rem;
}

/* ── Typography ────────────────────────────────────────────── */
p {
  font-size: 0.6rem;
  margin-bottom: 1rem;
  line-height: 2.2;
}

.subtitle {
  text-align: center;
  color: var(--neon-cyan);
  font-size: 0.55rem;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
  letter-spacing: 0.1em;
  margin-bottom: 2rem;
}

.blink {
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ── Pac-Dots List ─────────────────────────────────────────── */
.pac-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.pac-list li {
  font-size: 0.6rem;
  padding: 0.4rem 0 0.4rem 1.5rem;
  position: relative;
  line-height: 2;
}

.pac-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: var(--neon-yellow);
  border-radius: 50%;
}

.pac-list li:nth-child(4n+2)::before { background: var(--ghost-pink); }
.pac-list li:nth-child(4n+3)::before { background: var(--neon-cyan); }
.pac-list li:nth-child(4n+4)::before { background: var(--ghost-orange); }

/* ── Code Blocks ───────────────────────────────────────────── */
code {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.55rem;
  background: rgba(57, 255, 20, 0.1);
  color: var(--neon-green);
  padding: 0.15rem 0.4rem;
  border: 1px solid rgba(57, 255, 20, 0.3);
}

pre {
  background: #050505;
  border: 2px solid var(--neon-green);
  padding: 1.2rem;
  margin: 1rem 0;
  overflow-x: auto;
  position: relative;
}

pre::before {
  content: '>';
  color: var(--neon-green);
  position: absolute;
  top: 0.4rem;
  left: 0.5rem;
  animation: blink 1s step-end infinite;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.55rem;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  display: block;
  padding-left: 1rem;
  white-space: pre;
  line-height: 2.4;
  color: var(--neon-green);
}

/* ── Space Invader Logo (CSS pixel art) ────────────────────── */
.invader {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
}

.invader-grid {
  display: grid;
  grid-template-columns: repeat(11, 8px);
  grid-template-rows: repeat(8, 8px);
  gap: 0;
  image-rendering: pixelated;
}

.invader-grid .px {
  width: 8px;
  height: 8px;
}

.invader-grid .px-on  { background: var(--neon-green); box-shadow: 0 0 4px rgba(57,255,20,0.5); }
.invader-grid .px-off { background: transparent; }

/* ── Pipeline Flow ─────────────────────────────────────────── */
.pipeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.pipeline-stage {
  font-size: 0.55rem;
  padding: 0.5rem 0.8rem;
  border: 2px solid;
  text-align: center;
  min-width: 80px;
  text-transform: uppercase;
}

.pipeline-stage--scope   { border-color: var(--neon-cyan); color: var(--neon-cyan); }
.pipeline-stage--dev     { border-color: var(--neon-green); color: var(--neon-green); }
.pipeline-stage--review  { border-color: var(--neon-yellow); color: var(--neon-yellow); }
.pipeline-stage--rework  { border-color: var(--neon-magenta); color: var(--neon-magenta); }
.pipeline-stage--done    { border-color: var(--neon-green); color: var(--neon-green); background: rgba(57,255,20,0.1); }

.pipeline-arrow {
  color: var(--text-dim);
  font-size: 0.7rem;
}

/* ── Agent Cards ───────────────────────────────────────────── */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.agent-card {
  border: 3px solid;
  padding: 1rem;
  text-align: center;
}

.agent-card h4 {
  margin: 0.5rem 0;
  font-size: 0.6rem;
}

.agent-card p {
  font-size: 0.5rem;
  color: var(--text-dim);
}

.agent-card--scope   { border-color: var(--neon-cyan); }
.agent-card--scope h4 { color: var(--neon-cyan); }
.agent-card--dev     { border-color: var(--neon-green); }
.agent-card--dev h4  { color: var(--neon-green); }
.agent-card--review  { border-color: var(--neon-yellow); }
.agent-card--review h4 { color: var(--neon-yellow); }
.agent-card--rework  { border-color: var(--neon-magenta); }
.agent-card--rework h4 { color: var(--neon-magenta); }

/* Ghost pixel art for agent cards */
.ghost {
  font-size: 2rem;
  line-height: 1;
  display: block;
  margin-bottom: 0.3rem;
}

/* ── Terminal Block ────────────────────────────────────────── */
.terminal {
  background: #050505;
  border: 3px solid var(--neon-green);
  border-radius: 0;
  padding: 1rem;
  margin: 1rem 0;
  position: relative;
}

.terminal-bar {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-pixel);
}

.terminal-dot {
  width: 8px;
  height: 8px;
  border-radius: 0;
}

.terminal-dot--red    { background: var(--neon-red); }
.terminal-dot--yellow { background: var(--neon-yellow); }
.terminal-dot--green  { background: var(--neon-green); }

.terminal-line {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.5rem;
  line-height: 2.4;
  color: var(--neon-green);
}

.terminal-line--dim { color: var(--text-dim); }
.terminal-line--cyan { color: var(--neon-cyan); }
.terminal-line--yellow { color: var(--neon-yellow); }
.terminal-line--magenta { color: var(--neon-magenta); }

/* ── High Score Table ──────────────────────────────────────── */
.score-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.55rem;
}

.score-table th {
  color: var(--neon-yellow);
  text-align: left;
  padding: 0.5rem;
  border-bottom: 2px solid var(--neon-yellow);
  font-size: 0.5rem;
  text-transform: uppercase;
}

.score-table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-pixel);
  line-height: 2;
}

.score-table tr:hover td {
  background: rgba(255, 230, 0, 0.05);
}

/* ── Insert Coin CTA ──────────────────────────────────────── */
.insert-coin {
  text-align: center;
  margin: 3rem 0;
}

.insert-coin a {
  display: inline-block;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7rem;
  color: var(--neon-yellow);
  text-decoration: none;
  border: 3px solid var(--neon-yellow);
  padding: 1rem 2rem;
  animation: coin-pulse 2s ease-in-out infinite;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.insert-coin a:hover {
  background: var(--neon-yellow);
  color: var(--bg-dark);
  box-shadow: 0 0 30px rgba(255, 230, 0, 0.5);
}

@keyframes coin-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 230, 0, 0.3); }
  50% { box-shadow: 0 0 25px rgba(255, 230, 0, 0.6); }
}

/* ── Starfield Background ──────────────────────────────────── */
.stars {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -1;
  overflow: hidden;
}

.star {
  position: absolute;
  background: white;
  border-radius: 0;
  animation: twinkle linear infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.8; }
}

/* ── Footer ────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 2rem 0;
  margin-top: 3rem;
  border-top: 2px solid var(--border-pixel);
  font-size: 0.45rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  line-height: 2.5;
}

.footer a {
  color: var(--neon-cyan);
  text-decoration: none;
}

.footer a:hover {
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
}

/* ── Step Numbers ──────────────────────────────────────────── */
.step {
  counter-increment: step-counter;
  position: relative;
  padding-left: 2.5rem;
  margin-bottom: 1.5rem;
}

.step::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.8rem;
  height: 1.8rem;
  border: 2px solid var(--neon-cyan);
  color: var(--neon-cyan);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.steps {
  counter-reset: step-counter;
}

/* ── Marquee Divider ───────────────────────────────────────── */
.marquee-divider {
  text-align: center;
  padding: 1rem 0;
  font-size: 0.5rem;
  color: var(--text-dim);
  letter-spacing: 0.5em;
  overflow: hidden;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 600px) {
  .screen { padding: 1rem; }
  h1 { font-size: 1.2rem; }
  .nav-bar { gap: 0.3rem; }
  .nav-link { font-size: 0.5rem; padding: 0.4rem 0.6rem; }
  .pipeline { flex-direction: column; }
  .pipeline-arrow { transform: rotate(90deg); }
  .invader-grid { grid-template-columns: repeat(11, 6px); grid-template-rows: repeat(8, 6px); }
  .invader-grid .px { width: 6px; height: 6px; }
}
