/* Legion's Lab - Matrix Dark Theme + Interactive Demos
   Industry standard: semantic CSS, mobile-first, no frameworks, performant animations */

/* Reset & base - kept from your original, upgraded to pure Matrix black/green */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Courier New', Courier, monospace;
  background-color: #000000;        /* Pure black - Matrix void */
  color: #00ff00;                   /* Classic Matrix green text */
  line-height: 1.6;
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

/* ensure canvas sits behind content and covers the screen */
#canvas {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: -1; /* behind page content */
  display: block;
  background: transparent; /* we'll paint black in JS */
}

/* ensure the demo section content is above the canvas */
.demos-section {
  position: relative;
  z-index: 1;
}

/* Header & nav - enhanced glow */
header {
  text-align: center;
  margin-bottom: 3rem;
  border-bottom: 2px solid #00ff41; /* Brighter green border */
  padding-bottom: 1rem;
}

h1 {
  font-size: 3rem;
  color: #00ff41;                   /* Bright green */
  text-shadow: 0 0 10px #00ff41,
               0 0 20px #00ff41,
               0 0 30px #00ff41;   /* Triple glow layers */
}

nav a {
  color: #00ff9d;                   /* Lighter green links */
  margin: 0 1rem;
  text-decoration: none;
  transition: all 0.3s ease;
}

nav a:hover {
  color: #00ff41;
  text-shadow: 0 0 15px #00ff41;
  text-decoration: underline;
}

/* Sections - consistent Matrix styling */
section {
  margin: 3rem 0;
}

h2 {
  color: #00ff41;
  margin-bottom: 1rem;
  border-bottom: 2px solid #00ff41;
  display: inline-block;
  text-shadow: 0 0 10px #00ff41;
  padding-bottom: 0.5rem;
}

main {
  background: rgba(0, 0, 0, 0.9);   /* Subtle black overlay */
  padding: 2rem;
  border: 1px solid #004d00;        /* Dark green edge */
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0, 255, 65, 0.1); /* Outer glow */
}

ul {
  list-style: none;
}

ul li {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
  color: #00ff9d;                   /* Lighter green list items */
}

ul li::before {
  content: ">";
  position: absolute;
  left: 0;
  color: #00ff41;
  text-shadow: 0 0 5px #00ff41;
}

/* Footer */
footer {
  text-align: center;
  margin-top: 4rem;
  font-size: 0.9rem;
  opacity: 0.8;
  color: #00cc00;                   /* Muted green */
  border-top: 1px solid #004d00;
  padding-top: 1rem;
}

/* Demos section - new Matrix-styled showcase */
.demos-section {
  padding: 4rem 2rem;
  text-align: center;
}

.demo-card {
  background: #0a0a0a;              /* Near-black cards */
  border: 1px solid #004d00;
  border-radius: 8px;
  padding: 2rem;
  margin: 2rem auto;
  max-width: 800px;
  box-shadow: 0 0 15px rgba(0, 255, 65, 0.3); /* Green glow */
  transition: box-shadow 0.3s ease;
}

.demo-card:hover {
  box-shadow: 0 0 25px rgba(0, 255, 65, 0.5);
}

.full-width {
  max-width: 1000px;
}

/* 3D Hover Cards - Codrops-inspired transforms */
.cards-container {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.card {
  width: 220px;
  height: 140px;
  background: #111;
  border: 2px solid #00ff9d;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #00ff00;
  transition: all 0.4s ease;
  transform-style: preserve-3d;
  perspective: 1000px;
  box-shadow: 0 0 10px rgba(0, 255, 157, 0.4);
}

.card:hover {
  transform: rotateY(15deg) rotateX(10deg) scale(1.05);
  box-shadow: 0 15px 30px rgba(0, 255, 157, 0.6),
              inset 0 0 10px rgba(0, 255, 157, 0.2);
}

/* Terminal Demo - pure Matrix terminal look */
.terminal {
  background: #000;
  color: #00ff00;
  font-family: 'Courier New', monospace;
  padding: 1.5rem;
  height: 300px;
  overflow-y: auto;
  text-align: left;
  border: 1px solid #004d00;
  white-space: pre-wrap;
  font-size: 1rem;
  line-height: 1.4;
  box-shadow: inset 0 0 20px rgba(0, 255, 0, 0.15),
              0 0 15px rgba(0, 255, 0, 0.2);
}

/* Glitch Text Effect - Codrops-style distortion */
.glitch {
  font-size: 3rem;
  color: #00ff00;
  position: relative;
  display: inline-block;
  text-shadow: 0 0 5px #00ff00,
               0 0 10px #00ff00,
               0 0 20px #00ff00;
  animation: glitch-skew 1s infinite linear alternate-reverse;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}

.glitch::before {
  left: 2px;
  text-shadow: -2px 0 #ff00c1;     /* Magenta glitch layer */
  animation: glitch-anim 2s infinite linear alternate-reverse;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.glitch::after {
  left: -2px;
  text-shadow: 2px 0 #00ffff;      /* Cyan glitch layer */
  animation: glitch-anim2 3s infinite linear alternate-reverse;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

@keyframes glitch-anim {
  0% { clip-path: polygon(0 2%, 100% 2%, 100% 5%, 0 5%); }
  10% { clip-path: polygon(0 15%, 100% 15%, 100% 15%, 0 15%); }
  20% { clip-path: polygon(0 30%, 100% 30%, 100% 35%, 0 35%); }
}

@keyframes glitch-anim2 {
  0% { clip-path: polygon(0 25%, 100% 25%, 100% 30%, 0 30%); }
  15% { clip-path: polygon(0 45%, 100% 45%, 100% 50%, 0 50%); }
  30% { clip-path: polygon(0 60%, 100% 60%, 100% 65%, 0 65%); }
}

@keyframes glitch-skew {
  0%, 100% { transform: skew(0deg); }
  10% { transform: skew(2deg); }
  20% { transform: skew(-2deg); }
  30% { transform: skew(1deg); }
}

/* Responsive - mobile-first industry std */
@media (max-width: 768px) {
  body { padding: 1rem; }
  h1 { font-size: 2rem; }
  .cards-container { flex-direction: column; align-items: center; }
  .card { width: 90%; max-width: 300px; }
  .glitch { font-size: 2rem; }
}