/* ============================================================
   animations.css — cyberpunk FX: scanlines, glitch, neon pulse,
   flicker, corner brackets, slide-ins
   ============================================================ */

/* ── Scanline overlay ── */
#scanlines {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.08) 3px,
    rgba(0, 0, 0, 0.08) 4px
  );
  animation: scanline-drift 12s linear infinite;
}

@keyframes scanline-drift {
  0%   { background-position-y: 0px; }
  100% { background-position-y: 200px; }
}

/* ── VHS glitch blocks (driven by fx.js) ── */
#glitch-canvas {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

/* ── Header title glitch ── */
.header-title {
  position: relative;
  animation: title-flicker 6s ease-in-out infinite;
}

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

.header-title::before {
  color: #ff45c8;
  animation: glitch-top 5s steps(1) infinite;
  clip-path: polygon(0 0, 100% 0, 100% 40%, 0 40%);
}

.header-title::after {
  color: #00e5ff;
  animation: glitch-bot 5s steps(1) infinite;
  clip-path: polygon(0 60%, 100% 60%, 100% 100%, 0 100%);
}

@keyframes title-flicker {
  0%, 92%, 100% { text-shadow: 0 0 10px rgba(0, 229, 255, 0.5); }
  93%            { text-shadow: 0 0 20px #fff, 0 0 40px var(--cyan); opacity: 0.8; }
  94%            { text-shadow: 0 0 10px rgba(0, 229, 255, 0.5); opacity: 1; }
}

@keyframes glitch-top {
  0%, 90%, 100% { opacity: 0; transform: translateX(0); }
  91%            { opacity: 0.7; transform: translateX(-3px); }
  92%            { opacity: 0; transform: translateX(3px); }
}

@keyframes glitch-bot {
  0%, 93%, 100% { opacity: 0; transform: translateX(0); }
  94%            { opacity: 0.6; transform: translateX(3px); }
  95%            { opacity: 0; transform: translateX(-3px); }
}

/* ── Status badge neon flicker ── */
.status-badge {
  animation: badge-flicker 7s ease-in-out infinite;
}

@keyframes badge-flicker {
  0%, 88%, 90%, 100% { box-shadow: none; }
  89% {
    box-shadow:
      0 0 8px rgba(0, 229, 255, 0.4),
      0 0 20px rgba(0, 229, 255, 0.2);
  }
}

/* ── Panel top-bar glow pulse ── */
.service-panel::before,
.bottom-panel::before {
  animation: accent-pulse 3s ease-in-out infinite;
}

@keyframes accent-pulse {
  0%, 100% { opacity: 0.8; }
  50%       { opacity: 1;   box-shadow: 0 0 20px var(--panel-accent, var(--cyan)); }
}

/* ── Panel corner brackets ── */
.service-panel,
.bottom-panel {
  position: relative;
}

.service-panel::after,
.bottom-panel::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 12px; height: 12px;
  border-bottom: 2px solid var(--panel-accent, var(--cyan));
  border-right:  2px solid var(--panel-accent, var(--cyan));
  opacity: 0.5;
  border-radius: 0 0 var(--radius) 0;
  pointer-events: none;
}

/* ── Card hover neon glow ── */
.service-card:hover .card-icon {
  box-shadow: 0 0 10px var(--panel-accent, var(--cyan));
  border-color: var(--panel-accent, var(--cyan));
  transition: box-shadow 0.2s, border-color 0.2s;
}

.service-card:hover .card-name {
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
  transition: color 0.15s, text-shadow 0.15s;
}

/* ── Activity list items slide in ── */
#activity-list li {
  animation: slide-in 0.3s ease both;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Quick action btn neon pulse on hover ── */
.action-btn:hover {
  animation: btn-glow 1s ease-in-out infinite alternate;
}

@keyframes btn-glow {
  from { box-shadow: 0 0 8px  rgba(176, 64, 255, 0.2); }
  to   { box-shadow: 0 0 20px rgba(176, 64, 255, 0.5); }
}

/* ── Header border bottom glow pulse ── */
#portal-header {
  animation: header-glow 4s ease-in-out infinite;
}

@keyframes header-glow {
  0%, 100% { border-bottom-color: rgba(0, 229, 255, 0.15); }
  50%       { border-bottom-color: rgba(0, 229, 255, 0.35); }
}

/* ── Terminal modal ── */
.term-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.term-modal--open { display: flex; }

.term-modal-win {
  width: min(1100px, 94vw);
  height: min(680px, 88vh);
  background: #0d0d0d;
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 8px;
  box-shadow: 0 0 60px rgba(0, 229, 255, 0.15), 0 30px 80px rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: term-modal-in 0.2s ease;
}

@keyframes term-modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.term-modal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0, 229, 255, 0.05);
  border-bottom: 1px solid rgba(0, 229, 255, 0.15);
  flex-shrink: 0;
}

.term-modal-dots { display: flex; gap: 6px; cursor: pointer; }

.term-modal-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(0, 229, 255, 0.5);
  letter-spacing: 0.1em;
}

.term-modal-close {
  background: none;
  border: none;
  color: rgba(0, 229, 255, 0.4);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
}
.term-modal-close:hover { color: #fff; }

#terminal-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: #0d0d0d;
}

/* ── Ghost terminal popup ── */
.ghost-terminal {
  position: fixed;
  z-index: 50;
  width: 480px;
  max-width: 90vw;
  background: rgba(5, 3, 15, 0.96);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 6px;
  box-shadow:
    0 0 0 1px rgba(0, 229, 255, 0.08),
    0 0 30px rgba(0, 229, 255, 0.12),
    0 20px 60px rgba(0, 0, 0, 0.7);
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0;
  transform: translateY(10px) scale(0.97);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.ghost-terminal--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.ghost-terminal--closing {
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.ghost-terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: rgba(0, 229, 255, 0.06);
  border-bottom: 1px solid rgba(0, 229, 255, 0.12);
  border-radius: 6px 6px 0 0;
}

.ghost-terminal-dots { display: flex; gap: 5px; }
.td { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.td-r { background: #ff5f57; }
.td-y { background: #febc2e; }
.td-g { background: #28c840; }

.ghost-terminal-title {
  color: rgba(0, 229, 255, 0.5);
  font-size: 10px;
  letter-spacing: 0.08em;
  flex: 1;
  text-align: center;
}

.ghost-terminal-body {
  padding: 10px 12px;
  max-height: 220px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gt-line { line-height: 1.6; white-space: pre-wrap; word-break: break-all; }
.gt-prompt { color: rgba(0, 229, 255, 0.5); }
.gt-cmd  { color: #c8e6ff; }
.gt-out  { color: rgba(180, 210, 230, 0.55); padding-left: 2px; }
.gt-err  { color: #ff4560; text-shadow: 0 0 6px rgba(255, 69, 96, 0.4); }

/* ── Canvas data stream (behind panels) ── */
#fx-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.07;
}
