/* ============================================
   DCG PANAMA — MAIN STYLESHEET
   Dark Retro Hacker Aesthetic
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=VT323&family=Orbitron:wght@400;700;900&family=Fira+Code:wght@300;400;500;700&display=swap');

/* --- CSS Variables --- */
:root {
  --bg-primary: #000000;
  --bg-secondary: #1f0000;
  --bg-terminal: #050505;
  --red-primary: #ff0000;
  --red-dim: #cc0000;
  --red-glow: #ff000080;
  --red-dark: #330000;
  --red-accent: #ff0000;
  --red-glow: #ff003360;
  --cyan-accent: #00e5ff;
  --cyan-glow: #00e5ff50;
  --amber: #ffb300;
  --amber-glow: #ffb30040;
  --white: #e0e0e0;
  --white-dim: #888;
  --gray-dark: #1a1a1a;
  --gray-mid: #2a2a2a;
  --scanline-opacity: 0.04;
  --font-mono: 'Share Tech Mono', 'Fira Code', monospace;
  --font-display: 'Orbitron', sans-serif;
  --font-retro: 'VT323', monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-primary);
  color: var(--white);
  font-family: var(--font-mono);
  overflow-x: hidden;
  min-height: 100vh;
}

::selection {
  background: var(--red-primary);
  color: var(--bg-primary);
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--red-dark);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--red-dim);
}

/* --- Scanline Overlay (Global) --- */
.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 65, var(--scanline-opacity)) 2px,
    rgba(0, 255, 65, var(--scanline-opacity)) 4px
  );
}

/* --- Noise Overlay --- */
.noise-overlay {
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 9900;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  animation: noiseShift 0.5s steps(10) infinite;
}

@keyframes noiseShift {
  0% { transform: translate(0, 0); }
  10% { transform: translate(-5%, -5%); }
  20% { transform: translate(3%, -8%); }
  30% { transform: translate(-8%, 2%); }
  40% { transform: translate(5%, 5%); }
  50% { transform: translate(-3%, 8%); }
  60% { transform: translate(8%, -2%); }
  70% { transform: translate(-5%, 5%); }
  80% { transform: translate(3%, -3%); }
  90% { transform: translate(-2%, 6%); }
  100% { transform: translate(0, 0); }
}

/* --- Navigation --- */
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--red-dark);
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--red-primary);
  text-decoration: none;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 0 0 10px var(--red-glow);
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-brand img {
  height: 32px;
  filter: brightness(1.1);
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  align-items: center;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--white-dim);
  text-decoration: none;
  letter-spacing: 2px;
  text-transform: uppercase;
  position: relative;
  transition: color 0.3s ease, text-shadow 0.3s ease;
  padding: 4px 0;
}

.nav-links a::before {
  content: '>';
  margin-right: 4px;
  color: var(--red-primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--red-primary);
  text-shadow: 0 0 8px var(--red-glow);
}

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

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--red-dark);
  color: var(--red-primary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  font-family: var(--font-mono);
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    background: rgba(10, 10, 10, 0.97);
    flex-direction: column;
    padding: 2rem;
    gap: 1.5rem;
    border-bottom: 1px solid var(--red-dark);
    transform: translateY(-120%);
    transition: transform 0.4s ease;
  }

  .nav-links.open {
    transform: translateY(0);
  }
}

/* --- Glitch Text Effect --- */
.glitch {
  position: relative;
  display: inline-block;
}

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

.glitch::before {
  color: var(--cyan-accent);
  animation: glitch-1 3s infinite linear alternate-reverse;
  clip-path: inset(0 0 65% 0);
}

.glitch::after {
  color: var(--red-accent);
  animation: glitch-2 2.5s infinite linear alternate-reverse;
  clip-path: inset(65% 0 0 0);
}

@keyframes glitch-1 {
  0% { transform: translate(0); }
  20% { transform: translate(-3px, 2px); }
  40% { transform: translate(3px, -1px); }
  60% { transform: translate(-2px, 1px); }
  80% { transform: translate(2px, -2px); }
  100% { transform: translate(0); }
}

@keyframes glitch-2 {
  0% { transform: translate(0); }
  20% { transform: translate(2px, -1px); }
  40% { transform: translate(-3px, 2px); }
  60% { transform: translate(1px, -2px); }
  80% { transform: translate(-2px, 1px); }
  100% { transform: translate(0); }
}

/* --- Flicker Animation --- */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  3% { opacity: 0.3; }
  6% { opacity: 1; }
  7% { opacity: 0.4; }
  8% { opacity: 1; }
  50% { opacity: 1; }
  52% { opacity: 0.8; }
  53% { opacity: 1; }
}

.flicker {
  animation: flicker 4s infinite;
}

/* --- Fade In Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in-up {
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards;
}

.fade-in {
  opacity: 0;
  animation: fadeIn 1s ease forwards;
}

/* Staggered delays */
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }
.delay-4 { animation-delay: 0.8s; }
.delay-5 { animation-delay: 1.0s; }
.delay-6 { animation-delay: 1.2s; }

/* --- Cursor Blink --- */
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.cursor-blink::after {
  content: '█';
  animation: blink 1s step-end infinite;
  color: var(--red-primary);
  margin-left: 2px;
}

/* --- Typing Animation --- */
@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

.typing-text {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--red-primary);
  animation: typing 2s steps(30) forwards, blink 1s step-end infinite;
  width: 0;
}

/* --- Matrix Rain Canvas --- */
#matrix-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.25;
}

/* --- Pulse Glow --- */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 5px var(--red-glow), 0 0 10px var(--red-glow);
  }
  50% {
    box-shadow: 0 0 15px var(--red-glow), 0 0 30px var(--red-glow), 0 0 50px var(--red-glow);
  }
}

/* --- Grid Background --- */
.grid-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0) 1px, transparent 1px),
    linear-gradient(90deg, rgba(141, 141, 141, 0) 1px, transparent 1px);
  background-size: 50px 50px;
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--red-dark);
  padding: 2rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--white-dim);
  letter-spacing: 1px;
  background: var(--bg-primary);
}

.site-footer .footer-line {
  margin-bottom: 0.5rem;
}

.site-footer span.green {
  color: var(--red-primary);
}

/* --- Page Transition --- */
.page-content {
  padding-top: 60px;
  min-height: 100vh;
}

/* --- Utility --- */
.text-green { color: var(--red-primary); }
.text-red { color: var(--red-accent); }
.text-cyan { color: var(--cyan-accent); }
.text-amber { color: var(--amber); }
.text-dim { color: var(--white-dim); }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 2rem; }
