/* "Ask AI before you DM me" launcher + dialog (js/chat.js). Uses the palette variables from styles.css. */
.askai-launcher {
  position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 45;
  display: inline-flex; align-items: center; gap: .5em;
  min-height: 48px; padding: .6em 1.1em; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 .98rem/1.2 var(--sans); cursor: pointer; box-shadow: var(--shadow-lg);
  transition: bottom .25s ease, transform .15s ease, border-color .15s, opacity .25s ease, visibility 0s;
}
.askai-launcher[hidden] { display: none; }
.askai-launcher .icon { color: var(--accent); width: 1.3em; height: 1.3em; }
.askai-launcher:hover { border-color: var(--accent); transform: translateY(-1px); }
@media (min-width: 720px) { .askai-launcher { right: 24px; bottom: 24px; } }
/* Phone: sit above the sticky "Free scan" bar when it is showing. While the hero is on screen (js/chat.js sets
   .in-hero) stay hidden: the pill would cover hero lines / contact buttons, and the hero has its own CTAs. */
@media (max-width: 719px) {
  .mobile-cta.show ~ .askai-launcher { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 62px); }
  .askai-launcher.in-hero { opacity: 0; visibility: hidden; transform: translateY(12px); transition-delay: 0s, 0s, 0s, 0s, .25s; }
}
/* Narrow phones: icon only (the button keeps its aria-label). */
@media (max-width: 379px) {
  .askai-launcher { width: 52px; height: 52px; padding: 0; justify-content: center; }
  .askai-launcher-text { display: none; }
}

.askai {
  padding: 0; border: 0; margin: 0; background: transparent; color: var(--ink);
  max-width: none; max-height: none; overflow: visible;
  position: fixed; inset: auto 0 0 0; width: 100%; height: min(86dvh, 720px);
}
.askai::backdrop { background: rgb(20 14 8 / .45); }
@media (min-width: 720px) {
  .askai { inset: auto 24px 24px auto; width: 380px; height: min(640px, calc(100dvh - 48px)); }
  .askai::backdrop { background: rgb(20 14 8 / .18); }
}
.askai[open] .askai-panel { animation: askai-in .22s ease-out; }
@keyframes askai-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.askai-panel {
  display: flex; flex-direction: column; height: 100%;
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0; box-shadow: var(--shadow-lg); overflow: hidden;
  font: 400 .97rem/1.55 var(--sans);
}
@media (min-width: 720px) { .askai-panel { border-bottom: 1px solid var(--line); border-radius: var(--radius); } }

.askai-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 10px 18px; }
.askai-head h2 { font-size: 1.25rem; margin: 0; }
.askai-close {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer;
}
.askai-close:hover { border-color: var(--muted); }
.askai-note { margin: 0; padding: 0 18px 10px; font-size: .86rem; color: var(--muted); border-bottom: 1px solid var(--line); }

.askai-log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 10px; }
.askai-msg { max-width: 92%; padding: 10px 13px; border-radius: 16px; overflow-wrap: anywhere; }
.askai-bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.askai-user { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.askai-body p { margin: 0 0 .55em; }
.askai-body p:last-child, .askai-body ul:last-child { margin-bottom: 0; }
.askai-body ul { margin: 0 0 .55em; padding-left: 1.15em; }
.askai-body li { margin-bottom: .25em; }
.askai-msg a { font-weight: 600; }
.askai-error { background: var(--warn-soft); border-color: transparent; }
.askai-contacts { margin: .4em 0 0; }

.askai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.askai-chip, .askai-more {
  font: 500 .88rem/1.25 var(--sans); text-align: left; cursor: pointer;
  padding: .45em .8em; border-radius: 999px; border: 1px solid var(--accent); background: var(--surface); color: var(--accent);
}
.askai-chip:hover, .askai-more:hover { background: var(--accent-soft); }
.askai-actions { margin-top: 8px; }

.askai-dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.askai-dots::before, .askai-dots::after, .askai-dots i { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: askai-dot 1s infinite ease-in-out; }
.askai-dots i { animation-delay: .15s; }
.askai-dots::after { animation-delay: .3s; }
@keyframes askai-dot { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

.askai-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.askai-form textarea {
  flex: 1; resize: none; min-height: 44px; max-height: 140px; padding: 10px 14px; border-radius: 22px;
  border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); font: 400 1rem/1.4 var(--sans);
}
.askai-form textarea:focus { border-color: var(--accent); outline: none; }
.askai-send {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none;
  border-radius: 999px; border: 0; background: var(--accent); color: var(--on-accent); cursor: pointer;
}
.askai-send:disabled { opacity: .5; cursor: default; }
.askai-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 719px) { html.askai-open { overflow: hidden; } }
@media (prefers-reduced-motion: reduce) {
  .askai-launcher, .askai[open] .askai-panel, .askai-dots::before, .askai-dots::after, .askai-dots i { transition: none; animation: none; }
}
