/* ============================================================
   Hero terminal — cinematic live-audit component
   Scale-Proof dark design system. Uses ONLY existing tokens
   from styles.css (:root). Namespaced `.hterm*` so it never
   collides with the existing `.terminal`/`.scanner` components.

   Visual language is borrowed from the existing `.terminal`
   (mac window chrome, mono font, #05070a body) and `.scanner`
   (width, radius-lg, deep shadow) so it feels native.

   NOTE ON REDUCED MOTION: hero-terminal.js checks
   `prefers-reduced-motion: reduce` and injects the full final
   state instantly (no typing, no streaming, no count-up). The
   only thing this stylesheet needs to quiet is the blinking
   cursor + entrance fade — handled in the media query at the end.
   ============================================================ */

/* ---- Window shell (matches .scanner footprint / .terminal chrome) ---- */
.hterm {
  margin: clamp(40px, 5vw, 56px) auto 0;
  max-width: 840px;
  position: relative;
  z-index: 1;
  text-align: left;
  font-family: var(--mono);
  background-image: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.008));
  background-color: rgba(5, 7, 10, .88);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow:
    0 1px 0 rgba(255,255,255,.06) inset,
    0 0 0 1px rgba(137,87,229,.06),
    0 40px 80px -40px rgba(0,0,0,.92);
  overflow: hidden;
}

/* ---- Title bar with 3 mac dots (like .terminal__bar) ---- */
.hterm__bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-2);
  background: rgba(0, 0, 0, .28);
}
.hterm__bar i { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.hterm__bar i:nth-child(1) { background: #ff5f57; }
.hterm__bar i:nth-child(2) { background: #febc2e; }
.hterm__bar i:nth-child(3) { background: #28c840; }
.hterm__title {
  margin-left: 8px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .01em;
}

/* ---- Body (dark code surface, contained horizontal scroll) ---- */
.hterm__body {
  padding: 18px 22px 20px;
  font-size: 12.5px;
  line-height: 1.78;
  color: var(--text-2);
  min-height: 300px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.hterm__body::-webkit-scrollbar { height: 6px; }
.hterm__body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.hterm__body::-webkit-scrollbar-track { background: transparent; }

/* ---- A streamed line (preformatted so column padding aligns) ---- */
.hterm__line {
  display: block;
  white-space: pre;
  min-width: max-content;
  animation: hterm-in .28s var(--ease) both;
}
@keyframes hterm-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ---- Token colors ---- */
.hterm-p      { color: var(--green); }                       /* $ / › prompt      */
.hterm-cmd    { color: var(--text); }                        /* user-typed command */
.hterm-c      { color: var(--muted); }                       /* comments / dim     */
.hterm-hex    { color: var(--purple-2); }                    /* ⬢ glyph            */
.hterm-agent  { color: var(--purple-2); font-weight: 500; }  /* agent names        */
.hterm-disp   { color: var(--blue); }                        /* → ⟶ dispatch arrows */
.hterm-ok     { color: var(--green); }                       /* ✓                  */
.hterm-fail   { color: var(--red); }                         /* ✗                  */
.hterm-gate   { color: var(--muted); }                       /* gate NN · label    */
.hterm-desc   { color: var(--text-2); }                      /* finding description */
.hterm-path   { color: #6e7b8a; }                            /* file · line ref    */
.hterm-crit   { color: var(--red);   font-weight: 500; letter-spacing: .02em; }
.hterm-high   { color: var(--amber); font-weight: 500; letter-spacing: .02em; }

/* ---- Blinking cursor (reuses the .terminal__cursor idea) ---- */
.hterm__cursor {
  display: inline-block;
  width: 8px; height: 15px;
  background: var(--green);
  vertical-align: -2px;
  margin-left: 1px;
  animation: hterm-blink 1.1s step-end infinite;
}
@keyframes hterm-blink { 50% { opacity: 0; } }

/* ---- The payoff: score line ---- */
.hterm__score {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-2);
  animation: hterm-score-in .5s var(--ease) both;
}
@keyframes hterm-score-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hterm__score-key {
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  align-self: center;
}
.hterm__score-val { display: inline-flex; align-items: baseline; gap: 7px; }
.hterm__score-val b {
  font-family: var(--sans);
  font-size: 40px;
  font-weight: 500;
  letter-spacing: -.04em;
  line-height: 1;
  color: var(--amber);
  text-shadow: 0 0 26px rgba(210, 153, 34, .35);
}
.hterm__score-of { font-size: 13px; color: var(--muted); }
.hterm__score-dot { color: var(--border); align-self: center; }
.hterm__score-bucket {
  align-self: center;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: var(--pill);
  background: rgba(210, 153, 34, .12);
  color: var(--amber);
}

/* ---- Responsive ---- */
@media (max-width: 560px) {
  .hterm__body { font-size: 12px; padding: 16px 16px 18px; min-height: 268px; }
  .hterm__score-val b { font-size: 34px; }
}

/* ---- Reduced motion: JS already renders the instant final state;
        here we just silence the cursor + entrance animations. ---- */
@media (prefers-reduced-motion: reduce) {
  .hterm__cursor { animation: none; }
  .hterm__line,
  .hterm__score { animation: none; }
}
