/* ---------- Colors ---------- */
/* Light (default) */
:root {
  color-scheme: light dark;
  --bg: #faf8f4;          /* warm off-white, like paper */
  --fg: #2b2a27;          /* warm near-black text */
  --muted: #6b665e;       /* quotes, secondary text */
  --link: #1f5f99;        /* calm blue, darker for light bg */
  --code-bg: #f0ede6;     /* slightly darker than the page */
  --border: #e2ddd3;
}

/* Dark (when the visitor's system is in dark mode) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1b19;        /* warm dark gray */
    --fg: #d8d4cc;        /* soft off-white text */
    --muted: #9a958c;
    --link: #8ab4d8;
    --code-bg: #262522;
    --border: #36342f;
  }
}

/* ---------- Base ---------- */
html {
  font-size: 93.75%;   /* 15px; use 100% for 16px, 87.5% for 14px */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  background-color: var(--bg);
  color: var(--fg);
}

body {
  max-width: 60ch;     /* line width; 50ch = narrower, 60ch = wider */
  margin: 2rem auto;
  padding: 0 1.25rem;
}

/* ---------- Headings ---------- */
h1, h2, h3, h4 {
  line-height: 1.25;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

/* ---------- Links ---------- */
a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Code ---------- */
pre, code {
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
  font-size: 0.9em;
}

code {
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

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

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

/* ---------- Quotes ---------- */
blockquote {
  border-left: 3px solid var(--border);
  margin-left: 0;
  padding-left: 1rem;
  color: var(--muted);
}

/* ---------- Lists ---------- */
ul, ol {
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.25rem;
}

/* ---------- Images ---------- */
img {
  max-width: 100%;
  height: auto;
}

/* ---------- Navigation ---------- */
#preamble nav {
  margin-bottom: 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

#preamble nav a {
  text-decoration: none;
}

#preamble nav a:hover {
  text-decoration: underline;
}

.date { color: #777; font-size: 0.9em; }
