/* ============================================================
   Terminal Portfolio — full-page CRT terminal
   Themes are driven by CSS variables on [data-theme].
   ============================================================ */

:root,
[data-theme="green"] {
  --fg: #3dff74;
  --fg-dim: #1d7c3c;
  --accent: #c9ffdd;
  --bg: #040705;
  --panel: #070c09;
  --border: rgba(61, 255, 116, 0.28);
  --glow: rgba(61, 255, 116, 0.22);
  --shadow: 0 0 6px rgba(61, 255, 116, 0.20);
}

[data-theme="amber"] {
  --fg: #ffb000;
  --fg-dim: #8a5e00;
  --accent: #ffe3ab;
  --bg: #0a0703;
  --panel: #0f0a04;
  --border: rgba(255, 176, 0, 0.28);
  --glow: rgba(255, 176, 0, 0.22);
  --shadow: 0 0 6px rgba(255, 176, 0, 0.20);
}

[data-theme="blue"] {
  --fg: #5ec8ff;
  --fg-dim: #1f5f80;
  --accent: #d3edff;
  --bg: #03070a;
  --panel: #060d12;
  --border: rgba(94, 200, 255, 0.28);
  --glow: rgba(94, 200, 255, 0.22);
  --shadow: 0 0 6px rgba(94, 200, 255, 0.20);
}

[data-theme="mono"] {
  --fg: #e9f1ea;
  --fg-dim: #76837a;
  --accent: #ffffff;
  --bg: #08090a;
  --panel: #0d0f10;
  --border: rgba(233, 241, 234, 0.22);
  --glow: rgba(233, 241, 234, 0.16);
  --shadow: 0 0 5px rgba(233, 241, 234, 0.14);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* --------------------------------------------------------------------------
   Full-page terminal: the viewport IS the terminal. One single scroll region
   (the output) so trackpad / touch scrolling behaves natively and never gets
   "stuck" bouncing between nested scroll containers.
   -------------------------------------------------------------------------- */
html, body { height: 100%; }

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;             /* no page scroll — the output pane scrolls */
  overscroll-behavior: none;    /* kill macOS rubber-band "nothing happens" feel */
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  line-height: 1.6;
  text-shadow: var(--shadow);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

button, a, .inline-cmd, .chip { touch-action: manipulation; } /* remove tap delay */

/* ---------- CRT overlay (never intercepts pointer events) ---------- */
.crt {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.14) 3px
  );
}
.crt::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, 0.50) 100%);
}

/* ---------- terminal shell ---------- */
.term {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  background:
    radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--fg) 4%, transparent), transparent 60%),
    var(--bg);
}

/* ---------- output: the one and only scroll container ---------- */
.output {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 16px clamp(12px, 2.2vw, 26px) 6px;
  cursor: text;
}
.output::-webkit-scrollbar { width: 10px; }
.output::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
.output::-webkit-scrollbar-track { background: transparent; }
.output { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

.line {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: fadein 0.14s ease both;
}
.line + .line { margin-top: 2px; }

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

/* ---------- text helpers ---------- */
.dim { color: var(--fg-dim); text-shadow: none; }
.accent { color: var(--accent); }
.err { color: #ff6b6b; text-shadow: 0 0 6px rgba(255, 107, 107, 0.28); }
.warn { color: #ffd166; text-shadow: 0 0 6px rgba(255, 209, 102, 0.25); }
.ok { color: var(--fg); }
.bold { font-weight: 700; }
.banner { font-weight: 700; color: var(--fg); text-shadow: 0 0 10px var(--glow), 0 0 2px var(--fg); }
.bar { letter-spacing: -1px; }

/* ---------- hero: compact ASCII wordmark ---------- */
.hero { margin: 4px 0 8px; }
.hero-big {
  margin: 0;
  white-space: pre;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  font-weight: 700;
  font-size: clamp(7px, 0.95vw, 12px);
  line-height: 1;
  color: var(--fg);
  text-shadow: none;
  scrollbar-width: none;
}
.hero-big::-webkit-scrollbar { display: none; }
.hero-plain { display: none; font-weight: 700; font-size: 1.35rem; line-height: 1.25; color: var(--fg); }

@media (max-width: 520px) {
  .hero-big { display: none; }
  .hero-plain { display: block; }
}
.spacer { height: 0.6em; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover, a:focus-visible {
  background: var(--fg);
  color: var(--bg);
  text-decoration: none;
  text-shadow: none;
  outline: none;
}

.block { border-left: 2px solid var(--border); padding-left: 12px; margin: 8px 0; }
.sep { border: 0; border-top: 1px dashed var(--border); margin: 10px 0; }
.tag {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 6px;
  margin: 2px 4px 2px 0;
  font-size: 12.5px;
  color: var(--fg-dim);
  text-shadow: none;
}

/* ---------- prompt / input ---------- */
.inputline {
  display: flex;
  align-items: baseline;
  gap: 0.6ch;
  padding: 8px clamp(12px, 2.2vw, 26px) 10px;
  border-top: 1px dashed var(--border);
  background: rgba(0, 0, 0, 0.18);
}
.prompt { white-space: nowrap; color: var(--fg-dim); cursor: text; text-shadow: none; }
.prompt .user { color: var(--fg); }
.prompt .host { color: var(--fg); }
.prompt .path { color: var(--accent); }
.prompt .sigil { color: var(--fg-dim); }

#cmd {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  padding: 0;
  color: var(--fg);
  font: inherit;
  caret-color: var(--fg);
  caret-shape: block;
}

/* ---------- tmux-style status bar (bottom) ---------- */
.statusbar {
  display: flex;
  align-items: stretch;
  background: var(--fg);
  color: var(--bg);
  text-shadow: none;
  font-size: 12.5px;
  line-height: 1.9;
  border-top: 1px solid var(--bg);
  user-select: none;
}
.statusbar .seg { flex: 0 0 auto; padding: 0 12px; white-space: nowrap; }
.statusbar .shell { font-weight: 700; }
.statusbar .clock { font-variant-numeric: tabular-nums; opacity: 0.9; }

.chips {
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  font: inherit;
  font-size: 12.5px;
  color: var(--bg);
  background: transparent;
  border: 0;
  border-left: 1px solid rgba(0, 0, 0, 0.28);
  padding: 0 12px;
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
}
.chip:hover, .chip:focus-visible {
  background: var(--bg);
  color: var(--fg);
  outline: none;
}
.chip::before { content: "$ "; opacity: 0.55; }

/* clickable command inside output */
.inline-cmd {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-bottom: 1px dotted var(--fg-dim);
  text-shadow: none;
}
.inline-cmd:hover, .inline-cmd:focus-visible {
  background: var(--fg);
  color: var(--bg);
  border-bottom-color: transparent;
  outline: none;
}

/* neofetch two-column layout */
.nf { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.nf pre { margin: 0; color: var(--fg); text-shadow: 0 0 8px var(--glow); line-height: 1.15; }
.nf .nf-info { min-width: 240px; flex: 1; }

/* small screens */
@media (max-width: 560px) {
  body { font-size: 13.5px; }
  .output { padding: 12px 12px 4px; }
  .inputline { padding: 7px 12px 8px; }
  .statusbar { font-size: 11.5px; }
  .statusbar .seg { padding: 0 9px; }
  .chip { padding: 0 9px; }
  .nf { gap: 12px; }
  .nf pre { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .line { animation: none; }
}

::selection { background: var(--fg); color: var(--bg); text-shadow: none; }
