/* ============================================================
   RAG Terminal — terminal.css
   Dark CRT-style terminal theme
   ============================================================ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
  /* ── Design Tokens (OKLCH) ── */
  --bg:          oklch(0.14 0.02 160);
  --bg-raise:    oklch(0.18 0.02 160);
  --bg-border:   oklch(0.32 0.06 150);
  
  --phosphor:    oklch(0.88 0.28 140); /* More vibrant neon green */
  --phosphor-dim:oklch(0.88 0.28 140 / 0.7);
  --green:       var(--phosphor);
  
  --amber:       oklch(0.85 0.18 70);
  --cyan:        oklch(0.85 0.15 200);
  --red:         oklch(0.72 0.28 340);
  --dim:         oklch(0.32 0.06 150);
  --dim-text:    oklch(0.6 0.04 150);

  /* ── Typography ── */
  --font-mono:   'JetBrains Mono', monospace;
  --font-display:'Space Grotesk', sans-serif;
  --font-term:   'VT323', monospace;
  
  --font:        var(--font-mono);
  --font-size:   14px;
  --line-height: 1.5;

  /* ── Effects ── */
  --glow-color:  oklch(0.88 0.28 140 / 0.45);
  --glow:        0 0 10px var(--glow-color);
  --glow-strong: 0 0 20px var(--glow-color), 0 0 5px var(--glow-color);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Body — flex column layout ──────────────────────────────── */
html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--green);
  font-family: var(--font);
  font-size: var(--font-size);
  line-height: var(--line-height);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  /* Slight phosphor warmth */
  filter: brightness(1.0) contrast(1.02);
  /* Prevent double-tap zoom and improve touch feel */
  touch-action: manipulation;
  animation: screen-flicker 0.15s infinite;
}

/* ── CRT Scanlines overlay ──────────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%,
    rgba(0, 0, 0, 0.1) 50%
  ),
  repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 1px,
    rgba(0, 0, 0, 0.08) 1px,
    rgba(0, 0, 0, 0.08) 2px
  );
  background-size: 100% 4px, 100% 2px;
  pointer-events: none;
  z-index: 9000;
  animation: scanline 10s linear infinite;
}

/* ── CRT Vignette overlay ───────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 50%,
    rgba(0, 0, 0, 0.4) 100%
  );
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  z-index: 9001;
}

@keyframes scanline {
  0% { background-position: 0 0; }
  100% { background-position: 0 100%; }
}

@keyframes screen-flicker {
  0%   { opacity: 0.994; }
  20%  { opacity: 1; }
  40%  { opacity: 0.997; }
  60%  { opacity: 0.999; }
  80%  { opacity: 0.995; }
  100% { opacity: 1; }
}

/* ── Header — ASCII art ─────────────────────────────────────── */
#header {
  flex-shrink: 0;
  border-bottom: 1px solid var(--bg-border);
  padding: 10px 16px 2px;
  background: var(--bg);
}

.ascii-header {
  color: var(--green);
  text-shadow: var(--glow-strong);
  font-family: var(--font-mono); /* Use JetBrains Mono for perfect alignment */
  font-size: 13.5px;
  line-height: 1.0; /* Close vertical gaps */
  white-space: pre;
  letter-spacing: normal;
  /* Subtle flicker */
  animation: flicker 10s infinite;
}

@keyframes flicker {
  0%,  97%,   100% { opacity: 1; }
  97.5%            { opacity: 0.92; }
  98%              { opacity: 1; }
  98.5%            { opacity: 0.88; }
  99%              { opacity: 1; }
}

/* ── Output area ────────────────────────────────────────────── */
#output {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 18px 8px;
  scroll-behavior: smooth;
}

/* Custom scrollbar */
#output::-webkit-scrollbar        { width: 4px; }
#output::-webkit-scrollbar-track  { background: var(--bg); }
#output::-webkit-scrollbar-thumb  { background: var(--dim); border-radius: 2px; }
#output::-webkit-scrollbar-thumb:hover { background: var(--green-dim); }

/* ── Output blocks ──────────────────────────────────────────── */
.output-block {
  margin-bottom: 10px;
}

/* Command echo: "> command the user typed" */
.cmd-block {
  color: var(--dim-text);
  font-size: var(--font-size);
  margin-bottom: 4px;
}

/* LLM response text */
.response pre,
.response-text {
  color: var(--green);
  text-shadow: var(--glow);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Streaming indicator — subtle pulsing glow on the text */
.streaming {
  animation: pulse-glow 1.5s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { text-shadow: var(--glow); }
  50%       { text-shadow: var(--glow-strong); }
}

/* Blinking cursor appended inside the response area while streaming */
.stream-cursor {
  display: inline;
  color: var(--green);
  text-shadow: var(--glow-strong);
  margin-left: 1px;
  vertical-align: baseline;
  animation: blink 0.9s step-end infinite;
}

/* "Thinking…" dots shown before the first token arrives */
.thinking-block {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  color: var(--dim-text);
  font-size: var(--font-size);
}
.thinking-label {
  letter-spacing: 0.06em;
}
.thinking-dots {
  display: flex;
  gap: 4px;
}
.thinking-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-dim);
  animation: dot-pulse 1.2s ease-in-out infinite;
}
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-pulse {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40%           { opacity: 1;   transform: scale(1.2); box-shadow: 0 0 6px var(--green-glow); }
}

/* Error text */
.error pre,
.error-text {
  color: var(--red);
  text-shadow: 0 0 6px rgba(255, 68, 68, 0.4);
  white-space: pre-wrap;
}

/* Success text */
.success pre,
.success-text {
  color: var(--green);
  text-shadow: var(--glow);
}

/* Info / system messages */
.info pre,
.info-text {
  color: var(--dim-text);
  white-space: pre-wrap;
}

/* Warning */
.warning pre {
  color: var(--amber);
  text-shadow: 0 0 6px rgba(255, 170, 0, 0.3);
  white-space: pre-wrap;
}

/* ── Source citations (inline after response) ──────────────── */
.sources-block {
  margin-top: 6px;
  padding: 6px 0 2px;
  border-left: 2px solid var(--cyan);
  padding-left: 10px;
}

.sources-label {
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.source-item {
  color: var(--green-dim);
  font-size: 11.5px;
  line-height: 1.5;
}

.source-id {
  color: var(--dim);
  font-size: 10px;
}

/* Keep old .sources class for backwards compat */
.sources {
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
  font-size: 12px;
  margin-top: 4px;
  border-left: 2px solid var(--cyan);
  padding-left: 8px;
}

/* ── Source Citation Trail (/sources command) ───────────────── */
.sources-history {
  margin-bottom: 10px;
}

.sources-history-title {
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.citation-entry {
  margin-bottom: 8px;
  padding-left: 4px;
  border-left: 1px solid var(--bg-border);
  padding: 4px 0 4px 10px;
}

.citation-question {
  color: var(--green);
  text-shadow: var(--glow);
  font-size: 12.5px;
}

.citation-time {
  color: var(--dim);
  font-size: 10px;
}

.citation-source {
  color: var(--green-dim);
  font-size: 11.5px;
  padding-left: 4px;
}

.citation-summary {
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
  font-size: 12px;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--bg-border);
  white-space: pre-wrap;
}

/* ── Conversation History (/history command) ────────────────── */
.history-block {
  margin-bottom: 10px;
}

.history-title {
  color: var(--amber);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.history-user,
.history-assistant {
  margin-bottom: 6px;
  padding: 4px 0 4px 10px;
  border-left: 1px solid var(--bg-border);
}

.history-user .history-role {
  color: var(--green);
  text-shadow: var(--glow);
  font-size: 11.5px;
  font-weight: 500;
}

.history-assistant .history-role {
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
  font-size: 11.5px;
  font-weight: 500;
}

.history-content {
  color: var(--dim-text);
  font-size: 11.5px;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 2px;
  padding-left: 4px;
  line-height: 1.5;
}

/* Contextual rewrite note — shows when a follow-up was understood */
.context-note {
  color: var(--dim-text);
  font-size: 11px;
  font-style: italic;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  padding: 2px 0;
  opacity: 0.75;
}

/* Document table — monospace box drawing */
.doc-table pre {
  color: var(--green-dim);
  text-shadow: none;
  white-space: pre;
  font-size: 12.5px;
  line-height: 1.45;
}

/* Upload progress block */
.upload-block {
  margin-bottom: 6px;
}

.upload-block .progress-bar {
  color: var(--green-dim);
  font-size: 12px;
  margin-top: 2px;
  letter-spacing: 0.05em;
}

/* ── Shortcuts Bar ───────────────────────────────────────────── */
#shortcuts-bar {
  flex-shrink: 0;
  display: flex;
  gap: 12px;
  padding: 4px 18px;
  background: var(--bg);
  border-top: 1px solid var(--bg-border);
  font-size: 10px;
  color: var(--dim-text);
  overflow-x: auto;
  white-space: nowrap;
}

#shortcuts-bar::-webkit-scrollbar { display: none; }

.shortcut {
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}

.shortcut .key {
  color: var(--green-dim);
  border: 1px solid var(--bg-border);
  padding: 0 4px;
  border-radius: 2px;
  font-size: 9px;
  background: var(--bg-raise);
}

/* ── Input bar ──────────────────────────────────────────────── */
#input-bar {
  flex-shrink: 0;
  position: relative;          /* anchor for autocomplete dropdown */
  display: flex;
  align-items: center;
  padding: 8px 18px;
  border-top: 1px solid var(--bg-border);
  background: var(--bg);
  gap: 6px;
}

/* Action buttons (voice + upload) sitting before the prompt */
#input-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--bg-border);
  border-radius: 4px;
  color: var(--dim-text);
  cursor: pointer;
  transition: all 0.25s ease;
  padding: 0;
  flex-shrink: 0;
}

.action-btn:hover {
  color: var(--cyan);
  border-color: var(--cyan);
  text-shadow: var(--glow-cyan);
  box-shadow: 0 0 8px var(--cyan-glow);
}

.action-btn:active {
  transform: scale(0.92);
}

.action-btn svg {
  display: block;
}

/* Voice button active state — pulsing glow when listening */
.action-btn.listening {
  color: var(--red);
  border-color: var(--red);
  box-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
  animation: mic-pulse 1.4s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(255, 68, 68, 0.3); }
  50%      { box-shadow: 0 0 14px rgba(255, 68, 68, 0.6); }
}

.prompt {
  color: var(--green);
  text-shadow: var(--glow);
  flex-shrink: 0;
  user-select: none;
  font-weight: 500;
}

#input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
}

/* Invisible mirror span — takes up the same width as typed text so
   the cursor can be placed directly after it in the flex row.
   The real <input> is overlaid on top via position:absolute.        */
#input-mirror {
  visibility: hidden;     /* space-occupying, not visible */
  white-space: pre;
  pointer-events: none;
  font: inherit;
  font-size: var(--font-size);
  letter-spacing: inherit;
  flex-shrink: 0;
  min-width: 0;
  max-width: calc(100% - 1ch);
  overflow: hidden;
}

#cmd-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--green);
  caret-color: transparent;   /* we render our own cursor */
  font: inherit;
  font-size: var(--font-size);
  letter-spacing: inherit;
  text-shadow: var(--glow);
  padding: 0;
  z-index: 1;
}

#cmd-input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Blinking block cursor — sits inline after #input-mirror */
#cursor {
  flex-shrink: 0;
  color: var(--green);
  text-shadow: var(--glow-strong);
  font-size: var(--font-size);
  line-height: 1;
  pointer-events: none;
  min-width: 1ch;
  z-index: 0;
}

@keyframes blink {
  0%,  49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
.blink {
  animation: blink 1.1s step-end infinite;
}

/* ── Autocomplete dropdown ───────────────────────────────────── */
#autocomplete-dropdown {
  display: none;
  position: absolute;
  bottom: 100%;          /* float above the input bar */
  left: 0;
  right: 0;
  background: var(--bg-raise);
  border: 1px solid var(--green-dim);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  max-height: 220px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(0, 100, 187, 0.15);
}

#autocomplete-dropdown.visible {
  display: block;
  animation: ac-slide-up 0.12s ease-out;
}

@keyframes ac-slide-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ac-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 18px;
  cursor: pointer;
  gap: 16px;
  transition: background 0.1s;
}

.ac-item:hover,
.ac-item.active {
  background: rgba(0, 100, 187, 0.15);
  border-left: 2px solid var(--cyan);
  padding-left: 16px;
}

.ac-cmd {
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
  font-family: var(--font);
  font-size: var(--font-size);
  font-weight: 500;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

.ac-desc {
  color: var(--dim-text);
  font-size: 11px;
  font-family: var(--font);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

/* Highlight matched prefix inside the command */
.ac-match {
  color: var(--green);
  text-shadow: var(--glow);
}

/* ── Status bar ─────────────────────────────────────────────── */
#status-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 18px;
  border-top: 1px solid var(--bg-border);
  background: var(--bg-raise);
  font-size: 11px;
  color: var(--dim-text);
  user-select: none;
  gap: 12px;
  /* Modern mobile safe areas */
  padding-bottom: calc(4px + env(safe-area-inset-bottom));
}

.interactive-toggle {
  cursor: pointer;
  transition: all 0.2s;
  padding: 2px 4px;
}

.interactive-toggle:hover {
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
}

.interactive-toggle.active {
  color: var(--green);
  text-shadow: var(--glow);
}

#ollama-status {
  font-weight: 500;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

#ollama-status.online  { color: var(--green);  text-shadow: 0 0 6px var(--green-glow); }
#ollama-status.offline { color: var(--red);    text-shadow: 0 0 6px rgba(255,68,68,0.4); }
#ollama-status.connecting { color: var(--amber); }

.status-dot { margin-right: 1px; }

#model-info {
  flex: 1;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#clock {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

/* ── Drag-and-drop zone ─────────────────────────────────────── */
#drop-zone {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 8000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 3px dashed var(--green);
  animation: drop-fade-in 0.12s ease-out;
}

#drop-zone.active {
  display: flex;
}

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

#drop-zone-inner {
  text-align: center;
  color: var(--green);
  text-shadow: var(--glow-strong);
  pointer-events: none;
}

#drop-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0);   }
  50%       { transform: translateY(-8px); }
}

.drop-hint {
  margin-top: 8px;
  color: var(--dim-text);
  font-size: 12px;
  letter-spacing: 0.15em;
}

/* ── Responsive ─────────────────────────────────────────────── */

/* iOS momentum scrolling */
#output {
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
  :root { --font-size: 12px; }

  #header       { padding: 6px 10px 4px; }
  .ascii-header { font-size: 10px; line-height: 1.2; }

  #output     { padding: 8px 10px 4px; }
  #input-bar  { padding: 7px 10px; }
  #status-bar { padding: 3px 10px; font-size: 10px; gap: 6px; }

  /* Shrink model info to just doc count so it still fits */
  #model-info { font-size: 10px; }

  .doc-table pre { font-size: 11px; overflow-x: auto; }

  /* Prevent input zoom on iOS (requires ≥16px to avoid zoom) */
  #cmd-input { font-size: 16px; }

  #shortcuts-bar { display: none; }
}

@media (max-width: 420px) {
  .ascii-header { font-size: 8.5px; }
  /* Hide the ASCII box header lines on very small screens — keep just title */
  #header { padding: 4px 8px; }
}

/* Landscape mobile — reduce header height */
@media (max-height: 500px) {
  #header { display: none; }
}

/* ── Onboarding Overlay ─────────────────────────────────────── */
#onboarding-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s;
  overflow: hidden;
}

#onboarding-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#onboarding-content {
  text-align: center;
  width: 100%;
  max-width: 600px;
  padding: 2rem;
  z-index: 2;
}

#onboarding-status {
  font-family: var(--font);
  font-size: 14px;
  color: var(--green-dim);
  letter-spacing: 0.2em;
  margin-bottom: 2rem;
  opacity: 0;
  animation: fade-in-out 1.5s forwards;
}

#onboarding-logo {
  font-size: 84px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--green);
  text-shadow: var(--glow-strong);
  margin-bottom: 0.5rem;
  opacity: 0;
  transform: translateY(20px);
  animation: logo-reveal 3.5s 1.5s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

#onboarding-subtitle {
  font-size: 16px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  opacity: 0;
  animation: fade-in 2s 3s forwards;
  margin-bottom: 3rem;
}

#onboarding-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.feature-item {
  font-size: 12px;
  color: var(--dim-text);
  letter-spacing: 0.15em;
  opacity: 0;
  transform: translateX(-10px);
}

.feature-item:nth-child(1) { animation: feature-reveal 0.5s 4.5s forwards; }
.feature-item:nth-child(2) { animation: feature-reveal 0.5s 5.0s forwards; }
.feature-item:nth-child(3) { animation: feature-reveal 0.5s 5.5s forwards; }

#skip-onboarding {
  position: absolute;
  bottom: 40px;
  right: 40px;
  background: transparent;
  border: 1px solid var(--bg-border);
  color: var(--dim-text);
  padding: 8px 16px;
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.3s;
  opacity: 0;
  animation: fade-in 1s 6s forwards;
}

#skip-onboarding:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
}

/* Animations */
@keyframes fade-in-out {
  0%   { opacity: 0; transform: translateY(10px); }
  20%  { opacity: 1; transform: translateY(0);    }
  80%  { opacity: 1; transform: translateY(0);    }
  100% { opacity: 0; transform: translateY(-10px); }
}

@keyframes logo-reveal {
  0% { 
    opacity: 0; 
    transform: translateY(20px) scale(0.9);
    filter: blur(10px);
  }
  20% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
  30%, 35%, 45%, 50% {
    text-shadow: var(--glow-strong), 2px 0 0 red, -2px 0 0 blue;
    transform: translate(2px, 0);
  }
  32%, 42%, 52% {
    text-shadow: var(--glow-strong);
    transform: translate(0, 0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

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

@keyframes feature-reveal {
  to {
    opacity: 1;
    transform: translateX(0);
    color: var(--green-dim);
  }
}

/* Glassy pulse backgrounds */
#onboarding-overlay::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--green-glow) 0%, transparent 70%);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  opacity: 0.15;
  animation: pulse-bg 10s infinite;
}

@keyframes pulse-bg {
  0%, 100% { transform: translate(-50%, -50%) scale(1);   opacity: 0.15; }
  50%       { transform: translate(-50%, -50%) scale(1.2); opacity: 0.25; }
}

/* ── Crazy Advanced Glitch Effect ── */
/* ── Crazy Advanced Glitch Effect (Stable Version) ── */
.glitch-loki {
  position: relative;
  font-family: var(--font-display);
  font-size: 84px;
  font-weight: 700;
  color: var(--green);
  text-shadow: var(--glow-strong);
  z-index: 2;
}

.glitch-loki::before,
.glitch-loki::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.8;
}

.glitch-loki::before {
  color: #ff00c1;
  z-index: -1;
  animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.glitch-loki::after {
  color: #00fff9;
  z-index: -2;
  animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
  0% { clip-path: inset(80% 0 0 0); transform: translate(-2px, -1px); }
  10% { clip-path: inset(10% 0 85% 0); transform: translate(2px, 1px); }
  20% { clip-path: inset(40% 0 43% 0); transform: translate(-2px, 2px); }
  30% { clip-path: inset(86% 0 5% 0); transform: translate(1px, -2px); }
  40% { clip-path: inset(20% 0 70% 0); transform: translate(-1px, 1px); }
  50% { clip-path: inset(60% 0 10% 0); transform: translate(2px, -1px); }
  60% { clip-path: inset(10% 0 80% 0); transform: translate(-2px, 2px); }
  70% { clip-path: inset(80% 0 15% 0); transform: translate(1px, -1px); }
  80% { clip-path: inset(30% 0 50% 0); transform: translate(-2px, 1px); }
  90% { clip-path: inset(50% 0 30% 0); transform: translate(2px, -2px); }
  100% { clip-path: inset(10% 0 85% 0); transform: translate(-1px, 1px); }
}

@keyframes glitch-anim-2 {
  0% { clip-path: inset(20% 0 70% 0); transform: translate(2px, 1px); }
  10% { clip-path: inset(80% 0 10% 0); transform: translate(-2px, -1px); }
  20% { clip-path: inset(10% 0 80% 0); transform: translate(2px, 2px); }
  30% { clip-path: inset(50% 0 30% 0); transform: translate(-1px, -2px); }
  40% { clip-path: inset(30% 0 50% 0); transform: translate(2px, 1px); }
  50% { clip-path: inset(85% 0 10% 0); transform: translate(-2px, -1px); }
  60% { clip-path: inset(15% 0 80% 0); transform: translate(2px, 2px); }
  70% { clip-path: inset(60% 0 15% 0); transform: translate(-1px, -1px); }
  80% { clip-path: inset(40% 0 43% 0); transform: translate(2px, 1px); }
  90% { clip-path: inset(86% 0 5% 0); transform: translate(-2px, -2px); }
  100% { clip-path: inset(10% 0 85% 0); transform: translate(1px, 1px); }
}


