/* ADR 0032 — search + Ask Medax. srch-* is the sitewide box and the /search page; ask-* is /ask.
   Scoped to these prefixes so nothing here touches another page. Theme-aware via Bootstrap tokens. */

/* ── header search: collapsed icon → flyout (slot P) ────────────────────────────
   The always-open box was eating ~15rem of header width. It now lives behind a magnifier
   icon that matches the theme toggle / notification bell, and expands into a right-aligned
   flyout card holding the GET form. CSS-only via <details> (same static-SSR disclosure the
   .mkt-menu hamburger uses), so it works with no JavaScript; search.js only enhances it. */
.srch-fly { position: relative; display: inline-flex; }
/* The collapsed trigger. Sized and shaped to read as one of the header's round utility
   buttons (cf. .mx-theme-toggle, .ntf-bell-btn) so the actions row is a tidy matched set. */
.srch-fly-btn {
    display: inline-grid; place-items: center; list-style: none;
    width: 2.1rem; height: 2.1rem; border-radius: 50%;
    border: 1px solid var(--bs-border-color, #d7ddd4);
    background: var(--bs-card-bg, #fff);
    color: var(--bs-body-color, #1b241f);
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.srch-fly-btn::-webkit-details-marker { display: none; }
.srch-fly-btn::marker { content: ""; }
.srch-fly-btn svg { width: 16px; height: 16px; }
.srch-fly-btn:hover { border-color: rgba(var(--bs-primary-rgb), .5); color: var(--bs-primary, #1c3faa); }
.srch-fly[open] .srch-fly-btn {
    border-color: rgba(var(--bs-primary-rgb), .5);
    color: var(--bs-primary, #1c3faa);
    background: var(--bs-secondary-bg, #f1f3f0);
}
.srch-fly-btn:focus-visible { outline: 2px solid var(--bs-primary, #1c3faa); outline-offset: 2px; }

/* The dropped panel. Right-aligned so it never runs off the viewport edge, on the theme's
   card surface with the app's elevation — an intentional card, not a layout jump. */
.srch-fly-panel {
    position: absolute; top: calc(100% + .5rem); right: 0; z-index: 1100;
    width: min(24rem, 92vw); padding: .5rem;
    background: var(--bs-card-bg, #fff);
    border: 1px solid var(--bs-border-color, #d7ddd4);
    border-radius: var(--mx-radius, .75rem);
    box-shadow: var(--mx-elevation, 0 1px 2px rgba(10, 26, 47, .06), 0 12px 28px -14px rgba(10, 26, 47, .18));
}
@media (prefers-reduced-motion: no-preference) {
    .srch-fly[open] .srch-fly-panel { animation: srch-fly-in .16s ease both; }
}
@keyframes srch-fly-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* The GET form fills the panel. Same pill as before, just no longer width-capped. */
.srch-box {
    display: flex;
    align-items: center;
    gap: .4rem;
    width: 100%;
    background: var(--bs-tertiary-bg, #f1f3f0);
    border: 1px solid var(--bs-border-color, #d7ddd4);
    border-radius: 999px;
    padding: .22rem .5rem .22rem .75rem;
}
.srch-box:focus-within { border-color: rgba(var(--bs-primary-rgb), .5); }
.srch-box-ic { display: inline-flex; flex: 0 0 auto; color: var(--bs-secondary-color, #6b7280); }
.srch-box-ic svg { width: 16px; height: 16px; }
.srch-box-input {
    border: 0;
    background: transparent;
    outline: none;
    font: inherit;
    font-size: .92rem;
    color: var(--bs-body-color, #1b241f);
    min-width: 0;
    flex: 1;
}
.srch-box-go {
    border: 0; flex: 0 0 auto;
    background: var(--bs-primary, #1c3faa);
    color: var(--mx-on-primary, #fff);
    border-radius: 999px;
    font-size: .82rem; font-weight: 600;
    padding: .3rem .8rem;
    cursor: pointer;
}
.srch-box-go:hover { filter: brightness(1.05); }

/* ── /search page ───────────────────────────────────────────────────────────── */
.srch { max-width: 62rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.srch-head h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
.srch-head p { color: var(--bs-secondary-color, #6b7280); margin: 0 0 1rem; }

.srch-form { display: flex; gap: .5rem; margin-bottom: 1rem; }
.srch-form input[type="search"] {
    flex: 1;
    font-size: 1.05rem;
    padding: .6rem .9rem;
    border: 1px solid var(--bs-border-color, #d7ddd4);
    border-radius: .6rem;
    background: var(--bs-body-bg, #fff);
    color: var(--bs-body-color, #1b241f);
}
.srch-form button {
    border: 0; border-radius: .6rem; cursor: pointer;
    background: var(--bs-primary, #1f7a54); color: var(--mx-on-primary, #fff);
    padding: .6rem 1.1rem; font-size: 1rem;
}

.srch-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.1rem; border-bottom: 1px solid var(--bs-border-color, #e2e6df); }
.srch-tab {
    border: 0; background: transparent; cursor: pointer;
    padding: .5rem .8rem; font-size: .92rem; border-radius: .5rem .5rem 0 0;
    color: var(--bs-secondary-color, #6b7280); text-decoration: none;
}
.srch-tab.is-on { color: var(--bs-primary, #1f7a54); font-weight: 600; box-shadow: inset 0 -2px 0 var(--bs-primary, #1f7a54); }
.srch-tab .srch-count { opacity: .7; font-variant-numeric: tabular-nums; }

.srch-results { display: flex; flex-direction: column; gap: .7rem; }
.srch-result {
    display: block; text-decoration: none;
    border: 1px solid var(--bs-border-color, #e2e6df); border-radius: .7rem;
    padding: .8rem .95rem; background: var(--bs-body-bg, #fff);
    color: inherit; transition: border-color .12s ease;
}
.srch-result:hover { border-color: var(--bs-primary, #1f7a54); }
.srch-result-top { display: flex; align-items: center; gap: .5rem; margin-bottom: .25rem; }
.srch-kind {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--bs-secondary-color, #6b7280);
    background: var(--bs-tertiary-bg, #f1f3f0); border-radius: 999px; padding: .1rem .5rem;
}
.srch-title { font-weight: 600; font-size: 1.02rem; }
.srch-snippet { color: var(--bs-secondary-color, #5a6b60); font-size: .92rem; line-height: 1.4; }
.srch-snippet mark { background: color-mix(in srgb, var(--bs-primary, #1f7a54) 22%, transparent); color: inherit; padding: 0 .05em; border-radius: 2px; }
.srch-lock {
    margin-left: auto; display: inline-flex; align-items: center; gap: .3rem;
    font-size: .75rem; color: #9a6a12;
}
.srch-lock-cta { font-size: .8rem; color: var(--bs-primary, #1f7a54); text-decoration: none; white-space: nowrap; }
.srch-lock-cta:hover { text-decoration: underline; }

.srch-empty { text-align: center; padding: 2.5rem 1rem; color: var(--bs-secondary-color, #6b7280); }
.srch-examples { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: .8rem; }
.srch-example { border: 1px solid var(--bs-border-color, #d7ddd4); border-radius: 999px; padding: .3rem .8rem; text-decoration: none; color: inherit; font-size: .9rem; }
.srch-ask { margin-top: 1.4rem; text-align: center; }
.srch-ask a { color: var(--bs-primary, #1f7a54); font-weight: 600; text-decoration: none; }

.srch-pager { display: flex; justify-content: space-between; margin-top: 1.2rem; }
.srch-pager a { color: var(--bs-primary, #1f7a54); text-decoration: none; }
.srch-pager span { color: var(--bs-secondary-color, #9aa39c); }

/* ── /ask page ──────────────────────────────────────────────────────────────── */
.ask { max-width: 48rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.ask-head h1 { font-size: 1.55rem; margin: 0 0 .2rem; }
.ask-head p { color: var(--bs-secondary-color, #6b7280); margin: 0 0 1rem; }

.ask-thread { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.2rem; }
.ask-turn { border: 1px solid var(--bs-border-color, #e2e6df); border-radius: .8rem; overflow: hidden; }
.ask-q { background: var(--bs-tertiary-bg, #f1f3f0); padding: .7rem .9rem; font-weight: 600; }
.ask-a { padding: .8rem .9rem; line-height: 1.55; }
.ask-a-ungrounded { color: var(--bs-secondary-color, #6b7280); font-style: italic; }
.ask-cites { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 .9rem .8rem; }
.ask-cite {
    display: inline-flex; align-items: center; gap: .35rem; text-decoration: none;
    border: 1px solid var(--bs-border-color, #d7ddd4); border-radius: 999px;
    padding: .18rem .6rem; font-size: .8rem; color: inherit;
}
.ask-cite .srch-kind { background: transparent; padding: 0; }
.ask-cite-locked { opacity: .7; }
.ask-thumbs { display: flex; gap: .3rem; padding: 0 .9rem .8rem; }
.ask-thumb { border: 1px solid var(--bs-border-color, #d7ddd4); background: transparent; border-radius: .5rem; cursor: pointer; padding: .2rem .5rem; font-size: .85rem; }
.ask-thumb.is-on { border-color: var(--bs-primary, #1f7a54); color: var(--bs-primary, #1f7a54); }

.ask-form { display: flex; gap: .5rem; }
.ask-form textarea {
    flex: 1; resize: vertical; min-height: 2.6rem; font: inherit; font-size: 1rem;
    padding: .55rem .8rem; border: 1px solid var(--bs-border-color, #d7ddd4); border-radius: .6rem;
    background: var(--bs-body-bg, #fff); color: var(--bs-body-color, #1b241f);
}
/* The page's one action: the site's orange, not Bootstrap's royal (--bs-primary is the link/secondary colour). */
.ask-form button { border: 0; border-radius: .6rem; background: var(--mx-action); color: var(--mx-action-on); font-weight: 600; padding: 0 1.1rem; cursor: pointer; }
.ask-form button:hover:not(:disabled) { background: var(--mx-action-hover); }
.ask-form button:disabled { opacity: .55; cursor: default; }

.ask-foot { margin-top: 1rem; font-size: .82rem; color: var(--bs-secondary-color, #6b7280); }
.ask-free { margin-top: .6rem; font-size: .85rem; color: #9a6a12; }
.ask-taste { border: 1px dashed var(--bs-border-color, #d7ddd4); border-radius: .7rem; padding: .8rem .9rem; text-align: center; }
.ask-taste a { color: var(--bs-primary, #1f7a54); font-weight: 600; text-decoration: none; }
.ask-followups { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 .9rem .8rem; }
.ask-starters { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: .75rem 0 0; }
.ask-starters-lbl { width: 100%; font-size: .78rem; font-weight: 600; color: var(--bs-secondary-color); }
.ask-starters .ask-followup { background: var(--bs-card-bg); }
.ask-starters .ask-followup:hover:not(:disabled) { border-color: var(--mx-action); }
.ask-followup { border: 1px solid var(--bs-border-color, #d7ddd4); background: transparent; border-radius: 999px; padding: .2rem .7rem; font-size: .82rem; cursor: pointer; color: inherit; }
.ask-unavailable { border: 1px solid var(--bs-border-color, #e2e6df); border-radius: .7rem; padding: .9rem; color: var(--bs-secondary-color, #6b7280); }
