/* GEN per-page agent conversation — one agent per page, grounded on that
   page's pack. Portable across GEN trees: agent-config.js + agent.js + this.
   The conversation opens as a CENTERED MODAL over a dimmed page (Anton,
   Oct 21 2026): no navigation, no separate talk screen. Marble rule: the
   floating button is the PURE orb (idle chrome); the conversation avatar is
   the page agent's marble from its pack (face for GEN — present & speaking).
   Open motions are the approved action pairings (Motion law, Oct 21 2026):
   Speak to GEN → Glass Bloom · Ask a question → Swirl Assemble. */
.gen-agent-btn{position:fixed;right:18px;bottom:18px;z-index:1200;display:flex;align-items:center;gap:10px;
  background:#101C31;color:#fff;border:2px solid #641D35;border-radius:999px;padding:8px 16px 8px 8px;
  font:600 14px/1 Inter,system-ui,sans-serif;cursor:pointer;box-shadow:0 10px 30px rgba(16,28,49,.35)}
.gen-agent-btn img{width:38px;height:38px;border-radius:50%;object-fit:cover;display:block}
.gen-agent-btn:hover{border-color:#9AA3AF}

/* Prominent in-page Talk button (Anton, Oct 21 2026): burgundy, unmistakably
   the primary action wherever GEN can be talked to. */
.btn-talk{display:inline-block;background:#641D35;color:#fff;border:1.5px solid #641D35;border-radius:999px;
  padding:16px 36px;font:700 1.06rem/1.2 Inter,system-ui,sans-serif;text-decoration:none;cursor:pointer;
  box-shadow:0 12px 28px rgba(100,29,53,.38);letter-spacing:.01em;transition:filter .15s ease,transform .15s ease}
.btn-talk:hover{filter:brightness(1.14);transform:translateY(-1px)}
.btn-talk:focus-visible,.gen-agent-btn:focus-visible,.gen-agent-panel button:focus-visible,
.gen-agent-panel input:focus-visible{outline:3px solid #9AA3AF;outline-offset:2px}

/* Backdrop — the dimmed page behind the centered box */
.gen-agent-backdrop{position:fixed;inset:0;z-index:1200;background:rgba(9,16,29,.6);
  -webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);display:none}
.gen-agent-backdrop.open{display:block;animation:ga-fade .3s ease both}

/* The conversation box — centered in the page at every width.
   Centering uses the `translate` property so open-motion keyframes can
   animate `transform` freely without fighting the centering. */
.gen-agent-panel{position:fixed;left:50%;top:50%;translate:-50% -50%;z-index:1201;
  width:min(560px,calc(100vw - 24px));height:min(720px,calc(100dvh - 32px));
  display:none;flex-direction:column;background:#fff;color:#101C31;
  border:2px solid #641D35;border-radius:20px;overflow:hidden;box-shadow:0 30px 80px rgba(9,16,29,.55);
  font:400 15px/1.5 Inter,system-ui,sans-serif}
.gen-agent-panel.open{display:flex}
.gen-agent-head{display:flex;align-items:center;gap:12px;background:#101C31;color:#fff;padding:12px 14px;flex:none}
.gen-agent-head img{width:44px;height:44px;border-radius:50%;object-fit:cover;border:2px solid #641D35}
.gen-agent-head .t{flex:1;min-width:0}
.gen-agent-head .t b{display:block;font-size:16px}
.gen-agent-head .t span{display:block;font-size:12px;color:#C7CCD4}
.gen-agent-head button{background:none;border:1px solid #9AA3AF;color:#fff;border-radius:8px;
  padding:6px 10px;font:600 12px Inter,system-ui,sans-serif;cursor:pointer;white-space:nowrap}
.gen-agent-log{padding:14px;overflow-y:auto;display:flex;flex-direction:column;gap:10px;background:#F7F5F2;flex:1;min-height:0}
.gen-agent-msg{max-width:88%;padding:10px 13px;border-radius:14px;white-space:pre-wrap;word-wrap:break-word}
.gen-agent-msg.bot{background:#fff;border:1.5px solid #C7CCD4;align-self:flex-start;border-bottom-left-radius:4px}
.gen-agent-msg.user{background:#641D35;color:#fff;align-self:flex-end;border-bottom-right-radius:4px}
.gen-agent-msg.err{background:#FDF0F3;border-color:#641D35}
.gen-agent-note{padding:8px 14px;font-size:12px;color:#5A6472;background:#fff;border-top:1px solid #E4E1DC;flex:none}
.gen-agent-form{display:flex;gap:8px;padding:12px 14px;background:#fff;border-top:2px solid #641D35;flex:none}
.gen-agent-form input{flex:1;min-width:0;padding:11px 12px;border:1.5px solid #C7CCD4;border-radius:10px;font:400 15px Inter,system-ui,sans-serif}
.gen-agent-form button{background:#641D35;color:#fff;border:none;border-radius:10px;padding:11px 16px;font:600 14px Inter,system-ui,sans-serif;cursor:pointer}
.gen-agent-form button:disabled{opacity:.55;cursor:wait}
.gen-agent-typing{align-self:flex-start;color:#5A6472;font-size:13px;font-style:italic}

/* --- signature open motions (Motion law, Anton, Oct 21 2026) --- */
@keyframes ga-fade{from{opacity:0}to{opacity:1}}
@keyframes ga-settle{0%{transform:scale(.55) translateY(30px);opacity:0}55%{transform:scale(1.04) translateY(-4px);opacity:1}75%{transform:scale(.985) translateY(1px)}100%{transform:scale(1) translateY(0)}}
@keyframes ga-swirl{0%{transform:rotate(-6deg) scale(.8) translate(46px,26px);opacity:0}60%{transform:rotate(2deg) scale(1.02) translate(-6px,-3px);opacity:1}100%{transform:rotate(0) scale(1) translate(0,0)}}
/* Glass Bloom, modal grade — the /motion/ Family B #1 bloom (iris from the
   orb, .85s door speed) recentered on the box: Speak to GEN's door. */
@keyframes ga-bloom{0%{clip-path:circle(4% at 50% 42%);filter:blur(9px);opacity:.35}100%{clip-path:circle(142% at 50% 42%);filter:blur(0);opacity:1}}
@keyframes ga-pop{0%{opacity:0;transform:scale(.55)}70%{opacity:1;transform:scale(1.07)}100%{opacity:1;transform:scale(1)}}
@keyframes ga-rise{from{transform:translateY(16px);opacity:0}to{transform:translateY(0);opacity:1}}
@keyframes ga-draw{0%{clip-path:inset(0 100% 0 0);box-shadow:inset 0 0 0 3px #641D35}70%{box-shadow:inset 0 0 0 3px #641D35}100%{clip-path:inset(0 0 0 0);box-shadow:none}}
.gen-agent-panel.open-marblesettle{animation:ga-settle .9s cubic-bezier(.22,1.2,.36,1) both}
.gen-agent-panel.open-swirlassemble{animation:ga-swirl .85s ease-out both}
.gen-agent-panel.open-glassbloom{animation:ga-bloom .85s cubic-bezier(.3,.7,.3,1) both}
.gen-agent-panel.open-glassbloom .gen-agent-head img{animation:ga-pop .5s ease .35s both}
.gen-agent-panel.open-tilecascade .gen-agent-head,.gen-agent-panel.open-tilecascade .gen-agent-log,
.gen-agent-panel.open-tilecascade .gen-agent-note,.gen-agent-panel.open-tilecascade .gen-agent-form{animation:ga-rise .55s ease-out both}
.gen-agent-panel.open-tilecascade .gen-agent-log{animation-delay:.12s}
.gen-agent-panel.open-tilecascade .gen-agent-note{animation-delay:.24s}
.gen-agent-panel.open-tilecascade .gen-agent-form{animation-delay:.34s}
.gen-agent-panel.open-blueprintbuild{animation:ga-draw 1s ease-out both}
@media (prefers-reduced-motion: reduce){.gen-agent-panel,.gen-agent-backdrop{animation:none!important}.gen-agent-panel *{animation:none!important}}
@media (max-width:480px){
  .gen-agent-panel{width:calc(100vw - 16px);height:calc(100dvh - 16px);border-radius:16px}
  .gen-agent-btn{right:12px;bottom:12px}
  .btn-talk{padding:15px 30px;font-size:1.02rem}
}
