/* ABOUTME: Scoped phosphor-green CRT styles for the opt-in terminal easter-egg overlay. */
/* ABOUTME: Every rule lives under .term-egg so the terminal aesthetic never leaks into the reading site. */

.term-egg {
  --t-bg: #0a0a0a;
  --t-bg-2: #111;
  --t-green: #33ff33;
  --t-green-dim: #22aa22;
  --t-green-bright: #66ff66;
  --t-amber: #ffb000;
  --t-cyan: #00ffff;
  --t-magenta: #ff00ff;
  --t-yellow: #ffff33;
  --t-gray: #888;
  --t-white: #ccc;
  --t-font: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--t-bg);
  color: var(--t-green);
  font-family: var(--t-font);
  font-size: 14px;
  line-height: 1.6;
  overflow-y: auto;
  padding: clamp(1rem, 4vw, 2.5rem);
  text-shadow: 0 0 5px rgba(51, 255, 51, 0.5);
}
.term-egg[hidden] { display: none; }

/* Scanlines */
.term-egg::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.04), rgba(0,0,0,0.04) 1px, transparent 1px, transparent 2px);
  z-index: 2;
}

.term-egg__window { max-width: 1000px; margin-inline: auto; position: relative; z-index: 1; }

.term-egg__close {
  position: sticky;
  top: 0;
  float: right;
  background: transparent;
  border: 1px solid var(--t-green-dim);
  color: var(--t-green);
  font-family: var(--t-font);
  font-size: 0.8rem;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
  border-radius: 3px;
}
.term-egg__close:hover { color: var(--t-bg); background: var(--t-green); }

.term-egg .ascii-logo { color: var(--t-green); white-space: pre; font-size: 0.7rem; line-height: 1.2; margin-bottom: 0.5rem; overflow-x: auto; }
.term-egg .terminal-title { color: var(--t-amber); font-size: 0.85rem; }
.term-egg .terminal-header { border-bottom: 1px solid var(--t-green-dim); padding-bottom: 1rem; margin-bottom: 1.25rem; }

.term-egg .system-info {
  display: flex; flex-wrap: wrap; gap: 1.5rem;
  padding: 0.5rem 0; margin-bottom: 1.25rem;
  border-bottom: 1px dashed var(--t-gray);
  font-size: 0.85rem; color: var(--t-gray);
}
.term-egg .system-info span { color: var(--t-cyan); }

.term-egg .output { padding: 0.5rem 0; }
.term-egg .output-block { margin: 1rem 0; }
.term-egg .output-line { margin: 0.2rem 0; }

.term-egg a { color: var(--t-cyan); text-decoration: none; }
.term-egg a:hover { color: var(--t-green-bright); text-decoration: underline; }

.term-egg .term-green { color: var(--t-green); }
.term-egg .term-cyan { color: var(--t-cyan); }
.term-egg .term-amber { color: var(--t-amber); }
.term-egg .term-magenta { color: var(--t-magenta); }
.term-egg .term-yellow { color: var(--t-yellow); }
.term-egg .term-gray { color: var(--t-gray); }
.term-egg .prompt-symbol { color: var(--t-green-bright); }
.term-egg .dir-name, .term-egg .dir-icon { color: var(--t-cyan); }
.term-egg .file-name, .term-egg .file-icon { color: var(--t-green); }

.term-egg .cmd-link { color: var(--t-amber); cursor: pointer; }
.term-egg .cmd-link::before { content: '> '; color: var(--t-green); }
.term-egg .cmd-link:hover { color: var(--t-yellow); }

/* Prompt + input */
.term-egg .command-input-wrapper { display: flex; align-items: center; margin-top: 1rem; padding: 0.5rem 0; }
.term-egg .prompt { display: flex; gap: 0.5ch; color: var(--t-green); }
.term-egg .prompt-user { color: var(--t-cyan); }
.term-egg .prompt-at, .term-egg .prompt-separator { color: var(--t-gray); }
.term-egg .prompt-host { color: var(--t-magenta); }
.term-egg .prompt-path { color: var(--t-amber); }
.term-egg .command-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--t-green); font-family: var(--t-font); font-size: 1rem;
  caret-color: var(--t-green); text-shadow: 0 0 5px rgba(51,255,51,0.5);
  margin-left: 0.5ch;
}
.term-egg .command-input::placeholder { color: var(--t-gray); }
.term-egg .cursor { display: inline-block; width: 0.6em; height: 1.2em; background: var(--t-green); animation: term-blink 1s step-end infinite; }
@keyframes term-blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* Content listings inside terminal */
.term-egg .content-list { list-style: none; }
.term-egg .content-item {
  padding: 0.5rem 0; border-bottom: 1px dotted var(--t-gray);
  display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: baseline;
}
.term-egg .content-type { color: var(--t-cyan); min-width: 8ch; }
.term-egg .content-title { color: var(--t-green); }
.term-egg .content-date { color: var(--t-gray); font-size: 0.85rem; }

/* Help */
.term-egg .help-section { margin: 1rem 0; }
.term-egg .help-title { color: var(--t-amber); margin-bottom: 0.5rem; }
.term-egg .help-command { display: grid; grid-template-columns: 20ch 1fr; gap: 1rem; padding: 0.2rem 0; }
.term-egg .help-cmd { color: var(--t-cyan); }
.term-egg .help-desc { color: var(--t-gray); }

/* History */
.term-egg .history-item { padding: 0.2rem 0; color: var(--t-gray); }
.term-egg .history-item .cmd { color: var(--t-green); }
.term-egg .history-number { color: var(--t-amber); min-width: 4ch; display: inline-block; }

/* Autocomplete */
.term-egg .autocomplete-menu { background: var(--t-bg); border: 1px solid var(--t-gray); border-radius: 4px; margin: 0.5rem 0; max-height: 300px; overflow-y: auto; }
.term-egg .autocomplete-header { padding: 0.4rem 1rem; border-bottom: 1px dashed var(--t-gray); }
.term-egg .autocomplete-hint { color: var(--t-gray); font-size: 0.85em; }
.term-egg .autocomplete-item { padding: 0.4rem 1rem; cursor: pointer; display: flex; gap: 1rem; align-items: center; }
.term-egg .autocomplete-item:hover { background: rgba(255,255,255,0.05); }
.term-egg .autocomplete-item.selected { background: var(--t-cyan); color: var(--t-bg); }
.term-egg .autocomplete-slug { color: var(--t-cyan); min-width: 30ch; flex-shrink: 0; }
.term-egg .autocomplete-title { color: var(--t-gray); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-egg .autocomplete-type { color: var(--t-amber); font-size: 0.85em; }
.term-egg .autocomplete-item.selected .autocomplete-slug,
.term-egg .autocomplete-item.selected .autocomplete-title,
.term-egg .autocomplete-item.selected .autocomplete-type { color: var(--t-bg); }

.term-egg pre { white-space: pre; overflow-x: auto; }

@media (prefers-reduced-motion: reduce) {
  .term-egg .cursor { animation: none; opacity: 1; }
}
