/* Light palette is the base; dark overrides only the tokens. */
:root {
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "DejaVu Sans Mono", monospace;
  --bg: #fdfdf8;
  --fg: #1a1a1a;
  --muted: #666;
  --rule: #c8c8bd;
  --link: #0000ee;
  --visited: #551a8b;
  --code-bg: #eeeee4;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16161a;
    --fg: #ddddd6;
    --muted: #8f8f88;
    --rule: #3a3a42;
    --link: #9db4ff;
    --visited: #c9a0dc;
    --code-bg: #24242a;
  }
}

:root[data-theme="dark"] {
  --bg: #16161a;
  --fg: #ddddd6;
  --muted: #8f8f88;
  --rule: #3a3a42;
  --link: #9db4ff;
  --visited: #c9a0dc;
  --code-bg: #24242a;
}

html { font-size: 13px; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  line-height: 1.45;
  margin: 1.5rem 0 3rem;
  padding: 0 1.5rem;
}

a { color: var(--link); }
a:visited { color: var(--visited); }

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 0.75rem 0;
}

/* header */

header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.9rem;
}

header .sitename {
  font-weight: bold;
  text-decoration: none;
  color: var(--fg);
  margin-right: auto;
}

header #theme-toggle {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--link);
  cursor: pointer;
}

/* typography */

h1, h2, h3, h4 {
  font-size: inherit;
  font-weight: bold;
  margin: 1.3em 0 0.25em;
}

h1 { margin-top: 0.6em; }

/* Group labels demoted out of the outline (see the answer-engine-optimization note)
   must still look like the heading they replace. */
p[role="heading"] {
  font-weight: bold;
  margin: 1.3em 0 0.25em;
}

p, ul, ol, dl, pre, blockquote, table { margin: 0 0 0.7em; }

ul, ol { padding-left: 1.4em; }
li { margin-bottom: 0.1em; }

blockquote {
  margin-left: 0;
  padding-left: 0.9em;
  border-left: 2px solid var(--rule);
  color: var(--muted);
}

code { background: var(--code-bg); padding: 0 0.2em; }

pre {
  background: var(--code-bg);
  padding: 0.6em 0.8em;
  overflow-x: auto;
}

pre code { background: none; padding: 0; }

table { border-collapse: collapse; }
th, td { border: 1px solid var(--rule); padding: 0.15em 0.5em; text-align: left; }

img { max-width: 100%; }

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

/* index listings */

ul.index { list-style: none; padding-left: 0; }
ul.index li { margin-bottom: 0.3em; }
ul.index .date { color: var(--muted); margin-right: 0.6em; }
ul.index .note { color: var(--muted); }

footer { color: var(--muted); }
footer p { margin: 0; }
