:root {
  color-scheme: light;
  --bg: #fbfaf7;
  --fg: #1c1b19;
  --muted: #6b6862;
  --line: #e2ded4;
  --card: #ffffff;
  --accent: #8a6d1f;
  --elsewhere-bg: #f4f2ed;
}

/* Same precedence as the archived sites (see restore/build_dark.py): the OS
   decides until the reader makes a choice, and the choice then wins in either
   direction. Only the custom properties are duplicated between the two blocks;
   every rule below is written once, against the properties. */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #16191d;
    --fg: #d7dae0;
    --muted: #8d949e;
    --line: #2a2f36;
    --card: #1c2025;
    --accent: #d6b155;
    --elsewhere-bg: #191d21;
  }
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #16191d;
  --fg: #d7dae0;
  --muted: #8d949e;
  --line: #2a2f36;
  --card: #1c2025;
  --accent: #d6b155;
  --elsewhere-bg: #191d21;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 3rem 1.25rem 5rem;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
main { max-width: 54rem; margin: 0 auto; }
header { border-bottom: 1px solid var(--line); padding-bottom: 1.75rem; margin-bottom: 2.5rem; }
h1 { font-size: 1.6rem; margin: 0 0 .5rem; letter-spacing: -.01em; }
header p { margin: .5rem 0 0; color: var(--muted); max-width: 42rem; }
a { color: var(--accent); }
ul.sites { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
li.site {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.15rem;
}
li.site.elsewhere { background: var(--elsewhere-bg); }
.row { display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem; }
.host { font-weight: 600; font-size: 1.05rem; text-decoration: none; }
.host:hover { text-decoration: underline; }
li.elsewhere .host { color: var(--muted); font-weight: 500; }
.title { color: var(--fg); }
.note { color: var(--muted); }
.meta { margin-top: .35rem; color: var(--muted); font-size: .85rem; }
.meta span + span::before { content: "·"; margin: 0 .5em; opacity: .6; }
h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em;
     color: var(--muted); font-weight: 600; margin: 2.5rem 0 .9rem; }
footer { margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line);
         color: var(--muted); font-size: .875rem; }
footer p { margin: .4rem 0; }

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

form.q { display: flex; gap: .6rem; flex-wrap: wrap; margin: 0 0 .75rem; }
form.q input[type=search] {
  flex: 1 1 18rem;
  min-width: 0;
  padding: .6rem .8rem;
  font: inherit;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}
form.q input[type=search]:focus-visible,
form.q select:focus-visible,
form.q button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
form.q select, form.q button {
  padding: .6rem .8rem;
  font: inherit;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}
form.q button { cursor: pointer; font-weight: 600; }
.status { color: var(--muted); font-size: .875rem; margin: .75rem 0 1.25rem; }
ol.results { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
ol.results li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.15rem;
}
.hit-title { font-weight: 600; font-size: 1.02rem; text-decoration: none; }
.hit-title:hover { text-decoration: underline; }
.hit-url { color: var(--muted); font-size: .8rem; margin-top: .2rem; word-break: break-all; }
.hit-snippet { margin-top: .5rem; }
.hit-snippet mark {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  color: inherit;
  border-radius: 2px;
  padding: 0 .1em;
}
.badge {
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .1rem .5rem;
  margin-left: .5rem;
  white-space: nowrap;
}

/* --- theme toggle -------------------------------------------------------- */

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 99999;
  display: none;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
}
/* Shown only once the script has marked the document: without JavaScript the
   button could do nothing, and the OS preference already applies. */
html.has-js .theme-toggle { display: block; }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle::before { content: "\25D1"; }
