/**
 * NeuroV0x - CSS do easter egg
 *
 * Tudo prefixado com .nv- pra nunca colidir com o tema.
 * Design system: fundo #000, neon #b8ff1a, destaque #d6ff4d,
 * erro #ff2244, JetBrains Mono, radius 0, sombras duras sem blur.
 *
 * @package IgorBrasil
 * @since   1.2.1
 */

:root {
  --nv-neon: #b8ff1a;
  --nv-neon-rgb: 184, 255, 26;
  --nv-hi: #d6ff4d;
  --nv-err: #ff2244;
  --nv-ink: #000000;
  --nv-dim: #b9b9b4;
  --nv-mono: 'JetBrains Mono', 'Courier New', monospace;
}

/* ---------------------------------------------------------------
   CHUVA · canvas permanente atrás do conteúdo
   --------------------------------------------------------------- */
.nv-rain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.13;
  transform-origin: 50% 42%;
}

/* garante o conteúdo do site acima do canvas */
.wp-site-blocks {
  position: relative;
  z-index: 1;
}

/* chuva promovida a primeiro plano durante a sessão */
.nv-rain--front {
  z-index: 9998;
}

/* dolly in: só transform e opacity, GPU */
.nv-rain--dolly {
  transition: transform 4.2s cubic-bezier(0.45, 0, 0.55, 1), opacity 4.2s cubic-bezier(0.45, 0, 0.55, 1);
  transform: scale(2.15);
  opacity: 0.52;
}

/* respiração: o JS assume o transform por rAF, sem transition.
   opacity fica aqui porque a classe dolly sai quando a breath entra */
.nv-rain--breath {
  transition: none;
  opacity: 0.52;
}

/* saída simétrica */
.nv-rain--out {
  transition: transform 1.4s cubic-bezier(0.45, 0, 0.55, 1), opacity 1.4s ease;
  transform: scale(1);
  opacity: 0.13;
}

/* ---------------------------------------------------------------
   PELÍCULA · overlay que escurece o site
   --------------------------------------------------------------- */
.nv-veil {
  position: fixed;
  inset: 0;
  background: var(--nv-ink);
  opacity: 0;
  pointer-events: none;
  z-index: 9997;
  transition: opacity 3.2s ease;
}

.nv-veil.nv-veil--on {
  opacity: 0.68;
  pointer-events: auto;
}

.nv-veil.nv-veil--out {
  transition: opacity 1.4s ease;
  opacity: 0;
}

body.nv-lock {
  overflow: hidden;
}

/* ---------------------------------------------------------------
   CRT · janela do terminal
   --------------------------------------------------------------- */
.nv-crt {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(740px, 94vw);
  height: min(560px, 86dvh);
  z-index: 9999;
  background: rgba(3, 6, 3, 0.94);
  border: 2px solid var(--nv-neon);
  border-radius: 0;
  box-shadow: 10px 10px 0 rgba(184, 255, 26, 0.18);
  display: none;
  flex-direction: column;
  font-family: var(--nv-mono);
  color: var(--nv-dim);
}

.nv-crt.nv-crt--show {
  display: flex;
}

/* scanlines */
.nv-crt::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: repeating-linear-gradient(
    0deg,
    rgba(184, 255, 26, 0.045) 0px,
    rgba(184, 255, 26, 0.045) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* liga: nasce colapsado numa linha e expande com overshoot */
.nv-crt--on {
  animation: nv-crt-on 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes nv-crt-on {
  0%   { transform: translate(-50%, -50%) scaleY(0.006); opacity: 0.6; }
  55%  { transform: translate(-50%, -50%) scaleY(1.07);  opacity: 1; }
  78%  { transform: translate(-50%, -50%) scaleY(0.97); }
  100% { transform: translate(-50%, -50%) scaleY(1); }
}

/* desliga: colapsa em linha e apaga */
.nv-crt--off {
  animation: nv-crt-off 0.5s cubic-bezier(0.7, 0, 0.84, 0) both;
}

@keyframes nv-crt-off {
  0%   { transform: translate(-50%, -50%) scaleY(1);     opacity: 1; }
  62%  { transform: translate(-50%, -50%) scaleY(0.012); opacity: 1; }
  100% { transform: translate(-50%, -50%) scaleY(0.004); opacity: 0; }
}

/* flicker contínuo sutil */
.nv-crt--flicker {
  animation: nv-flicker 3.4s steps(1, end) infinite;
}

@keyframes nv-flicker {
  0%, 100% { opacity: 1; }
  86%      { opacity: 1; }
  87%      { opacity: 0.965; }
  88%      { opacity: 1; }
  93%      { opacity: 0.98; }
  94%      { opacity: 1; }
}

/* ---------------------------------------------------------------
   HEADER do terminal
   --------------------------------------------------------------- */
.nv-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(184, 255, 26, 0.35);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nv-neon);
  flex: 0 0 auto;
}

.nv-head__title {
  font-weight: 700;
}

.nv-head__dot {
  width: 7px;
  height: 7px;
  background: var(--nv-neon);
  display: inline-block;
  animation: nv-pulse 2s ease-in-out infinite;
}

@keyframes nv-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.25; }
}

.nv-head__hint {
  margin-left: auto;
  color: var(--nv-dim);
  letter-spacing: 0.08em;
  font-size: 10px;
}

.nv-btn {
  background: transparent;
  border: 1px solid rgba(184, 255, 26, 0.5);
  border-radius: 0;
  color: var(--nv-neon);
  font-family: var(--nv-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 9px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nv-btn:hover,
.nv-btn:focus-visible {
  background: var(--nv-neon);
  color: var(--nv-ink);
}

/* ---------------------------------------------------------------
   TELA e linhas
   --------------------------------------------------------------- */
.nv-screen {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 18px;
  font-size: 13px;
  line-height: 1.6;
  scrollbar-width: thin;
  scrollbar-color: rgba(184, 255, 26, 0.4) transparent;
}

.nv-screen::-webkit-scrollbar { width: 8px; }
.nv-screen::-webkit-scrollbar-track { background: transparent; }
.nv-screen::-webkit-scrollbar-thumb { background: rgba(184, 255, 26, 0.35); }

.nv-line { white-space: pre-wrap; word-break: break-word; }

.nv-line--hi    { color: var(--nv-hi); }
.nv-line--user  { color: var(--nv-neon); }
.nv-line--agent { color: #e6e6e2; }
.nv-line--err   { color: var(--nv-err); }
.nv-line--dim   { color: rgba(185, 185, 180, 0.55); }

.nv-line--user .nv-prompt-label {
  color: var(--nv-hi);
  font-weight: 700;
}

/* cursor bloco */
.nv-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: var(--nv-neon);
  vertical-align: -2px;
  animation: nv-blink 0.9s steps(1, end) infinite;
}

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

/* ---------------------------------------------------------------
   INPUT
   --------------------------------------------------------------- */
.nv-inrow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid rgba(184, 255, 26, 0.35);
  flex: 0 0 auto;
}

.nv-inrow__label {
  color: var(--nv-hi);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.nv-input {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 0;
  outline: none;
  color: var(--nv-neon);
  caret-color: var(--nv-neon);
  font-family: var(--nv-mono);
  font-size: 13px;
  padding: 0;
}

.nv-input::placeholder {
  color: rgba(185, 185, 180, 0.4);
}

/* ---------------------------------------------------------------
   ERR0R · glitch
   --------------------------------------------------------------- */
.nv-error-big {
  font-size: clamp(48px, 14vw, 96px);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--nv-err);
  line-height: 1;
  margin: 24px 0 16px;
}

.nv-error-big.nv-glitching {
  animation: nv-jitter 0.09s steps(2, end) infinite;
}

@keyframes nv-jitter {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-3px, 2px); }
  50%  { transform: translate(2px, -2px); }
  75%  { transform: translate(-2px, -1px); }
  100% { transform: translate(3px, 1px); }
}

.nv-error-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.nv-error-actions .nv-btn {
  font-size: 11px;
  padding: 10px 16px;
  text-decoration: none;
  display: inline-block;
}

.nv-error-actions .nv-btn--solid {
  background: var(--nv-neon);
  color: var(--nv-ink);
  border-color: var(--nv-neon);
}

.nv-error-actions .nv-btn--solid:hover,
.nv-error-actions .nv-btn--solid:focus-visible {
  background: var(--nv-hi);
  border-color: var(--nv-hi);
}

/* ---------------------------------------------------------------
   FLASH · acesso autorizado
   --------------------------------------------------------------- */
.nv-flash {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 6, 3, 0.96);
  color: var(--nv-neon);
  font-size: clamp(18px, 4vw, 28px);
  font-weight: 700;
  letter-spacing: 0.18em;
  animation: nv-flash-in 0.9s ease both;
}

@keyframes nv-flash-in {
  0%   { opacity: 0; transform: scale(0.96); }
  18%  { opacity: 1; transform: scale(1.015); }
  30%  { transform: scale(1); }
  82%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------------------------------------------------------------
   MOBILE · terminal fullscreen
   --------------------------------------------------------------- */
@media (max-width: 700px) {
  .nv-crt {
    left: 0;
    top: 0;
    width: 100vw;
    height: 100dvh;
    transform: none;
    border-width: 0;
    border-bottom: 2px solid var(--nv-neon);
    box-shadow: none;
    /* o JS (fitViewport) sobrescreve height/top quando o teclado sobe */
  }

  /* input e header nunca encolhem, a tela de mensagens cede o espaço */
  .nv-inrow,
  .nv-head { flex-shrink: 0; }

  @keyframes nv-crt-on {
    0%   { transform: scaleY(0.006); opacity: 0.6; }
    55%  { transform: scaleY(1.07);  opacity: 1; }
    78%  { transform: scaleY(0.97); }
    100% { transform: scaleY(1); }
  }

  @keyframes nv-crt-off {
    0%   { transform: scaleY(1);     opacity: 1; }
    62%  { transform: scaleY(0.012); opacity: 1; }
    100% { transform: scaleY(0.004); opacity: 0; }
  }

  .nv-head__hint { display: none; }
}

/* ---------------------------------------------------------------
   REDUCED MOTION · sem zoom, sem flicker, sem glitch
   --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .nv-rain { display: none; }

  .nv-veil,
  .nv-veil.nv-veil--out {
    transition: opacity 0.3s ease;
  }

  .nv-crt--on,
  .nv-crt--off {
    animation-duration: 0.2s;
    animation-name: nv-fade;
  }

  @keyframes nv-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  .nv-crt--off {
    animation-direction: reverse;
  }

  .nv-crt--flicker { animation: none; }
  .nv-error-big.nv-glitching { animation: none; }
  .nv-head__dot { animation: none; }
  .nv-cursor { animation: none; }
}
