/* dancmdstat.com: one stylesheet, no build step. Light and dark follow the system setting. */
:root {
  --bg: #fbfaf7;
  --surface: #f2efe8;
  --text: #1f2328;
  --muted: #5d636b;
  --rule: #e2ddd3;
  --accent: #1f5f8b;
  --accent-soft: #e3edf4;
  --code-bg: #f2efe8;
  --img-bg: transparent;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15181c;
    --surface: #1d2126;
    --text: #e4e6e9;
    --muted: #9aa1aa;
    --rule: #2d333a;
    --accent: #7db6dc;
    --accent-soft: #1e2d39;
    --code-bg: #1d2126;
    --img-bg: #ffffff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15181c;
  --surface: #1d2126;
  --text: #e4e6e9;
  --muted: #9aa1aa;
  --rule: #2d333a;
  --accent: #7db6dc;
  --accent-soft: #1e2d39;
  --code-bg: #1d2126;
  --img-bg: #ffffff;
  color-scheme: dark;
}
/* R plots have white/transparent backgrounds: give them a white card in dark mode */
.post img { background: var(--img-bg); border-radius: 4px; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--sans);
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; height: auto; }

.site-header, main, .site-footer {
  max-width: 46rem; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.site-header nav {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 1.25rem 0; border-bottom: 1px solid var(--rule);
}
.brand { font: 600 1.15rem var(--serif); color: var(--text); text-decoration: none; }
.nav-links a { margin-left: 1.25rem; color: var(--muted); text-decoration: none; }
.nav-links a:hover, .nav-links a[aria-current] { color: var(--text); }
.site-footer { color: var(--muted); font-size: .875rem; border-top: 1px solid var(--rule); margin-top: 4rem; padding-block: 1rem 2rem; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.25; font-weight: 600; }
h1 { font-size: 2.1rem; margin: 2.5rem 0 .75rem; }
h2 { font-size: 1.4rem; margin: 2.5rem 0 .75rem; padding-bottom: .3rem; border-bottom: 1px solid var(--rule); }
h3 { font-size: 1.1rem; margin: 1.5rem 0 .25rem; }

/* ---------- home ---------- */
.intro { display: flex; gap: 1.75rem; align-items: center; margin-top: 2.5rem; }
.intro img { width: 132px; height: 132px; object-fit: cover; object-position: center; border-radius: 50%; flex: none; }
.intro h1 { margin: 0 0 .25rem; }
.tagline { margin: 0; color: var(--muted); font-size: 1.05rem; }
.links { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin: .75rem 0 0; padding: 0; list-style: none; font-size: .95rem; }
.lede { font-size: 1.1rem; }
.interests { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; padding: 0; list-style: none; }
.interests li { background: var(--surface); border-radius: 8px; padding: .9rem 1rem; }
.interests strong { display: block; font-family: var(--serif); font-size: 1.05rem; margin-bottom: .2rem; }
.interests span { color: var(--muted); font-size: .95rem; }
@media (max-width: 34rem) {
  .intro { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .intro img { width: 104px; height: 104px; }
  h1 { font-size: 1.8rem; }
}

/* ---------- CV ---------- */
.cv-actions { margin: 0 0 1.5rem; color: var(--muted); font-size: .95rem; }
.entry { display: grid; grid-template-columns: 1fr auto; gap: 0 1rem; margin: 1.1rem 0; }
.entry h3 { margin: 0; font-family: var(--sans); font-size: 1rem; }
.entry .when { color: var(--muted); font-size: .9rem; white-space: nowrap; text-align: right; }
.entry .where { color: var(--muted); font-size: .95rem; grid-column: 1 / -1; }
.entry ul, .entry p { grid-column: 1 / -1; margin: .35rem 0 0; }
.entry ul { padding-left: 1.2rem; }
.pubs { padding-left: 1.2rem; }
.pubs li { margin-bottom: .8rem; }
.plain { list-style: none; padding: 0; }
.plain li { margin-bottom: .6rem; }
.muted { color: var(--muted); }
.badge { display: inline-block; font-size: .78rem; padding: 0 .45rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); vertical-align: 1px; }
@media (max-width: 34rem) {
  .entry { grid-template-columns: 1fr; }
  .entry .when { text-align: left; }
}

/* ---------- writing ---------- */
.post-list { list-style: none; padding: 0; }
.post-list li { display: flex; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--rule); }
.post-list time { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; width: 3rem; }
.post-meta { color: var(--muted); font-size: .9rem; margin: 2.5rem 0 0; }
.post-meta a { color: var(--muted); }
.post h1 { margin-top: .5rem; }
.post img { display: block; margin: 1rem auto; }
pre {
  background: var(--code-bg); border: 1px solid var(--rule); border-radius: 6px;
  padding: .8rem 1rem; overflow-x: auto; font-size: .85rem; line-height: 1.5;
}
code { font-family: var(--mono); font-size: .9em; }
:not(pre) > code { background: var(--code-bg); padding: .1em .3em; border-radius: 4px; }
.katex-display { overflow-x: auto; overflow-y: hidden; }
table { border-collapse: collapse; margin: 1rem 0; display: block; overflow-x: auto; }
th, td { border: 1px solid var(--rule); padding: .3rem .6rem; }

/* ---------- print (CV) ---------- */
@media print {
  :root { --bg: #fff; --text: #000; --muted: #444; --rule: #ccc; --accent: #000; }
  body { font-size: 10.5pt; }
  .site-header, .site-footer, .cv-actions, .no-print { display: none; }
  main { max-width: none; padding: 0; }
  h1 { margin-top: 0; }
  h2 { margin-top: 1.2rem; break-after: avoid; }
  .entry, .pubs li { break-inside: avoid; }
  a { text-decoration: none; }
}
.intro > div, .post-list a, .entry > * { min-width: 0; }
