/* Aida, the voice agent: a figure of light in a dark glass portal that keeps the
   visitor company from the corner. In a call the portal grows beside the dialog. */
.aida-dock{
  --aida-size:128px;
  --aida-glass:#0d1713;
  --aida-glass-lit:#25392f;
  --aida-light:#d9bd83;
  --aida-live:#63c796;
  --aida-ease:cubic-bezier(.22,.61,.36,1);
  --aida-label-x:-50%;
  position:absolute;z-index:3;right:38px;bottom:74px;
  width:var(--aida-size);height:var(--aida-size);
  pointer-events:none;
}

.aida-character{
  position:absolute;inset:0;overflow:hidden;border-radius:50%;
  background:radial-gradient(circle at 50% 36%,var(--aida-glass-lit) 0%,var(--aida-glass) 64%,#070d0b 100%);
  border:1px solid #d9bd8380;
  box-shadow:0 22px 44px -14px #040a08b8,0 2px 10px #040a0866,inset 0 -22px 34px -18px #d9bd8340,inset 0 0 0 5px #d9bd830d;
  transition:transform .5s var(--aida-ease),border-color .3s,box-shadow .3s;
}
.aida-character canvas,.aida-character [data-figure-poster]{position:absolute;inset:0;width:100%;height:100%;display:block;object-fit:cover}
/* Until the figure assembles, a soft light waits where her face will be. */
.aida-character::before{
  content:"";position:absolute;inset:18%;border-radius:50%;
  background:radial-gradient(closest-side,#d9bd8338,#d9bd830f 58%,transparent 78%);
  transition:opacity .9s;
}
.aida-character:not([data-state=loading])::before{opacity:0}

/* The whole portal is the button; its label rides on the lower rim. */
.aida-launch{
  position:absolute;inset:0;padding:0;border:0;border-radius:var(--radius-control);
  background:transparent;color:var(--ink);font:inherit;cursor:pointer;pointer-events:auto;
  touch-action:manipulation;-webkit-tap-highlight-color:transparent;
  transition:opacity .25s;
}
.aida-launch::before,.aida-launch::after{
  content:"";position:absolute;inset:-7px;border:1px solid var(--aida-light);border-radius:50%;
  opacity:0;pointer-events:none;
}
.aida-launch:focus-visible{outline:2px solid var(--aida-light);outline-offset:9px}
.aida-launch-label{
  position:absolute;left:50%;top:calc(100% - 15px);transform:translateX(var(--aida-label-x));
  display:flex;align-items:center;gap:8px;padding:8px 15px 8px 12px;
  border:1px solid #d9bd83b3;border-radius:var(--radius-control);
  background:#faf7f0f7;box-shadow:0 10px 26px -10px #040a08a6;
  font-size:12.5px;font-weight:600;letter-spacing:.01em;line-height:1;white-space:nowrap;
  transition:transform .35s var(--aida-ease),background .2s,box-shadow .3s;
}
.aida-live{width:7px;height:7px;border-radius:50%;background:var(--aida-live);box-shadow:0 0 0 3px #63c79633}

.aida-dock[data-attentive=true] .aida-character{transform:scale(1.045);border-color:var(--aida-light);box-shadow:0 26px 50px -14px #040a08cc,0 0 34px -6px #d9bd8366,inset 0 -22px 34px -18px #d9bd8366,inset 0 0 0 5px #d9bd831a}
.aida-dock[data-attentive=true] .aida-launch-label{transform:translateX(var(--aida-label-x)) translateY(3px);background:#fffdf7;box-shadow:0 14px 30px -10px #040a08bf}
.aida-launch:active .aida-launch-label{transform:translateX(var(--aida-label-x)) translateY(4px) scale(.98)}

/* Her message: she "types", then says it. It returns whenever the visitor comes close. */
.aida-greeting{
  position:absolute;right:calc(100% + 18px);top:50%;margin:0;
  width:max-content;max-width:min(262px,calc(100vw - var(--aida-size) - 84px));
  padding:13px 17px 14px;border-radius:18px 18px 5px 18px;
  background:#faf7f0f5;color:var(--ink);border:1px solid #d9bd8366;
  box-shadow:0 18px 44px -16px #040a08b3;
  font-size:14px;line-height:1.45;cursor:pointer;
  opacity:0;visibility:hidden;transform:translate(10px,-50%) scale(.97);transform-origin:100% 60%;
  transition:opacity .45s var(--aida-ease),transform .45s var(--aida-ease),visibility 0s .45s;
}
.aida-greeting-kind{display:block;margin-bottom:5px;color:var(--gold);font-size:10.5px;font-weight:600;letter-spacing:.14em}
.aida-greeting-dots{position:absolute;left:17px;bottom:17px;display:flex;gap:5px;opacity:0;transition:opacity .25s}
.aida-greeting-dots i{width:6px;height:6px;border-radius:50%;background:var(--gold)}
.aida-greeting-text{transition:opacity .35s}
.aida-greeting[data-stage=typing] .aida-greeting-dots{opacity:1}
.aida-greeting[data-stage=typing] .aida-greeting-text{opacity:0}
.aida-greeting:is([data-stage=typing],[data-stage=shown]),
.aida-dock[data-attentive=true] .aida-greeting:not([data-stage=typing]){
  opacity:1;visibility:visible;pointer-events:auto;transform:translate(0,-50%) scale(1);transition-delay:0s;
}

@media(prefers-reduced-motion:no-preference){
  /* Two slow rings of light, like a voice carrying; nothing shakes. */
  .aida-launch::before{animation:aida-voice-ring 5.6s var(--aida-ease) 1.2s infinite}
  .aida-launch::after{animation:aida-voice-ring 5.6s var(--aida-ease) 2.1s infinite}
  .aida-live{animation:aida-live 2.8s ease-in-out infinite}
  .aida-greeting[data-stage=typing] .aida-greeting-dots i{animation:aida-typing 1s ease-in-out infinite}
  .aida-greeting-dots i:nth-child(2){animation-delay:.16s}
  .aida-greeting-dots i:nth-child(3){animation-delay:.32s}
  .aida-dock[data-attentive=true] .aida-launch::before,.aida-dock[data-attentive=true] .aida-launch::after,
  .studio[data-aida-focus=true] .aida-launch::before,.studio[data-aida-focus=true] .aida-launch::after{animation:none}
  html[data-page-hidden=true] .aida-launch::before,html[data-page-hidden=true] .aida-launch::after,
  html[data-page-hidden=true] .aida-live{animation-play-state:paused}
}
@keyframes aida-voice-ring{0%{opacity:0;transform:scale(.97)}14%{opacity:.5}58%,100%{opacity:0;transform:scale(1.24)}}
@keyframes aida-live{0%,100%{opacity:1}50%{opacity:.45}}
@keyframes aida-typing{0%,60%,100%{opacity:.35;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}

/* In a call she steps forward, beside her dialog. */
.studio[data-aida-focus=true] .aida-dock{--aida-size:clamp(220px,23vw,330px);right:352px;bottom:calc(50% - var(--aida-size) / 2)}
.studio[data-aida-focus=true] .aida-launch{opacity:0;pointer-events:none}
.studio[data-aida-focus=true] .aida-greeting{opacity:0;visibility:hidden;pointer-events:none}
.studio[data-aida-focus=true] .aida-character{border-color:var(--aida-light);box-shadow:0 40px 90px -30px #040a08e6,0 0 70px -18px #d9bd8359,inset 0 -40px 60px -34px #d9bd8359,inset 0 0 0 8px #d9bd8314}

@media(min-width:1600px){.studio[data-aida-focus=true] .aida-dock{right:calc(5vw + 318px)}}
@media(max-width:1050px){
  .aida-dock{--aida-size:100px;right:26px}
  .studio[data-aida-focus=true] .aida-dock{--aida-size:clamp(170px,24vw,230px);right:308px}
}
@media(max-height:700px) and (min-width:700px){.aida-dock{--aida-size:92px;bottom:62px}}
@media(max-width:699px){
  /* On a phone she is one capsule: the label tucks in behind her portal, and her short
     message rises above it without covering either. */
  .aida-dock{--aida-size:64px;--aida-label-x:0;right:14px;bottom:calc(var(--service-row-height,90px) + 30px)}
  .aida-character{border-width:1.5px;border-color:#d9bd83b3}
  .aida-launch-label{
    z-index:-1;left:auto;right:calc(100% - 22px);top:50%;transform:translateY(-50%);
    padding:0 32px 0 15px;height:42px;gap:8px;font-size:13px;
  }
  .aida-dock[data-attentive=true] .aida-launch-label,
  .aida-launch:active .aida-launch-label{transform:translateY(-50%)}
  .aida-greeting{
    right:0;top:auto;bottom:calc(100% + 14px);
    max-width:min(270px,calc(100vw - 28px));padding:11px 15px 12px;font-size:13.5px;
    border-radius:18px 18px 5px 18px;transform:translateY(8px) scale(.97);transform-origin:100% 100%;
  }
  .aida-greeting:is([data-stage=typing],[data-stage=shown]),
  .aida-dock[data-attentive=true] .aida-greeting:not([data-stage=typing]){transform:none}
  .aida-greeting-dots{left:15px;bottom:15px}
  /* In a call her portal sits centred just above the dialog, sized to the room left. */
  .studio[data-aida-focus=true] .aida-dock{--aida-size:max(72px,min(46vw,26dvh,calc(var(--aida-dialog-space-room,40dvh) - 36px)));right:calc(50% - var(--aida-size) / 2);bottom:calc(var(--aida-dialog-space,58dvh) + 14px)}
}
@media(max-height:600px) and (min-width:550px){
  .aida-dock{--aida-size:72px;--aida-label-x:0;right:18px;bottom:26px}
  .aida-launch-label{left:auto;right:-6px}
  .aida-greeting{display:none}
  .studio[data-aida-focus=true] .aida-dock{--aida-size:min(30vw,62dvh);bottom:calc(50% - var(--aida-size) / 2)}
}
/* Panels over the plaza take the stage: her message waits, even though it sets its own visibility. */
.studio:is([data-service-focus=true],[data-business-focus=true]) .aida-greeting{opacity:0;visibility:hidden;pointer-events:none}

@media(prefers-reduced-motion:reduce){
  .aida-character,.aida-launch,.aida-launch-label,.aida-greeting,.aida-greeting-dots,.aida-greeting-text{transition:none}
}
