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

:root {
  --bg: #0a0a0f;
  --fg: #e0e0e0;
  --cyan: #00ffd5;
  --magenta: #ff00aa;
  --green: #00ff41;
  --dim: #555;
  --font: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

html {
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
}

a {
  color: var(--cyan);
  text-decoration: none;
  transition: color 0.2s, text-shadow 0.2s;
}

a:hover {
  color: var(--magenta);
  text-shadow: 0 0 8px var(--magenta);
}

/* === Scanline overlay === */
#scanline {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
}

/* === Main content === */
main {
  text-align: center;
  padding: 2rem;
  max-width: 700px;
  z-index: 1;
}

/* === Glitch headline === */
.glitch {
  font-size: 4rem;
  font-weight: 700;
  color: var(--cyan);
  position: relative;
  text-shadow: 0 0 20px rgba(0, 255, 213, 0.5);
  animation: glow 3s ease-in-out infinite alternate;
}

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

.glitch::before {
  color: var(--magenta);
  animation: glitch-1 4s infinite linear;
}

.glitch::after {
  color: var(--cyan);
  animation: glitch-2 4s infinite linear;
}

@keyframes glitch-1 {
  0%, 92% { opacity: 0; transform: none; }
  93% { opacity: 0.8; transform: translate(-3px, 1px); clip-path: inset(20% 0 40% 0); }
  94% { opacity: 0; }
  96% { opacity: 0.6; transform: translate(2px, -1px); clip-path: inset(60% 0 10% 0); }
  97% { opacity: 0; }
}

@keyframes glitch-2 {
  0%, 94% { opacity: 0; transform: none; }
  95% { opacity: 0.7; transform: translate(3px, -2px); clip-path: inset(10% 0 70% 0); }
  96% { opacity: 0; }
  98% { opacity: 0.5; transform: translate(-2px, 2px); clip-path: inset(50% 0 20% 0); }
  99% { opacity: 0; }
}

@keyframes glow {
  from { text-shadow: 0 0 20px rgba(0, 255, 213, 0.3); }
  to { text-shadow: 0 0 30px rgba(0, 255, 213, 0.6), 0 0 60px rgba(0, 255, 213, 0.2); }
}

/* === Tagline === */
.tagline {
  font-size: 1.1rem;
  color: var(--dim);
  margin-top: 0.5rem;
  margin-bottom: 2.5rem;
}

/* === About === */
.about {
  margin-bottom: 2rem;
  line-height: 1.8;
}

.about p {
  margin-bottom: 0.5rem;
}

/* === Navigation links === */
.links {
  margin-bottom: 2.5rem;
  font-size: 1rem;
}

.separator {
  color: var(--dim);
  margin: 0 0.75rem;
}

/* === Terminal hint === */
.terminal-hint {
  color: var(--dim);
  font-size: 0.85rem;
  margin-top: 1rem;
  animation: fadeInUp 2s ease 1s both;
}

.cursor-hint {
  opacity: 0.6;
}

.blink-cursor {
  animation: blink 1s step-end infinite;
  color: var(--green);
}

@keyframes blink {
  50% { opacity: 0; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === Terminal === */
#terminal {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  max-height: 60vh;
  background: rgba(5, 5, 15, 0.95);
  border-top: 1px solid var(--cyan);
  padding: 1rem 1.5rem;
  z-index: 100;
  overflow-y: auto;
  font-size: 0.9rem;
  box-shadow: 0 -5px 30px rgba(0, 255, 213, 0.1);
  transition: transform 0.3s ease;
}

#terminal.hidden {
  transform: translateY(100%);
  pointer-events: none;
}

#terminal-output {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--green);
  margin-bottom: 0.5rem;
}

#terminal-output .command {
  color: var(--cyan);
}

#terminal-output .response {
  color: var(--green);
  opacity: 0.9;
}

#terminal-output .error {
  color: var(--magenta);
}

#terminal-input-line {
  display: flex;
  align-items: center;
}

.prompt {
  color: var(--cyan);
  flex-shrink: 0;
}

#terminal-input {
  color: var(--green);
  outline: none;
  flex-grow: 1;
  caret-color: transparent;
}

.terminal-cursor {
  font-size: 0.9rem;
}

/* === Footer === */
footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  text-align: center;
  padding: 1rem;
  color: var(--dim);
  font-size: 0.75rem;
  z-index: 0;
}

footer a {
  color: var(--dim);
}

footer a:hover {
  color: var(--cyan);
  text-shadow: none;
}

body.terminal-open footer {
  display: none;
}

/* === /42 page === */
.page-42 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}

.big-42 {
  font-size: 8rem;
  font-weight: 700;
  color: var(--cyan);
  text-shadow: 0 0 40px rgba(0, 255, 213, 0.4);
  line-height: 1;
  margin-bottom: 1rem;
  animation: glow 3s ease-in-out infinite alternate;
}

.page-42 h1 {
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--fg);
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--dim);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.contact-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(0, 255, 213, 0.15);
  border-radius: 4px;
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
  text-align: left;
}

.contact-line {
  margin-bottom: 0.75rem;
  display: flex;
  gap: 1rem;
  align-items: baseline;
}

.contact-line:last-child {
  margin-bottom: 0;
}

.contact-line .label {
  color: var(--dim);
  min-width: 4rem;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.back-link {
  font-size: 0.85rem;
  color: var(--dim);
}

.back-link:hover {
  color: var(--cyan);
}

/* === Impressum === */
.page-impressum {
  text-align: left;
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.page-impressum h1 {
  color: var(--cyan);
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.legal h2 {
  color: var(--fg);
  font-size: 0.95rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.legal p {
  color: var(--dim);
  line-height: 1.7;
  margin-bottom: 0.5rem;
}

.page-impressum .back-link {
  margin-top: 2rem;
}

/* === Matrix canvas === */
#matrix-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.5s;
}

#matrix-canvas.active {
  opacity: 1;
}

/* === Glitch effect (Konami) === */
.konami-glitch {
  animation: konami-hack 0.6s ease;
}

@keyframes konami-hack {
  0% { filter: none; }
  10% { filter: hue-rotate(90deg) saturate(3); transform: translate(2px, -2px); }
  20% { filter: hue-rotate(180deg) invert(0.2); transform: translate(-3px, 1px); }
  30% { filter: hue-rotate(270deg) saturate(2); transform: translate(1px, 3px); }
  40% { filter: hue-rotate(45deg) brightness(1.5); transform: translate(-1px, -3px); }
  50% { filter: invert(1); transform: translate(3px, 2px); }
  60% { filter: hue-rotate(200deg) saturate(4); transform: translate(-2px, -1px); }
  70% { filter: hue-rotate(320deg); transform: translate(2px, 1px); }
  80% { filter: hue-rotate(100deg) brightness(0.8); transform: translate(-1px, 2px); }
  90% { filter: hue-rotate(50deg) saturate(1.5); transform: translate(1px, -1px); }
  100% { filter: none; transform: none; }
}

/* === Responsive === */
@media (max-width: 600px) {
  .glitch {
    font-size: 2.5rem;
  }

  .big-42 {
    font-size: 5rem;
  }

  main {
    padding: 1.5rem 1rem;
  }

  .contact-card {
    padding: 1rem 1.25rem;
  }

  #terminal {
    font-size: 0.8rem;
    padding: 0.75rem 1rem;
  }
}
