/* Athena chat shell. Cut corners use the b-cut edge and fill layers. */

.ac-veil{
  position:fixed;
  inset:0;
  z-index:calc(var(--z-athena, 200) - 1);
  background:rgba(0,0,0,.42);
  pointer-events:none;
}
.ac-veil[hidden]{display:none}

.ac-shell{display:contents}
.ac-shell:not(.is-open) .ac-head,
.ac-shell:not(.is-open) .ac-thread{display:none}

.ac-shell.is-open{
  --clip-mirror:polygon(0 0,calc(100% - var(--cut)) 0,100% var(--cut),100% 100%,var(--cut) 100%,0 calc(100% - var(--cut)));
  --athena-edge:linear-gradient(135deg,color-mix(in srgb,var(--brand-cyan-bright) 75%,transparent),color-mix(in srgb,var(--brand-cyan) 45%,transparent) 42%,color-mix(in srgb,var(--brand-amber) 35%,transparent) 78%,color-mix(in srgb,var(--brand-cyan) 25%,transparent));
  --athena-fill:linear-gradient(160deg,color-mix(in srgb,var(--brand-cyan) 10%,var(--bg-elevated)) 0%,color-mix(in srgb,var(--bg-elevated) 92%,transparent) 48%,color-mix(in srgb,var(--brand-amber) 5%,var(--bg-elevated)) 100%);
  --athena-halo:0 0 0 1px color-mix(in srgb,var(--brand-cyan) 18%,transparent),0 0 28px color-mix(in srgb,var(--brand-cyan) 16%,transparent),0 12px 40px color-mix(in srgb,#000 28%,transparent);
  --fill:var(--athena-fill);
  --edge:var(--athena-edge);
  position:fixed;
  isolation:isolate;
  left:50%;
  bottom:12px;
  transform:translateX(-50%);
  width:min(720px,calc(100% - 32px));
  z-index:var(--z-athena, 200);
  display:flex;
  flex-direction:column;
  height:min(580px,calc(100vh - 110px));
  height:min(580px,calc(100dvh - 110px));
  max-height:calc(100vh - 110px);
  max-height:calc(100dvh - 110px);
  box-shadow:var(--athena-halo);
  background:none;
  border:0;
  border-radius:0;
}
html[data-theme="light"] .ac-shell.is-open{
  --athena-halo:0 0 0 1px color-mix(in srgb,var(--brand-cyan) 22%,transparent),0 0 24px color-mix(in srgb,var(--brand-cyan) 12%,transparent),0 10px 28px color-mix(in srgb,#000 8%,transparent);
  --athena-fill:linear-gradient(160deg,color-mix(in srgb,var(--brand-cyan) 8%,#fff) 0%,color-mix(in srgb,var(--bg-elevated) 96%,transparent) 50%,color-mix(in srgb,var(--brand-amber) 4%,#fff) 100%);
}
.ac-shell.is-open::before,
.ac-bubble.b-cut::before,
.ac-close.b-cut::before,
.ac-shell.is-open::after,
.ac-bubble.b-cut::after,
.ac-close.b-cut::after{
  content:"";
  position:absolute;
  z-index:-1;
  pointer-events:none;
  clip-path:var(--clip);
}
.ac-shell.is-open::before,
.ac-bubble.b-cut::before,
.ac-close.b-cut::before{inset:0;background:var(--edge)}
.ac-shell.is-open::after,
.ac-bubble.b-cut::after,
.ac-close.b-cut::after{inset:1px;background:var(--fill)}

.ac-head{
  position:relative;
  z-index:1;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  min-height:56px;
  flex:none;
  border-bottom:1px solid color-mix(in srgb,var(--text) 8%,transparent);
}
.ac-head-id{display:flex;align-items:center;gap:10px;min-width:0}
.ac-new{
  position:relative;
  z-index:2;
  margin-left:auto;
  padding:4px 8px;
  font:inherit;
  font-size:12px;
  line-height:1.2;
  color:var(--text-muted);
  background:none;
  border:0;
  cursor:pointer;
}
.ac-new:hover{color:var(--text)}
.ac-new:focus-visible{outline:2px solid var(--brand-cyan);outline-offset:2px}
.ac-head .athena-name{display:block}
.ac-close{
  position:relative;
  isolation:isolate;
  flex:none;
  width:32px;
  height:32px;
  padding:0;
  color:var(--text-muted);
  --cut:8px;
  --fill:color-mix(in srgb,var(--bg) 80%,transparent);
  --edge:color-mix(in srgb,var(--text) 22%,transparent);
  display:grid;
  place-items:center;
  cursor:pointer;
  background:none;
  border:0;
}
.ac-close:focus-visible{outline:2px solid var(--brand-cyan);outline-offset:2px}

.ac-thread{
  position:relative;
  z-index:1;
  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
  gap:16px;
  padding:8px 16px 16px;
  overflow-y:auto;
}
.ac-msg{display:flex;flex-direction:column;gap:6px;max-width:82%;min-width:0}
.ac-msg.is-athena{align-self:flex-start;align-items:flex-start}
.ac-msg.is-tu{align-self:flex-end;align-items:flex-end}
.ac-who{font-size:11px;font-weight:600;letter-spacing:.04em;line-height:1;padding:0 2px}
.ac-msg.is-athena .ac-who{color:var(--brand-amber)}
.ac-msg.is-tu .ac-who{color:var(--brand-cyan)}

.ac-bubble{
  position:relative;
  isolation:isolate;
  padding:10px 14px;
  max-width:100%;
  --cut:8px;
  --clip-mirror:polygon(0 0,calc(100% - var(--cut)) 0,100% var(--cut),100% 100%,var(--cut) 100%,0 calc(100% - var(--cut)));
  min-height:38px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  background:none;
  border:0;
  border-radius:0;
}
.ac-bubble p{margin:0;font-size:14px;line-height:1.45;white-space:pre-wrap}
.ac-bubble p+p,.ac-bubble ul,.ac-bubble ol{margin-top:8px}
.ac-bubble ul,.ac-bubble ol{margin-bottom:0;padding-left:1.1em}
.ac-bubble li+li{margin-top:4px}
.ac-msg.is-athena .ac-bubble a{color:var(--link);text-decoration:underline;text-underline-offset:2px}
.ac-msg.is-athena .ac-bubble a:hover{color:var(--brand-cyan-bright)}
html[data-theme="light"] .ac-msg.is-athena .ac-bubble a:hover,
html.light .ac-msg.is-athena .ac-bubble a:hover{color:var(--brand-cyan)}
.ac-msg.is-athena .ac-bubble{
  --fill:color-mix(in srgb,var(--brand-amber) 14%,var(--bg-elevated));
  --edge:color-mix(in srgb,var(--brand-amber) 48%,transparent);
}
.ac-msg.is-tu .ac-bubble{
  --clip:var(--clip-mirror);
  --fill:color-mix(in srgb,var(--brand-cyan) 14%,var(--bg-elevated));
  --edge:color-mix(in srgb,var(--brand-cyan) 48%,transparent);
}

.ac-loading{
  margin:auto;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:12px;
  color:var(--text-muted);
  font-size:14px;
  padding:24px 0;
}
.ac-wait{margin:0;display:flex;align-items:center;gap:6px}
.ac-dots{display:inline-flex;gap:3px}
.ac-dots i{
  width:4px;height:4px;border-radius:50%;background:currentColor;
  animation:ac-dot 1s infinite;
}
.ac-dots i:nth-child(2){animation-delay:.15s}
.ac-dots i:nth-child(3){animation-delay:.3s}
@keyframes ac-dot{0%,80%,100%{opacity:.25}40%{opacity:1}}
@media (prefers-reduced-motion:reduce){
  .ac-dots i{animation:none;opacity:1}
}

.ac-shell.is-open .athena-bar>.athena-mark{display:none}
.ac-shell.is-open .athena-bar>.athena-name{display:none}
.ac-shell.is-open .athena-bar{
  position:relative;
  left:auto;
  right:auto;
  bottom:auto;
  transform:none;
  z-index:1;
  width:100%;
  flex:none;
  border-radius:0;
  box-shadow:none;
  border-top:1px solid color-mix(in srgb,var(--text) 8%,transparent);
}
@media (max-width:1023.98px){
  .ac-shell.is-open{width:calc(100% - 24px);height:min(640px,calc(100vh - 88px));height:min(640px,calc(100dvh - 88px));max-height:calc(100dvh - 88px)}
  .ac-thread{gap:14px;padding:6px 14px 16px}
  .ac-msg{max-width:88%}
}
.rt-athena-code{display:block;margin-top:6px;font-size:11px;letter-spacing:.04em;color:var(--text-muted)}
