/* ============================================================
   ATLAS CHAT — animated agent demo
   Reuses Mithra tokens from mithra.css / product-ui.css
   ============================================================ */

.ac-stage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vw, 56px);
  background: radial-gradient(120% 120% at 82% -10%, #0a2da0 0%, var(--deep-ocean) 46%, var(--deep-ocean-2) 100%);
  position: relative;
  overflow: hidden;
}
.ac-stage::before {
  content: "";
  position: absolute; inset: 0;
  background-image: url('../assets/bg-dotgrid.png');
  background-size: 460px;
  opacity: .35;
  mix-blend-mode: screen;
  pointer-events: none;
}

/* ---- window shell ---- */
.ac-window {
  position: relative;
  width: min(780px, 100%);
  height: min(82vh, 760px);
  display: flex;
  --ac-brand-1: #2bb255;
  --ac-brand-2: #1c7d40;
  flex-direction: column;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 40px 90px rgba(0,15,60,.45), 0 8px 24px rgba(0,15,60,.28);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.4);
}

/* ---- header ---- */
.ac-head {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--soft-border-2);
  background: #fff;
  flex: 0 0 auto;
}
.ac-avatar {
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(150deg, var(--ac-brand-1), var(--ac-brand-2));
  box-shadow: 0 6px 16px rgba(36,161,72,.32);
}
.ac-avatar svg { width: 23px; height: 23px; }
/* header avatar rendered as the Pulse "blob" orb (homepage hero only — needs home.css + filter defs) */
.ac-head .ac-avatar-orb { width: 42px; height: 42px; flex: 0 0 auto; box-shadow: 0 6px 16px rgba(20,30,80,.22); }
.ac-id { display: flex; flex-direction: column; line-height: 1.2; }
.ac-id .ac-name { font-family: var(--font-head); font-weight: 700; font-size: 16px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.ac-id .ac-tag { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #1c7d40; background: var(--green-bg); border: 1px solid #bfe6cb; border-radius: 999px; padding: 2px 9px; }
.ac-id .ac-sub { font-size: 12.5px; color: var(--slate); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.ac-live { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(36,161,72,.5); animation: acPulse 2.4s infinite; }
@keyframes acPulse { 0%{ box-shadow: 0 0 0 0 rgba(36,161,72,.45);} 70%{ box-shadow: 0 0 0 7px rgba(36,161,72,0);} 100%{ box-shadow: 0 0 0 0 rgba(36,161,72,0);} }
.ac-head-spacer { flex: 1; }
.ac-replay {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-body); font-weight: 600; font-size: 13px;
  color: var(--slate); background: #fff; border: 1px solid var(--soft-border);
  border-radius: 999px; padding: 7px 14px; transition: .18s var(--ease);
}
.ac-replay:hover { color: var(--really-blue); border-color: var(--cool-water); }
.ac-replay svg { width: 14px; height: 14px; transition: transform .5s var(--ease); }
.ac-replay:hover svg { transform: rotate(-180deg); }

/* ---- thread ---- */
.ac-thread {
  flex: 1; overflow-y: auto;
  padding: 26px 22px 12px;
  display: flex; flex-direction: column; gap: 18px;
  scroll-behavior: smooth;
  background:
    linear-gradient(180deg, #fbfcff, #fff 120px);
}
.ac-thread::-webkit-scrollbar { width: 8px; }
.ac-thread::-webkit-scrollbar-thumb { background: #d7deec; border-radius: 99px; }

/* row + enter animation */
.ac-row { display: flex; gap: 12px; max-width: 100%; opacity: 0; transform: translateY(12px); animation: acIn .5s var(--ease) forwards; }
@keyframes acIn { to { opacity: 1; transform: none; } }
.ac-row.user { justify-content: flex-end; }
.ac-mini {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(150deg, var(--ac-brand-1), var(--ac-brand-2));
}
.ac-mini svg { width: 16px; height: 16px; }
/* assistant row avatar rendered as the Pulse "blob" orb */
.ac-row .ac-mini-orb { width: 30px; height: 30px; flex: 0 0 auto; box-shadow: 0 3px 9px rgba(20,30,80,.18); }

/* user bubble */
.ac-bubble-user {
  background: var(--really-blue);
  color: #fff;
  font-size: 15px; line-height: 1.5;
  padding: 13px 17px;
  border-radius: 16px 16px 4px 16px;
  max-width: 78%;
  box-shadow: 0 8px 20px rgba(15,98,254,.22);
}

/* assistant block */
.ac-asst { max-width: 86%; display: flex; flex-direction: column; gap: 12px; }
.ac-text {
  background: var(--off-white);
  border: 1px solid var(--soft-border-2);
  color: var(--ink);
  font-size: 15px; line-height: 1.6;
  padding: 14px 18px;
  border-radius: 4px 16px 16px 16px;
}
.ac-text b { color: var(--ink); font-weight: 700; }
.ac-text .ac-hl { color: var(--really-blue); font-weight: 700; }
.ac-cursor { display: inline-block; width: 2px; height: 1em; background: var(--cool-water); margin-left: 1px; vertical-align: -2px; animation: acBlink 1s steps(2) infinite; }
@keyframes acBlink { 50% { opacity: 0; } }

/* typing indicator */
.ac-typing { display: inline-flex; align-items: center; gap: 5px; padding: 15px 18px; background: var(--off-white); border: 1px solid var(--soft-border-2); border-radius: 4px 16px 16px 16px; }
.ac-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--slate-light); animation: acBob 1.1s infinite ease-in-out; }
.ac-typing i:nth-child(2){ animation-delay: .15s; } .ac-typing i:nth-child(3){ animation-delay: .3s; }
@keyframes acBob { 0%,80%,100%{ transform: translateY(0); opacity:.5;} 40%{ transform: translateY(-5px); opacity:1;} }

/* ---- reasoning / search trail ---- */
.ac-trace {
  border: 1px solid var(--soft-border);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.ac-trace-hd {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #eef2f8;
  font-family: var(--font-head); font-weight: 600; font-size: 13.5px; color: var(--ink);
}
.ac-trace-hd .ac-spin {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #d7e0f2; border-top-color: var(--really-blue);
  animation: acSpin .7s linear infinite; flex: 0 0 auto;
}
.ac-trace.done .ac-trace-hd .ac-spin {
  border: none; background: var(--green-bg); color: #1c7d40;
  display: grid; place-items: center; animation: none;
}
.ac-trace.done .ac-trace-hd .ac-spin::after { content: "✓"; font-size: 11px; font-weight: 800; }
@keyframes acSpin { to { transform: rotate(360deg); } }
.ac-trace-hd .ac-trace-meta { margin-left: auto; font-family: var(--font-body); font-weight: 600; font-size: 11.5px; color: var(--slate); }

.ac-steps { padding: 6px 0; }
.ac-step {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 11px;
  padding: 9px 16px;
  opacity: 0; transform: translateX(-6px);
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.ac-step.show { opacity: 1; transform: none; }
.ac-step-ic {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid #d7e0f2; border-top-color: var(--really-blue);
  animation: acSpin .7s linear infinite;
}
.ac-step.complete .ac-step-ic {
  border: none; animation: none; background: var(--green); color: #fff;
  display: grid; place-items: center;
}
.ac-step.complete .ac-step-ic::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(42deg) translate(-0.5px,-1px); }
.ac-step-label { font-size: 13.5px; color: var(--ink); }
.ac-step.complete .ac-step-label { color: #3a4452; }
.ac-step-ev {
  font-size: 11.5px; font-weight: 600; color: var(--really-blue);
  background: var(--off-white); border: 1px solid var(--soft-border);
  border-radius: 999px; padding: 3px 10px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
  opacity: 0; transition: opacity .3s var(--ease);
}
.ac-step.complete .ac-step-ev { opacity: 1; }

/* ---- opportunity finding cards ---- */
.ac-finds { display: flex; flex-direction: column; gap: 12px; }
.ac-find {
  border: 1px solid var(--soft-border);
  border-radius: 14px;
  background: #fff;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  opacity: 0; transform: translateY(14px) scale(.985);
  animation: acFindIn .55s var(--ease) forwards;
  position: relative; overflow: hidden;
}
@keyframes acFindIn { to { opacity: 1; transform: none; } }
.ac-find::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--cool-water);
}
.ac-find.tail::before { background: var(--really-blue); }
.ac-find.cons::before { background: var(--green); }
.ac-find-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.ac-find-type { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--really-blue); }
.ac-find.cons .ac-find-type { color: #1c8a3d; }
.ac-find-title { font-family: var(--font-head); font-weight: 600; font-size: 15px; color: var(--ink); }
.ac-find-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 4px; }
.ac-find-val { font-family: var(--font-head); font-weight: 700; font-size: 26px; color: var(--ink); letter-spacing: -.02em; line-height: 1; }
.ac-find-val span { font-family: var(--font-body); font-size: 12.5px; font-weight: 500; color: var(--slate); }
.ac-find-ev { margin-top: 11px; padding-top: 11px; border-top: 1px solid #f0f3f8; display: flex; flex-direction: column; gap: 7px; }
.ac-find-ev .er { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; color: var(--slate); line-height: 1.4; }
.ac-find-ev .er .ic { width: 14px; height: 14px; color: var(--cool-water); flex: 0 0 auto; margin-top: 2px; }
.ac-find-ev .er .ic svg { width: 14px; height: 14px; }

/* summary banner */
.ac-summary {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border-radius: 14px;
  background: linear-gradient(135deg, #06226e, #001d6c);
  color: #fff;
  opacity: 0; transform: translateY(12px);
  animation: acFindIn .55s var(--ease) forwards;
}
.ac-summary .acs-ic { width: 38px; height: 38px; border-radius: 11px; background: rgba(120,169,255,.2); color: var(--clear-sky); display: grid; place-items: center; flex: 0 0 auto; }
.ac-summary .acs-ic svg { width: 20px; height: 20px; }
.ac-summary .acs-big { font-family: var(--font-head); font-weight: 700; font-size: 24px; letter-spacing: -.02em; line-height: 1; }
.ac-summary .acs-label { font-size: 12.5px; color: rgba(255,255,255,.72); margin-top: 3px; }

/* suggestion chips */
.ac-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ac-chip {
  font-size: 12.5px; font-weight: 500; color: var(--really-blue);
  background: #fff; border: 1px solid var(--soft-border); border-radius: 999px;
  padding: 8px 14px; cursor: pointer; transition: .15s var(--ease);
  opacity: 0; transform: translateY(8px); animation: acFindIn .4s var(--ease) forwards;
}
.ac-chip:hover { border-color: var(--cool-water); background: var(--off-white); }

/* ---- composer (decorative) ---- */
.ac-composer {
  flex: 0 0 auto;
  border-top: 1px solid var(--soft-border-2);
  padding: 14px 18px 16px;
  background: #fff;
}
.ac-input {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--soft-border); border-radius: 14px;
  padding: 12px 12px 12px 16px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.ac-input.focus { border-color: var(--cool-water); box-shadow: 0 0 0 4px rgba(69,137,255,.12); }
.ac-input .ac-ph { flex: 1; font-size: 14.5px; color: var(--slate-light); min-height: 20px; }
.ac-input .ac-ph .ac-typed { color: var(--ink); }
.ac-input .ac-ph .ac-cursor2 { display: inline-block; width: 1.5px; height: 15px; background: var(--really-blue); vertical-align: -2px; animation: acBlink 1s steps(2) infinite; }
.ac-send {
  width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto;
  background: var(--really-blue); color: #fff; border: none;
  display: grid; place-items: center; box-shadow: var(--shadow-blue);
  transition: .18s var(--ease);
}
.ac-send svg { width: 18px; height: 18px; }
.ac-send.armed { transform: scale(1.04); }
.ac-foot-note { text-align: center; font-size: 11px; color: var(--slate-light); margin-top: 10px; }

/* ---- embedded in the homepage hero ---- */
.hero-chat { position: relative; z-index: 1; }
.hero-chat .ac-window {
  height: 552px;
  width: 100%;
  box-shadow: 0 44px 90px rgba(0,12,52,.5), 0 10px 26px rgba(0,12,52,.32);
}
@media (max-width: 980px){
  .hero-chat .ac-window { height: 520px; max-width: 620px; margin: 0 auto; }
}

@media (max-width: 560px){
  .ac-stage .ac-window { height: 88vh; }
  .ac-asst, .ac-bubble-user { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce){
  .ac-row, .ac-find, .ac-summary, .ac-chip { animation: none !important; opacity: 1 !important; transform: none !important; }
  .ac-step { transition: none; }
}
