/* पूछें (Ask Rudrapur), docs/SPEC-V6.md §11: the floating button, the home strip and the /ask chat. Loaded only while the
   AI is on (src/views/layout.js) and on /ask itself. Tokens from app.css only; no colour of its own. */

/* The floating button: above the tab bar on phones, bottom corner on desktop (no tab bar there). */
.ask-fab { position: fixed; z-index: 29; inset-inline-end: max(16px, var(--safe-r)); inset-block-end: calc(var(--tab-h) + var(--safe-b) + 14px); display: inline-flex; align-items: center; gap: 6px; min-block-size: 52px; padding-inline: 16px 20px; border-radius: var(--r-pill); background: var(--ink); color: var(--on-ink); font-family: var(--font-display); font-weight: 800; font-size: 18px; line-height: 1; box-shadow: var(--shadow-lift); }
.ask-fab:hover { background: var(--ink-2); }
.ask-fab:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
@media (min-width: 1024px) { .ask-fab { inset-block-end: 24px; inset-inline-end: 24px; } }
@media print { .ask-fab { display: none; } }

/* The home strip: looks like a question box, is a link. */
.ask-strip { display: flex; align-items: center; gap: 10px; min-block-size: 56px; padding: 8px 8px 8px 16px; border: 2px solid var(--ink); border-radius: var(--r-pill); background: var(--surface); color: var(--ink); }
.ask-strip:hover { background: var(--surface-2); }
.ask-strip-text { flex: 1; min-inline-size: 0; color: var(--ink-2); font-size: var(--t-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-strip .btn { flex: none; }

/* The /ask page: a column of turns, the question box pinned above the tab bar. */
.ask-page { display: grid; gap: 16px; max-inline-size: 760px; }
.is-ask .main { padding-block-end: 8px; }
.ask-langs { margin: 0; }
.ask-start { display: grid; gap: 10px; }
.ask-chips-h { margin: 0; }
.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ask-chip { display: inline-flex; align-items: center; gap: 6px; min-block-size: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--t-sm); line-height: 1.3; text-align: start; cursor: pointer; }
.ask-chip:hover { border-color: var(--ink-2); }
.ask-chip:disabled { opacity: .5; cursor: default; }
.ask-chip:focus-visible, .ask-vote:focus-visible, .ask-new:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.ask-thread { display: grid; gap: 22px; }
.ask-thread:empty { display: none; }
.ask-turn { display: grid; gap: 10px; scroll-margin-block-start: calc(var(--head-h) + var(--safe-t) + 12px); }
.ask-q { justify-self: end; max-inline-size: 88%; margin: 0; padding: 10px 14px; border-radius: 18px 18px 4px 18px; background: var(--sun); color: var(--sun-ink); font-weight: 600; overflow-wrap: anywhere; }
.ask-a { display: grid; gap: 10px; min-inline-size: 0; }
.ask-status { margin: 0; color: var(--muted); font-size: var(--t-sm); display: flex; align-items: center; gap: 8px; }
.ask-status::before { content: ''; flex: none; inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--sun-deep); animation: ask-pulse 1s ease-in-out infinite alternate; }
@keyframes ask-pulse { from { opacity: .3; } to { opacity: 1; } }
.ask-text { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.ask-text:empty { display: none; }
.ask-text.is-error { color: var(--red); }
.ask-text [lang="ur"], .ask-text:lang(ur) { direction: rtl; }
.ask-link { text-decoration: underline; text-underline-offset: .2em; font-weight: 600; }
.ask-cards { display: grid; gap: 10px; }
.ask-cards:empty { display: none; }
.ask-card { min-inline-size: 0; }
.ai-row { align-items: center; }
.ask-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: var(--t-xs); color: var(--muted); }
.ask-votes { display: inline-flex; gap: 4px; }
.ask-vote { min-inline-size: 40px; min-block-size: 36px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); font-size: 16px; line-height: 1; cursor: pointer; }
.ask-report { color: var(--muted); text-decoration: underline; text-underline-offset: .2em; }

.ask-form { position: sticky; z-index: 20; inset-block-end: calc(var(--tab-h) + var(--safe-b) + 8px); display: grid; gap: 6px; padding: 10px; border-radius: 22px; background: var(--ground); box-shadow: var(--shadow-up); }
@media (min-width: 1024px) { .ask-form { inset-block-end: 16px; } }
.ask-box { display: flex; align-items: flex-end; gap: 8px; }
.ask-input { flex: 1; min-inline-size: 0; min-block-size: 48px; max-block-size: 160px; padding: 12px 14px; border: 2px solid var(--ink); border-radius: var(--r-input); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--t-md); line-height: 1.4; resize: none; }
.ask-input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.ask-input:disabled { opacity: .6; }
.ask-send { flex: none; min-block-size: 48px; }
.ask-form.is-busy .ask-send { opacity: .5; pointer-events: none; }
.ask-form-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-block-size: 20px; }
.ask-count { font-size: var(--t-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.ask-new { display: inline-flex; align-items: center; gap: 4px; min-block-size: 32px; padding-inline: 10px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); font: inherit; font-size: var(--t-xs); cursor: pointer; }
.ask-off { margin: 0; color: var(--ink-2); }
.ask-privacy { margin: 0; }
.ask-noscript { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 0; padding: 0; list-style: none; }
@media (max-width: 479px) { .ask-send-label { display: none; } }

/* Voice (docs/SPEC-V6.md §6): the mic beside the box, the listening line, the language picker, the listen button. */
.ask-mic { flex: none; display: inline-grid; place-items: center; inline-size: 48px; block-size: 48px; border: 2px solid var(--ink); border-radius: 50%; background: var(--surface); color: var(--ink); cursor: pointer; }
.ask-mic:hover { background: var(--surface-2); }
.ask-mic:focus-visible, .ask-listen:focus-visible, .ask-lang select:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ask-mic.is-listening { border-color: var(--red); background: var(--red); color: var(--on-red); animation: ask-ring 1.2s ease-out infinite; }
@keyframes ask-ring { from { box-shadow: 0 0 0 0 var(--red); } to { box-shadow: 0 0 0 12px transparent; } }
.ask-listening { margin: 0; font-size: var(--t-sm); color: var(--ink-2); font-weight: 600; }
.ask-lang { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-xs); color: var(--muted); }
.ask-lang select { min-block-size: 32px; padding: 2px 8px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--t-xs); }
.ask-listen { display: inline-flex; align-items: center; gap: 4px; min-block-size: 36px; padding-inline: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--t-xs); font-weight: 600; cursor: pointer; }
.ask-listen.is-on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.ask-listen.is-loading { animation: ask-pulse .7s ease-in-out infinite alternate; }
.ask-voice-note[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .ask-status::before, .ask-mic.is-listening, .ask-listen.is-loading { animation: none; } }
