.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Ask: a question box in the nav (every page) and the home hero, opening a panel that streams cited answers from /api/ask. */
.ask-btn, .hero-ask { display: none; }
.ask-ready .ask-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: currentColor; cursor: pointer; transition: background-color var(--dur-instant, 160ms) var(--ease, ease); }
.ask-ready .ask-btn:hover, .ask-ready .ask-btn:focus-visible { background: rgba(255, 255, 255, 0.14); }
.nav.is-solid .ask-btn:hover, .nav.is-solid .ask-btn:focus-visible { background: rgba(26, 24, 22, 0.07); }
:root[data-theme="dark"] .nav.is-solid .ask-btn:hover { background: rgba(255, 255, 255, 0.1); }
.ask-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* Hero entry point (wide and tall-enough screens only; elsewhere the nav button does the job) */
@media (min-width: 1024px) and (min-height: 781px) {
    .ask-ready .hero-ask { display: flex; align-items: center; gap: 8px; width: min(100%, 30rem); margin-top: 28px; padding: 6px 6px 6px 18px; border-radius: 999px;
        background: var(--glass-dark, rgba(20, 18, 16, 0.38)); border: 1px solid var(--glass-dark-edge, rgba(255, 255, 255, 0.16));
        -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
}
.hero-ask svg.spark { width: 16px; height: 16px; flex: none; fill: none; stroke: #E0714D; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.hero-ask input { flex: 1; min-width: 0; height: 40px; border: 0; background: transparent; color: #F2EFE9; font: inherit; font-size: var(--fs-ui, 0.9375rem); outline: none; }
.hero-ask input::placeholder { color: rgba(242, 239, 233, 0.62); }
.hero-ask button { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; background: #F2EFE9; color: #1A1816; cursor: pointer; transition: transform var(--dur-instant, 160ms) var(--ease, ease); }
.hero-ask button:hover { transform: translateX(2px); }
.hero-ask button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hero-ask:focus-within { border-color: rgba(224, 113, 77, 0.7); }

/* Panel */
.ask-panel { width: min(640px, calc(100vw - 24px)); max-height: min(780px, calc(100dvh - 24px)); margin: auto; padding: 0; border: 0; border-radius: 22px; overflow: hidden;
    background: var(--bone, #F2EFE9); color: var(--ink, #1A1816); box-shadow: 0 0 0 1px var(--rule, #D3CCBF), 0 40px 80px -30px rgba(0, 0, 0, 0.55); font-family: var(--sans); }
.ask-panel[open] { display: flex; flex-direction: column; }
.ask-panel::backdrop { background: rgba(20, 18, 16, 0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@media (prefers-reduced-motion: no-preference) {
    .ask-panel[open] { animation: ask-in var(--dur-base, 480ms) var(--ease-out, ease-out); }
    .ask-panel[open]::backdrop { animation: ask-fade var(--dur-quick, 280ms) ease; }
}
@keyframes ask-in { from { opacity: 0; transform: translateY(var(--rise, 12px)) scale(0.985); } }
@keyframes ask-fade { from { opacity: 0; } }
.ask-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 16px; border-bottom: 1px solid var(--rule, #D3CCBF); }
.ask-head h2 { font-family: var(--serif); font-weight: 400; font-size: var(--fs-title, 1.5rem); line-height: 1.2; letter-spacing: -0.01em; }
.ask-head p { margin-top: 6px; font-size: var(--fs-small, 0.875rem); line-height: 1.45; color: var(--ink-muted, #6B655C); }
.ask-close { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.ask-close:hover, .ask-close:focus-visible { background: rgba(26, 24, 22, 0.07); }
:root[data-theme="dark"] .ask-close:hover { background: rgba(255, 255, 255, 0.1); }
.ask-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ask-log { flex: 1; overflow-y: auto; padding: 18px 24px 8px; overscroll-behavior: contain; }
.ask-suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.ask-suggest button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--rule, #D3CCBF); background: transparent; color: inherit; font: inherit; font-size: var(--fs-small, 0.875rem); cursor: pointer; transition: background-color var(--dur-instant, 160ms) var(--ease, ease); }
.ask-suggest button:hover, .ask-suggest button:focus-visible { background: rgba(26, 24, 22, 0.06); }
:root[data-theme="dark"] .ask-suggest button:hover { background: rgba(255, 255, 255, 0.08); }
.ask-q { margin-top: 18px; font-weight: 500; font-size: var(--fs-ui, 0.9375rem); color: var(--ink-muted-deep, #5A544B); }
.ask-q:first-child { margin-top: 0; }
.ask-a { margin-top: 8px; font-family: var(--serif); font-size: 1.125rem; line-height: 1.55; }
.ask-a p + p { margin-top: 0.7em; }
.ask-a sup a { margin-left: 2px; font-family: var(--sans); font-size: 0.7em; font-weight: 600; color: var(--oxide-deep, #A63B1C); text-decoration: none; }
.ask-a.is-thinking::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 4px; border-radius: 50%; background: var(--oxide, #B3401E); vertical-align: middle; }
@media (prefers-reduced-motion: no-preference) { .ask-a.is-thinking::after { animation: ask-pulse 900ms var(--ease-in-out, ease-in-out) infinite; } }
@keyframes ask-pulse { 50% { opacity: 0.25; } }
.ask-src { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--fs-small, 0.875rem); }
.ask-src a { color: var(--ink-muted-deep, #5A544B); text-decoration-color: var(--rule, #D3CCBF); }
.ask-src a:hover { color: var(--ink, #1A1816); text-decoration-color: var(--oxide, #B3401E); }
.ask-src b { margin-right: 4px; font-weight: 600; color: var(--oxide-deep, #A63B1C); }
.ask-err { margin-top: 8px; font-size: var(--fs-small, 0.875rem); color: var(--ink-muted, #6B655C); }
.ask-form { display: flex; gap: 8px; padding: 14px 16px 16px; border-top: 1px solid var(--rule, #D3CCBF); }
.ask-form input { flex: 1; min-width: 0; height: 48px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--rule, #D3CCBF); background: var(--stone, #E6E1D7); color: inherit; font: inherit; font-size: 1rem; outline: none; }
.ask-form input:focus { border-color: var(--oxide, #B3401E); }
.ask-form button { display: inline-grid; place-items: center; width: 48px; height: 48px; flex: none; border: 0; border-radius: 50%; background: var(--ink, #1A1816); color: var(--bone, #F2EFE9); cursor: pointer; }
.ask-form button:disabled { opacity: 0.45; cursor: default; }
.ask-form button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ask-foot { padding: 0 24px 14px; font-size: var(--fs-label, 0.75rem); color: var(--ink-muted, #6B655C); }
@media (max-width: 767px) {
    .ask-panel { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
    .ask-head { padding: 18px 16px 14px; padding-top: calc(18px + env(safe-area-inset-top, 0px)); }
    .ask-log { padding: 16px 16px 8px; }
    .ask-form { padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
    .ask-foot { padding: 0 16px 10px; }
}
@media (prefers-reduced-motion: no-preference) { .ask-ready .hero .hero-ask { opacity: 0; transform: translateY(var(--rise, 8px)); animation: lift var(--dur-base, 480ms) var(--ease, ease) 560ms forwards; } }
