/* ==========================================================================
   Ask the Dojo chat widget
   Self-hosted floating drawer per docs/SITE-QA-CHAT-SPEC.md. One widget,
   embedded site-wide. Dark parchment, gold accent, no alarm colors.
   ========================================================================== */

.ask-btn {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--gold);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.3rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.ask-btn:hover {
  background: #f0d288;
  transform: translateY(-1px);
}

.ask-btn .ask-btn-glyph {
  width: 1.15em;
  height: 1.15em;
  flex: none;
}

/* The drawer */
.ask-drawer {
  position: fixed;
  right: 1.25rem;
  bottom: 5.4rem;
  z-index: 60;
  width: min(400px, calc(100vw - 2.5rem));
  max-height: min(620px, calc(100vh - 7rem));
  background: var(--parchment-dark);
  border: 1px solid var(--parchment-light);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.ask-drawer.is-open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* Full-page host (ask-the-dojo page) */
.ask-host .ask-drawer {
  position: static;
  width: 100%;
  max-width: 720px;
  height: min(620px, 70vh);
  max-height: none;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  box-shadow: none;
  margin: 1.4rem auto 0;
}

.ask-host .ask-btn {
  display: none;
}

.ask-header {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 1.1rem 1.2rem 0.7rem;
  border-bottom: 1px solid var(--line);
}

.ask-header-mark {
  width: 34px;
  height: 34px;
  color: var(--gold);
  flex: none;
}

.ask-header-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  margin: 0;
  line-height: 1.2;
}

.ask-header-sub {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin: 0.15rem 0 0;
}

.ask-close {
  margin-left: auto;
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-muted);
  border-radius: 999px;
  width: 30px;
  height: 30px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex: none;
}

.ask-close:hover {
  color: var(--ink-text);
  border-color: var(--ink-muted);
}

.ask-scope {
  font-size: 0.8rem;
  color: var(--false-heat);
  padding: 0.6rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: rgba(225, 154, 60, 0.06);
  margin: 0;
}

.ask-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  scroll-behavior: smooth;
}

.ask-msg {
  max-width: 88%;
  padding: 0.7rem 0.95rem;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.55;
  animation: ask-in 0.2s ease both;
}

@keyframes ask-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.ask-msg p {
  margin: 0 0 0.5rem;
}

.ask-msg p:last-child {
  margin-bottom: 0;
}

.ask-msg code {
  font-size: 0.86em;
}

.ask-msg--bot {
  background: var(--parchment);
  border: 1px solid var(--parchment-light);
  color: var(--ink-text);
  align-self: flex-start;
}

.ask-msg--user {
  background: var(--cool);
  color: var(--ink);
  align-self: flex-end;
}

.ask-msg--sys {
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--ink-muted);
  align-self: flex-start;
}

.ask-source {
  display: block;
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.ask-source a {
  color: var(--cool);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ask-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem 0;
}

.ask-suggest button {
  background: transparent;
  border: 1px solid var(--parchment-light);
  color: var(--ink-muted);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  font-family: var(--font-body);
  cursor: pointer;
}

.ask-suggest button:hover {
  color: var(--ink-text);
  border-color: var(--ink-muted);
}

.ask-typing {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.3rem 0;
}

.ask-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-muted);
  animation: ask-blink 1.2s ease infinite;
}

.ask-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.ask-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes ask-blink {
  0%,
  80%,
  100% {
    opacity: 0.3;
  }
  40% {
    opacity: 1;
  }
}

.ask-input-row {
  display: flex;
  gap: 0.6rem;
  padding: 0.8rem 1.2rem;
  border-top: 1px solid var(--line);
  align-items: center;
}

.ask-input {
  flex: 1;
  background: var(--ink);
  border: 1px solid var(--parchment-light);
  border-radius: 999px;
  color: var(--ink-text);
  font-family: var(--font-body);
  font-size: 0.92rem;
  padding: 0.65rem 1.1rem;
  outline: none;
}

.ask-input:focus {
  border-color: var(--cool);
}

.ask-send {
  background: var(--gold);
  color: var(--ink);
  border: none;
  border-radius: 999px;
  width: 40px;
  height: 40px;
  font-size: 1.05rem;
  cursor: pointer;
  flex: none;
}

.ask-send:hover {
  background: #f0d288;
}

.ask-footer {
  padding: 0.7rem 1.2rem;
  border-top: 1px solid var(--line);
  font-size: 0.76rem;
  color: var(--ink-muted);
  background: var(--ink);
}

.ask-footer p {
  margin: 0;
  line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  .ask-msg,
  .ask-drawer,
  .ask-typing span {
    animation: none !important;
    transition: none !important;
  }
}
