/* =========================================================
   V1 PAPER TERMINAL — extracted from terminal-redesign.css
   Overrides the old .terminal styles in home.css.
   ========================================================= */

:root {
  /* Bauhaus palette — muted via oklch (matches comparison page) */
  --bauhaus-yellow: oklch(0.82 0.13 88);
  --bauhaus-blue:   oklch(0.58 0.10 252);
  --bauhaus-red:    oklch(0.64 0.12 32);
  --terminal-command: oklch(0.72 0.12 55);
  --terminal-error: oklch(0.64 0.12 32);
  /* Keeps the home-page terminal and radio in a stable shared row. */
  --home-panel-height: 460px;
}

/* ---------- DM Mono fallback for terminal output ---------- */
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&display=swap');

/* =========================================================
   Shared terminal structure
   ========================================================= */
.term {
  position: relative;
  border-radius: 6px;
  height: var(--home-panel-height);
  padding: 1.5rem 1.75rem;
  min-height: 0;
  display: flex;
  flex-direction: column;
  font-family: 'IBM Plex Mono', 'Noto Sans SC', monospace;
  transition: all 0.3s ease;
  overflow: hidden;
}

.term-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--accent-secondary);
}

.term-title {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
  white-space: nowrap;
}

.term-body {
  /* Explicit viewport: it grows into the remaining panel height only. */
  height: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  font-family: 'DM Mono', 'IBM Plex Mono', 'Noto Sans SC', monospace;
  /* Soft top fade for scrolled-off history */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 32px, #000 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 32px, #000 100%);
  font-size: 0.85rem;
  line-height: 1.75;
  padding-right: 0.25rem;
  /* Preserve wheel/touch scrolling while keeping the terminal paper-clean. */
  scrollbar-width: none;
}

/* The outer element is the scroll viewport. This inner element only aligns
   short output to the bottom; once output is taller, it expands normally. */
.terminal-output {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.term-body::-webkit-scrollbar { display: none; }

.terminal-line {
  margin: 0.15rem 0;
  flex: 0 0 auto;
  white-space: pre-wrap;
  word-break: break-word;
  /* Disable the typewriter animation from globals.css for terminal output */
  animation: none;
}

.terminal-echo  { opacity: 1; }
.terminal-error { color: var(--terminal-error); }
.terminal-prompt {
  user-select: none;
  font-family: 'DM Mono', 'IBM Plex Mono', 'Noto Sans SC', monospace;
}
.terminal-prompt-main { color: currentColor; font-weight: 600; }
.terminal-prompt-muted { opacity: 0.55; }
.terminal-command { color: var(--terminal-command); font-weight: 500; }
.terminal-flag { opacity: 0.6; }
.terminal-aux,
.terminal-help-note { opacity: 0.55; }
.terminal-help-description { opacity: 0.55; }
.terminal-post-date { opacity: 0.55; }
.terminal-post-category { color: currentColor; font-weight: 600; }
.terminal-post-title { color: currentColor; font-weight: 400; }
.terminal-error-badge {
  display: inline-block;
  margin-right: 0.7em;
  padding: 0.12em 0.42em;
  border-radius: 2px;
  background: var(--terminal-error);
  color: #fff;
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.25;
  vertical-align: 0.08em;
}
.terminal-error-text { color: var(--terminal-error); }

.term-input {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 1rem;
  margin-top: 0.5rem;
  position: relative;
}

.term-input input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: inherit;
  font-family: 'DM Mono', 'IBM Plex Mono', 'Noto Sans SC', monospace;
  font-size: 0.85rem;
  padding: 0;
  caret-color: currentColor;
}

/* Keyboard-hint strip */
.term-hints {
  flex: 0 0 auto;
  display: flex;
  gap: 1.25rem;
  font-size: 0.7rem;
  color: var(--accent-secondary);
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 1px dashed var(--border-light);
  opacity: 0.85;
  flex-wrap: wrap;
}

body.dark .term-hints { border-top-color: var(--border-dark); }

.term-hints kbd {
  font-family: inherit;
  font-size: 0.68rem;
  padding: 1px 5px;
  border: 1px solid var(--border-light);
  border-radius: 2px;
  margin-right: 0.3rem;
}

body.dark .term-hints kbd { border-color: var(--border-dark); }

/* =========================================================
   V1 — Paper Terminal
   ========================================================= */
.term-v1 {
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--text-light);
  box-shadow: var(--shadow-subtle);
}

body.dark .term-v1 {
  background: #111111;
  border-color: var(--border-dark);
  color: var(--text-dark);
  --terminal-command: oklch(0.76 0.11 55);
  --terminal-error: oklch(0.72 0.12 32);
}

.term-v1 .term-head { border-bottom: 1px solid var(--border-light); }
body.dark .term-v1 .term-head { border-bottom-color: var(--border-dark); }

/* Single Bauhaus yellow dot — V1 signature */
.term-v1 .dot-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bauhaus-yellow);
  flex-shrink: 0;
}

.term-v1 .term-input { border-top: 1px solid var(--border-light); }
body.dark .term-v1 .term-input { border-top-color: var(--border-dark); }

.term-v1 .term-input .terminal-prompt { color: var(--terminal-command); }
body.dark .term-v1 .term-input .terminal-prompt { color: var(--terminal-command); }

.term-v1:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

@media (max-width: 968px) {
  :root { --home-panel-height: 400px; }
}

/* =========================================================
   Status indicator dot
   ========================================================= */
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bauhaus-blue);
  margin-right: 0.35em;
  vertical-align: 0.1em;
  animation: status-pulse 2.2s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

/* =========================================================
   ASCII art / banner lines
   ========================================================= */
.terminal-line.art {
  white-space: pre;
  word-break: normal;
  overflow: hidden;
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
  font-family: 'DM Mono', 'IBM Plex Mono', monospace;
}
.terminal-line.art-muted { opacity: 0.55; }

/* =========================================================
   Radio progress strip (extracted from V1 reference)
   Adds NOW PLAYING + bottom track to existing .radio
   ========================================================= */
.radio-progress {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-top: 1.375rem;
  margin-top: 0.25rem;
  border-top: 1px solid var(--border-light);
  font-family: 'IBM Plex Mono', 'Noto Sans SC', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.75;
  z-index: 1;
}
body.dark .radio-progress { border-top-color: var(--border-dark); }

.radio-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  white-space: nowrap;
}
.radio-progress-meta .now {
  font-weight: 600;
  letter-spacing: 0.08em;
  opacity: 0.6;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.radio-progress-meta .time {
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.radio-progress-track {
  position: relative;
  height: 2px;
  background: var(--border-light);
  border-radius: 1px;
  overflow: hidden;
}
body.dark .radio-progress-track { background: var(--border-dark); }
.radio-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--orange);
  transition: width .12s linear;
}
