/* ============================================================
   ALTERNITY METRICS — Assistant prototype layer
   Docked assistant widget + two treatments (guided / free-form).
   Uses tokens from alternity.css. Prototype-only; not shipped.
   ============================================================ */

#asst-root { position: fixed; z-index: 1000; }

/* dock anchoring */
.asst-dock { position: fixed; bottom: 26px; z-index: 1000; display: flex; flex-direction: column; align-items: flex-end; gap: 14px; }
.asst-dock.right { right: 26px; align-items: flex-end; }
.asst-dock.left  { left: 26px;  align-items: flex-start; }

/* ---------- launcher ---------- */
.asst-launch {
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--ink); color: #f3f4f6; border: 1px solid var(--ink);
  padding: 13px 20px 13px 14px; cursor: pointer;
  font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  box-shadow: 0 14px 40px rgba(14,20,23,0.26); transition: background .25s ease, border-color .25s ease, transform .2s ease;
}
.asst-launch:hover { background: var(--teal); border-color: var(--teal); }
.asst-launch:active { transform: translateY(1px); }
.asst-launch .seal { width: 26px; height: 26px; flex: 0 0 auto; }
.asst-launch .seal circle { stroke: #f3f4f6; }
.asst-launch .seal .a { fill: var(--teal-bright); }
.asst-launch.is-open { display: none; }

/* ---------- panel shell ---------- */
.asst-panel {
  width: 384px; max-width: calc(100vw - 36px);
  height: 600px; max-height: calc(100vh - 120px);
  background: var(--paper); border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(14,20,23,0.30);
  display: flex; flex-direction: column; overflow: hidden;
  transform-origin: bottom right;
  animation: asst-in .26s cubic-bezier(.22,.61,.36,1);
}
.asst-dock.left .asst-panel { transform-origin: bottom left; }
@keyframes asst-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

/* surface: dark variant */
.asst-panel.dark { background: var(--graphite); border-color: rgba(238,240,242,0.16); color: #eef0f2; }

/* ---------- header ---------- */
.asst-head {
  display: flex; align-items: center; gap: 12px; padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line-soft); background: var(--stone);
}
.asst-panel.dark .asst-head { background: rgba(0,0,0,0.18); border-bottom-color: rgba(238,240,242,0.12); }
.asst-head .seal { width: 34px; height: 34px; flex: 0 0 auto; }
.asst-head .seal circle { stroke: var(--ink); }
.asst-panel.dark .asst-head .seal circle { stroke: #eef0f2; }
.asst-head .seal .a { fill: var(--teal); }
.asst-panel.dark .asst-head .seal .a { fill: var(--teal-bright); }
.asst-head .ht { display: flex; flex-direction: column; line-height: 1.1; flex: 1 1 auto; }
.asst-head .ht .name { font-family: "Cinzel", Georgia, serif; font-weight: 600; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); }
.asst-panel.dark .asst-head .ht .name { color: #eef0f2; }
.asst-head .ht .sub { font-family: var(--sans); font-size: 9.5px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; color: var(--slate); margin-top: 5px; }
.asst-close {
  background: none; border: 0; cursor: pointer; color: var(--ink-46); padding: 4px;
  font-size: 20px; line-height: 1; transition: color .2s ease; flex: 0 0 auto;
}
.asst-close:hover { color: var(--ink); }
.asst-panel.dark .asst-close { color: rgba(238,240,242,0.5); }
.asst-panel.dark .asst-close:hover { color: #fff; }

/* ---------- body (scroll) ---------- */
.asst-body { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 20px 18px; }
.asst-body::-webkit-scrollbar { width: 8px; }
.asst-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.asst-intro { font-family: var(--serif); font-size: 18px; line-height: 1.4; letter-spacing: -0.01em; color: var(--ink); margin: 0 0 6px; text-wrap: pretty; }
.asst-panel.dark .asst-intro { color: #fff; }
.asst-intro .em { font-style: italic; }
.asst-introsub { font-size: 13px; line-height: 1.55; color: var(--ink-68); margin: 0 0 20px; }
.asst-panel.dark .asst-introsub { color: rgba(238,240,242,0.66); }

/* ---------- guided: question accordion ---------- */
.asst-qlist { display: flex; flex-direction: column; }
.asst-q { border-top: 1px solid var(--line-soft); }
.asst-q:last-child { border-bottom: 1px solid var(--line-soft); }
.asst-panel.dark .asst-q { border-top-color: rgba(238,240,242,0.12); }
.asst-panel.dark .asst-q:last-child { border-bottom-color: rgba(238,240,242,0.12); }
.asst-q-btn {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  display: flex; align-items: flex-start; gap: 12px; padding: 15px 0;
  font-family: var(--serif); font-weight: 400; font-size: 15.5px; line-height: 1.32; letter-spacing: -0.005em;
  color: var(--ink); transition: color .18s ease;
}
.asst-panel.dark .asst-q-btn { color: #eef0f2; }
.asst-q-btn:hover { color: var(--teal); }
.asst-panel.dark .asst-q-btn:hover { color: var(--teal-bright); }
.asst-q-btn .mk { margin-left: auto; flex: 0 0 auto; color: var(--teal); font-family: var(--sans); font-weight: 400; font-size: 19px; line-height: 1.1; transition: transform .2s ease; }
.asst-panel.dark .asst-q-btn .mk { color: var(--teal-bright); }
.asst-q.open .asst-q-btn .mk { transform: rotate(45deg); }
.asst-a { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.asst-q.open .asst-a { max-height: 460px; }
.asst-a-inner { padding: 0 0 18px; }
.asst-a-inner p { font-size: 13.5px; line-height: 1.62; color: var(--ink-68); margin: 0 0 10px; text-wrap: pretty; }
.asst-panel.dark .asst-a-inner p { color: rgba(238,240,242,0.72); }
.asst-a-inner p:last-child { margin-bottom: 0; }
.asst-a-inner strong { color: var(--ink); font-weight: 600; }
.asst-panel.dark .asst-a-inner strong { color: #fff; }
.asst-cta {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px;
  font-family: var(--sans); font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--teal); text-decoration: none; border-bottom: 1px solid transparent; padding-bottom: 2px; transition: border-color .2s ease;
}
.asst-panel.dark .asst-cta { color: var(--teal-bright); }
.asst-cta:hover { border-color: currentColor; }
.asst-cta .ar { transition: transform .2s ease; }
.asst-cta:hover .ar { transform: translateX(4px); }

/* ---------- free-form: chat thread ---------- */
.asst-thread { display: flex; flex-direction: column; gap: 16px; }
.asst-msg { display: flex; flex-direction: column; gap: 5px; max-width: 88%; }
.asst-msg .role { font-family: var(--sans); font-size: 9px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--slate); }
.asst-msg.user { align-self: flex-end; align-items: flex-end; }
.asst-msg.user .bubble {
  background: var(--ink); color: #f3f4f6; padding: 11px 15px; font-family: var(--sans); font-size: 13.5px; line-height: 1.5;
}
.asst-panel.dark .asst-msg.user .bubble { background: #000; }
.asst-msg.bot .bubble { font-family: var(--serif); font-size: 15px; line-height: 1.55; color: var(--ink); letter-spacing: -0.004em; }
.asst-panel.dark .asst-msg.bot .bubble { color: #eef0f2; }
.asst-msg.bot .bubble p { margin: 0 0 9px; text-wrap: pretty; }
.asst-msg.bot .bubble p:last-child { margin-bottom: 0; }

/* starter chips */
.asst-starters { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.asst-chip {
  text-align: left; background: var(--stone); border: 1px solid var(--line-soft); cursor: pointer;
  padding: 11px 14px; font-family: var(--serif); font-size: 13.5px; line-height: 1.3; color: var(--ink);
  transition: border-color .18s ease, background .18s ease;
}
.asst-panel.dark .asst-chip { background: rgba(238,240,242,0.06); border-color: rgba(238,240,242,0.12); color: #eef0f2; }
.asst-chip:hover { border-color: var(--teal); }

/* typing indicator */
.asst-typing { display: inline-flex; gap: 5px; align-items: center; padding: 4px 0; }
.asst-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--slate); opacity: .4; animation: asst-blink 1.1s infinite both; }
.asst-typing span:nth-child(2) { animation-delay: .18s; }
.asst-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes asst-blink { 0%,80%,100% { opacity: .25; transform: translateY(0); } 40% { opacity: .9; transform: translateY(-2px); } }

/* ---------- footer / input ---------- */
.asst-foot { flex: 0 0 auto; border-top: 1px solid var(--line-soft); background: var(--stone); }
.asst-panel.dark .asst-foot { background: rgba(0,0,0,0.18); border-top-color: rgba(238,240,242,0.12); }
.asst-form { display: flex; align-items: flex-end; gap: 8px; padding: 12px 12px 10px; }
.asst-input {
  flex: 1 1 auto; resize: none; border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 13.5px; line-height: 1.45; padding: 10px 12px; max-height: 96px;
}
.asst-panel.dark .asst-input { background: var(--graphite); border-color: rgba(238,240,242,0.18); color: #eef0f2; }
.asst-input:focus { outline: none; border-color: var(--teal); }
.asst-input::placeholder { color: var(--ink-46); }
.asst-send {
  flex: 0 0 auto; background: var(--teal); border: 1px solid var(--teal); color: #fff; cursor: pointer;
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; transition: background .2s ease;
}
.asst-send:hover { background: var(--ink); border-color: var(--ink); }
.asst-send:disabled { opacity: .4; cursor: default; }
.asst-send svg { width: 17px; height: 17px; }
.asst-disclaimer {
  padding: 0 14px 12px; margin: 0; font-family: var(--sans); font-size: 10px; line-height: 1.45; color: var(--ink-46);
  letter-spacing: 0.01em;
}
.asst-panel.dark .asst-disclaimer { color: rgba(238,240,242,0.42); }

/* guided footer note (no input) */
.asst-guidefoot { padding: 14px 16px; }
.asst-guidefoot p { margin: 0; font-family: var(--sans); font-size: 11px; line-height: 1.5; color: var(--ink-46); letter-spacing: 0.01em; }
.asst-panel.dark .asst-guidefoot p { color: rgba(238,240,242,0.42); }

@media (max-width: 480px) {
  .asst-panel { height: calc(100vh - 96px); }
}
