/* ============================================================
   Terminal portfolio — theme variables
   Tweak these to recolor the whole site.
   ============================================================ */
:root {
  --bg: #0b0e14;
  --term-bg: #0d1117;
  --term-bg-2: #161b22;
  --fg: #c9d1d9;
  --green: #3fb950;
  --green-bright: #56d364;
  --cyan: #39c5cf;
  --yellow: #e3b341;
  --red: #f85149;
  --magenta: #bc8cff;
  --blue: #58a6ff;
  --muted: #8b949e;
  --selection: rgba(63, 185, 80, 0.3);
  --font: "SFMono-Regular", "JetBrains Mono", "Fira Code", "Cascadia Code",
    Consolas, "Liberation Mono", Menlo, monospace;
  --glow: 0 0 4px rgba(63, 185, 80, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  background:
    radial-gradient(ellipse at top, #11151f 0%, var(--bg) 70%);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0px, 3vw, 32px);
  overflow: hidden;
}

::selection {
  background: var(--selection);
}

.hidden {
  display: none !important;
}

/* ============================================================
   Language selection screen
   ============================================================ */
.lang-select {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #11151f 0%, #06080c 80%);
  z-index: 10;
  animation: fade-in 0.4s ease;
}

.lang-box {
  text-align: center;
  padding: 32px;
  max-width: 90vw;
}

.lang-logo {
  color: var(--green);
  text-shadow: var(--glow);
  font-size: clamp(7px, 2.2vw, 14px);
  line-height: 1.1;
  margin-bottom: 28px;
  display: inline-block;
  text-align: left;
  white-space: pre;
}

.lang-prompt {
  color: var(--fg);
  font-size: 1.05rem;
  margin-bottom: 24px;
  letter-spacing: 0.5px;
}

.lang-options {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.lang-btn {
  background: var(--term-bg-2);
  color: var(--fg);
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 14px 24px;
  font-family: var(--font);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 180px;
}

.lang-btn:hover,
.lang-btn:focus-visible {
  border-color: var(--green);
  color: var(--green-bright);
  box-shadow: var(--glow);
  outline: none;
  transform: translateY(-2px);
}

.lang-btn .flag {
  color: var(--green);
  font-weight: bold;
  margin-right: 6px;
}

.lang-hint {
  color: var(--muted);
  font-size: 0.85rem;
}

kbd {
  background: var(--term-bg-2);
  border: 1px solid #30363d;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--font);
  font-size: 0.8rem;
}

/* ============================================================
   Terminal window
   ============================================================ */
.terminal-window {
  position: relative;
  width: min(900px, 100%);
  height: min(600px, 100%);
  background: var(--term-bg);
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px #30363d;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: boot-up 0.5s ease;
}

.title-bar {
  display: flex;
  align-items: center;
  background: var(--term-bg-2);
  padding: 9px 14px;
  border-bottom: 1px solid #30363d;
  user-select: none;
}

.buttons {
  display: flex;
  gap: 8px;
  width: 70px;
}

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

.btn.close {
  background: #ff5f56;
}
.btn.min {
  background: #ffbd2e;
}
.btn.max {
  background: #27c93f;
}

.title {
  flex: 1;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.title-spacer {
  width: 70px;
}

/* ============================================================
   Terminal body
   ============================================================ */
.terminal {
  flex: 1;
  padding: 16px 18px;
  overflow-y: auto;
  cursor: text;
  scrollbar-width: thin;
  scrollbar-color: #30363d transparent;
}

.terminal::-webkit-scrollbar {
  width: 10px;
}
.terminal::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 5px;
}

.output {
  white-space: pre-wrap;
  word-break: break-word;
}

.line {
  white-space: pre-wrap;
  word-break: break-word;
}

.cmd-echo {
  color: var(--fg);
}

.prompt {
  color: var(--green);
  text-shadow: var(--glow);
  white-space: pre;
}

.prompt .user {
  color: var(--green-bright);
}
.prompt .path {
  color: var(--blue);
}

.c-green {
  color: var(--green-bright);
}
.c-cyan {
  color: var(--cyan);
}
.c-yellow {
  color: var(--yellow);
}
.c-red {
  color: var(--red);
}
.c-magenta {
  color: var(--magenta);
}
.c-blue {
  color: var(--blue);
}
.c-muted {
  color: var(--muted);
}
.bold {
  font-weight: bold;
}
a {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px dotted var(--cyan);
}
a:hover {
  color: var(--green-bright);
  border-bottom-color: var(--green-bright);
}

/* ============================================================
   Input line
   ============================================================ */
.input-line {
  display: flex;
  align-items: baseline;
  gap: 0;
}

.input-wrap {
  position: relative;
  flex: 1;
  display: inline-flex;
  align-items: baseline;
}

.cmd-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font-family: var(--font);
  font-size: inherit;
  line-height: inherit;
  flex: 1;
  caret-color: transparent;
  padding: 0;
  margin: 0;
}

.fake-cursor {
  position: absolute;
  width: 9px;
  height: 1.1em;
  background: var(--green);
  box-shadow: var(--glow);
  animation: blink 1s steps(1) infinite;
  pointer-events: none;
  transform: translateY(0.15em);
}

.fake-cursor.hide {
  display: none;
}

/* ============================================================
   CRT scanlines
   ============================================================ */
.terminal-window::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.015) 0px,
    rgba(255, 255, 255, 0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
  border-radius: 10px;
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  50.01%,
  100% {
    opacity: 0;
  }
}

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

@keyframes boot-up {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 600px) {
  body {
    padding: 0;
  }
  .terminal-window {
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
  .terminal-window::after {
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  .fake-cursor {
    animation: none !important;
  }
}

/* ============================================================
   Matrix overlay
   ============================================================ */
.matrix-canvas {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100vw;
  height: 100vh;
  pointer-events: auto;
  cursor: pointer;
  background: #0b0e14;
  opacity: 1;
}

.cmd-input:disabled {
  opacity: 0.5;
}
