/* The assistant chat (src/assistant.mjs), inline where it is asked. Built from the site's own tokens, with plain fallbacks for a skin
 * that lacks one: a thread under the composer (the visitor on the right, answers on the left with their sources as chips), the composer
 * sticking to the foot of a phone screen while a conversation is active, a docked chat behind the Ask button, and a larger view by choice. */
:root{--as-bg:var(--cream,var(--bg,#fff));--as-panel:var(--panel,#fff);--as-ink:var(--ink,#1d1d1f);--as-muted:var(--muted,#5f5f66);--as-line:var(--line,#e3e3e8);--as-accent:var(--accent,#1d1d1f);--as-on-accent:var(--on-accent,#fff);--as-soft:var(--blush,var(--bg-2,#f2f2f5));--as-font:var(--sans,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif)}
.as-chat{--as-halo:var(--as-bg);display:grid;grid-template-columns:minmax(0,1fr);gap:12px;max-width:720px;min-width:0;font-family:var(--as-font);color:var(--as-ink)}
.as-chat[hidden]{display:none}
.as-chat-h{margin:0;font:700 clamp(18px,2vw,22px)/1.25 var(--as-font);color:var(--as-ink)}
.as-open:focus-visible,.as-send:focus-visible,.as-voice:focus-visible,.as-chip:focus-visible,.as-tool:focus-visible,.as-cite:focus-visible,.as-act:focus-visible{outline:3px solid var(--as-accent);outline-offset:2px}
/* the composer */
.as-bar{display:flex;align-items:center;gap:6px;margin:0;padding:6px 6px 6px 18px;min-height:56px;border-radius:999px;background:var(--as-panel);border:1px solid var(--as-line);box-shadow:0 10px 30px -18px rgb(0 0 0 / .35)}
.as-bar:focus-within{border-color:var(--as-accent)}
.as-bar input{flex:1;min-width:0;height:44px;border:0;background:none;font:16px var(--as-font);color:var(--as-ink);padding:0;outline:none;box-shadow:none}
.as-bar input::placeholder{color:var(--as-muted);opacity:1}
.as-send{flex:none;display:inline-grid;place-items:center;width:44px;height:44px;border-radius:999px;border:0;background:var(--as-accent);color:var(--as-on-accent);cursor:pointer}
.as-voice{flex:none;display:inline-grid;place-items:center;width:44px;height:44px;border-radius:999px;border:0;background:none;color:var(--as-ink);cursor:pointer}
.as-voice[hidden]{display:none}
.as-voice:hover,.as-voice.is-on{background:var(--as-soft)}.as-voice.is-on{color:var(--as-accent)}
.as-chips{display:flex;flex-wrap:wrap;gap:8px;margin:0;padding:0;list-style:none}
.as-chips[hidden]{display:none}
.as-chip{min-height:40px;padding:8px 14px;border-radius:999px;border:1px solid var(--as-line);background:var(--as-panel);color:var(--as-ink);font:500 14px/1.3 var(--as-font);text-align:left;cursor:pointer}
.as-chip:hover{border-color:var(--as-accent)}
/* suggestion cards: square, 2 by 2 on a phone and up to 4 in a row when there is room; two small ones under "Ask about this page" */
.as-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:0;padding:0;list-style:none}
.as-cards[hidden]{display:none}
@media (min-width:761px){.as-cards{grid-template-columns:repeat(auto-fit,minmax(140px,1fr))}.as-cards:has(> li:nth-child(4)){grid-template-columns:repeat(4,minmax(0,1fr))}}
.as-card{display:flex;flex-direction:column;justify-content:space-between;gap:10px;width:100%;aspect-ratio:1/1;min-height:120px;padding:14px;border-radius:16px;border:1px solid var(--as-line);background:var(--as-panel);color:var(--as-ink);font:inherit;text-align:left;cursor:pointer;overflow:hidden;box-shadow:0 8px 22px -18px rgb(0 0 0 / .4)}
.as-card:hover{border-color:var(--as-accent)}
.as-card:focus-visible{outline:3px solid var(--as-accent);outline-offset:2px}
.as-card-top{display:flex;align-items:center;gap:8px;color:var(--as-accent)}
.as-card-i{flex:none;width:30px;height:30px;padding:6px;border-radius:10px;background:var(--as-soft)}
.as-card-label{font:700 12px/1.2 var(--as-font);letter-spacing:.06em;text-transform:uppercase;color:var(--as-muted)}
.as-card-q{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;font:600 15px/1.35 var(--as-font);color:var(--as-ink)}
.as-cards-small{grid-template-columns:repeat(2,minmax(0,132px))}
@media (min-width:761px){.as-cards-small,.as-cards-small:has(> li:nth-child(4)){grid-template-columns:repeat(2,minmax(0,132px))}}
.as-cards-small .as-card{min-height:0;padding:12px;border-radius:14px;gap:6px}
.as-cards-small .as-card-i{width:26px;height:26px;padding:5px}
.as-cards-small .as-card-q{font-size:14px}
.as-dock .as-cards{grid-template-columns:repeat(2,minmax(0,1fr))}
.as-fine{margin:0;font-size:12px;line-height:1.4;color:var(--as-muted)}
.as-fine[hidden]{display:none}
/* the thread, between the heading and the composer once a conversation starts */
.as-chat>*{min-width:0}
.as-tools{display:flex;flex-wrap:wrap;gap:4px;justify-content:flex-end}
.as-tools[hidden]{display:none}
.as-tool{display:inline-flex;align-items:center;min-height:36px;padding:4px 12px;border-radius:999px;border:0;background:none;color:var(--as-muted);font:600 13px/1 var(--as-font);cursor:pointer}
.as-tool:hover{background:var(--as-soft);color:var(--as-ink)}
.as-log{display:flex;flex-direction:column;gap:16px;padding:4px 0}
.as-log[hidden]{display:none}
.as-msg{max-width:90%;font-size:16px;line-height:1.6}
.as-msg p{margin:0 0 8px}.as-msg p:last-child{margin-bottom:0}
.as-msg ul{margin:0 0 8px;padding-left:20px}
.as-me{align-self:flex-end;padding:10px 16px;border-radius:20px 20px 6px 20px;background:var(--as-accent);color:var(--as-on-accent)}
.as-bot{align-self:flex-start;max-width:100%}
.as-note{color:var(--as-muted);font-size:14px}
.as-signpost{padding:10px 12px;border-radius:12px;background:var(--as-soft);border-left:4px solid var(--as-accent);font-size:14px}
.as-dyor{color:var(--as-muted);font-size:13px}
.as-extras[hidden]{display:none}
.as-cites{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:10px 0 0}
.as-cites-h{font:700 12px/1 var(--as-font);letter-spacing:.08em;text-transform:uppercase;color:var(--as-muted);margin-right:2px}
.as-cite{display:inline-block;max-width:100%;min-height:32px;padding:7px 12px;border-radius:999px;border:1px solid var(--as-line);background:var(--as-panel);color:var(--as-ink);font-size:13px;line-height:1.3;text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.as-cite:hover{border-color:var(--as-accent)}
.as-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.as-act{display:inline-flex;align-items:center;min-height:40px;padding:8px 14px;border-radius:999px;background:var(--as-ink);color:var(--as-bg);font:600 14px/1.2 var(--as-font);text-decoration:none}
.as-act-quiet{background:none;color:var(--as-ink);border:1px solid var(--as-line)}
.as-typing{display:flex;gap:5px;padding:10px 2px}
.as-typing i{width:8px;height:8px;border-radius:50%;background:var(--as-muted);animation:as-b 1.2s infinite ease-in-out}
.as-typing i:nth-of-type(2){animation-delay:.15s}.as-typing i:nth-of-type(3){animation-delay:.3s}
@keyframes as-b{0%,80%,100%{opacity:.25;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}
@media (prefers-reduced-motion:reduce){.as-typing i{animation:none;opacity:.6}}
/* "Ask about this page", at the end of the content */
.as-page{margin:48px 0 0;padding:24px;border-radius:var(--wf-r,16px);background:var(--as-soft)}
.as-page .as-chat{max-width:none;--as-halo:var(--as-soft)}
/* the Ask button and the docked chat behind it */
.as-open{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 16px;border-radius:999px;border:1px solid var(--as-line);background:var(--as-panel);color:var(--as-ink);font:600 15px/1 var(--as-font);cursor:pointer}
.as-fab{position:fixed;right:max(16px,env(safe-area-inset-right));bottom:max(16px,env(safe-area-inset-bottom));z-index:60;min-height:52px;padding:0 20px;background:var(--as-accent);color:var(--as-on-accent);border-color:transparent;box-shadow:0 12px 32px -12px rgb(0 0 0 / .45)}
html.as-dock-on .as-fab{display:none}
@media (max-width:760px){html.as-inline-on .as-fab{display:none}}
.as-dock{position:fixed;z-index:61;right:max(16px,env(safe-area-inset-right));bottom:max(16px,env(safe-area-inset-bottom));width:min(420px,calc(100vw - 32px));max-height:min(620px,calc(100dvh - 32px));overflow:auto;padding:16px;border-radius:20px;background:var(--as-bg);border:1px solid var(--as-line);box-shadow:0 24px 60px -24px rgb(0 0 0 / .45);align-content:start}
.as-dock .as-chat-h{font-size:17px;padding-right:44px}
.as-dock.is-active .as-bar{position:sticky;bottom:0;box-shadow:0 0 0 12px var(--as-bg)}
.as-tool-x{position:absolute;top:10px;right:10px;width:40px;height:40px;justify-content:center;padding:0}
.as-dock .as-tools{min-height:36px}
/* the larger view, by choice */
.as-chat.is-big{position:fixed;z-index:62;inset:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) auto;width:min(760px,calc(100vw - 32px));max-width:none;max-height:none;overflow:auto;padding:20px;border-radius:20px;background:var(--as-bg);border:1px solid var(--as-line);box-shadow:0 24px 80px -24px rgb(0 0 0 / .5);align-content:start}
.as-chat.is-big{--as-halo:var(--as-bg)}
.as-chat.is-big.is-active .as-bar{position:sticky;bottom:0;box-shadow:0 0 0 12px var(--as-bg)}
/* on a phone the thread stays in the page, and the composer sticks to the foot of the screen while a conversation is active */
@media (max-width:760px){
 .as-inline.is-active .as-bar{position:sticky;bottom:max(8px,env(safe-area-inset-bottom));z-index:5;box-shadow:0 0 0 10px var(--as-halo)}
 html.as-dock-on body{overflow:hidden}
 .as-dock{left:8px;right:8px;bottom:8px;width:auto;max-height:calc(100dvh - 80px)}
 .as-chat.is-big{inset:8px;width:auto}
 .as-page{padding:16px;margin-top:32px}
}
.as-hero-keep{margin:0;font-size:15px}
.as-results{padding-left:20px}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
