/* --- Reset and base --- */
*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, h3, p, ul, ol, li, hr, footer, header, main, section, article, time, nav { margin: 0; padding: 0; }

:root {
  --bg: #fdfdfc;
  --text: #222;
  --muted: #777;
  --rule: #e4e2dd;
  --code-bg: #f0eeea;
  --link: #2b6cb0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161a;
    --text: #d8d6d0;
    --muted: #8a8780;
    --rule: #2a2b30;
    --code-bg: #20222a;
    --link: #7fb3d5;
  }
}

html { color-scheme: light dark; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  max-width: 38rem;
  margin: 0;
  padding: 3rem 2rem 4rem max(2rem, 8vw);
}

/* --- Header --- */
header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px dotted var(--rule);
}

h1 {
  font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.tagline {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

nav {
  font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease, color 120ms ease;
}

nav a:hover, nav a:focus {
  background: transparent;
  color: var(--link);
  border-bottom-color: var(--link);
}

nav span {
  color: var(--rule);
}

/* --- Sections --- */
main {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

section h2 {
  font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  font-weight: 500;
  font-size: 1.05rem;
  text-transform: lowercase;
  letter-spacing: 0.01em;
  color: var(--text);
  margin-bottom: 1rem;
}

/* About sub-headings: Nix renderer emits <h3 class="about-sub"> only when an
   `about` entry has a non-null heading; CSS prepends the `## ` decoration. */
.about-sub {
  font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--muted);
  margin-top: 1.4rem;
  margin-bottom: 0.5rem;
}

.about-sub::before {
  content: "## ";
  color: var(--rule);
}

section p {
  margin-bottom: 0.9rem;
}

section p:last-child {
  margin-bottom: 0;
}

/* --- Notes: <time> and <h3> inline with a `→` separator,
   <p> body block underneath. Same markup as archivist; only CSS differs. --- */
.notes article {
  padding: 0.7rem 0;
  border-bottom: 1px dotted var(--rule);
}

.notes article:last-of-type {
  border-bottom: none;
}

.notes article time {
  font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 0.88rem;
  color: var(--muted);
  display: inline;
}

.notes article time::after {
  content: " → ";
  color: var(--link);
}

.notes article h3 {
  display: inline;
  font-weight: 500;
  font-size: 0.92rem;
  font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  color: var(--text);
}

.notes article p {
  margin-top: 0.45rem;
  margin-bottom: 0;
  color: var(--text);
  font-size: 0.94rem;
  line-height: 1.55;
}

/* --- Inline links + code --- */
a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid var(--link);
}

a:hover, a:focus {
  background: var(--link);
  color: var(--bg);
  border-bottom-color: transparent;
}

code, kbd, samp, .mono {
  font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 0.95em;
  background: var(--code-bg);
  padding: 0.05em 0.3em;
  border-radius: 2px;
}

/* --- Footer --- */
footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px dotted var(--rule);
  font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  color: var(--muted);
  font-size: 0.82rem;
}

/* --- Responsive --- */
@media (max-width: 540px) {
  body {
    font-size: 15px;
    padding: 2rem 1.1rem 3rem;
  }
  h1 { font-size: 1.25rem; }
  nav { gap: 0.3rem; }
}
