/* ============================================================
   home-act2.css — home act 02 "Self-proving. Self-improving."
   Banner session: three problem runs (scan prior art → verify →
   proven) sharing one memory graph; time/token bars shrink
   run-over-run. Scoped under #hm-act2 / .hm2-*.
   Theme-aware via site tokens (warm-light fallbacks baked in).
   ============================================================ */

/* ---- instrument frame ---- */
#hm-act2 .hm2-app {
  position: relative;
  border: 1px solid var(--color-border, #e0ddd1);
  border-radius: var(--radius-lg, 10px);
  overflow: hidden;
  background: var(--color-bg, #f5f4ef);
  box-shadow: var(--shadow-lg, 0 24px 60px -20px rgba(26, 26, 23, 0.14));
  font-family: var(--font-sans, "Geist", -apple-system, sans-serif);
  color: var(--color-text, #1a1a17);
  text-align: left;
}

/* ---- title bar ---- */
.hm2-tb {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px;
  background: var(--color-surface, #eae7dd);
  border-bottom: 1px solid var(--color-border, #e0ddd1);
}
.hm2-dots { display: flex; gap: 6px; flex: none; }
.hm2-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--color-border, #e0ddd1); }
.hm2-title {
  flex: 1; min-width: 0; text-align: center;
  font-family: var(--font-mono, "Geist Mono", ui-monospace, Menlo, monospace);
  font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--color-muted, #6c6b61);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hm2-tag {
  flex: none;
  font-family: var(--font-mono, "Geist Mono", ui-monospace, Menlo, monospace);
  font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--color-muted, #6c6b61);
  border: 1px solid var(--bb-line, rgba(26, 26, 23, 0.14));
  border-radius: 999px; padding: 2px 7px;
}
.hm2-status {
  display: block; flex: 0 1 auto; min-width: 0;
  font-family: var(--font-mono, "Geist Mono", ui-monospace, Menlo, monospace);
  font-size: 12px; color: var(--color-muted, #6c6b61);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hm2-status::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 6px; vertical-align: 1px;
  background: var(--color-border, #e0ddd1);
  transition: background .3s, box-shadow .3s;
}
#hm-act2.hm2-live .hm2-status::before {
  background: var(--accent, #d9542b);
  box-shadow: 0 0 0 3px var(--accent-soft, rgba(217, 84, 43, 0.10));
}

/* ---- stage ---- */
.hm2-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) clamp(170px, 16vw, 214px) clamp(168px, 18vw, 230px);
  gap: clamp(14px, 2vw, 28px);
  height: clamp(264px, 26vw, 330px);
  padding: clamp(12px, 1.5vw, 18px) clamp(14px, 1.8vw, 22px);
  box-sizing: border-box;
}

/* ---- run capsules (real buttons — click a finished one to replay) ---- */
.hm2-runs { display: flex; flex-direction: column; gap: clamp(7px, .9vw, 11px); min-width: 0; }
.hm2-run {
  appearance: none; -webkit-appearance: none;
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  flex: 1 1 0; min-height: 0; min-width: 0;
  margin: 0; padding: 7px 11px;
  font: inherit; color: inherit; text-align: left;
  background: var(--color-bg, #f5f4ef);
  border: 1px solid var(--bb-line, rgba(26, 26, 23, 0.14));
  border-radius: 8px;
  opacity: .55;
  transition: opacity .35s, border-color .35s, background .35s, box-shadow .35s;
}
.hm2-run:disabled { cursor: default; }
.hm2-run.hm2-act { opacity: 1; border-color: var(--color-text, #1a1a17); }
.hm2-run.hm2-done { opacity: 1; cursor: pointer; }
.hm2-run.hm2-done:hover,
.hm2-run.hm2-done:focus-visible {
  border-color: var(--color-text, #1a1a17);
  background: var(--surface-alt, #efece4);
}
.hm2-run:focus-visible { outline: 2px solid var(--accent, #d9542b); outline-offset: 2px; }

.hm2-run-top { display: flex; align-items: center; gap: 7px; min-width: 0; }
.hm2-glyph {
  flex: none; width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; line-height: 1;
  color: var(--color-muted, #6c6b61);
  border: 1px solid var(--bb-line, rgba(26, 26, 23, 0.14));
  border-radius: 4px;
  transition: color .35s, border-color .35s;
}
.hm2-run.hm2-act .hm2-glyph { color: var(--accent, #d9542b); border-color: var(--accent, #d9542b); }
.hm2-run.hm2-done .hm2-glyph { color: var(--color-text, #1a1a17); }
.hm2-run-name {
  flex: 1; min-width: 0;
  font-family: var(--font-mono, "Geist Mono", ui-monospace, Menlo, monospace);
  font-size: 12.5px; letter-spacing: .03em;
  color: var(--color-text, #1a1a17);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hm2-run-state {
  flex: none;
  font-family: var(--font-mono, "Geist Mono", ui-monospace, Menlo, monospace);
  font-size: 12px; letter-spacing: .04em;
  color: var(--color-muted, #6c6b61);
  white-space: nowrap;
  transition: color .3s;
}
.hm2-run.hm2-done .hm2-run-state { color: var(--color-success, #22c55e); font-weight: 500; }
.hm2-replay {
  color: var(--color-muted, #6c6b61); font-weight: 400;
  opacity: 0; transition: opacity .3s;
}
.hm2-run.hm2-done:hover .hm2-replay,
.hm2-run.hm2-done:focus-visible .hm2-replay { opacity: 1; }

/* prior-art shelf: repo tiles + scan beam + best-match label */
.hm2-shelf { display: flex; align-items: center; gap: 9px; min-width: 0; }
.hm2-tiles { position: relative; display: flex; gap: 4px; flex: none; overflow: hidden; padding: 1px; }
.hm2-tile {
  width: 15px; height: 15px; flex: none; box-sizing: border-box;
  border: 1px solid var(--bb-line, rgba(26, 26, 23, 0.14));
  border-radius: 3px;
  background: var(--color-surface, #eae7dd);
  transition: border-color .3s, background .3s, box-shadow .3s;
}
.hm2-run.hm2-scan .hm2-tile { animation: hm2-flash .95s linear both; animation-delay: calc(var(--hm2-i) * .105s); }
.hm2-tile.hm2-best {
  border-color: var(--accent, #d9542b);
  background: var(--accent-soft, rgba(217, 84, 43, 0.10));
  box-shadow: 0 0 0 2px var(--accent-soft, rgba(217, 84, 43, 0.10));
}
.hm2-beam {
  position: absolute; top: 0; bottom: 0; left: -18px; width: 16px;
  background: linear-gradient(90deg, transparent, var(--accent-soft, rgba(217, 84, 43, 0.10)) 35%, var(--accent, #d9542b) 50%, var(--accent-soft, rgba(217, 84, 43, 0.10)) 65%, transparent);
  opacity: 0; pointer-events: none;
}
.hm2-run.hm2-scan .hm2-beam { animation: hm2-sweep .95s linear both; }
@keyframes hm2-sweep {
  0%   { transform: translateX(0); opacity: 0; }
  8%   { opacity: .9; }
  92%  { opacity: .9; }
  100% { transform: translateX(148px); opacity: 0; }
}
@keyframes hm2-flash {
  0%, 100% { border-color: var(--bb-line, rgba(26, 26, 23, 0.14)); }
  50%      { border-color: var(--accent, #d9542b); }
}
.hm2-match {
  flex: 1; min-width: 0;
  font-family: var(--font-mono, "Geist Mono", ui-monospace, Menlo, monospace);
  font-size: 12px; letter-spacing: .03em;
  color: var(--accent, #d9542b);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transform: translateX(-5px);
  transition: opacity .4s, transform .4s;
}
.hm2-match.hm2-show { opacity: 1; transform: none; }

/* verify tick rail */
.hm2-rail { display: flex; align-items: center; gap: 8px; }
.hm2-railtag {
  flex: none;
  font-family: var(--font-mono, "Geist Mono", ui-monospace, Menlo, monospace);
  font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--color-muted, #6c6b61);
}
.hm2-ticks { display: flex; gap: 3px; flex: 1; min-width: 0; max-width: 190px; }
.hm2-tick {
  flex: 1; height: 5px; border-radius: 2px;
  background: var(--color-surface, #eae7dd);
  box-shadow: inset 0 0 0 1px var(--bb-line, rgba(26, 26, 23, 0.14));
  transition: background .25s, box-shadow .25s;
}
.hm2-tick.hm2-on {
  background: var(--color-success, #22c55e);
  box-shadow: none;
}

/* ---- improvement meters ---- */
.hm2-meters { display: flex; flex-direction: column; justify-content: center; gap: clamp(12px, 1.6vw, 20px); min-width: 0; }
.hm2-mgroup { display: flex; flex-direction: column; gap: 5px; }
.hm2-mhead { display: flex; align-items: baseline; gap: 8px; }
.hm2-mname {
  font-family: var(--font-mono, "Geist Mono", ui-monospace, Menlo, monospace);
  font-size: 12px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--color-muted, #6c6b61);
}
.hm2-mdrop {
  margin-left: auto;
  font-family: var(--font-mono, "Geist Mono", ui-monospace, Menlo, monospace);
  font-size: 12px; letter-spacing: .03em;
  color: var(--accent, #d9542b);
  opacity: 0; transform: translateY(-3px);
  transition: opacity .45s, transform .45s;
}
.hm2-mdrop.hm2-show { opacity: 1; transform: none; }
.hm2-mrow { display: flex; align-items: center; gap: 7px; }
.hm2-mrun {
  flex: none; width: 20px;
  font-family: var(--font-mono, "Geist Mono", ui-monospace, Menlo, monospace);
  font-size: 12px; color: var(--color-muted, #6c6b61);
  font-variant-numeric: tabular-nums;
}
.hm2-mbar {
  flex: 1; min-width: 0; height: 7px; border-radius: 2px;
  background: var(--color-surface, #eae7dd);
  box-shadow: inset 0 0 0 1px var(--bb-line, rgba(26, 26, 23, 0.14));
  overflow: hidden;
}
.hm2-mfill {
  display: block; width: 0; height: 100%;
  background: var(--color-text, #1a1a17);
  border-radius: 2px;
  transition: width .7s cubic-bezier(.4, 0, .2, 1);
}
.hm2-mval {
  flex: none; width: 44px; text-align: right;
  font-family: var(--font-mono, "Geist Mono", ui-monospace, Menlo, monospace);
  font-size: 12px; color: var(--color-text, #1a1a17);
  font-variant-numeric: tabular-nums;
  opacity: .35; transition: opacity .4s;
}
.hm2-mval.hm2-set { opacity: 1; }

/* ---- memory graph ---- */
.hm2-mem { position: relative; display: flex; flex-direction: column; min-width: 0; }
#hm2-graph { display: block; width: 100%; flex: 1; min-height: 0; }
.hm2-leg {
  position: absolute; top: 2px; right: 2px;
  display: flex; gap: 8px;
  opacity: 0; transition: opacity .3s;
  pointer-events: none;
}
.hm2-mem:hover .hm2-leg,
.hm2-mem.hm2-hl0 .hm2-leg, .hm2-mem.hm2-hl1 .hm2-leg, .hm2-mem.hm2-hl2 .hm2-leg { opacity: 1; }
.hm2-lg {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono, "Geist Mono", ui-monospace, Menlo, monospace);
  font-size: 12px; letter-spacing: .04em;
  color: var(--color-muted, #6c6b61);
  transition: opacity .3s;
}
.hm2-lg::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.hm2-lg-0::before { background: var(--color-text, #1a1a17); }
.hm2-lg-1::before { background: var(--accent, #d9542b); }
.hm2-lg-2::before { background: var(--color-success, #22c55e); }
.hm2-mem.hm2-hl0 .hm2-lg-1, .hm2-mem.hm2-hl0 .hm2-lg-2,
.hm2-mem.hm2-hl1 .hm2-lg-0, .hm2-mem.hm2-hl1 .hm2-lg-2,
.hm2-mem.hm2-hl2 .hm2-lg-0, .hm2-mem.hm2-hl2 .hm2-lg-1 { opacity: .3; }
.hm2-memcap {
  flex: none; padding-top: 4px; text-align: center;
  font-family: var(--font-mono, "Geist Mono", ui-monospace, Menlo, monospace);
  font-size: 12px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--color-muted, #6c6b61);
}

/* ---- footer punch line ---- */
.hm2-foot {
  display: flex; align-items: center; justify-content: center;
  padding: 8px 16px 9px;
  border-top: 1px solid var(--color-border, #e0ddd1);
  background: var(--color-surface, #eae7dd);
}
.hm2-punch {
  font-family: var(--font-mono, "Geist Mono", ui-monospace, Menlo, monospace);
  font-size: 12.5px; letter-spacing: .03em;
  color: var(--color-text, #1a1a17);
  text-align: center;
  opacity: 0; transform: translateY(3px);
  transition: opacity .6s, transform .6s;
}
.hm2-punch.hm2-show { opacity: 1; transform: none; }

/* ---- screen-reader summary ---- */
.hm2-sr {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden;
  white-space: nowrap;
}

/* ---- narrow screens: runs full-width, meters + graph share a row ---- */
@media (max-width: 760px) {
  .hm2-stage {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    height: auto;
  }
  .hm2-runs { grid-column: 1 / -1; }
  .hm2-run { flex: none; }
  #hm2-graph { height: 150px; flex: none; }
  .hm2-title { display: none; }
  .hm2-tb { justify-content: space-between; }
}
@media (max-width: 430px) {
  .hm2-stage { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .hm2-match { display: none; }
  .hm2-dots { display: none; }
}

/* ---- reduced motion: no sweeps, no transitions ---- */
@media (prefers-reduced-motion: reduce) {
  #hm-act2 .hm2-run.hm2-scan .hm2-tile,
  #hm-act2 .hm2-run.hm2-scan .hm2-beam { animation: none; }
  #hm-act2 .hm2-beam { display: none; }
  #hm-act2 .hm2-run, #hm-act2 .hm2-glyph, #hm-act2 .hm2-tile, #hm-act2 .hm2-tick,
  #hm-act2 .hm2-match, #hm-act2 .hm2-mdrop, #hm-act2 .hm2-mfill,
  #hm-act2 .hm2-mval, #hm-act2 .hm2-punch, #hm-act2 .hm2-run-state { transition: none; }
}
