/* Front Door demo: component styles. Load tokens.css first. Motion is transform and opacity only, and
   prefers-reduced-motion is honoured at the bottom of this file. */
*{box-sizing:border-box;margin:0;padding:0}
html,body{background:var(--bg);color:var(--fg)}
body{font-family:var(--sans);min-height:100vh;-webkit-font-smoothing:antialiased;line-height:1.5;-webkit-text-size-adjust:100%}
.wrap{max-width:1080px;margin:0 auto;padding:30px 20px 60px}

/* header (standalone page only) */
header{display:flex;justify-content:space-between;align-items:center;gap:12px;border-bottom:1px solid var(--line);
  padding-bottom:14px;margin-bottom:26px;flex-wrap:wrap}
.brand{font-weight:600;font-size:15px}
.brand a{color:var(--fg);text-decoration:none}
.brand a:hover{color:var(--accent-txt)}
.tag{font-family:var(--mono);font-size:12px;color:var(--muted)}

/* intro */
h1{font-size:clamp(28px,4.4vw,40px);font-weight:700;line-height:1.12;letter-spacing:-.01em;max-width:24ch;text-wrap:balance}
.sub{color:var(--muted);margin:12px 0 22px;max-width:62ch;line-height:1.55;font-size:17px;text-wrap:pretty}
a{color:var(--accent-txt)}

/* scenario tabs */
.scenarios{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px;align-items:center}
.scn{background:var(--s2);border:1px solid var(--line);color:var(--fg);font:600 15px var(--sans);min-height:48px;
  padding:0 14px;border-radius:12px;cursor:pointer;touch-action:manipulation}
.scn.active{border-color:var(--accent);color:var(--accent-txt);box-shadow:inset 0 0 0 1px var(--accent)}
.replay{background:none;border:1px solid var(--line);color:var(--fg);font:600 15px var(--sans);min-height:48px;
  cursor:pointer;padding:0 14px;border-radius:12px;margin-left:auto;touch-action:manipulation}
.scn:focus-visible,.replay:focus-visible,.techbtn:focus-visible,.cta:focus-visible,.rawtoggle:focus-visible,
.bubble.agent:focus-visible,.tgroup:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.note{font-size:14px;color:var(--muted);margin:0 0 12px}

/* stage: two columns on wide screens, one timeline on phones (the engine moves tool calls inline) */
.stage{display:grid;grid-template-columns:1fr 1fr;border:1px solid var(--line);border-radius:18px;overflow:hidden;
  background:var(--s1);min-height:430px}
.col{--colpad:16px;padding:0 var(--colpad) 20px;display:flex;flex-direction:column;gap:11px;min-width:0}
.col+.col{border-left:1px solid var(--line);background:var(--bg)}
.colhead{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:13px;font-weight:600;
  color:var(--muted);margin:0 calc(-1 * var(--colpad)) 2px;padding:14px var(--colpad) 10px;border-bottom:1px solid var(--line);
  background:var(--s1)}
#ledger .colhead{background:var(--bg)}
.colhead small{font-weight:400;font-size:12px}
body.narrow .stage{grid-template-columns:1fr;min-height:0}
body.narrow #ledger{display:none}

/* conversation bubbles */
.bubble{max-width:92%;padding:10px 13px;border-radius:14px;font-size:16px;line-height:1.5;
  opacity:0;transform:translateY(6px);transition:opacity .35s ease,transform .35s ease,box-shadow .18s,border-color .18s}
.bubble.show{opacity:1;transform:none}
.cust{align-self:flex-start;background:var(--s2);border:1px solid var(--line)}
.agent{align-self:flex-end;background:var(--acc-wash);border:1px solid var(--acc-bd)}
.who{font-size:12px;font-weight:600;color:var(--muted);display:flex;align-items:center;gap:6px;margin-bottom:4px}
.agent .who{color:var(--accent-txt)}
.txt{color:var(--fg)}
.caret{display:inline-block;width:2px;height:1em;background:var(--accent);vertical-align:-2px;margin-left:1px;animation:blink 1s steps(1) infinite}
@keyframes blink{50%{opacity:0}}
.chip{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;border-radius:6px;
  background:var(--acc-wash);border:1px solid var(--acc-bd);color:var(--accent-txt);font:600 12px var(--mono)}
.typing{align-self:flex-end;display:flex;gap:4px;padding:12px 14px;background:var(--acc-wash);border:1px solid var(--acc-bd);border-radius:14px}
.typing span{width:6px;height:6px;border-radius:50%;background:var(--accent-txt);opacity:.5;animation:td 1.2s ease-in-out infinite}
.typing span:nth-child(2){animation-delay:.18s}.typing span:nth-child(3){animation-delay:.36s}
@keyframes td{0%,60%,100%{opacity:.35;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}

/* tool-call groups */
.tgroup{border:1px solid var(--line);border-left:3px solid var(--acc-bd);border-radius:12px;background:var(--s1);padding:9px;
  display:flex;flex-direction:column;gap:8px;transition:border-color .18s,box-shadow .18s;outline:none}
body.narrow .tgroup{background:var(--bg);margin:0 0 0 10px}
.tghead{display:flex;align-items:center;gap:8px;font-size:12px;font-weight:600;color:var(--muted);padding:1px 2px}
.linked{border-color:var(--acc-bd-hi);box-shadow:0 0 0 1px var(--acc-bd-hi)}
.linked.tgroup{border-left-color:var(--accent)}
.card{background:var(--s2);border:1px solid var(--line);border-radius:10px;padding:9px 11px;font:13px/1.5 var(--mono);
  opacity:0;transform:translateY(6px);transition:opacity .35s ease,transform .35s ease;min-width:0}
.card.show{opacity:1;transform:none}
.card-top{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.cstat{width:8px;height:8px;border-radius:50%;background:var(--accent);flex:none}
.cstat.calling{animation:beat 1.1s ease-in-out infinite}
@keyframes beat{50%{opacity:.3}}
.cstat.done{background:var(--muted)}
.dir{color:var(--accent-txt);font-weight:600}
.dir.res{color:var(--muted)}
.tname{color:var(--fg);font-weight:600;word-break:break-all}
.ct-right{margin-left:auto;display:flex;align-items:center;gap:9px}
.rawtoggle{background:var(--s3);border:1px solid var(--line);color:var(--fg);font:14px var(--mono);min-height:48px;padding:0 12px;
  border-radius:8px;cursor:pointer;white-space:nowrap;touch-action:manipulation}
.lat{font-size:12px;color:var(--muted);white-space:nowrap}
.lat.calling{color:var(--accent-txt)}
.card pre{white-space:pre-wrap;word-break:break-word;color:var(--muted2);margin-top:6px;font:inherit}
.card pre .k{color:var(--accent-txt)}.card pre .v{color:var(--muted2)}
.rpc{display:none;margin-top:6px}
.rpc.open{display:block}
.rpc pre{margin-top:0;padding:8px 9px;background:var(--bg);border:1px solid var(--line);border-radius:8px;color:var(--muted)}
.result{display:none}
.result.show{display:block;margin-top:8px;padding-top:8px;border-top:1px dashed var(--line);animation:rin .35s ease}
@keyframes rin{from{opacity:0}to{opacity:1}}
.badge{display:inline-flex;align-items:center;gap:6px;font:600 12px var(--sans);padding:3px 10px;border-radius:99px;margin-top:8px}
.badge::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor}
.badge.pending{color:var(--pending);border:1px solid var(--pending-bd);background:var(--pending-wash)}
.badge.ok{color:var(--ok);border:1px solid var(--ok-bd);background:var(--ok-wash)}

/* phones: one plain sentence per tool call; the technical details are one tap away */
.plain{display:none}
body.narrow:not(.tech) .card .tech{display:none}
body.narrow:not(.tech) .card .plain{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font:15px/1.45 var(--sans);color:var(--fg)}
.plain .badge{margin-top:0}
.plain>span:nth-child(2){flex:1 1 200px;min-width:0}
.plain .cstat{align-self:flex-start;margin-top:7px}
.card:not(.done) .plain .badge{display:none}
.techbtn{display:none}
body.narrow .techbtn{display:inline-flex;align-items:center;margin-top:12px;background:none;border:1px solid var(--line);
  color:var(--fg);font:600 15px var(--sans);min-height:48px;padding:0 14px;border-radius:12px;cursor:pointer;touch-action:manipulation}
body.hero .techbtn{display:none}

/* tally */
.tally{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px;opacity:0;transform:translateY(6px);transition:opacity .5s ease,transform .5s ease}
.tally:empty{display:none}
.tally.show{opacity:1;transform:none}
.tally .stat{flex:1 1 150px;background:var(--s1);border:1px solid var(--line);border-radius:12px;padding:12px 14px}
.tally .stat.amber{border-color:var(--pending-bd);background:var(--pending-wash)}
.tally b{display:block;font-weight:700;font-size:22px;color:var(--fg);margin-bottom:2px}
.tally .amber b{color:var(--pending)}
.tally .stat span{font-size:14px;color:var(--muted);line-height:1.4;display:block}

/* footer (standalone page only) */
footer{margin-top:30px;border-top:1px solid var(--line);padding-top:20px;display:flex;justify-content:space-between;gap:16px;
  flex-wrap:wrap;align-items:center}
footer p{color:var(--muted);font-size:16px;max-width:60ch;line-height:1.55}
.cta{background:var(--accent);color:#fff;font-weight:600;padding:0 20px;min-height:48px;display:inline-flex;align-items:center;
  border-radius:12px;text-decoration:none;font-size:16px}
.cta:hover{color:#fff;background:#0077ed}

/* embedded in a project page: no chrome, no inner scrolling (the page grows the frame to fit) */
body.embed{min-height:0;overflow:hidden}
body.embed .full-only{display:none}
body.embed .wrap{max-width:none;padding:2px 2px 4px}
body.embed .stage{min-height:0}

/* compact hero mode (?mode=hero), kept for old links: no tabs, loops the first scenario */
.herobar,.hnote{display:none}
body.hero .full-only,body.hero .scenarios{display:none}
body.hero .wrap{max-width:1240px;padding:16px 20px 18px}
body.hero .herobar{display:block;font-size:18px;font-weight:600;margin-bottom:12px}
body.hero .hnote{display:block;font-size:14px;color:var(--muted);margin-top:10px}

@media(max-width:420px){
  .wrap{padding:20px 14px 44px}
  .col{--colpad:12px;padding:0 var(--colpad) 16px}
  .bubble{max-width:100%}
  .tally .stat{flex-basis:120px}
}
@media(prefers-reduced-motion:reduce){
  *{animation:none!important;transition:none!important}
  .bubble,.card,.tally{opacity:1;transform:none}
}
