/* ============================================================================
   pages.css — the site's own design: home (bio), posts index, projects, now, 404.

   This deliberately does NOT load the vendored Hugo theme CSS (css/site.css).
   Only the report page uses that, because css/report.css depends on Simple.css's
   body grid. Everything here is written from scratch.

   Technical/monospace direction: mono type, hairline rules instead of boxes,
   terminal-ish affordances. Theming has three states -- tokens on bare :root,
   re-declared under prefers-color-scheme and again under [data-theme] -- so no
   color may have its only definition inside one of those blocks.
   ========================================================================== */

:root {
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --bg: #fbfbfa;
  --bg-soft: #f2f2ef;
  --text: #16161a;
  --text-dim: #6b6b76;
  --rule: #d8d8d2;
  --accent: #0b5fd0;

  --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e11;
    --bg-soft: #17171c;
    --text: #e6e6e9;
    --text-dim: #90909c;
    --rule: #2b2b33;
    --accent: #ffb545;
  }
}

:root[data-theme="dark"] {
  --bg: #0e0e11;
  --bg-soft: #17171c;
  --text: #e6e6e9;
  --text-dim: #90909c;
  --rule: #2b2b33;
  --accent: #ffb545;
}

/* --- base ---------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light dark;
}

body {
  margin: 0 auto;
  padding: 0 1.5rem;
  max-width: 52rem;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
  font-variant-ligatures: none;
}

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

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- masthead ------------------------------------------------------------ */

body > header {
  padding: 1.75rem 0 1.25rem;
  border-bottom: 1px solid var(--rule);
}

body > header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin-bottom: 2rem;
}

body > header nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
}

body > header nav a:hover {
  color: var(--text);
}

body > header nav a.current {
  color: var(--accent);
}

body > header nav a.current::before {
  content: "[";
  color: var(--text-dim);
}

body > header nav a.current::after {
  content: "]";
  color: var(--text-dim);
}

body > header h1 {
  margin: 0;
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

body > header > p {
  margin: 0.8rem 0 0;
  max-width: var(--measure);
  color: var(--text-dim);
}

/* --- main ---------------------------------------------------------------- */

main {
  padding: 2.5rem 0 3rem;
}

.prose {
  max-width: var(--measure);
}

.prose > :first-child {
  margin-top: 0;
}

.prose h2 {
  margin: 2.75rem 0 0.75rem;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.prose h2::before {
  content: "## ";
  color: var(--text-dim);
  font-weight: 400;
}

.prose h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1rem;
}

.prose p {
  margin: 0 0 1.15rem;
}

.prose ul,
.prose ol {
  margin: 0 0 1.15rem;
  padding-left: 1.4rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

.prose blockquote {
  margin: 1.75rem 0;
  padding: 0.75rem 0 0.75rem 1.1rem;
  border-left: 2px solid var(--accent);
  background: var(--bg-soft);
  color: var(--text-dim);
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px dashed var(--rule);
}

.prose code {
  background: var(--bg-soft);
  padding: 0.1em 0.35em;
  font-size: 0.9em;
}

.prose pre {
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  padding: 1rem;
  overflow-x: auto;
}

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

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
}

.prose th,
.prose td {
  border-bottom: 1px solid var(--rule);
  padding: 0.4rem 0.6rem;
  text-align: left;
}

/* wide tables scroll rather than pushing the page sideways */
.prose > table {
  display: block;
  overflow-x: auto;
}

/* --- post list ----------------------------------------------------------- */

ul.blog-posts {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
  max-width: var(--measure);
}

ul.blog-posts li {
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
}

ul.blog-posts li span {
  flex: 0 0 7rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

ul.blog-posts li i {
  font-style: normal;
}

ul.blog-posts li a {
  text-decoration: none;
}

ul.blog-posts li a:hover {
  text-decoration: underline;
}

/* --- footer -------------------------------------------------------------- */

body > footer {
  border-top: 1px solid var(--rule);
  padding: 1.25rem 0 2.5rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* --- narrow -------------------------------------------------------------- */

@media (max-width: 640px) {
  body > header {
    padding-top: 1.25rem;
  }

  body > header nav {
    margin-bottom: 1.5rem;
  }

  ul.blog-posts li {
    flex-wrap: wrap;
    gap: 0.1rem 1rem;
  }

  ul.blog-posts li span {
    flex-basis: 100%;
  }
}
