/* Ask Radar: the /ask page, the corner panel and the radar mascot. Colours come from each screen's own tokens. */

.ask { --ask-gap: 14px; color: var(--ink); }
.ask-top { display: flex; align-items: center; gap: 16px; margin: 4px 0 12px; }
.ask-top .ask-mascot svg { width: 64px; height: 64px; }

/* the question box */
.ask-form { display: flex; flex: 1; min-width: 0; border: 1.5px solid var(--line-strong); border-radius: 999px; background: var(--surface);
  padding: 4px 4px 4px 18px; align-items: center; transition: border-color .15s; }
.ask-form:focus-within { border-color: var(--accent); }
.ask-input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 16px; padding: 10px 0; }
.ask-input::placeholder { color: var(--muted); }
.ask-input:focus { outline: none; }
.ask-go { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 600; padding: 9px 16px; cursor: pointer; }
.ask-go:hover { filter: brightness(1.08); }
.ask-form:focus-within, .ask-go:focus-visible, .ask a:focus-visible, .ask button:focus-visible, .ask-launch:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px; }

.ask-suggest { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.ask-suggest a { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; color: var(--ink-2);
  text-decoration: none; font-size: 13.5px; background: var(--surface); }
.ask-suggest a:hover { border-color: var(--accent); color: var(--ink); }

/* the answer reads as a short briefing, then its sources */
.ask-answer { border-left: 3px solid var(--accent); padding: 2px 0 2px 18px; }
.ask-said p { margin: 0 0 10px; font-size: 18px; line-height: 1.55; max-width: 68ch; }
.ask-page .ask-said p:first-child { font-size: 20px; }
.ask-wait { color: var(--muted); margin: 6px 0; }
.ask-wait::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: ask-dots 1.2s steps(4) infinite; }
@keyframes ask-dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.ask-note { margin: 0 0 10px; color: var(--ink-2); font-size: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 6px 10px; }
.ask-how { margin: 4px 0 14px; color: var(--muted); font-size: 13px; }
.ask-cite { display: inline-grid; place-items: center; min-width: 1.45em; height: 1.45em; margin: 0 2px; padding: 0 3px; border: 1.5px solid var(--accent);
  border-radius: 5px; color: var(--accent); font-size: .68em; font-weight: 700; text-decoration: none; vertical-align: .18em; line-height: 1; }
.ask-cite:hover { background: var(--accent); color: var(--accent-ink); }

.ask-src-title { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.ask-srcs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ask-src-link { display: grid; grid-template-columns: auto auto 1fr; gap: 12px; align-items: start; padding: 10px; border: 1px solid var(--line);
  border-radius: var(--radius-lg, 10px); background: var(--surface); color: var(--ink); text-decoration: none; }
.ask-src-link:hover { border-color: var(--line-strong); }
.ask-src:target .ask-src-link { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.ask-src-n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); color: var(--ink);
  font-weight: 700; font-size: 13px; }
.ask-src-pic { width: 84px; height: 56px; object-fit: cover; border-radius: 6px; background: var(--sunken); }
.ask-src-link:not(:has(.ask-src-pic)) { grid-template-columns: auto 1fr; }
.ask-src-body { display: grid; gap: 4px; min-width: 0; }
.ask-src-head { font-weight: 600; line-height: 1.35; }
.ask-src-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; color: var(--muted); font-size: 12.5px; }
.ask-src-who { color: var(--ink-2); }
.ask-back { border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 6px; }
.ask-back.is-official { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ask-back.is-unconfirmed { border-style: dashed; }
.ask-foot { margin-top: 22px; color: var(--muted); font-size: 13px; max-width: 72ch; }

/* the corner panel on the home page */
.ask-dock { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.ask-launch { display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px 6px 6px; border-radius: 999px; background: var(--surface);
  color: var(--ink); border: 1.5px solid var(--line-strong); text-decoration: none; font-weight: 600; box-shadow: 0 6px 22px rgb(0 0 0 / .22); }
.ask-launch:hover { border-color: var(--accent); }
.ask-launch .ask-mascot svg { width: 40px; height: 40px; }
.ask-is-open .ask-launch { display: none; }
.ask-panel { order: -1; width: min(420px, calc(100vw - 36px)); max-height: min(78vh, 720px); overflow: auto; overscroll-behavior: contain;
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: 16px; padding: 14px 16px 18px;
  box-shadow: 0 18px 50px rgb(0 0 0 / .32); }
.ask-panel[hidden] { display: none; }
.ask-panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ask-panel-head .ask-mascot svg { width: 36px; height: 36px; }
.ask-panel-head h2 { margin: 0; flex: 1; font-size: 18px; }
.ask-full { font-size: 13px; color: var(--ink-2); }
.ask-close { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface);
  color: var(--ink); cursor: pointer; }
.ask-panel .ask-form { margin-bottom: 10px; }
.ask-panel .ask-said p { font-size: 15.5px; }
.ask-panel .ask-src-pic { width: 64px; height: 44px; }

@media (max-width: 600px) {
  .ask-dock { right: 12px; bottom: 12px; left: 12px; align-items: flex-end; }
  .ask-launch-text { display: none; }
  .ask-launch { padding: 4px; }
  .ask-panel { width: 100%; max-height: 82vh; border-radius: 16px 16px 12px 12px; }
  .ask-top .ask-mascot { display: none; }
  .ask-src-pic { display: none; }
  .ask-src-link, .ask-src-link:has(.ask-src-pic) { grid-template-columns: auto 1fr; }
}

/* the radar mascot: a placeholder until the owner's animation replaces the SVG */
.ask-mascot { display: inline-grid; flex: none; line-height: 0; }
.ask-mascot svg { overflow: visible; }
.ask-mascot .m-body { fill: var(--surface-2); stroke: var(--ink); stroke-width: 2; }
.ask-mascot .m-ring { fill: none; stroke: var(--line-strong); stroke-width: 1.2; }
.ask-mascot .m-sweep path { fill: var(--accent); opacity: .32; }
.ask-mascot .m-sweep { transform-origin: 24px 25px; animation: ask-sweep 6s linear infinite; }
.ask-mascot .m-eye { fill: var(--ink); transform-box: fill-box; transform-origin: center; animation: ask-blink 5s infinite; }
.ask-mascot .m-mouth, .ask-mascot .m-mast { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.ask-mascot .m-mouth { transform-box: fill-box; transform-origin: center top; }
.ask-mascot .m-tip { fill: var(--accent); }
.ask-mascot[data-state="thinking"] .m-sweep { animation-duration: 1.1s; }
.ask-mascot[data-state="thinking"] .m-tip { animation: ask-pulse .8s ease-in-out infinite; }
.ask-mascot[data-state="talking"] .m-mouth { animation: ask-talk .35s ease-in-out infinite alternate; }
.ask-mascot[data-state="sleeping"] { opacity: .6; }
.ask-mascot[data-state="sleeping"] .m-eye { transform: scaleY(.2); animation: none; }
.ask-mascot[data-state="sleeping"] .m-sweep { animation: none; }
.ask-mascot[data-state="alert"] .m-tip { fill: var(--war); animation: ask-pulse .5s ease-in-out infinite; }
@keyframes ask-sweep { to { transform: rotate(360deg); } }
@keyframes ask-blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes ask-pulse { 50% { opacity: .25; } }
@keyframes ask-talk { to { transform: scaleY(1.9); } }

@media (prefers-reduced-motion: reduce) {
  .ask-mascot *, .ask-wait::after { animation: none !important; }
  .ask-form { transition: none; }
}
