/* ─── terminal.css ────────────────────────────────────────────────────────────
   Terminal container, output area, line variants, interactive commands,
   prompt row, cursor blink, and responsive overrides.
──────────────────────────────────────────────────────────────────────────── */

/* ─── Terminal Container ─────────────────────────────────────────────────── */
#terminal {
  position: fixed;
  inset: 0;
  z-index: var(--z-terminal);
  display: flex;
  flex-direction: column;
  /* Generous padding — mirrors a real terminal window inset */
  padding: clamp(28px, 5vh, 64px) clamp(24px, 6vw, 76px);
  overflow: hidden;
}

/* ─── Static Boot Content ────────────────────────────────────────────────── */
/* #terminal-output holds the boot header + command menu — never scrolls.     */
#terminal-output {
  flex-shrink: 0;
  overflow: visible;
}

/* ─── Dynamic Response Area ──────────────────────────────────────────────── */
/* Command execution output goes here; cleared on each new command.           */
#terminal-response {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-top: 6px;
}

#terminal-response::-webkit-scrollbar {
  display: none;
}

/* ─── Terminal Line Base ─────────────────────────────────────────────────── */
.tline {
  display: block;
  font-size: 13px;
  line-height: 1.62;
  white-space: pre;
  color: var(--text-primary);
}

/* Inline typing cursor — appended via ::after during animation */
.tline.typing::after {
  content: '\2588';   /* █ */
  color: inherit;
  animation: cur-blink 0.85s step-end infinite;
}

/* ─── Line Variants ──────────────────────────────────────────────────────── */
.tline-blank {
  /* Invisible spacer line — preserves line height */
  opacity: 0;
  pointer-events: none;
  user-select: none;
}

.tline-system {
  color: var(--text-dim);
}

.tline-bright {
  color: var(--text-bright);
}

.tline-header {
  color: var(--text-dim);
  letter-spacing: 0.03em;
}

.tline-separator {
  color: var(--text-separator);
  user-select: none;
  pointer-events: none;
}

.tline-label {
  color: var(--text-dim);
  font-size: 11.5px;
  letter-spacing: 0.07em;
}

/* [OK] confirmation line */
.tline-ok {
  color: var(--text-dim);
}

.ok-tag {
  color: var(--text-ok);
}

/* ─── Interactive Command Lines ──────────────────────────────────────────── */
.tline-interactive {
  width: fit-content;   /* hover zone = text width only, not full terminal width */
  color: var(--text-cmd);
  cursor: pointer;
  /* display: block inherited from .tline — keeps commands stacked vertically */
  /* white-space: pre inherited from .tline — preserves caret spacing */
}

.cmd-caret {
  /* 2-char fixed column — switches between '  ' and '> ' */
  color: var(--text-dim);
  transition: color 0.08s ease;
  user-select: none;
}

.cmd-name {
  color: var(--text-cmd);
  transition: color 0.08s ease;
}

.cmd-desc {
  color: var(--text-dim);
  font-size: 12px;
  transition: color 0.08s ease;
}

/* Hover state — colour shift only, no layout change */
.tline-interactive:hover .cmd-caret { color: var(--text-cmd-hover); }
.tline-interactive:hover .cmd-name  { color: var(--text-cmd-hover); }
.tline-interactive:hover .cmd-desc  { color: var(--text-cmd); }

/* Executing state — locked, bright */
.tline-interactive.executing .cmd-caret,
.tline-interactive.executing .cmd-name {
  color: var(--text-bright);
  pointer-events: none;
}

/* Keyboard-focused command (arrow-key navigation) */
.tline-interactive.focused .cmd-caret { color: var(--text-cmd-hover); }
.tline-interactive.focused .cmd-name  { color: var(--text-cmd-hover); }
.tline-interactive.focused .cmd-desc  { color: var(--text-cmd); }

/* Focus ring for keyboard users */
.tline-interactive:focus-visible {
  outline: 1px solid var(--text-dim);
  outline-offset: 1px;
}

/* ─── Prompt Line ────────────────────────────────────────────────────────── */
#terminal-prompt {
  flex-shrink: 0;
  padding-top: 4px;
  font-size: 13px;
  line-height: 1.62;
  white-space: nowrap;
  user-select: none;
}

.p-host              { color: var(--text-primary); }
.p-sep               { color: var(--text-dim); }
.p-path              { color: var(--text-bright); }
.p-dollar            { color: var(--text-dim); }
#prompt-input-display { color: var(--text-primary); }

/* ─── Block Cursor ───────────────────────────────────────────────────────── */
#cursor {
  color: var(--text-primary);
  animation: cur-blink 1.1s step-end infinite;
}

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

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  #terminal {
    padding: 20px 18px;
  }

  .tline,
  #terminal-prompt {
    font-size: 12px;
  }

  .tline-label { font-size: 10.5px; }
  .cmd-desc    { font-size: 11px; }
}
