/* ── base ── */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #1c1b17;
  --bg-raised: #24231e;
  --text: #b5ad9e;
  --text-bright: #d6cdbf;
  --link: #8aab6e;
  --link-hover: #a4c488;
  --muted: #6d665a;
  --border: #33312a;
  --highlight-bg: #3a3520;
  --highlight-text: #d4c47c;
  --danger: #a65d5d;
  --font: "Courier New", Courier, monospace;
}

html { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.6; }
body { max-width: 640px; margin: 0 auto; padding: 1rem 1rem 3rem; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
strong { color: var(--text-bright); }
small { color: var(--muted); }
hr { border: none; border-top: 1px dashed var(--border); margin: 1rem 0; }

/* ── nav ── */
nav { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
nav ul { list-style: none; display: flex; gap: 1rem; align-items: center; }
nav .site-title { color: var(--text-bright); font-size: 1.1rem; }
nav form { display: inline; }

/* ── forms ── */
label { display: block; margin-bottom: 0.75rem; color: var(--muted); font-size: 0.85rem; }
input, textarea, select { display: block; width: 100%; margin-top: 0.25rem; padding: 0.4rem 0.5rem; background: var(--bg); color: var(--text-bright); border: 1px solid var(--border); font-family: var(--font); font-size: 0.95rem; border-radius: 0; }
input:focus, textarea:focus, select:focus { outline: 1px solid var(--muted); border-color: var(--muted); }
input[type="search"] { border-style: dashed; }
textarea { resize: vertical; }
select option { background: var(--bg); }

button, input[type="submit"] {
  display: inline-block; padding: 0.35rem 0.9rem;
  background: transparent; color: var(--link); border: 1px solid var(--link);
  font-family: var(--font); font-size: 0.9rem; cursor: pointer;
}
button:hover, input[type="submit"]:hover { background: var(--link); color: var(--bg); }
button.outline { border-style: dashed; }
button.secondary, button.outline.secondary { color: var(--muted); border-color: var(--muted); }
button.secondary:hover, button.outline.secondary:hover { background: var(--muted); color: var(--bg); }

fieldset { border: none; padding: 0; }
fieldset[role="group"] { display: flex; gap: 0; }
fieldset[role="group"] select { border-right: none; }
fieldset[role="group"] button { white-space: nowrap; }

/* ── headings ── */
h1, h2, h3, h4 { color: var(--text-bright); font-weight: normal; margin-bottom: 0.5rem; }
h1 { font-size: 1.2rem; }
h2 { font-size: 1.05rem; border-bottom: 1px dashed var(--border); padding-bottom: 0.25rem; margin-top: 1.5rem; }
h3 { font-size: 1rem; }
h4 { font-size: 0.95rem; }

/* ── sections ── */
section { margin-bottom: 1.5rem; }
p { margin-bottom: 0.5rem; }

/* ── tables ── */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: normal; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── details ── */
details { margin-top: 0.75rem; }
details summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
details summary:hover { color: var(--text); }

/* ── articles / cards (used sparingly) ── */
article { padding: 0; margin-bottom: 0; }
article header { padding-bottom: 0; margin-bottom: 0.15rem; }
article header small { display: block; word-break: break-all; font-size: 0.8rem; }
article p { font-size: 0.9rem; margin-bottom: 0.25rem; }

/* ── progress bar ── */
progress { width: 100%; height: 6px; appearance: none; -webkit-appearance: none; border: none; background: var(--border); }
progress::-webkit-progress-bar { background: var(--border); }
progress::-webkit-progress-value { background: var(--link); }
progress::-moz-progress-bar { background: var(--link); }

/* ── grid ── */
.grid { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── search results ── */
.site-group { margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.site-group:last-child { border-bottom: none; }
.site-group-header { margin-bottom: 0.15rem; }
.site-group-header small { font-weight: normal; }

.site-group mark {
  background: var(--highlight-bg);
  color: var(--highlight-text);
  padding: 0.05em 0.2em;
  border-radius: 0;
}

.site-group details summary { padding: 0.25rem 0; }

.result { margin-bottom: 0.5rem; }
.result a { display: block; }
.result small { display: block; }
.result p { color: var(--text); }

.engine-source { font-style: italic; font-size: 0.8rem; }

/* ── depth results ── */
.depth-section { margin-top: 1.25rem; padding-top: 0.75rem; border-top: 1px dashed var(--border); }

/* ── error ── */
.error-msg { color: var(--danger); border: 1px solid var(--danger); padding: 0.5rem 0.75rem; margin-bottom: 1rem; }

/* ── utility ── */
.muted { color: var(--muted); }
