/* ============================================ */
/*     VENEER V∅LT — CRT TERMINAL EFFECTS       */
/*   Scanlines · Glitch · Phosphor · Flicker    */
/* ============================================ */

/* ---- Scanlines overlay ---- */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99999;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.045) 0px,
    rgba(0, 0, 0, 0.045) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* ---- CRT vignette ---- */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99998;
  background: radial-gradient(
    ellipse at center,
    transparent 55%,
    rgba(0, 0, 0, 0.6) 100%
  );
}

/* ---- Screen flicker ---- */
@keyframes flicker {
  0%   { opacity: 1; }
  91%  { opacity: 1; }
  92%  { opacity: 0.88; }
  93%  { opacity: 1; }
  96%  { opacity: 0.94; }
  97%  { opacity: 1; }
  100% { opacity: 1; }
}

body {
  animation: flicker 9s infinite;
}

/* ---- Glitch keyframes ---- */
@keyframes glitch-1 {
  0%   { clip-path: inset(40% 0 61% 0); transform: translate(-3px, 0); }
  20%  { clip-path: inset(92% 0 1%  0); transform: translate( 3px, 0); }
  40%  { clip-path: inset(43% 0 1%  0); transform: translate(-3px, 0); }
  60%  { clip-path: inset(25% 0 58% 0); transform: translate( 3px, 0); }
  80%  { clip-path: inset(54% 0 7%  0); transform: translate(-3px, 0); }
  100% { clip-path: inset(58% 0 43% 0); transform: translate( 0,   0); }
}

@keyframes glitch-2 {
  0%   { clip-path: inset(24% 0 29% 0); transform: translate( 3px, 0); color: #ff4f00; }
  20%  { clip-path: inset(54% 0 21% 0); transform: translate(-3px, 0); color: #1b58ff; }
  40%  { clip-path: inset(11% 0 66% 0); transform: translate( 3px, 0); color: #ffad00; }
  60%  { clip-path: inset(72% 0 3%  0); transform: translate(-3px, 0); color: #ff4f00; }
  80%  { clip-path: inset(38% 0 49% 0); transform: translate( 3px, 0); color: #1b58ff; }
  100% { clip-path: inset(61% 0 7%  0); transform: translate( 0,   0); color: #ffad00; }
}

/* ---- .glitch component (requires data-text attr) ---- */
.glitch {
  position: relative;
  display: inline-block;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  pointer-events: none;
}

.glitch::before {
  animation: glitch-1 4s infinite linear;
  color: #ff4f00;
  opacity: 0.8;
}

.glitch::after {
  animation: glitch-2 4s infinite linear reverse;
  color: #1b58ff;
  opacity: 0.8;
}

/* ---- Phosphor glow utilities ---- */
.glow-sm { text-shadow: 0 0 6px #00ff9f, 0 0 14px rgba(0, 255, 159, 0.35); }
.glow-lg  { text-shadow: 0 0 10px #00ff9f, 0 0 32px rgba(0, 255, 159, 0.55), 0 0 65px rgba(0, 255, 159, 0.2); }
.glow-box { box-shadow: 0 0 10px rgba(0, 255, 159, 0.35), inset 0 0 25px rgba(0, 0, 0, 0.4); }

/* ---- Blinking cursor ---- */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.cursor::after {
  content: '_';
  display: inline-block;
  margin-left: 3px;
  animation: blink 1s step-end infinite;
  color: var(--primary);
}

/* ---- Terminal box ---- */
.terminal-box {
  background: var(--bg-screen);
  border: 1px solid rgba(0, 255, 159, 0.35);
  box-shadow: 0 0 12px rgba(0, 255, 159, 0.2), inset 0 0 30px rgba(0, 0, 0, 0.3);
  padding: 2.5em 2em 2em;
  position: relative;
}

.terminal-box::before {
  content: '● ● ●';
  position: absolute;
  top: 0.7em;
  left: 1em;
  color: var(--primary);
  font-size: 0.5em;
  letter-spacing: 0.35em;
  opacity: 0.4;
}

/* ---- Prompt prefix ---- */
.prompt::before {
  content: '> ';
  color: var(--primary);
  font-weight: bold;
  text-shadow: var(--glow-sm);
}

/* ---- Terminal divider ---- */
.term-divider {
  border: none;
  border-top: 1px solid rgba(0, 255, 159, 0.2);
  margin: 2em 0;
  position: relative;
}

.term-divider::after {
  content: '//';
  position: absolute;
  top: -0.75em;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-main);
  padding: 0 1em;
  color: rgba(0, 255, 159, 0.35);
  font-size: 0.8em;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.2em;
}

/* ---- Boot-sequence typing animation ---- */
@keyframes typing {
  from { width: 0; }
  to   { width: 100%; }
}

@keyframes blink-border {
  50% { border-color: transparent; }
}

.boot-line {
  overflow: hidden;
  white-space: nowrap;
  width: 0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.78em;
  color: rgba(0, 255, 159, 0.55);
  border-right: 2px solid var(--primary);
  animation: typing 0.9s steps(40, end) forwards, blink-border 0.75s step-end infinite;
}

.boot-line:nth-child(1) { animation-delay: 0s,   0s; }
.boot-line:nth-child(2) { animation-delay: 0.5s, 0.5s; }
.boot-line:nth-child(3) { animation-delay: 1.0s, 1.0s; }
.boot-line:nth-child(3):not(:last-child) { border-right: none; }