/* The website assistant (inc/assistant.php, js/assistant.js). Self-contained: the front page and the store pages load
   different stylesheets, so the tokens it needs are set here. */
.ask {
  --a-ink: #0b1538; --a-ink-2: #3a4566; --a-ink-3: #646d8a; --a-rule: #dbe3ea; --a-ice: #f4f6f8; --a-cta: #1d3cff; --a-blue: #1d3cff; --a-green: #03c97c;
  --a-ease: cubic-bezier(.16, 1, .3, 1);
  position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: calc(18px + var(--ask-lift, 0px) + env(safe-area-inset-bottom)); z-index: 55;
  font: 400 15px/1.45 "Matter", system-ui, sans-serif; color: var(--a-ink); -webkit-font-smoothing: antialiased;
  transition: bottom .35s var(--a-ease), opacity .3s ease;
}
.ask.ask-ride { transition: opacity .3s ease; }   /* resting on the footer line: follows the scroll exactly */
html.dr-open .ask, html.menu-open .ask, html.is-menu-open .ask, html.sx-lock .ask { opacity: 0; pointer-events: none; }

/* ---------- the trigger: his mark on a dark glass hexagon (the label's honeycomb) ---------- */
.ask-btn { position: relative; display: grid; place-items: center; width: 58px; height: 58px; padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ask-hex { position: absolute; inset: 0; clip-path: polygon(50% 0, 93.3% 25%, 93.3% 75%, 50% 100%, 6.7% 75%, 6.7% 25%);
  background: radial-gradient(90% 90% at 30% 20%, #2a45c9 0%, #12257a 55%, #0a1650 100%); transition: transform .5s var(--a-ease); }
.ask-hex::after { content: ""; position: absolute; inset: 1.5px; clip-path: inherit; background: linear-gradient(160deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 45%); }
.ask-btn::before { content: ""; position: absolute; inset: -10px; border-radius: 50%; background: radial-gradient(closest-side, rgba(29, 60, 255, .32), transparent); filter: blur(4px); opacity: .7; transition: opacity .4s ease; pointer-events: none; }
.ask-mark { position: relative; width: 28px; height: 28px; --mk-blue: #fff; --mk-ink: #a9b7ff; }   /* the logo's own colours on blue: white arch + plus, light-blue D (Eric 10-28: "colours on the chatbot need flipping") */
.ask-btn:hover .ask-hex, .ask-btn:focus-visible .ask-hex { transform: scale(1.06); }
.ask-btn:hover::before { opacity: 1; }
.ask-btn:focus-visible { outline: 2px solid var(--a-blue); outline-offset: 4px; border-radius: 50%; }
.ask-tip { position: absolute; right: calc(100% + 10px); top: 50%; translate: 0 -50%; white-space: nowrap; padding: 8px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .94); box-shadow: 0 0 0 1px rgba(11, 21, 56, .08), 0 12px 26px -14px rgba(11, 21, 56, .45); backdrop-filter: blur(10px);
  font: 500 14px/1 "Matter", sans-serif; color: var(--a-ink); opacity: 0; transform: translateX(8px); transition: opacity .3s ease, transform .45s var(--a-ease); pointer-events: none; }
/* "How can I help you?" stays beside the mark at all times, desktop and phone (Nick 10-24: "keep it visible... at all times...
   without hiding the text after the pulse"); it slides in once as the mark arrives, and steps aside only while the chat is open */
.ask-tip { opacity: 1; transform: none; animation: ask-tip-in .6s var(--a-ease) 1.1s backwards; }
@keyframes ask-tip-in { from { opacity: 0; transform: translateX(8px); } }
@media (max-width: 760px) { .ask-tip { padding: 7px 12px; font-size: 13px; right: calc(100% + 8px); } }
.ask[data-panel="open"] .ask-tip, .ask:not([data-call="idle"]) .ask-tip { opacity: 0; transform: translateX(8px); animation: none; }
@media (max-width: 760px) { .ask.ask-ride .ask-tip { opacity: 0; transform: translateX(8px); animation: none; } }   /* on a phone the footer text runs full width: the mark alone, no bubble over it */
.ask.arrive .ask-btn { animation: ask-in .9s var(--a-ease) both; }
/* the ping (Nick 10-22, "The pulse!!!!"): two hexagon rings leave the mark like sonar, until the chat is opened once this visit */
.ask-ping { position: absolute; inset: 0; pointer-events: none; }
.ask-ping i { position: absolute; inset: 0; background: #7d92ff; opacity: 0; animation: ask-ping 3.4s cubic-bezier(.2, .7, .3, 1) 1.6s infinite;
  clip-path: polygon(50% 0, 93.3% 25%, 93.3% 75%, 50% 100%, 6.7% 75%, 6.7% 25%, 50% 0, 50% 7%, 12.8% 28.5%, 12.8% 71.5%, 50% 93%, 87.2% 71.5%, 87.2% 28.5%, 50% 7%); }
.ask-ping i:nth-child(2) { animation-delay: 2.15s; }
@keyframes ask-ping { 0% { transform: scale(1); opacity: .7; } 70%, 100% { transform: scale(2); opacity: 0; } }
.ask.seen .ask-ping, .ask[data-panel="open"] .ask-ping, .ask:not([data-call="idle"]) .ask-ping { display: none; }
@keyframes ask-in { from { opacity: 0; transform: translateY(14px) scale(.8); } }

/* ---------- the panel ---------- */
.ask-panel { position: absolute; right: 0; bottom: calc(100% + 14px); width: min(392px, calc(100vw - 36px)); height: min(600px, calc(100dvh - 150px)); display: grid; grid-template-rows: auto 1fr auto auto auto;
  border-radius: 22px; background: #fff; box-shadow: 0 0 0 1px rgba(11, 21, 56, .08), 0 40px 80px -36px rgba(11, 21, 56, .55); overflow: hidden;
  transform-origin: 100% 100%; animation: ask-open .45s var(--a-ease) both; }
.ask-panel[hidden] { display: none; }
@keyframes ask-open { from { opacity: 0; transform: translateY(10px) scale(.96); } }
.ask-h { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; background: #1d3cff; color: #fff; }
.ask-mode { order: 3; flex: 1 0 100%; display: flex; gap: 3px; padding: 3px; border-radius: 999px; background: rgba(6, 12, 60, .22); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.ask-mode[hidden] { display: none; }
.ask-mode button { flex: 1; height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px; border: 0; border-radius: 999px; background: none;
  color: rgba(232, 241, 249, .78); font: 500 14px/1 "Matter", sans-serif; cursor: pointer; transition: background .3s var(--a-ease), color .3s ease; }
.ask-mode button svg { width: 17px; height: 17px; }
.ask-mode button:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.ask-mode button[aria-pressed="true"] { background: #fff; color: var(--a-ink); }
.ask-mode button:focus-visible { outline: 2px solid #a9b7ff; outline-offset: 1px; }
.ask[data-call="connecting"] .ask-mode [data-mode="talk"] svg { animation: ask-pulse 1.2s ease-in-out infinite; }
.ask-av { flex: none; width: 38px; height: 38px; display: grid; place-items: center; clip-path: polygon(50% 0, 93.3% 25%, 93.3% 75%, 50% 100%, 6.7% 75%, 6.7% 25%); background: #3a55ff; }
.ask-av svg { width: 20px; height: 20px; --mk-blue: #fff; --mk-ink: #a9b7ff; }
.ask-ht { min-width: 0; flex: 1; }
.ask-t { margin: 0; font: 500 16px/1.2 "Matter", sans-serif; letter-spacing: -.01em; }
.ask-s { margin: 3px 0 0; display: flex; align-items: center; gap: 7px; font: 400 11px/1 "Fragment Mono", ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; color: rgba(226, 231, 255, .7); }
.ask-s i { width: 7px; height: 7px; border-radius: 50%; background: var(--a-green); box-shadow: 0 0 0 3px rgba(3, 201, 124, .2); }
.ask-x { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); color: #fff; cursor: pointer; }
.ask-x svg { width: 14px; height: 14px; }
.ask-x:hover { background: rgba(255, 255, 255, .14); }

.ask-log { overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px; background: var(--a-ice); }
.ask-m { margin: 0; max-width: 86%; padding: 10px 14px; border-radius: 18px; font-size: 15px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; text-wrap: pretty; }
.ask-m.bot { align-self: flex-start; background: #fff; border: 1px solid var(--a-rule); border-bottom-left-radius: 6px; color: var(--a-ink); }
.ask-m.you { align-self: flex-end; background: var(--a-cta); color: #fff; border-bottom-right-radius: 6px; }
.ask-m.sys { align-self: center; max-width: 100%; background: none; padding: 2px 6px; font-size: 13px; color: var(--a-ink-3); text-align: center; }
.ask-m a { color: var(--a-blue); text-decoration: underline; text-underline-offset: 2px; }
.ask-m.you a { color: #fff; }
.ask-typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.ask-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--a-ink-3); animation: ask-dot 1.2s ease-in-out infinite; }
.ask-typing i:nth-child(2) { animation-delay: .15s; } .ask-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ask-dot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

.ask-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 10px; background: var(--a-ice); scrollbar-width: none; }
.ask-chips::-webkit-scrollbar { display: none; }
.ask-chips[hidden] { display: none; }
.ask-chips button { flex: none; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--a-rule); background: #fff; color: var(--a-ink); font: 400 13.5px/1 "Matter", sans-serif; cursor: pointer; transition: border-color .25s ease; }
.ask-chips button:hover { border-color: var(--a-ink); }

/* the compose row: one rounded field holding the question, the mic and send; the whole row lights on focus */
.ask-in { display: flex; align-items: flex-end; gap: 6px; margin: 10px 12px 2px; padding: 5px 5px 5px 16px; border: 1px solid var(--a-rule); border-radius: 26px; background: #fff;
  transition: border-color .25s ease, box-shadow .25s ease; }
.ask-in:focus-within { border-color: rgba(29, 60, 255, .55); box-shadow: 0 0 0 4px rgba(29, 60, 255, .12); }
.ask-in[hidden] { display: none; }
.ask .ask-in textarea { flex: 1; min-width: 0; height: 42px; min-height: 42px; max-height: 112px; margin: 0; padding: 11px 0; border: 0 !important; outline: 0 !important; box-shadow: none !important; background: none !important; resize: none; overflow-y: auto;
  font: 400 16px/20px "Matter", sans-serif; color: var(--a-ink); border-radius: 0; }
.ask .ask-in textarea::placeholder { color: var(--a-ink-3); opacity: 1; }
.ask-mic, .ask-send { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; }
.ask-mic { border: 0; background: var(--a-ice); color: var(--a-ink); transition: background .25s ease; }
.ask-mic:hover { background: #e6edf3; }
.ask-mic[hidden] { display: none; }
.ask-send { border: 0; background: var(--a-cta); color: #fff; transition: background .25s ease, opacity .25s ease; }
.ask-send:hover { background: #3a55ff; }
.ask-send:disabled { background: #c9d2dc; cursor: default; }
.ask-mic svg, .ask-send svg { width: 18px; height: 18px; }

/* a call in progress takes the compose row's place */
.ask-call { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-top: 1px solid var(--a-rule); background: #fff; }
.ask-call[hidden] { display: none; }
.ask-wave { display: inline-flex; align-items: center; gap: 3px; height: 22px; }
.ask-wave i { width: 3px; height: 8px; border-radius: 2px; background: var(--a-blue); }
.ask[data-call="live"][data-talk="speaking"] .ask-wave i { animation: ask-wave 1s ease-in-out infinite; }
.ask-wave i:nth-child(2) { animation-delay: .1s; } .ask-wave i:nth-child(3) { animation-delay: .2s; } .ask-wave i:nth-child(4) { animation-delay: .3s; } .ask-wave i:nth-child(5) { animation-delay: .4s; }
@keyframes ask-wave { 0%, 100% { height: 6px; } 50% { height: 22px; } }
.ask-cs { flex: 1; margin: 0; display: grid; gap: 2px; font-size: 14px; }
.ask-call .ask-cs > span { display: flex; align-items: baseline; gap: 8px; }
.ask-call .ask-cs small { font-size: 12.5px; line-height: 1.3; color: var(--a-ink-3); }
.ask-cs b { font-weight: 500; }
.ask-timer { font: 400 12px/1 "Fragment Mono", ui-monospace, monospace; color: var(--a-ink-3); }
.ask-mute, .ask-end, .ask-type { flex: none; width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border-radius: 50%; border: 0; cursor: pointer; transition: background .25s ease, color .25s ease; }
.ask-mute svg, .ask-end svg, .ask-type svg { width: 19px; height: 19px; }
.ask-mute, .ask-type { background: var(--a-ice); color: var(--a-ink); }
.ask-mute:hover, .ask-type:hover { background: #e6edf3; }
.ask-mute .slash { opacity: 0; }
.ask-mute[aria-pressed="true"] { background: var(--a-ink); color: #fff; }
.ask-mute[aria-pressed="true"] .slash { opacity: 1; }
.ask-end { background: #d64545; color: #fff; }
.ask-end:hover { background: #bf3a3a; }

.ask-foot { margin: 0; padding: 8px 16px 10px; background: #fff; font: 400 10.5px/1.4 "Fragment Mono", ui-monospace, monospace; letter-spacing: .06em; text-transform: uppercase; color: var(--a-ink-3); text-align: center; }

/* ---------- phones: a bottom sheet that follows the keyboard ---------- */
@media (max-width: 620px) {
  .ask { right: 14px; bottom: calc(14px + var(--ask-lift, 0px) + env(safe-area-inset-bottom)); }
  .ask-btn { width: 54px; height: 54px; }
  .ask-panel { position: fixed; left: 0; right: 0; bottom: 0; width: auto; height: min(78dvh, var(--vvh, 100dvh)); border-radius: 22px 22px 0 0; transform-origin: 50% 100%; animation-name: ask-sheet; }
  @keyframes ask-sheet { from { transform: translateY(40px); opacity: 0; } }
  html.ask-open { overflow: hidden; }
  html.ask-open .ask-btn { opacity: 0; pointer-events: none; }
  .ask-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .ask, .ask-hex, .ask-tip { transition: none; }
  .ask.arrive .ask-btn, .ask-panel, .ask-card, .ask-typing i, .ask-wave i, .ask-dot { animation: none !important; }
  .ask-ping { display: none; }
}
.ask .screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* the compose row sits on white under the thread */
.ask-panel { grid-template-rows: auto 1fr auto auto auto; }
.ask-in, .ask-call { position: relative; }
.ask-panel > .ask-in { box-sizing: border-box; }
.ask-panel::after { content: none; }
.ask-log + .ask-chips + .ask-in, .ask-chips[hidden] + .ask-in { margin-top: 10px; }
.ask-foot { border-top: 0; }
/* codes in a reply: tap to copy */
.ask-code { appearance: none; display: inline-flex; align-items: center; gap: 6px; margin: 0 1px; padding: 1px 8px; border: 1px dashed rgba(11, 21, 56, .35); border-radius: 999px; background: var(--a-ice);
  font: 400 13px/1.5 "Fragment Mono", ui-monospace, monospace; letter-spacing: .06em; color: var(--a-ink); cursor: pointer; vertical-align: 1px; transition: border-color .25s ease, background .25s ease; }
.ask-code::after { content: ""; width: 10px; height: 10px; background: currentColor; opacity: .5;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6'%3E%3Crect x='5' y='5' width='8' height='8' rx='1.5'/%3E%3Cpath d='M3 10.5V4.5A1.5 1.5 0 0 1 4.5 3h6'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6'%3E%3Crect x='5' y='5' width='8' height='8' rx='1.5'/%3E%3Cpath d='M3 10.5V4.5A1.5 1.5 0 0 1 4.5 3h6'/%3E%3C/svg%3E") center / contain no-repeat; }
.ask-code:hover { border-color: var(--a-ink); background: #fff; }
.ask-code.done { border-style: solid; border-color: var(--a-green); color: #0f7a52; }
.ask-code.done::after { opacity: 1; -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 8.5l3 3 7-7'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 8.5l3 3 7-7'/%3E%3C/svg%3E"); }
.ask-m.you .ask-code { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .5); color: #fff; }
/* while an answer streams in, a soft caret follows the words */
.ask-m.bot.streaming::after { content: ""; display: inline-block; width: 7px; height: 1em; margin-left: 2px; vertical-align: -2px; border-radius: 1px; background: var(--a-blue); opacity: .5; animation: ask-caret 1s steps(2) infinite; }
@keyframes ask-caret { 50% { opacity: 0; } }
@media (max-width: 620px) {
  .ask .ask-in textarea { font-size: 16px; }   /* 16px: iOS never zooms the page on focus */
}

/* ---------- the call card: floats above the mark while a call runs with the chat closed ---------- */
.ask-card { position: absolute; right: 0; bottom: calc(100% + 14px); width: min(340px, calc(100vw - 36px)); display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding: 16px 14px 14px 18px;
  border-radius: 20px; background: rgba(10, 22, 80, .94); color: #fff; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 30px 60px -28px rgba(6, 12, 48, .7);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%); animation: ask-open .45s var(--a-ease) both; transform-origin: 100% 100%; }
.ask-card[hidden] { display: none; }
.ask-ct { flex: 1; min-width: 0; }
.ask-card .ask-cs { display: flex; align-items: center; gap: 8px; margin: 0; font: 400 11px/1 "Fragment Mono", ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; color: rgba(226, 231, 255, .72); }
.ask-card .ask-cs b { font-weight: 400; color: #fff; }
.ask-card .ask-timer { margin-left: auto; color: rgba(226, 231, 255, .5); }
.ask-dot { width: 8px; height: 8px; border-radius: 50%; background: #f5b941; box-shadow: 0 0 0 3px rgba(245, 185, 65, .2); animation: ask-pulse 1.2s ease-in-out infinite; }
.ask[data-call="live"] .ask-dot { background: var(--a-green); box-shadow: 0 0 0 3px rgba(3, 201, 124, .22); }
@keyframes ask-pulse { 50% { opacity: .35; } }
.ask-cap { margin: 7px 0 0; min-height: 20px; font: 400 15px/1.35 "Matter", sans-serif; color: #fff; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ask-cap:empty::before { content: "Go ahead, ask anything."; color: rgba(226, 231, 255, .55); }
.ask[data-call="connecting"] .ask-cap:empty::before { content: "One moment…"; }
.ask-cb { display: flex; align-items: center; gap: 6px; }
.ask-card .ask-type { width: auto; margin-right: auto; display: inline-flex; gap: 8px; padding: 0 16px 0 13px; border-radius: 999px; font: 500 14px/1 "Matter", sans-serif; }
.ask-card .ask-type svg { width: 17px; height: 17px; }
.ask-card .ask-mute, .ask-card .ask-type { background: rgba(255, 255, 255, .1); color: #fff; }
.ask-card .ask-mute:hover, .ask-card .ask-type:hover { background: rgba(255, 255, 255, .18); }
.ask-card .ask-mute[aria-pressed="true"] { background: #fff; color: var(--a-ink); }
/* the mark during a call: it breathes with whoever is speaking (--lvl from the audio meter) */
.ask:not([data-call="idle"]) .ask-btn::before { opacity: calc(.55 + var(--lvl, 0) * 1.2); transform: scale(calc(1 + var(--lvl, 0) * .55)); }
.ask-btn::before { transition: opacity .12s linear, transform .12s linear; }
.ask[data-call="connecting"] .ask-hex { animation: ask-pulse 1.2s ease-in-out infinite; }
@media (max-width: 620px) {
  .ask-card { position: fixed; left: 12px; right: 12px; width: auto; bottom: calc(84px + var(--ask-lift, 0px) + env(safe-area-inset-bottom)); }
}
