:root {
  --bg-color: #000;
  --text-color: #33ff00;
  --dim-color: #1a8000;
  --scanline-color: rgba(18, 16, 16, 0.5);
  /* Darker scanline */
  --glow-color: rgba(51, 255, 0, 0.2);
  --font-family:
    "JetBrains Mono", "Source Code Pro", "Courier New", Courier, monospace;
}

body {
  background-color: #1a1a1a;
  /* Frame around the screen */
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  color: var(--text-color);
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* Fix vertical scrolling: allow containers to grow and don't hide overflow */
html,
body {
  height: auto;
  min-height: 100%;
  overflow-y: auto;
}

.crt {
  max-width: 1200px;
  width: 100%;
  margin: 2rem auto;
  padding: 1rem;
  box-sizing: border-box;
  /* ensure content can grow taller than the viewport */
  height: auto !important;
  overflow: visible !important;
  position: relative; /* ensure absolute children are positioned to this container */
}

.terminal {
  /* use min-height so it can grow beyond one viewport */
  min-height: 100vh;
  overflow: visible;
  position: relative;
  z-index: 2;             /* must be greater than canvas z-index */
  background: transparent;/* allow the matrix to show through where desired */
}

/* CRT Screen Effect */
.crt {
  max-width: 1200px;
  /* change this to taste (e.g. 900px, 1200px) */
  width: 100%;
  margin: 2rem auto;
  /* centers the page horizontally and gives vertical spacing */
  padding: 1rem;
  box-sizing: border-box;
  background-color: var(--bg-color);
  border: 2px solid #333;
  border-radius: 10px;
  box-shadow: 0 0 20px var(--dim-color);
  position: relative;
  overflow: hidden;
}

.crt::before {
  content: " ";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background:
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
    linear-gradient(
      90deg,
      rgba(255, 0, 0, 0.06),
      rgba(0, 255, 0, 0.02),
      rgba(0, 0, 255, 0.06)
    );
  z-index: 2;
  background-size:
    100% 2px,
    3px 100%;
  pointer-events: none;
}

.crt::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: rgba(18, 16, 16, 0.1);
  opacity: 0;
  z-index: 2;
  pointer-events: none;
  animation: flicker 0.15s infinite;
}

@keyframes flicker {
  0% {
    opacity: 0.05;
  }

  50% {
    opacity: 0.1;
  }

  100% {
    opacity: 0.05;
  }
}

/* Terminal Content */
.terminal {
  padding: 2rem;
  height: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  position: relative;
  z-index: 1;
  text-shadow: 0 0 2px var(--dim-color);
}

/* Scrollbar */
.terminal::-webkit-scrollbar {
  width: 10px;
}

.terminal::-webkit-scrollbar-track {
  background: var(--bg-color);
}

.terminal::-webkit-scrollbar-thumb {
  background: var(--dim-color);
  border: 1px solid var(--text-color);
}

/* Header */
header {
  border-bottom: 2px solid var(--text-color);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
}

.logo {
  font-weight: bold;
  font-size: 1.2rem;
  letter-spacing: 2px;
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1.5rem;
}

nav a {
  color: var(--text-color);
  text-decoration: none;
  font-weight: bold;
  transition: all 0.2s;
}

nav a:hover {
  color: var(--bg-color);
  background-color: var(--text-color);
  box-shadow: 0 0 10px var(--text-color);
}

/* Sections */
section {
  margin-bottom: 3rem;
}

h2 {
  border-bottom: 1px dashed var(--dim-color);
  padding-bottom: 0.5rem;
  margin-top: 0;
}

.content-block {
  margin-left: 1rem;
  border-left: 2px solid var(--dim-color);
  padding-left: 1rem;
}

/* Grid for Projects */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.card {
  border: 1px solid var(--text-color);
  padding: 1rem;
  transition: box-shadow 0.3s;
}

.card:hover {
  box-shadow: inset 0 0 15px var(--dim-color);
}

.card h3 {
  margin-top: 0;
  background: var(--text-color);
  color: var(--bg-color);
  display: inline-block;
  padding: 0 5px;
}

.card a {
  display: inline-block;
  margin-top: 1rem;
  color: var(--text-color);
  text-decoration: none;
  border: 1px solid var(--text-color);
  padding: 0.2rem 0.5rem;
}

.card a:hover {
  background: var(--text-color);
  color: var(--bg-color);
}

/* center and limit images inside project cards */
.card img {
  display: block;
  margin: 10px auto;
  /* centers the image in the card */
  width: 100%;
  max-width: 480px;
  /* limit image growth; adjust as needed */
  height: auto;
  border: 1px solid var(--dim-color);
  object-fit: contain;
}

/* Resume */
.btn {
  display: inline-block;
  border: 1px solid var(--text-color);
  padding: 0.5rem 1rem;
  color: var(--text-color);
  text-decoration: none;
  margin-top: 1rem;
  transition: 0.3s;
}

.btn:hover {
  background: var(--text-color);
  color: var(--bg-color);
  box-shadow: 0 0 8px var(--text-color);
}

/* Footer */
footer {
  border-top: 1px solid var(--dim-color);
  margin-top: 2rem;
  padding-top: 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--dim-color);
}

footer p {
    margin: 0;             /* remove default spacing */
    padding: 0;
    line-height: 1.15;     /* tighten vertical spacing inside each line */
    color: inherit;
    font-size: 0.95rem;
}

footer p + p {
    margin-top: 4px;       /* small gap between consecutive lines; adjust as needed */
}

/* Typing Effect */
.typing-effect {
  white-space: pre-wrap;
}

.typing-effect::after {
  content: "█";
  animation: blink 1s infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

/* Utilities */
.hidden {
  /* Initially hidden for JS to reveal; leave visible by default for testing. */
  display: block;
}

/* Matrix background canvas behind the terminal */
#matrix-canvas {
  position: absolute;
  inset: 0;               /* top:0; right:0; bottom:0; left:0 */
  width: 100%;
  height: 100%;
  z-index: 0;             /* behind the terminal (terminal z-index should be higher) */
  pointer-events: none;   /* clicks pass through */
  opacity: 0.85;
  mix-blend-mode: screen;
}
