:root {
  --bg: #000;
  --neon: #0f0;
  --neon-dim: rgba(0, 255, 0, 0.1);
  --text: #aaffaa;
  --font-head: "Space Grotesk", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  height: auto;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
}

#matrix-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.15;
  pointer-events: none;
}

.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.3) 3px
  );
  pointer-events: none;
  z-index: 50;
}

.vignette {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, transparent 50%, black 100%);
  pointer-events: none;
  z-index: 50;
}

.system-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 20px 40px;
  z-index: 100;
}
.back-link {
  text-decoration: none;
  color: var(--neon);
  font-weight: bold;
  text-shadow: 0 0 5px var(--neon);
}
.status-indicator {
  color: #555;
  font-size: 0.8rem;
}
.blink {
  color: var(--neon);
  animation: blink 1s infinite;
}

.grid-container {
  position: relative;
  z-index: 10;
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px 20px;
}

.header-glitch {
  text-align: center;
  margin-bottom: 4rem;
}

.glitch {
  font-size: 4rem;
  font-family: var(--font-head);
  color: var(--neon);
  text-transform: uppercase;
  position: relative;
  display: inline-block;
}
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
}
.glitch::before {
  left: 2px;
  text-shadow: -1px 0 red;
  clip: rect(44px, 450px, 56px, 0);
  animation: glitchAnim 5s infinite linear alternate-reverse;
}
.glitch::after {
  left: -2px;
  text-shadow: -1px 0 blue;
  clip: rect(44px, 450px, 56px, 0);
  animation: glitchAnim2 5s infinite linear alternate-reverse;
}

p {
  color: #555;
  letter-spacing: 2px;
  margin-top: 10px;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  width: 100%;
  max-width: 1000px;
  padding-bottom: 100px;
}

.tech-card {
  background: rgba(0, 20, 0, 0.6);
  border: 1px solid rgba(0, 255, 0, 0.3);
  padding: 2rem;
  position: relative;
  cursor: pointer;
  transition: 0.2s;
  backdrop-filter: blur(5px);
}

.tech-card:hover {
  background: rgba(0, 255, 0, 0.1);
  border-color: var(--neon);
  box-shadow: 0 0 15px var(--neon-dim);
  transform: scale(1.02);
}

.corner {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid var(--neon);
  transition: 0.3s;
}
.t-l {
  top: -1px;
  left: -1px;
  border-bottom: none;
  border-right: none;
}
.b-r {
  bottom: -1px;
  right: -1px;
  border-top: none;
  border-left: none;
}
.tech-card:hover .corner {
  width: 100%;
  height: 100%;
  opacity: 0.5;
}

.card-icon {
  font-size: 2.5rem;
  color: #444;
  margin-bottom: 1.5rem;
  transition: 0.3s;
}
.tech-card:hover .card-icon {
  color: var(--neon);
  text-shadow: 0 0 10px var(--neon);
}

.tech-card h3 {
  font-family: var(--font-head);
  letter-spacing: 1px;
  color: #fff;
  margin-bottom: 0.5rem;
}
.tech-card p {
  font-size: 0.75rem;
  color: #666;
  margin: 0;
  letter-spacing: 0;
}

.terminal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  backdrop-filter: blur(5px);
}
.terminal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.terminal-box {
  width: 90%;
  max-width: 700px;
  background: #050505;
  border: 2px solid var(--neon);
  box-shadow: 0 0 50px rgba(0, 255, 0, 0.1);
}

.term-header {
  background: var(--neon);
  color: #000;
  padding: 5px 15px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
}
#term-close {
  background: none;
  border: none;
  font-weight: bold;
  cursor: pointer;
  font-size: 1.2rem;
}
#term-close:hover {
  color: #fff;
}

.term-body {
  padding: 30px;
  min-height: 300px;
  font-size: 0.9rem;
}
.term-cursor {
  display: inline-block;
  animation: blink 0.8s infinite;
  color: var(--neon);
  font-weight: bold;
}

.resource-link {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: 10px;
  border-left: 2px solid #333;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  transition: 0.2s;
}
.resource-link:hover {
  border-left-color: var(--neon);
  color: var(--neon);
  background: rgba(0, 255, 0, 0.05);
}
.rec-tag {
  background: #333;
  color: #fff;
  font-size: 0.6rem;
  padding: 2px 5px;
  margin-right: 10px;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}
@keyframes glitchAnim {
  0% {
    clip: rect(44px, 450px, 56px, 0);
  }
  20% {
    clip: rect(8px, 450px, 20px, 0);
  }
  40% {
    clip: rect(72px, 450px, 81px, 0);
  }
  100% {
    clip: rect(44px, 450px, 56px, 0);
  }
}

@media (max-width: 768px) {
  .system-nav {
    padding: 15px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    border-bottom: 1px solid rgba(0, 255, 0, 0.1);
  }
  .status-indicator {
    display: none;
  }

  .header-glitch {
    margin-top: 40px;
    margin-bottom: 2rem;
    padding: 0 10px;
  }

  .glitch {
    font-size: 2.2rem;
    line-height: 1.1;
    word-break: break-word;
  }

  .glitch::before,
  .glitch::after {
    display: none;
  }

  p {
    font-size: 0.7rem;
  }

  .cards-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    width: 100%;
    padding: 0 10px 100px 10px;
  }

  .card-icon {
    margin-bottom: 0;
    font-size: 2rem;
  }

  .terminal-box {
    width: 95%;
    height: 80vh;
    display: flex;
    flex-direction: column;
  }

  .term-body {
    overflow-y: auto;
    flex: 1;
    padding: 20px;
  }

  #matrix-canvas {
    position: fixed;
  }
}
