/* ============================================================
   terminal-folio - Sanjay Suthar
   ============================================================ */

:root {
  --bg: #0a0e12;
  --term-bg: rgba(13, 17, 23, 0.92);
  --term-border: #1f2933;
  --bar-bg: #161b22;
  --fg: #c9d1d9;
  --dim: #8b949e;
  --accent: #39d353;
  --accent-dim: #26a641;
  --link: #58a6ff;
  --warn: #d29922;
  --err: #f85149;
  --sel: rgba(57, 211, 83, 0.25);
  --glow: rgba(57, 211, 83, 0.08);
  --font: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Menlo, Consolas, monospace;
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 50% 0%, var(--glow), transparent 60%);
  color: var(--fg);
  font-family: var(--font);
  font-variant-ligatures: none;
  font-size: 15px;
  line-height: 1.55;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}

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

/* -------- CRT scanline overlay -------- */
.crt {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.11) 0px,
    rgba(0, 0, 0, 0.11) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.5;
}

/* -------- terminal window -------- */
.terminal {
  width: min(960px, 100%);
  height: min(640px, 100%);
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: 10px;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset,
    0 0 90px var(--glow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(6px);
}

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

.terminal__buttons { display: flex; gap: 8px; }
.btn { width: 12px; height: 12px; border-radius: 50%; display: block; }
.btn--close { background: #ff5f56; }
.btn--min   { background: #ffbd2e; }
.btn--max   { background: #27c93f; }

.terminal__title {
  flex: 1;
  text-align: center;
  font-size: 13px;
  color: var(--dim);
  letter-spacing: 0.02em;
}
.terminal__hint { font-size: 12px; color: var(--accent-dim); }

.terminal__body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 26px;
  scrollbar-width: thin;
  scrollbar-color: var(--term-border) transparent;
  overscroll-behavior: contain;
}
.terminal__body::-webkit-scrollbar { width: 8px; }
.terminal__body::-webkit-scrollbar-thumb {
  background: var(--term-border); border-radius: 4px;
}

.terminal__footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
  padding: 3px 14px 7px;
  font-size: 11px;
  line-height: 1;
  color: var(--dim);
  opacity: 0.7;
  user-select: none;
}
.terminal__footer .copy-sign {
  font-size: 15px;
  line-height: 1;
}

/* -------- output -------- */
#output { white-space: pre-wrap; word-break: break-word; }

.line { min-height: 1.55em; }

.ascii {
  color: var(--accent);
  font-size: clamp(6px, 1.55vw, 13px);
  line-height: 1.25;
  text-shadow: 0 0 12px var(--glow);
}

.accent  { color: var(--accent); }
.dim     { color: var(--dim); }
.warn    { color: var(--warn); }
.err     { color: var(--err); }
.bold    { font-weight: 800; }

a, .link {
  color: var(--link);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

.bar-track { color: var(--term-border); }
.bar-fill  { color: var(--accent); }

.kbd {
  border: 1px solid var(--term-border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 5px;
  font-size: 0.85em;
  color: var(--dim);
}

/* -------- prompt / input -------- */
.prompt-line {
  display: flex;
  align-items: baseline;
  min-height: 1.55em;
}

.prompt { color: var(--accent); white-space: pre; font-weight: 600; }
.prompt .path { color: var(--link); }
.prompt .sym  { color: var(--fg); }

.input-wrap {
  position: relative;
  flex: 1;
  min-width: 40px;
  word-break: break-all;
}

#cmd-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  border: none;
  outline: none;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font: inherit;
  width: 100%;
}

#typed, #typed-after { white-space: pre-wrap; }

.cursor {
  color: var(--accent);
  animation: blink 1.05s steps(1) infinite;
  margin-left: -2px;
}
@keyframes blink { 50% { opacity: 0; } }

.terminal.shake { animation: shake 0.35s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

/* -------- responsive -------- */
@media (max-width: 640px) {
  body { padding: 12px; font-size: 13px; }
  .terminal { border-radius: 8px; }
  .terminal__body { padding: 14px 14px 20px; }
  .terminal__hint { display: none; }
}
