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

/* VHS Style Base */
body {
  background: black;
  /*
    CRT flicker & scanline overlay
    We'll simulate scanlines with repeating linear-gradient.
  */
  color: #0ff; /* neon cyan base text color */
  font-family: 'Courier New', Courier, monospace;
  font-size: 16px;
  line-height: 1.4;
  text-shadow:
    0 0 3px #0ff,
    0 0 7px #0ff,
    0 0 15px #08f,
    0 0 21px #0ff;
  position: relative;
  min-height: 100vh;
  cursor: default;
  user-select: none;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(255,255,255,0.03) 0,
    rgba(255,255,255,0.03) 1px,
    transparent 1px,
    transparent 3px
  );
  animation: flicker 0.15s infinite alternate;
}

@keyframes flicker {
  0% {
    opacity: 0.98;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.98;
  }
}

a {
  color: #f0f;
  text-decoration: underline dashed #ff0;
  font-weight: bold;
  transition: color 0.3s ease;
}
a:hover, a:focus {
  color: #ff0;
  outline: none;
  text-decoration-style: solid;
}

/* Container to center content */
.container {
  width: 94%;
  max-width: 960px;
  margin: 1rem auto;
  padding: 1rem;
  border: 3px inset #0ff;
  background-color: rgba(0,0,0,0.85);
  box-shadow:
    0 0 10px #0ff,
    inset 0 0 5px #0ff;
  position: relative;
}

/* VHS overlay glitch lines */
.vhs-glitch {
  position: absolute;
  pointer-events: none;
  width: 100%;
  height: 100%;
  top: 0; left: 0;
  mix-blend-mode: screen;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.06),
    rgba(255,255,255,0.06) 2px,
    transparent 2px,
    transparent 3px
  );
  animation: glitch-lines 0.2s infinite;
  z-index: 20;
}
@keyframes glitch-lines {
  0% { background-position: 0 0; }
  100% { background-position: 0 3px; }
}

/* ----- Header ----- */
header {
  border-bottom: 2px groove #0ff;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  text-align: center;
  text-shadow:
    0 0 7px #f0f,
    0 0 10px #0ff,
    0 0 15px #ff00ff;
  font-size: 2.4rem;
}

/* Navigation - old school horizontal list */
nav {
  margin-top: 0.75rem;
}
nav ul {
  list-style: none;
  display: inline-block;
}
nav ul li {
  display: inline;
  margin: 0 1rem;
}
nav ul li a {
  font-weight: bold;
  font-size: 1rem;
}

/* Underline style similar to old web */
hr {
  border: none;
  border-top: 1px solid #f0f;
  margin: 1rem 0;
  box-shadow:
    0 1px 7px #f0f;
}

/* --- Hero Section --- */
.hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
}
.hero h1 {
  font-family: 'Press Start 2P', cursive, monospace;
  font-size: 2.8rem;
  color: #0ff;
  text-shadow:
    0 0 5px #0ff,
    0 0 10px #0ff,
    0 0 15px #ff0, /* yellow glow */
    0 0 20px #ff0;
  margin-bottom: 1rem;
  letter-spacing: 3px;
}
.hero p {
  font-size: 1.2rem;
  color: #ff0;
  font-weight: bold;
  text-shadow:
    0 0 10px #ff0;
  margin-bottom: 1.6rem;
  font-family: monospace;
}
.btn-primary {
  background: #ff0;
  color: black;
  font-weight: 700;
  padding: 0.6rem 1.6rem;
  border: 3px outset #0ff;
  font-family: monospace;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow:
    0 0 10px #ff0;
  transition:
    box-shadow 0.2s ease,
    background-color 0.3s ease,
    color 0.3s ease;
}
.btn-primary:hover, .btn-primary:focus {
  background: #0ff;
  color: black;
  box-shadow:
    0 0 8px #0ff,
    0 0 15px #0ff,
    0 0 25px #0ff;
  outline: none;
}

/* -- About Section -- */
.about {
  font-size: 1rem;
  color: #0ff;
  border: 2px solid #0ff;
  background: rgba(10,40,60,0.7);
  padding: 1rem;
  margin-bottom: 2rem;
  overflow: hidden;
}
.about img {
  float: left;
  border: 3px ridge #0ff;
  margin-right: 1rem;
  width: 120px;
  height: 120px;
  image-rendering: pixelated;
  filter: contrast(1.3) brightness(1.1);
  box-shadow: 0 0 10px #0ff inset;
}
.about-text p {
  margin-bottom: 0.75rem;
  font-family: monospace;
  text-shadow:
    0 0 2px #0ff,
    0 0 3px #0ff;
}

/* --- Portfolio --- */
.portfolio h2 {
  text-align: center;
  font-family: 'Press Start 2P', cursive, monospace;
  color: #ff0;
  text-shadow:
    0 0 13px #ff0,
    0 0 23px #ff0,
    0 0 40px #ffcc00;
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.projects-table {
  width: 100%;
  border-collapse: collapse;
}
.projects-table td {
  border: 3px double #0ff;
  padding: 10px;
  vertical-align: top;
  background: #000820;
  box-shadow:
    inset 0 0 12px #0ff;
}
.project-image {
  width: 180px;
  height: 110px;
  background: #001030;
  display: block;
  margin-bottom: 6px;
  border: 2px solid #0ff;
  image-rendering: pixelated;
  filter: grayscale(20%) contrast(1.5) brightness(1.1);
}
.project-title {
  font-family: 'Courier New', Courier, monospace;
  color: #ff0;
  font-size: 1.1rem;
  text-shadow: 0 0 10px #ff0;
  margin-bottom: 0.3rem;
}
.project-desc {
  font-family: monospace;
  font-size: 0.9rem;
  color: #0ff;
  margin-bottom: 6px;
  height: 3.75em; /* limit lines */
  overflow: hidden;
}
.project-links a {
  font-weight: bold;
  margin-right: 1rem;
  text-decoration: underline dotted #ff0;
}
.project-links a:hover, .project-links a:focus {
  text-decoration-style: solid;
  color: #ff0;
  outline: none;
}

/* --- Contact --- */
.contact {
  border: 2px solid #0ff;
  background: #000820;
  font-family: monospace;
  color: #0ff;
  padding: 1rem;
  max-width: 600px;
  margin: 2rem auto 3rem;
}
.contact h2 {
  font-family: 'Press Start 2P', cursive, monospace;
  color: #f0f;
  font-size: 1.7rem;
  text-align: center;
  margin-bottom: 1rem;
  text-shadow: 0 0 15px #f0f;
}
label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 700;
  color: #ff0;
}
input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  background: black;
  color: #0ff;
  border: 2px inset #0ff;
  padding: 0.5rem;
  font-family: monospace;
  font-size: 1rem;
  resize: vertical;
  box-shadow: 0 0 10px #0ff inset;
  outline: none;
  transition: box-shadow 0.3s ease;
}
input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
  box-shadow: 0 0 20px #f0f inset;
}
textarea {
  min-height: 100px;
}
.btn-submit {
  margin-top: 1rem;
  background: #ff0;
  color: black;
  border: 3px outset #0ff;
  padding: 0.7rem 1.5rem;
  font-family: monospace;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    0 0 20px #ff0, 
    inset 0 0 15px #f0f;
  transition: background 0.3s ease;
}
.btn-submit:hover, .btn-submit:focus {
  background: #0ff;
  color: black;
  box-shadow: 0 0 40px #0ff, inset 0 0 20px #0ff;
  outline: none;
}

/* --- Footer --- */
footer {
  text-align: center;
  color: #0ff;
  font-family: monospace;
  padding: 1rem 1rem 2rem;
  border-top: 2px groove #0ff;
  font-size: 0.9rem;
  position: relative;
}
.social-links a {
  margin: 0 1rem;
  font-size: 1.3rem;
  color: #f0f;
  text-shadow:
    0 0 15px #f0f;
  text-decoration: none;
}
.social-links a:hover, .social-links a:focus {
  color: #ff0;
  outline: none;
  text-shadow:
    0 0 25px #ff0;
}

/* --- VHS scanline and glitch filters --- */
/* We'll layer repeating gradients & animate background positions in container for slight distortion effect */
.container::before {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(255,255,255,0.04),
    rgba(255,255,255,0.04) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: screen;
  animation: scanline-move 0.2s linear infinite;
  z-index: 10;
}

@keyframes scanline-move {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 0 4px;
  }
}

/* Small glitch flickers on main container */
.container {
  animation: subtle-glitch 3s infinite alternate ease-in-out;
}

@keyframes subtle-glitch {
  0%, 20%, 60%, 100% { filter: none; }
  40% { filter: hue-rotate(5deg) brightness(0.95) saturate(1.2); }
  80% { filter: hue-rotate(-5deg) brightness(1.05) saturate(1.4); }
}

/* Container background - darker and less transparent */
.container {
  width: 94%;
  max-width: 960px;
  margin: 1rem auto;
  padding: 1rem;
  border: 3px inset #0ff;
  background-color: rgba(0,0,0,0.95); /* increased opacity */
  box-shadow:
    0 0 10px #0ff,
    inset 0 0 5px #0ff;
  position: relative;
  overflow: hidden;
}

/* Add subtle noise overlay with before pseudo-element */
.container::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  background-image: url('https://www.transparenttextures.com/patterns/outlined-paper.png');
  opacity: 0.15; /* subtle but visible noise */
  pointer-events: none;
  mix-blend-mode: overlay;
  z-index: 12;
}

/* Slightly reduced text glow */
body {
  color: #0ff;
  text-shadow:
    0 0 3px #0ff,
    0 0 7px #0ff,
    0 0 12px #08f;
}

/* Reduce the glow on headings and important text */
.hero h1,
.portfolio h2,
.about-text h2,
.contact h2,
.project-title {
  text-shadow:
    0 0 6px #0ff,
    0 0 12px #0ff,
    0 0 18px #089;
}

/* Reduce glow for yellow text */
.hero p,
.project-title,
.project-links a,
label {
  text-shadow:
    0 0 4px #ff0,
    0 0 8px #aa0;
}

/* Enhanced glitch effect: horizontal shifts and RGB channel splits */

/* Keyframes for glitch horizontal translate */
@keyframes glitch-jitter {
  0%, 20%, 40%, 60%, 80%, 100% {
    transform: translate(0, 0);
  }
  10% {
    transform: translate(-2px, 0);
  }
  30% {
    transform: translate(2px, 0);
  }
  50% {
    transform: translate(-1.5px, 0);
  }
  70% {
    transform: translate(1.5px, 0);
  }
  90% {
    transform: translate(0, 0);
  }
}

/* Create layered glitch behind container using pseudo elements */
.container::before {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(255,255,255,0.06),
    rgba(255,255,255,0.06) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: screen;
  animation: scanline-move 0.2s linear infinite;
  z-index: 10;
}

/* Additional pseudo elements to create RGB shift glitches */
.container:after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-color: transparent;
  box-shadow:
    1px 0 1px #f0f, /* Magenta shadow */
    -1px 0 1px #0ff; /* Cyan shadow */
  mix-blend-mode: screen;
  animation: glitch-jitter 2s infinite;
  z-index: 15;
}



/* Optional: Adjust scanline brightness */
.container::before {
  background: repeating-linear-gradient(
    0deg,
    rgba(255,255,255,0.1), /* stronger scanlines */
    rgba(255,255,255,0.1) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* Keep responsiveness intact */
@media (max-width: 600px) {
  .container::after {
    display: none; /* avoid clutter on small screens */
  }
}

/* Optionally, add a subtle vertical shake on header and hero text */
header,
.hero h1,
.hero p {
  animation: glitch-jitter 3s infinite;
}

/* Fonts: Import 8bit style font */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* Responsive tweaks */
@media (max-width: 600px) {
  .about img {
    float: none;
    display: block;
    margin: 0 auto 1rem;
    width: 100px;
    height: 100px;
  }

  .projects-table td {
    display: block;
    margin-bottom: 1rem;
    border: 2px inset #0ff;
  }

  .project-image {
    width: 100%;
    height: auto;
    margin-bottom: 0.5rem;
  }
}