/* ============================================================
   EFFECTS — Animations, Glitch, Scanlines, Matrix, Cursor
   T.M CORP — Cyberpunk CV
   ============================================================ */

/* --- Matrix Rain Canvas --- */
#matrixCanvas {
  position: fixed; inset: 0;
  z-index: 0;
  opacity: 0.12;
  pointer-events: none;
}

/* --- Grid + Scanlines --- */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 1;
  background-image:
    linear-gradient(rgba(0, 245, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 245, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 1;
  background: repeating-linear-gradient(transparent, transparent 2px, rgba(0, 245, 255, 0.015) 3px);
  pointer-events: none;
  animation: scanlineScroll 8s linear infinite;
}
@keyframes scanlineScroll {
  0%   { background-position: 0 0; }
  100% { background-position: 0 120px; }
}

/* --- Init Screen --- */
#initScreen {
  position: fixed; inset: 0; z-index: 1002;
  background: #020509;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
#initScreen .init-prompt {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px; letter-spacing: 3px;
  color: var(--cyan);
  opacity: 0.5;
  animation: initPulse 2s ease-in-out infinite;
}
@keyframes initPulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 0.8; }
}

/* --- Lock Screen --- */
#lockScreen {
  position: fixed; inset: 0; z-index: 1001;
  background: #020509;
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  font-family: 'Share Tech Mono', monospace;
  color: var(--cyan);
  transition: opacity 0.6s ease;
}
#lockScreen.hidden { opacity: 0; pointer-events: none; }
#lockLabel {
  font-size: 11px; letter-spacing: 3px;
  color: rgba(200, 230, 255, 0.4);
  text-transform: uppercase;
  margin-bottom: 16px;
}
#lockField {
  display: flex; align-items: center; gap: 2px;
  font-size: 22px; letter-spacing: 6px;
  height: 40px;
}
#lockField .lock-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.15s ease;
}
#lockField .lock-char.visible {
  opacity: 1;
  transform: translateY(0);
}
#lockCursor {
  display: inline-block;
  width: 2px; height: 24px;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: cursorBlink 0.6s infinite;
}
@keyframes cursorBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
#lockStatus {
  margin-top: 24px;
  font-family: 'Orbitron', sans-serif;
  font-size: 14px; letter-spacing: 4px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
#lockStatus.granted {
  opacity: 1;
  color: var(--neon-green);
  text-shadow: 0 0 20px var(--neon-green), 0 0 40px rgba(0, 255, 156, 0.3);
}

/* --- Boot Screen --- */
#bootScreen {
  position: fixed; inset: 0; z-index: 1000;
  background: #020509;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-family: 'Share Tech Mono', monospace;
  color: var(--cyan);
  transition: opacity 0.8s ease;
}
#bootScreen.hidden { opacity: 0; pointer-events: none; }

#bootLogo {
  font-family: 'Share Tech Mono', monospace;
  font-size: 18px; font-weight: 400;
  white-space: pre; line-height: 1.3;
  color: var(--cyan);
  text-shadow: 0 0 40px var(--cyan), 0 0 80px rgba(0, 245, 255, 0.3);
  margin-bottom: 10px;
  animation: logoGlitch 3s infinite;
}
#bootCorpLabel {
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px; letter-spacing: 4px;
  color: var(--cyan);
  text-shadow: 0 0 20px var(--cyan);
  border: 1px solid var(--cyan);
  padding: 8px 20px;
  margin-bottom: 40px;
  text-align: center;
}
@keyframes logoGlitch {
  0%, 92%, 100% { transform: translate(0); filter: none; }
  93% { transform: translate(-3px, 1px); filter: hue-rotate(90deg); }
  94% { transform: translate(3px, -1px); filter: hue-rotate(-90deg); }
  95% { transform: translate(0); filter: none; }
  96% { transform: translate(2px, 2px); filter: hue-rotate(180deg) brightness(1.5); }
  97% { transform: translate(0); filter: none; }
}

#bootTerminal {
  width: 600px; max-width: 90vw;
  font-size: 13px; line-height: 1.8;
}
#bootTerminal .line {
  opacity: 0; transform: translateX(-10px);
  transition: all 0.3s ease;
}
#bootTerminal .line.visible { opacity: 1; transform: translateX(0); }
#bootTerminal .line.success { color: var(--neon-green); }
#bootTerminal .line.warn    { color: var(--amber); }
#bootTerminal .line.error   { color: var(--red); }

#bootProgress {
  width: 600px; max-width: 90vw; height: 2px;
  background: rgba(0, 245, 255, 0.1);
  margin-top: 30px; border-radius: 1px; overflow: hidden;
}
#bootProgressBar {
  height: 100%; width: 0;
  background: var(--cyan);
  transition: width 0.4s ease;
  box-shadow: 0 0 20px var(--cyan);
}

/* --- CRT Vignette --- */
.crt-vignette {
  position: fixed; inset: 0; z-index: 9999;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.5) 100%);
}

/* --- Custom Cursor --- */
* { cursor: none !important; }
#cursorDot, #cursorRing { display: none; }
body.custom-cursor #cursorDot,
body.custom-cursor #cursorRing { display: block; }

#cursorDot {
  position: fixed; z-index: 99999;
  width: 6px; height: 6px;
  background: var(--cyan);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 8px var(--cyan), 0 0 20px rgba(0, 245, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.15s, height 0.15s, background 0.15s;
}
#cursorRing {
  position: fixed; z-index: 99998;
  width: 28px; height: 28px;
  border: 1px solid rgba(0, 245, 255, 0.4);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s, border-color 0.2s;
}

/* --- Glitch Text --- */
.glitch { position: relative; }
.glitch:hover::before,
.glitch:hover::after {
  content: attr(data-text);
  position: absolute; left: 0; top: 0;
  width: 100%; height: 100%;
}
.glitch:hover::before {
  color: var(--cyan);
  animation: glitchClip 0.3s infinite;
  clip-path: inset(20% 0 40% 0);
  transform: translate(-2px);
}
.glitch:hover::after {
  color: var(--magenta);
  animation: glitchClip 0.3s infinite reverse;
  clip-path: inset(60% 0 10% 0);
  transform: translate(2px);
}
@keyframes glitchClip {
  0%   { clip-path: inset(20% 0 40% 0); }
  25%  { clip-path: inset(50% 0 20% 0); }
  50%  { clip-path: inset(10% 0 60% 0); }
  75%  { clip-path: inset(70% 0 5% 0); }
  100% { clip-path: inset(30% 0 30% 0); }
}

/* --- Particle Canvas --- */
#particleCanvas {
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
}
