@import 'base.css';
@import 'tokens.css';

html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background: var(--bg);
}

@media (hover: hover) {
  html {
    overflow: hidden;
  }
  body {
    overflow: hidden;
  }
}

.terminal-wrap.desktop {
  display: flex;
  flex-direction: column;
  width: min(720px, calc(100% - 32px));
  height: 100vh;
  cursor: text;
}

.terminal-wrap.desktop .input-line {
  display: flex;
  align-items: center;
  position: relative;
  flex-shrink: 0;
  margin-top: 25vh;
}

.terminal-wrap.desktop .input-wrap {
  position: relative;
  width: 100%;
  min-height: 1.4em;
  font-size: 16px;
}

.terminal-wrap.desktop .input-ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  pointer-events: none;
}

.terminal-wrap.desktop #input-text-display {
  color: var(--fg);
}

.terminal-wrap.desktop #input-suggestion {
  color: var(--ghost);
}

#char-prefix {
  position: absolute;
  right: 0;
  top: 0;
  padding: 0 4px;
  font-size: inherit;
  line-height: inherit;
  color: color-mix(in srgb, var(--muted) 35%, transparent);
  pointer-events: none;
  white-space: nowrap;
  display: none;
  z-index: 2;
}

.terminal-wrap.desktop #terminal-input {
  position: relative;
  z-index: 1;
  display: block;
  background: transparent;
  border: none;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: var(--caret);
  caret-shape: block;
  font-family: var(--font);
  font-size: inherit;
  line-height: inherit;
  outline: none;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0;
  margin: 0;
  width: 100%;
  height: 1.4em;
  min-height: 1.4em;
}

#mode-indicator {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--muted);
  z-index: 10;
  visibility: hidden;
}

#mode-indicator.visible {
  visibility: visible;
}

.mode-chat {
  color: var(--warn);
}
.mode-email {
  color: var(--accent);
}

.terminal-wrap.desktop .history {
  flex: 1;
  overflow-y: auto;
  padding-top: 2px;
  padding-bottom: 32px; /* clear the fixed .site-footer */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.terminal-wrap.desktop .history::-webkit-scrollbar {
  display: none;
}

.terminal-wrap.desktop .history-line {
  display: flex;
  align-items: baseline;
  padding: 2px 0;
  font-size: 12px;
  transition: opacity 0.6s ease;
}

.terminal-wrap.desktop .history-line.output-line {
  padding-bottom: 12px;
}

.terminal-wrap.desktop .line-num {
  width: 2ch;
  flex-shrink: 0;
  text-align: right;
  margin-right: 1.5ch;
  color: var(--muted);
  user-select: none;
}

.terminal-wrap.desktop .line-content {
  flex: 1;
  min-width: 0;
}

.terminal-wrap.desktop .history-line.fade-1 {
  opacity: 0.65;
}
.terminal-wrap.desktop .history-line.fade-2 {
  opacity: 0.4;
}
.terminal-wrap.desktop .history-line.fade-3 {
  opacity: 0.2;
}
.terminal-wrap.desktop .history-line.fade-4 {
  opacity: 0.08;
}
.terminal-wrap.desktop .history-line.fade-5 {
  opacity: 0.03;
}
.terminal-wrap.desktop .history-line.fade-6 {
  opacity: 0;
}

@media (max-width: 768px) {
  .terminal-wrap.desktop .input-line {
    margin-top: 10vh;
  }
  .terminal-wrap.desktop #terminal-input {
    min-height: 44px;
  }
  .input-wrap:not(:focus-within) .input-ghost {
    animation: pulse-input 2s ease-in-out infinite;
  }
}

@keyframes pulse-input {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.cmd-text {
  color: var(--fg);
}
.warning {
  color: var(--warn);
}

.help-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
}

.help-cmd {
  color: var(--accent);
}
.help-desc {
  color: var(--muted);
  word-break: break-all;
}
.help-section {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  padding: 8px 0 2px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.text-muted {
  color: var(--muted);
}
.mb-8 {
  margin-bottom: 8px;
}

.routes-grid {
  display: grid;
  grid-template-columns: 7ch 16ch 1fr;
  gap: 4px 16px;
}
.routes-method {
  color: var(--accent);
}
.routes-path {
  color: var(--muted);
}
.routes-desc {
  color: var(--muted);
}
.email-tui {
  margin: 4px 0;
}
.email-row {
  display: flex;
  gap: 8px;
  padding: 2px 0;
}
.email-row.active::before {
  content: '> ';
  color: var(--accent);
}
.email-label {
  color: var(--muted);
  min-width: 8ch;
}
.email-value {
  color: var(--fg);
  white-space: pre-wrap;
  word-break: break-word;
}

.history a {
  color: var(--link);
}

.site-footer {
  position: fixed;
  bottom: 0;
  right: 16px;
  padding: 4px 0 4px 8px;
  background: var(--bg);
  font-size: 11px;
  color: var(--muted);
}

.site-footer a {
  color: inherit;
}
