/* ==========================================================================
   PDF Search — self-contained styles. No fonts, no CDNs.
   ========================================================================== */

:root {
    --bg: #0b1016;
    --bg-2: #111923;
    --panel: #131c27;
    --line: #22303f;
    --text: #e6edf5;
    --muted: #93a4b8;
    --teal: #5eead4;
    --amber: #fbbf24;
    --mark: #fde68a;
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { animation: none !important; transition: none !important; }
}

body {
    margin: 0;
    background: radial-gradient(1200px 600px at 50% -10%, #16222f 0%, var(--bg) 60%) no-repeat;
    background-attachment: fixed;
    color: var(--text);
    font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

.wrap {
    width: min(1080px, 100% - 32px);
    margin-inline: auto;
}

.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;
}

/* ---- Header -------------------------------------------------------------- */
.topbar {
    padding: 34px 0 18px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 26px;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    letter-spacing: -0.02em;
}

.topbar .glyph {
    margin-right: 6px;
}

.tagline {
    margin: 6px 0 0;
    color: var(--muted);
}

/* ---- Panels -------------------------------------------------------------- */
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 22px;
}

.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px 18px;
    margin-bottom: 14px;
}

.panel-head h2 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}

.panel-actions {
    display: flex;
    gap: 8px;
}

/* ---- Search -------------------------------------------------------------- */
.searchrow {
    position: relative;
    display: flex;
    align-items: center;
}

.searchicon {
    position: absolute;
    left: 14px;
    font-size: 1.05rem;
    pointer-events: none;
    opacity: 0.75;
}

.qinput {
    width: 100%;
    padding: 14px 44px 14px 44px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: var(--bg-2);
    color: var(--text);
    font: inherit;
}

.qinput:focus-visible,
select:focus-visible,
button:focus-visible,
input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.qinput::-webkit-search-cancel-button {
    display: none;
}

.clearbtn {
    position: absolute;
    right: 8px;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.95rem;
}

.clearbtn:hover {
    background: #1d2a38;
    color: var(--text);
}

.syntax {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.syntax code {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 1px 5px;
    font-size: 0.86em;
}

.chip {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--teal);
    cursor: pointer;
    font: inherit;
    font-size: 0.84rem;
    padding: 2px 11px;
    margin: 2px 1px;
}

.chip:hover {
    border-color: var(--teal);
}

.controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 20px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.92rem;
    cursor: pointer;
}

.toggle input {
    accent-color: var(--teal);
}

select {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    padding: 5px 8px;
}

.ghostbtn {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 0.88rem;
    padding: 6px 13px;
}

.ghostbtn:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.ghostbtn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ---- Document shelf ------------------------------------------------------ */
.doclist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.doc {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 12px;
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--bg-2);
}

.doc.off {
    opacity: 0.5;
}

.doc input {
    margin-top: 4px;
    accent-color: var(--teal);
    width: 17px;
    height: 17px;
}

.doc-title {
    font-weight: 600;
    cursor: pointer;
    display: block;
}

.doc-blurb {
    color: var(--muted);
    font-size: 0.88rem;
    margin: 3px 0 0;
}

.doc-meta {
    color: var(--muted);
    font-size: 0.8rem;
    margin: 5px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
}

.doc-meta a {
    color: var(--teal);
}

.doc-hits {
    align-self: center;
    white-space: nowrap;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    color: var(--bg);
    background: var(--teal);
    border-radius: 999px;
    padding: 2px 10px;
    font-weight: 600;
}

.doc-hits.zero {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
}

.loading {
    color: var(--muted);
}

/* ---- Results ------------------------------------------------------------- */
.summary {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.results {
    display: grid;
    gap: 18px;
}

.hint,
.empty {
    color: var(--muted);
    margin: 0;
}

.rgroup h3 {
    margin: 0 0 10px;
    font-size: 0.95rem;
    color: var(--teal);
    border-bottom: 1px solid var(--line);
    padding-bottom: 7px;
}

.rgroup h3 .count {
    color: var(--muted);
    font-weight: 400;
}

.hit {
    padding: 11px 0;
    border-bottom: 1px dashed var(--line);
}

.hit:last-child {
    border-bottom: 0;
}

.hit-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 5px;
}

.hit-page {
    font-weight: 600;
    font-size: 0.88rem;
}

.hit-page a {
    color: var(--amber);
}

.hit-n {
    color: var(--muted);
    font-size: 0.8rem;
}

.snippet {
    margin: 5px 0 0;
    color: #cbd8e6;
    font-size: 0.94rem;
}

.snippet mark {
    background: var(--mark);
    color: #1a1400;
    border-radius: 3px;
    padding: 0 2px;
    font-weight: 600;
}

.more {
    background: none;
    border: 0;
    color: var(--teal);
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
    padding: 4px 0 0;
}

.more:hover {
    text-decoration: underline;
}

/* ---- Footer -------------------------------------------------------------- */
.foot {
    border-top: 1px solid var(--line);
    margin-top: 34px;
    padding: 20px 0 90px;
    color: var(--muted);
    font-size: 0.88rem;
}

.foot p {
    margin: 0 0 6px;
}

.foot code {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 1px 5px;
}

.muted {
    color: var(--muted);
}

@media (max-width: 620px) {
    .doc {
        grid-template-columns: auto 1fr;
    }

    .doc-hits {
        grid-column: 2;
        justify-self: start;
    }
}
