:root {
  --bg: #fdfdfb;
  --fg: #1d1f21;
  --muted: #5f6368;
  --accent: #1f5f8b;
  --rule: #e3e3de;
  --code-bg: #f2f1ec;
  --header-bg: #16324a;
  --header-fg: #f4f6f8;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181b;
    --fg: #e4e4e0;
    --muted: #a0a4a8;
    --accent: #7fb6e0;
    --rule: #2c3135;
    --code-bg: #22272b;
    --header-bg: #0d1b27;
    --header-fg: #e4e9ee;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.6 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

header {
  background: var(--header-bg);
  color: var(--header-fg);
  padding: 0.9rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.6rem;
  align-items: baseline;
}

header a { color: var(--header-fg); text-decoration: none; }
header .brand { font-weight: 700; font-size: 1.1rem; }
header nav { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; font-size: 0.95rem; }
header nav a { opacity: 0.82; }
header nav a:hover, header nav a.current { opacity: 1; text-decoration: underline; }

main {
  max-width: 62rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

h1, h2, h3 { line-height: 1.25; font-weight: 600; }
h1 { font-size: 2rem; margin-top: 0.5rem; }
h2 { font-size: 1.45rem; margin-top: 2.2rem; padding-bottom: 0.2rem; border-bottom: 1px solid var(--rule); }
h3 { font-size: 1.15rem; }

a { color: var(--accent); }

code {
  font-family: "JuliaMono", "DejaVu Sans Mono", "Menlo", "Consolas", monospace;
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 0.08em 0.3em;
  border-radius: 3px;
}

pre {
  background: var(--code-bg);
  padding: 0.8rem 1rem;
  overflow-x: auto;
  border-radius: 4px;
}

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

.table-wrap { overflow-x: auto; margin: 1rem 0; }

table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { text-align: left; vertical-align: top; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--rule); }
th { border-bottom: 2px solid var(--rule); }
td:first-child { white-space: nowrap; }

li { margin: 0.25rem 0; }

footer {
  max-width: 62rem;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--rule);
}

li.task { list-style: none; position: relative; }
li.task::before { position: absolute; left: -1.3em; font-weight: 700; }
li.task.done::before { content: "✓"; color: #2e7d32; }
li.task.partial::before { content: "◐"; color: var(--muted); }
li.task.open::before { content: "○"; color: var(--muted); }

nav.toc {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.4rem 1rem;
  margin: 1rem 0 1.5rem;
  font-size: 0.93rem;
}
nav.toc p { margin: 0.3rem 0; font-weight: 600; }
nav.toc ul { margin: 0.2rem 0; padding-left: 1.2rem; }

details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary h2 { display: inline-block; }
details > summary h2::after { content: " ▸"; color: var(--muted); font-size: 0.9em; }
details[open] > summary h2::after { content: " ▾"; }

/* the two ways into the library, at the top of the overview */
.entry { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin: 1.2rem 0 1.8rem; }
.entry-card { display: block; padding: 1rem 1.2rem; border: 1px solid var(--rule); border-left: 4px solid var(--accent);
  border-radius: 6px; background: var(--code-bg); color: var(--fg); text-decoration: none; }
.entry-card b { display: block; font-size: 1.15rem; color: var(--accent); margin-bottom: 0.3rem; }
.entry-card span { color: var(--muted); font-size: 0.95rem; }
.entry-card:hover { border-color: var(--accent); }
.entry-card:hover b { text-decoration: underline; }
