/* Ask Aikho, the agent in the corner (specifications/aikho-standalone-website.md, PR 3).
   Plain CSS on the shared tokens and aikho.css's site tokens. Three looks for the launcher:
     - without scripts, a small pill linking to the Contact page;
     - with scripts, the same pill as the button that opens the chat;
     - while Aikho is docked in the corner (html[data-ak-docked], set by aikho.js under motion),
       a transparent round button over the character, its label shown on hover and focus.
   The panel opens above the corner: a card on a desktop, a sheet across the bottom on a phone. */

.ask-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.ask-launch {
  position: fixed; right: 24px; bottom: 24px; z-index: 9;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  background: oklch(0.2 0.006 75 / 0.88); color: var(--ak-paper);
  border: 1px solid var(--ak-line); box-shadow: 0 10px 30px oklch(0 0 0 / 0.35);
  font: 500 15px/1 "IBM Plex Sans", system-ui, sans-serif;
  transition: opacity 0.3s var(--ak-expo), transform 0.3s var(--ak-expo);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.ask-launch:hover { transform: translateY(-2px); }
.ask.is-tucked .ask-launch { opacity: 0; pointer-events: none; }
.ask.is-tucked .ask-launch:focus-visible { opacity: 1; pointer-events: auto; }

/* Docked: Aikho itself is the button. The label shows beside it on hover and on focus. */
html[data-ak-docked] .ask.is-ready .ask-launch {
  width: 64px; height: 64px; min-height: 0; padding: 0; border-radius: 50%;
  background: transparent; border-color: transparent; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
html[data-ak-docked] .ask.is-ready .ask-launch-label {
  position: absolute; right: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  padding: 8px 12px; border-radius: 999px; white-space: nowrap;
  background: var(--ak-paper); color: var(--ak-ink); font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
html[data-ak-docked] .ask.is-ready .ask-launch:hover .ask-launch-label,
html[data-ak-docked] .ask.is-ready .ask-launch:focus-visible .ask-launch-label { opacity: 1; }
html[data-ak-docked] .ask.is-ready .ask-launch:focus-visible { outline: 2px solid var(--aikho-accent-300); outline-offset: 4px; }

/* ---------- the panel ---------- */
.ask-panel {
  position: fixed; right: 24px; bottom: 100px; z-index: 30;
  width: min(400px, calc(100vw - 48px)); max-height: min(640px, calc(100dvh - 124px));
  display: flex; flex-direction: column;
  border-radius: 20px; border: 1px solid var(--ak-line);
  background: oklch(0.17 0.006 75); color: var(--ak-paper);
  box-shadow: 0 30px 80px oklch(0 0 0 / 0.5);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}
.ask-panel[hidden] { display: none; }
.ask-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--ak-line); }
.ask-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.ask-head p { margin: 2px 0 0; font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ak-soft); }
.ask-close, .ask-send { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--ak-paper); cursor: pointer; }
.ask-close svg, .ask-send svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ask-close:hover { background: var(--ak-line); }

.ask-log { flex: 1 1 auto; min-height: 120px; overflow-y: auto; overscroll-behavior: contain; padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; }
.ask-msg { margin: 0; max-width: 92%; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.ask-msg p { margin: 0; }
.ask-msg p + p, .ask-msg p + form { margin-top: 8px; }
.ask-from-aikho { align-self: flex-start; padding-left: 12px; border-left: 2px solid var(--ak-violet); }
.ask-from-visitor { align-self: flex-end; padding: 8px 12px; border-radius: 14px 14px 4px 14px; background: oklch(1 0 0 / 0.08); }
.ask-wait { color: var(--ak-soft); }
.ask-more { font-size: 14px; color: var(--ak-soft); }
.ask-more a, .ask-fine a { color: var(--ak-paper); text-decoration: underline; text-underline-offset: 3px; }

.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 10px; }
.ask-chips[hidden] { display: none; }
.ask-chips li { list-style: none; margin: 0; padding: 0; }
.ask-follow { padding: 8px 0 0; }
.ask-chip { display: inline-flex; align-items: center; text-decoration: none; min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--ak-line); background: transparent; color: var(--ak-paper); font: 14px/1.3 "IBM Plex Sans", system-ui, sans-serif; text-align: left; cursor: pointer; }
.ask-chip:hover { background: oklch(1 0 0 / 0.06); }
.ask-chip-strong { border-color: var(--ak-cobalt); }

.ask-compose-form { display: flex; align-items: flex-end; gap: 6px; margin: 0 12px; padding: 6px 6px 6px 14px; border: 1px solid var(--ak-line); border-radius: 22px; background: oklch(1 0 0 / 0.04); }
.ask-compose-form:focus-within { border-color: var(--aikho-accent-300); }
.ask-compose-form textarea { flex: 1; min-height: 32px; max-height: 120px; padding: 6px 0; border: 0; resize: none; outline: none; background: transparent; color: var(--ak-paper); font: 15px/1.4 "IBM Plex Sans", system-ui, sans-serif; }
.ask-compose-form textarea::placeholder { color: oklch(0.98 0.004 75 / 0.5); }
.ask-send { width: 36px; height: 36px; background: var(--ak-cobalt); color: var(--ak-ink); }
.ask-fine { margin: 0; padding: 10px 18px 14px; font-size: 12px; line-height: 1.45; color: oklch(0.98 0.004 75 / 0.56); }

/* The call-back form, in the conversation. */
.ask-callback { display: grid; gap: 10px; }
.ask-field { display: grid; gap: 4px; }
.ask-field label { font-size: 13px; color: var(--ak-soft); }
.ask-field input, .ask-field select, .ask-field textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--ak-line); background: oklch(1 0 0 / 0.05); color: var(--ak-paper);
  font: 15px/1.3 "IBM Plex Sans", system-ui, sans-serif;
}
.ask-field select option { color: var(--ak-ink); }
.ask-field [aria-invalid="true"] { border-color: var(--aikho-bad-line); }
.ask-err { margin: 0; font-size: 13px; color: var(--aikho-bad-fg); }
.ask-submit { justify-self: start; min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--ak-cobalt); color: var(--ak-ink); font: 500 15px/1 "IBM Plex Sans", system-ui, sans-serif; cursor: pointer; }
.ask-submit:disabled { opacity: 0.6; cursor: progress; }

.ask button:focus-visible, .ask a:focus-visible, .ask input:focus-visible, .ask select:focus-visible, .ask textarea:focus-visible { outline: 2px solid var(--aikho-accent-300); outline-offset: 2px; }
.ask .ask-compose-form textarea:focus-visible { outline: none; } /* the box's border shows the focus */

@media (max-width: 760px) {
  .ask-launch { right: 12px; bottom: 12px; }
  html[data-ak-docked] .ask.is-ready .ask-launch { width: 44px; height: 44px; }
  .ask-panel { left: 12px; right: 12px; bottom: 64px; width: auto; max-height: calc(100dvh - 80px); border-radius: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .ask-launch, .ask-launch-label { transition: none; }
  .ask-launch:hover { transform: none; }
}

@media print {
  .ask { display: none; }
}
