/* Ask Aaron search UI. Self-contained: no external fonts, no CDN, no images.
   Light palette on :root, dark only overriding tokens, so the page works in
   either scheme and in the default "no preference" state. */

:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f0efeb;
  --ink: #1b1a17;
  --ink-2: #55524c;
  --ink-3: #85817a;
  --line: #ddd9d2;
  --accent: #9a3412;
  --accent-ink: #ffffff;
  --accent-soft: #fdeee7;
  --chip: #eceae5;
  --radius: 7px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161a;
    --surface: #1d1f24;
    --surface-2: #23262c;
    --ink: #eceef2;
    --ink-2: #a9aeb8;
    --ink-3: #777d88;
    --line: #2f333b;
    --accent: #fb923c;
    --accent-ink: #1b1205;
    --accent-soft: #2b1d10;
    --chip: #272a31;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

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

/* ---------- masthead ---------- */

.masthead {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 30px 0 24px;
}
.masthead h1 {
  margin: 0 0 6px;
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  letter-spacing: -0.02em;
}
.masthead h1 span { color: var(--accent); font-weight: 400; }
.lede {
  margin: 0;
  max-width: 68ch;
  color: var(--ink-2);
  font-size: 0.94rem;
}
.lede a { color: var(--accent); }

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  grid-template-areas: "search search" "facets results";
  gap: 22px 28px;
  align-items: start;
  padding-top: 24px;
  padding-bottom: 48px;
}
.searchbar { grid-area: search; }
.facets { grid-area: facets; position: sticky; top: 16px; }
#results { grid-area: results; min-width: 0; }

@media (max-width: 800px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "search" "facets" "results";
  }
  .facets { position: static; }
}

/* ---------- search box ---------- */

.searchbar { display: flex; flex-direction: column; gap: 7px; }

#q {
  width: 100%;
  padding: 13px 15px;
  font: inherit;
  font-size: 1.04rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
#q:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
#q::placeholder { color: var(--ink-3); }

#count { color: var(--ink-3); font-size: 0.85rem; }

/* ---------- facets ---------- */

.facets-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 10px;
}
.facets h2 {
  margin: 0; font-size: 0.74rem; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3);
}
#clear {
  border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--accent); font: inherit; font-size: 0.82rem;
}
#clear:hover { text-decoration: underline; }

.facet {
  border-top: 1px solid var(--line);
  padding: 11px 0 13px;
}
.facet h3 {
  margin: 0 0 7px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
}
.opt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 2px 0;
  font-size: 0.86rem;
  color: var(--ink-2);
  cursor: pointer;
}
.opt:hover { color: var(--ink); }
.opt input { accent-color: var(--accent); margin: 0; }
.opt .name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.opt .n {
  color: var(--ink-3); font-size: 0.74rem; font-variant-numeric: tabular-nums;
}
.opt.extra { display: none; }
.facet.open .opt.extra { display: grid; }
button.more {
  margin-top: 5px; border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--accent); font: inherit; font-size: 0.8rem;
}
button.more:hover { text-decoration: underline; }

/* ---------- results ---------- */

.hit {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 11px;
}

.hit-title {
  display: block;
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  text-wrap: pretty;
}
.hit-title:hover { color: var(--accent); text-decoration: underline; }
.hit-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.out {
  width: 0.72em; height: 0.72em; margin-left: 0.3em;
  vertical-align: baseline; color: var(--ink-3); flex: none;
}

.hit-summary {
  margin: 6px 0 0;
  color: var(--ink-2);
  font-size: 0.9rem;
}

.hit-meta {
  margin: 8px 0 0;
  color: var(--ink-3);
  font-size: 0.8rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
}
.hit-meta code { font-family: var(--mono); font-size: 0.95em; }

.kind {
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--chip);
  color: var(--ink-2);
}
.kind.page { background: var(--accent-soft); color: var(--accent); }

.tags {
  margin: 10px 0 0;
  display: flex; flex-wrap: wrap; gap: 5px;
}
.tag {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  border-radius: 100px;
  padding: 2px 9px;
  font: inherit;
  font-size: 0.74rem;
  cursor: pointer;
}
.tag:hover { border-color: var(--accent); color: var(--accent); }

.empty {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px 20px;
  color: var(--ink-2);
  text-align: center;
}

.more-results {
  display: block; width: 100%;
  margin-top: 4px; padding: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--accent);
  font: inherit; font-size: 0.9rem; cursor: pointer;
}
.more-results:hover { border-color: var(--accent); }

/* ---------- footer ---------- */

.foot {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 18px 0 30px;
}
.foot p {
  margin: 0; max-width: 72ch;
  color: var(--ink-3); font-size: 0.82rem;
}
