/* ============================================================
   Ask Doza — the help chat on every page of doza.ai (assets/ask.js).
   Uses the page palette tokens every template defines (--bg, --ink,
   --ink-soft, --rule, --accent-bright, --font-*), with fallbacks, so it
   reads on the dark pages and the light legal shell alike.
   ============================================================ */

.ask{
  --ask-bg: var(--bg, #0e0d0c);
  --ask-ink: var(--ink, #f2efe8);
  --ask-soft: var(--ink-soft, rgba(242,239,232,.6));
  --ask-rule: var(--rule, rgba(242,239,232,.14));
  --ask-accent: var(--accent-bright, var(--accent, #6fa3e0));
  --ask-panel: color-mix(in srgb, var(--ask-bg) 94%, var(--ask-ink) 6%);
  --ask-bubble: color-mix(in srgb, var(--ask-bg) 86%, var(--ask-ink) 14%);
  font-family: var(--font-body, "IBM Plex Sans", system-ui, sans-serif);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ask-ink);
}

.ask-launch{
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px 11px 14px;
  border: 1px solid var(--ask-rule); border-radius: 999px;
  background: var(--ask-panel); color: var(--ask-ink);
  font: inherit; font-weight: 600; cursor: pointer;
  box-shadow: 0 8px 28px rgba(0,0,0,.28);
  transition: transform .15s ease, border-color .15s ease;
}
.ask-launch:hover{ transform: translateY(-1px); border-color: var(--ask-accent); }
.ask-launch:focus-visible{ outline: 2px solid var(--ask-accent); outline-offset: 3px; }
.ask-launch svg{ width: 18px; height: 18px; color: var(--ask-accent); flex: none; }
.ask.is-open .ask-launch{ display: none; }

.ask-panel{
  position: fixed; right: 20px; bottom: 20px; z-index: 61;
  width: min(400px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 40px));
  height: min(620px, calc(100dvh - 40px));
  display: none; flex-direction: column;
  background: var(--ask-panel);
  border: 1px solid var(--ask-rule); border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0,0,0,.4);
  overflow: hidden;
}
.ask.is-open .ask-panel{ display: flex; }

.ask-head{
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 14px 12px 18px;
  border-bottom: 1px solid var(--ask-rule);
}
.ask-head-text{ flex: 1; min-width: 0; }
.ask-title{ margin: 0; font-size: 16px; font-weight: 600; }
.ask-sub{ margin: 2px 0 0; font-size: 12.5px; color: var(--ask-soft); }
.ask-iconbtn{
  flex: none; width: 32px; height: 32px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--ask-soft);
  cursor: pointer; font: inherit;
}
.ask-iconbtn:hover{ color: var(--ask-ink); background: var(--ask-bubble); }
.ask-iconbtn:focus-visible{ outline: 2px solid var(--ask-accent); outline-offset: 1px; }
.ask-iconbtn svg{ width: 16px; height: 16px; }

.ask-log{
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 12px;
}
.ask-msg{ max-width: 88%; padding: 9px 13px; border-radius: 14px; overflow-wrap: anywhere; }
.ask-msg p{ margin: 0 0 .55em; }
.ask-msg p:last-child, .ask-msg ol:last-child, .ask-msg ul:last-child{ margin-bottom: 0; }
.ask-msg ol, .ask-msg ul{ margin: 0 0 .55em; padding-left: 1.25em; }
.ask-msg li{ margin: .15em 0; }
.ask-msg a{ color: var(--ask-accent); text-decoration: underline; text-underline-offset: 2px; border: 0; }
.ask-msg--bot{ align-self: flex-start; background: var(--ask-bubble); border-bottom-left-radius: 4px; }
.ask-msg--you{ align-self: flex-end; background: color-mix(in srgb, var(--ask-accent) 26%, var(--ask-bg)); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.ask-msg--note{ align-self: stretch; max-width: none; padding: 0; font-size: 12.5px; color: var(--ask-soft); font-family: var(--font-mono, ui-monospace, Menlo, monospace); }
.ask-msg.is-typing::after{ content: "▍"; animation: ask-blink 1s steps(2) infinite; color: var(--ask-soft); }
@keyframes ask-blink{ 50%{ opacity: 0; } }

.ask-chips{ display: flex; flex-wrap: wrap; gap: 8px; }
.ask-chip{
  padding: 6px 11px; border: 1px solid var(--ask-rule); border-radius: 999px;
  background: transparent; color: var(--ask-ink); font: inherit; font-size: 13.5px; cursor: pointer;
}
.ask-chip:hover{ border-color: var(--ask-accent); }
.ask-chip:focus-visible{ outline: 2px solid var(--ask-accent); outline-offset: 2px; }

.ask-form{ display: flex; gap: 8px; align-items: flex-end; padding: 12px 14px 6px; border-top: 1px solid var(--ask-rule); }
.ask-input{
  flex: 1; min-height: 40px; max-height: 120px; resize: none;
  padding: 9px 12px; border: 1px solid var(--ask-rule); border-radius: 10px;
  background: var(--ask-bg); color: var(--ask-ink); font: inherit; font-size: 16px; line-height: 1.4;
}
.ask-input:focus{ outline: none; border-color: var(--ask-accent); }
.ask-send{
  flex: none; height: 40px; padding: 0 14px; border: 0; border-radius: 10px;
  background: var(--ask-accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.ask-send:disabled{ opacity: .45; cursor: default; }
.ask-send:focus-visible{ outline: 2px solid var(--ask-ink); outline-offset: 2px; }
.ask-foot{ margin: 0; padding: 0 16px 12px; font-size: 11.5px; color: var(--ask-soft); }
.ask-foot a{ color: inherit; text-decoration: underline; border: 0; }

@media (max-width: 600px){
  .ask-launch{ right: 16px; bottom: 16px; }
  .ask-panel{ left: 12px; right: 12px; bottom: 12px; width: auto; height: min(80vh, calc(100vh - 24px)); height: min(80dvh, calc(100dvh - 24px)); }
}
@media (prefers-reduced-motion: reduce){
  .ask-launch{ transition: none; }
  .ask-msg.is-typing::after{ animation: none; }
}
@media print{ .ask{ display: none; } }
