/* ============================================
   TERMINAL THEME
   Palette: "Vector Lab" — a dark, slightly green-tinted
   terminal evoking genomic sequencers + code editors.

   --bg        #0b0e0c  near-black, faint green undertone
   --bg-panel  #111512  title bar / panel surface
   --fg        #c9f3d6  soft mint-white text
   --accent    #5ef2a0  signal green (prompts, links, success)
   --accent-2  #ffd166  amber (warnings, highlights, headings)
   --accent-3  #7aa2ff  cool blue (links, file paths)
   --muted     #5c7568  dim green-grey (comments, timestamps)
   --error     #ff6b6b  red (errors)
   ============================================ */

:root {
  --bg: #0b0e0c;
  --bg-panel: #111512;
  --fg: #c9f3d6;
  --accent: #5ef2a0;
  --accent-2: #ffd166;
  --accent-3: #7aa2ff;
  --muted: #5c7568;
  --error: #ff6b6b;

  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", "Cascadia Code", Consolas, monospace;
  --font-display: "JetBrains Mono", monospace;

  --line-height: 1.6;
  --font-size: 15px;

  --radius: 6px;
  --border: 1px solid #1f2a23;
}

@font-face {
  font-family: "JetBrains Mono";
  src: local("JetBrains Mono");
}

html {
  background: var(--bg);
}

body {
  background:
    radial-gradient(ellipse at top, rgba(94, 242, 160, 0.04), transparent 60%),
    var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: var(--font-size);
  line-height: var(--line-height);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ============================================
   BOOT SCREEN
   ============================================ */

#boot-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#boot-screen.hidden {
  display: none;
}

#boot-text {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  max-width: 720px;
  text-shadow: 0 0 6px rgba(94, 242, 160, 0.35);
}

#boot-text .boot-line {
  display: block;
  opacity: 0;
  animation: boot-fade-in 0.15s ease forwards;
}

#boot-text .boot-ok {
  color: var(--accent);
}

#boot-text .boot-warn {
  color: var(--accent-2);
}

#boot-text .boot-dim {
  color: var(--muted);
}

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

#boot-text .boot-cursor::after {
  content: "_";
  animation: blink 1s steps(1) infinite;
}

/* ============================================
   TERMINAL WINDOW
   ============================================ */

#terminal {
  width: min(960px, 100%);
  height: min(680px, 88vh);
  background: var(--bg);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow:
    0 0 0 1px rgba(94, 242, 160, 0.04),
    0 30px 80px -20px rgba(0, 0, 0, 0.8),
    0 0 60px -10px rgba(94, 242, 160, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.99);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

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

#terminal.hidden {
  display: flex; /* overridden by .visible transition; keep flex for layout */
}

/* ---- Title bar ---- */

.title-bar {
  background: var(--bg-panel);
  border-bottom: var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  flex-shrink: 0;
  -webkit-user-select: none;
  user-select: none;
}

.title-bar-buttons {
  display: flex;
  gap: 8px;
}

.btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.btn-close { background: #ff6b6b; }
.btn-min   { background: #ffd166; }
.btn-max   { background: #5ef2a0; }

.title-bar-text {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.title-bar-clock {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.05em;
  min-width: 64px;
  text-align: right;
}

/* ---- Output area ---- */

#output {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--muted) transparent;
}

#output::-webkit-scrollbar {
  width: 8px;
}

#output::-webkit-scrollbar-thumb {
  background: #1f2a23;
  border-radius: 8px;
}

#output::-webkit-scrollbar-track {
  background: transparent;
}

.line {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 2px;
  animation: line-in 0.18s ease both;
}

@keyframes line-in {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}

.line.echo {
  color: var(--fg);
  margin-top: 10px;
}

.line.echo .echo-prompt {
  color: var(--accent);
}

.line .out-block {
  display: block;
}

.line.dim, .out-dim { color: var(--muted); }
.line.accent, .out-accent { color: var(--accent); }
.line.heading, .out-heading {
  color: var(--accent-2);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.line.error, .out-error { color: var(--error); }
.line.link, .out-link {
  color: var(--accent-3);
  text-decoration: underline;
  text-decoration-color: rgba(122, 162, 255, 0.35);
}
.line.link:hover { text-decoration-color: var(--accent-3); }

.section-rule {
  border: none;
  border-top: 1px dashed #1f2a23;
  margin: 10px 0;
}

/* ---- Rainbow ASCII banner ---- */

.rainbow-banner {
  /* override the single accent colour */
  color: unset;
  text-shadow: none;
}

.rainbow-banner .rb {
  color: hsl(calc(var(--hue) + var(--rb-offset, 0deg)), 90%, 68%);
  animation: rb-hue-shift 4s linear infinite;
  animation-delay: calc(var(--hue) * -0.011s); /* stagger per char */
  display: inline;
}

@keyframes rb-hue-shift {
  from { --rb-offset: 0deg;   }
  to   { --rb-offset: 360deg; }
}

@supports not (color: hsl(calc(1deg), 1%, 1%)) {
  /* Fallback for browsers that don't support calc() inside hsl() */
  .rainbow-banner .rb {
    animation: rb-hue-shift-fallback 4s linear infinite;
    animation-delay: calc(var(--hue) * -0.011s);
  }
  @keyframes rb-hue-shift-fallback {
    0%   { color: #ff6b6b; }
    20%  { color: #ffd166; }
    40%  { color: #5ef2a0; }
    60%  { color: #7aa2ff; }
    80%  { color: #c77dff; }
    100% { color: #ff6b6b; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .rainbow-banner .rb {
    animation: none;
    color: hsl(var(--hue), 85%, 65%);
  }
}

/* ---- ASCII banner ---- */

.ascii-banner {
  color: var(--accent);
  font-size: 9.5px;
  line-height: 1.25;
  margin: 4px 0 12px;
  text-shadow: 0 0 8px rgba(94, 242, 160, 0.25);
  white-space: pre;
  overflow-x: auto;
  display: block;
}

/* ---- Project / job cards rendered as text blocks ---- */

.entry {
  margin: 8px 0 16px;
  padding-left: 14px;
  border-left: 2px solid #1f2a23;
}

.entry-title {
  color: var(--accent-2);
  font-weight: 700;
}

.entry-meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.entry ul {
  margin-top: 4px;
  padding-left: 18px;
}

.entry li {
  margin-bottom: 3px;
}

.entry li::marker {
  color: var(--accent);
}

.tag {
  display: inline-block;
  border: 1px solid #29382f;
  border-radius: 4px;
  padding: 1px 6px;
  margin: 2px 4px 2px 0;
  font-size: 11px;
  color: var(--accent-3);
  background: rgba(122, 162, 255, 0.06);
}

/* ---- Skill bars (visual flair for `skills`) ---- */

.skill-row {
  display: grid;
  grid-template-columns: 140px 1fr 40px;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.skill-label {
  color: var(--fg);
}

.skill-bar-track {
  height: 8px;
  background: #161c18;
  border-radius: 4px;
  overflow: hidden;
}

.skill-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
  width: 0%;
  transition: width 0.9s cubic-bezier(.2,.8,.2,1);
  border-radius: 4px;
}

.skill-pct {
  text-align: right;
  color: var(--muted);
  font-size: 12px;
}

/* ---- Help table ---- */

.help-table {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 4px 12px;
  margin: 6px 0;
}

.help-cmd { color: var(--accent); }
.help-desc { color: var(--fg); }

/* ============================================
   INPUT LINE
   ============================================ */

.input-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px 16px;
  flex-shrink: 0;
  border-top: 1px solid transparent;
}

.prompt {
  flex-shrink: 0;
  white-space: nowrap;
}

.prompt-user { color: var(--accent); font-weight: 700; }
.prompt-at, .prompt-colon, .prompt-dollar { color: var(--muted); }
.prompt-host { color: var(--accent-3); font-weight: 700; }
.prompt-path { color: var(--accent-2); }
.prompt-dollar { margin-left: 4px; }

.input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}

#cmd-input {
  position: absolute;
  inset: 0;
  width: 100%;
  caret-color: transparent;
  color: transparent;
  z-index: 2;
}

.input-mirror {
  color: var(--fg);
  white-space: pre;
  pointer-events: none;
  z-index: 1;
}

.cursor-block {
  display: inline-block;
  width: 8px;
  height: 18px;
  background: var(--accent);
  margin-left: 2px;
  animation: blink 1s steps(1) infinite;
  flex-shrink: 0;
  vertical-align: middle;
}

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

/* ============================================
   KONAMI EASTER EGG
   Cosmetic rainbow celebration mode
   ============================================ */

@keyframes konami-rainbow {
  0%   { color: #ff6b6b; }
  20%  { color: #ffd166; }
  40%  { color: #5ef2a0; }
  60%  { color: #7aa2ff; }
  80%  { color: #c77dff; }
  100% { color: #ff6b6b; }
}

html.konami-active .prompt-user,
html.konami-active .prompt-host,
html.konami-active .prompt-path,
html.konami-active .cursor-block,
html.konami-active .echo-prompt {
  animation: konami-rainbow 2s linear infinite;
}

html.konami-active .cursor-block {
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

html.konami-active #terminal {
  box-shadow:
    0 0 0 1px rgba(94, 242, 160, 0.04),
    0 30px 80px -20px rgba(0, 0, 0, 0.8),
    0 0 60px -6px rgba(255, 209, 102, 0.25);
}

@media (prefers-reduced-motion: reduce) {
  html.konami-active .prompt-user,
  html.konami-active .prompt-host,
  html.konami-active .prompt-path,
  html.konami-active .cursor-block,
  html.konami-active .echo-prompt {
    animation: none;
    color: var(--accent-2);
  }
}





/* ============================================
   SOCIAL CARDS
   ============================================ */

.social-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin: 4px 0 8px;
}

.social-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #1f2a23;
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--fg);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.social-card:hover {
  border-color: var(--accent);
  background: rgba(94, 242, 160, 0.05);
  transform: translateY(-1px);
}

.social-icon {
  color: var(--accent);
  font-weight: 700;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.social-label {
  font-size: 13px;
}

/* ============================================
   NEOFETCH
   ============================================ */

.neofetch {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
  margin: 4px 0;
}

.neofetch-art {
  color: var(--accent);
  font-size: 9px;
  line-height: 1.2;
  white-space: pre;
  text-shadow: 0 0 6px rgba(94, 242, 160, 0.25);
  flex-shrink: 0;
}

.neofetch-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  align-content: center;
  font-size: 13px;
}

.neofetch-key {
  color: var(--accent-2);
  font-weight: 700;
}

.neofetch-val {
  color: var(--fg);
}

.man-page {
  border: 1px solid #1f2a23;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.015);
  padding: 14px 16px;
  margin: 4px 0 12px;
}

.man-header {
  display: flex;
  justify-content: space-between;
  color: var(--accent-2);
  font-weight: 700;
  border-bottom: 1px dashed #1f2a23;
  padding-bottom: 8px;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

.man-header-section {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  text-transform: uppercase;
}

.man-section-title {
  color: var(--accent);
  font-weight: 700;
  margin: 12px 0 4px;
  letter-spacing: 0.08em;
}

.man-body {
  color: var(--fg);
  padding-left: 4px;
}

.man-body ul,
ul.man-body {
  padding-left: 20px;
  margin: 0;
}

.man-body li {
  margin-bottom: 4px;
}

.man-body li::marker {
  color: var(--accent);
}

.man-diagram {
  color: var(--accent-3);
  font-size: 12px;
  line-height: 1.4;
  white-space: pre;
  overflow-x: auto;
  padding: 8px 0 4px 4px;
  margin: 0;
}

.man-footer {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px dashed #1f2a23;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  letter-spacing: 0.05em;
}



/* Fade/slide in for rich HTML blocks (entries, tables, banners) */
.fade-in-block {
  animation: block-fade-in 0.3s ease both;
}

@keyframes block-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Thinking / loading dots shown before command output */
.thinking-indicator {
  height: 1.4em;
}

.thinking-dots span {
  opacity: 0;
  animation: thinking-blink 1.1s infinite;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.18s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes thinking-blink {
  0%, 20%   { opacity: 0; }
  35%, 60%  { opacity: 1; }
  100%      { opacity: 0; }
}

/* Glitch-in effect for the ASCII name banner on load */
.glitch-in {
  animation: glitch-in 0.6s steps(2, end) both;
}

@keyframes glitch-in {
  0%   { opacity: 0; transform: translate(2px, 0); filter: blur(1px); }
  20%  { opacity: 1; transform: translate(-2px, 0); }
  40%  { transform: translate(1px, 0); }
  60%  { transform: translate(-1px, 0); filter: blur(0.5px); }
  80%  { transform: translate(1px, 0); }
  100% { opacity: 1; transform: translate(0, 0); filter: blur(0); }
}

/* Matrix rain easter-egg overlay */
.matrix-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  cursor: pointer;
  animation: matrix-fade-in 0.25s ease both;
}

.matrix-overlay canvas {
  display: block;
}

.matrix-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  background: rgba(11, 14, 12, 0.6);
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid #1f2a23;
}

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

@media (prefers-reduced-motion: reduce) {
  .fade-in-block, .glitch-in, .matrix-overlay {
    animation: none;
  }
  .thinking-dots span {
    animation: none;
    opacity: 1;
  }
}

/* ============================================
   UTILITIES
   ============================================ */

.hidden { display: none !important; }

/* ---------- Window state modifiers ---------- */

/* Minimized: keep title bar visible, collapse output and input to a thin bar */
#terminal.minimized {
  height: auto;
  max-height: 56px;
  width: 360px;
  border-radius: 6px;
}

#terminal.minimized #output,
#terminal.minimized .input-line {
  display: none;
}

/* Fullscreen: occupy the full viewport */
#terminal.fullscreen {
  position: fixed;
  inset: 12px;
  width: auto;
  height: auto;
  border-radius: 8px;
  z-index: 150;
  max-width: none;
  max-height: none;
}

#terminal.fullscreen #output {
  overflow: auto;
}