/* =====================================================================
   atlas-terminal.css
   The estate shell. Inherits the site tokens with hex fallbacks, same
   idiom as system-map.css, so it renders correctly on any page even if
   that page forgot a token.

   Same 64px grid as the Ramone chassis and the system map host: the
   live surfaces of this site read as panels of one machine.
   ===================================================================== */

body.term-open { overflow: hidden; }

.term-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(5, 5, 8, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(24px, 4vh) 20px;
  backdrop-filter: blur(6px);
}
.term-overlay[hidden] { display: none; }

.term-panel {
  position: relative;
  width: min(720px, calc(100vw - 40px));
  height: min(560px, calc(100dvh - 80px));
  min-height: 420px;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(245, 166, 35, 0.05), transparent 55%),
    rgba(17, 17, 24, 0.98);
  border: 1px solid var(--border-hi, rgba(255, 255, 255, 0.16));
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  font-family: var(--mono, 'IBM Plex Mono', monospace);
}
.term-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
}

.term-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  position: relative;
}
.term-title {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dim, #aaa9a0);
}
.term-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: none;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 4px;
  color: var(--text-faint, #555560);
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.term-close:hover,
.term-close:focus-visible {
  color: var(--accent, #f5a623);
  border-color: var(--accent, #f5a623);
  outline: none;
}

.term-examples {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: rgba(255, 255, 255, 0.025);
}
.term-examples-label {
  color: var(--text-faint, #555560);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.term-example {
  max-width: 100%;
  background: rgba(245, 166, 35, 0.08);
  border: 1px solid rgba(245, 166, 35, 0.24);
  border-radius: 4px;
  color: var(--text, #e8e8e0);
  font-family: inherit;
  font-size: 11.5px;
  padding: 5px 8px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.term-example:hover,
.term-example:focus-visible {
  background: rgba(245, 166, 35, 0.14);
  border-color: var(--accent, #f5a623);
  color: var(--accent, #f5a623);
  outline: none;
}

.term-output {
  position: relative;
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 8px;
  font-size: 12.5px;
  line-height: 1.75;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--text-faint, #555560) transparent;
}

.term-line { color: var(--text, #e8e8e0); }
.term-line.t-row { white-space: pre-wrap; }
.term-line.t-gap { line-height: 0.8; }
.term-line.t-echo { margin-top: 6px; color: var(--text, #e8e8e0); }

.t-prompt { color: var(--accent, #f5a623); }
.t-accent { color: var(--accent, #f5a623); }
.t-cmd    { color: var(--text, #e8e8e0); }
.t-dim    { color: var(--text-dim, #aaa9a0); }
.t-faint  { color: var(--text-faint, #555560); }
.t-ok     { color: #4ade80; }
.t-warn   { color: var(--accent, #f5a623); }
.t-err    { color: #e24b4a; }

.term-cursor {
  display: inline-block;
  width: 8px;
  height: 13px;
  background: var(--accent, #f5a623);
  vertical-align: middle;
  margin-left: 6px;
  animation: term-blink 1.1s step-end infinite;
}
@keyframes term-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.term-input-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}
.term-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text, #e8e8e0);
  font-family: inherit;
  font-size: 12.5px;
  caret-color: var(--accent, #f5a623);
  padding: 2px 0;
}

/* ── Triggers ─────────────────────────────────────────────────────── */
.term-nav-trigger {
  color: var(--accent, #f5a623) !important;
  letter-spacing: 0.05em;
}

.term-chip {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 380;
  display: none;
  background: var(--bg-2, #1a1a24);
  border: 1px solid var(--border-hi, rgba(255, 255, 255, 0.16));
  border-radius: 6px;
  color: var(--accent, #f5a623);
  font-family: var(--mono, 'IBM Plex Mono', monospace);
  font-size: 13px;
  padding: 8px 12px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.term-chip:active { border-color: var(--accent, #f5a623); }

@media (max-width: 720px) {
  .term-overlay { padding: 14px; }
  .term-panel {
    width: min(100%, calc(100vw - 28px));
    height: min(560px, calc(100dvh - 28px));
    min-height: min(420px, calc(100dvh - 28px));
  }
  .term-examples {
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .term-example { flex: 0 0 auto; }
  .term-output { font-size: 13px; }
  .term-input { font-size: 16px; } /* below 16px iOS zooms the page on focus */
  .term-chip { display: block; }
  .term-nav-trigger { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .term-cursor { animation: none; }
}
