/* ─────────────────────────────────────────────────────────────────────────────
   effects.css — Visual effects (phosphor-only, unless noted)
   All GPU-cheap: text-shadow, pseudo-elements, keyframe animations.
   No filter:blur. All disabled under prefers-reduced-motion.
───────────────────────────────────────────────────────────────────────────── */

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

/* ── Glitch shake + RGB split ── */
@keyframes glitch-shake {
  0%         { transform: translateX(0); }
  15%        { transform: translateX(-2px); }
  30%        { transform: translateX(2px); }
  45%        { transform: translateX(-1px); }
  60%        { transform: translateX(1px); }
  75%        { transform: translateX(-1px); }
  90%        { transform: translateX(1px); }
  100%       { transform: translateX(0); }
}

@keyframes glitch-rgb {
  0%   { text-shadow:  1px 0 0 #ff5fcf, -1px 0 0 #5ce1ff; }
  25%  { text-shadow: -2px 0 0 #ff5fcf,  2px 0 0 #5ce1ff; }
  50%  { text-shadow:  1px 0 0 #5ce1ff, -1px 0 0 #ff5fcf; }
  75%  { text-shadow: -1px 0 0 #ff5fcf,  1px 0 0 #5ce1ff; }
  100% { text-shadow: none; }
}

/* Shimmer (shared) */
@keyframes shim {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   PHOSPHOR-ONLY effects
───────────────────────────────────────────────────────────────────────────── */

/* ── Scanlines overlay (opt-in via .scanlines-on on body) ── */
[data-theme="phosphor"].scanlines-on body::after,
[data-theme="phosphor"] body.scanlines-on::after {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--effect-scanlines);
  pointer-events: none;
  z-index: 9998;
  opacity: 1;
}

/* ── CRT vignette (always-on, very subtle) ── */
[data-theme="phosphor"] body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.25) 100%);
  pointer-events: none;
  z-index: 9997;
}

/* ── Phosphor bloom on .glow elements ── */
[data-theme="phosphor"] .glow {
  text-shadow: var(--effect-bloom);
}

/* Inputs: bloom ring on focus */
[data-theme="phosphor"] input:focus,
[data-theme="phosphor"] textarea:focus,
[data-theme="phosphor"] select:focus {
  box-shadow: 0 0 0 1px var(--brand), 0 0 8px rgba(95,255,159,0.3);
}

/* Active/focused interactive elements get subtle bloom */
[data-theme="phosphor"] .ab-btn.on .ab-label,
[data-theme="phosphor"] .tab.on,
[data-theme="phosphor"] #sbp-host,
[data-theme="phosphor"] .sc-v,
[data-theme="phosphor"] .sb-mode {
  text-shadow: 0 0 6px currentColor;
}

/* Buttons: bloom on hover in phosphor */
[data-theme="phosphor"] .btn:hover,
[data-theme="phosphor"] .btn-p {
  box-shadow: 0 0 6px rgba(95,255,159,0.15);
}

/* ── Glitch class — triggered by effects.js on toast errors ── */
[data-theme="phosphor"] .glitch {
  animation:
    glitch-shake 0.24s ease,
    glitch-rgb    0.24s ease;
}

/* ── Blinking cursor glyph ── */
[data-theme="phosphor"] .blink-cursor {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  background: var(--brand);
  vertical-align: middle;
  margin-left: 2px;
  box-shadow: 0 0 6px var(--brand);
  animation: blink-cursor 1.06s step-end infinite;
}

/* ── Toast: phosphor style ── */
[data-theme="phosphor"] .toast {
  background: var(--bg-ov);
  border: 1px solid var(--bdr-a);
  font-family: var(--mono);
  font-size: 11px;
  border-radius: 0 !important;
  border-left: 2px solid var(--brand);
}

[data-theme="phosphor"] .t-ok  { border-left-color: var(--acc); }
[data-theme="phosphor"] .t-er  { border-left-color: var(--crit); }
[data-theme="phosphor"] .t-in  { border-left-color: var(--info); }

/* ── Boot overlay — dmesg typewriter (built by effects.js) ── */
[data-theme="phosphor"] #boot-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-void);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 40px 60px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.8;
  color: var(--txt-m);
}

[data-theme="phosphor"] #boot-log {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 70vh;
  overflow: hidden;
}

[data-theme="phosphor"] .boot-line {
  white-space: pre;
  color: var(--txt-m);
}

[data-theme="phosphor"] .boot-line .boot-ts {
  color: var(--txt-ghost);
  margin-right: 8px;
}

[data-theme="phosphor"] .boot-line .boot-ok {
  color: var(--acc);
  text-shadow: 0 0 4px var(--acc);
}

[data-theme="phosphor"] .boot-line .boot-warn {
  color: var(--warn);
}

[data-theme="phosphor"] .boot-line .boot-svc {
  color: var(--brand);
}

/* ── Matrix rain canvas (created by effects.js, Intake-only) ── */
[data-theme="phosphor"] #matrix-rain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  z-index: 2;
}

/* ── Progress / skeleton — phosphor style ── */
[data-theme="phosphor"] .skel {
  background: linear-gradient(90deg,
    var(--bg-el) 25%,
    var(--bg-ov) 50%,
    var(--bg-el) 75%
  );
  background-size: 200% 100%;
  animation: shim 1.2s infinite;
}

/* ── Empty state shells ── */
[data-theme="phosphor"] .shell-ic {
  color: var(--txt-ghost);
  text-shadow: 0 0 20px var(--brand);
}

[data-theme="phosphor"] .shell-ttl {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--txt-s);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

[data-theme="phosphor"] .shell-eta {
  background: var(--brand-d);
  color: var(--brand);
  border: 1px solid var(--brand);
  font-family: var(--mono);
  font-size: 10px;
  text-shadow: var(--effect-bloom);
}

/* ─────────────────────────────────────────────────────────────────────────────
   REDUCED MOTION — suppress all effects
───────────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  [data-theme="phosphor"] body::after,
  [data-theme="phosphor"] body.scanlines-on::after { display: none; }

  [data-theme="phosphor"] .glitch { animation: none; }
  [data-theme="phosphor"] .blink-cursor { animation: none; opacity: 1; }
  [data-theme="phosphor"] #ph-pal-cursor { animation: none; opacity: 1; }
  [data-theme="phosphor"] #matrix-rain { display: none !important; }

  .skel { animation: none !important; }
}
