:root {
  color-scheme: light;
  --background: #FAF8F3;
  --text: #252525;
  --secondary: #60605B;
  --link: #244E91;
  --visited: #684A86;
  --surface: #F0EDE6;
  --border: #9B9993;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: #1C1C1E;
    --text: #E8E6E1;
    --secondary: #B5B3AE;
    --link: #9CBFFF;
    --visited: #CAB3EF;
    --surface: #28282B;
    --border: #76767C;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #1C1C1E;
  --text: #E8E6E1;
  --secondary: #B5B3AE;
  --link: #9CBFFF;
  --visited: #CAB3EF;
  --surface: #28282B;
  --border: #76767C;
}
html, body { background: var(--background); color: var(--text); }
body { font-size: 18px; line-height: 1.6; }
a { color: var(--link); text-underline-offset: .14em; }
a:visited { color: var(--visited); }
a:focus-visible, button:focus-visible, select:focus-visible {
  outline: 2px solid var(--link); outline-offset: 4px;
}
.theme-toolbar { display: flex; justify-content: flex-end; align-items: center; gap: .5em; color: var(--secondary); font-size: .85em; margin-bottom: .7em; }
.theme-toolbar[hidden] { display: none; }
button, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: .3em .55em; }
.theme-toolbar select { min-height: 36px; }
.bio, .abstract, #tldr > p, #citation > p { max-width: 72ch; }
.paper-body { max-width: 72ch; }
.research-entry p { margin: .35em 0; }
footer, .paper-body figcaption, .source-footnote { color: var(--secondary); }
footer, .paper-body th, .paper-body td { border-color: var(--border); }
pre { color: var(--text); background: var(--surface); }
.pdf-button:hover { background: var(--surface); }
.paper-body img { background: #fff; box-sizing: border-box; padding: 6px; border-radius: 2px; }
.paper-body th { background: var(--surface); }
@media (max-width: 600px) {
  body { font-size: 18px; }
  .theme-toolbar { margin-bottom: .4em; }
  .paper-body .ltx_item > .ltx_tag_item { position: static; margin-right: .4em; }
}
@media print {
  :root { color-scheme: light; }
  html, body { color: #000 !important; background: #fff !important; }
  body { font-size: 11pt; line-height: 1.45; }
  .theme-toolbar { display: none !important; }
  a, a:visited, footer, .paper-body figcaption, .source-footnote { color: #000; }
  pre, .paper-body th { color: #000; background: #f6f6f6; }
  button, select { color: #000; background: #fff; }
}
