/* Minimal academic theme shared by every page (see _layouts/default.html). */
:root { --fg: #222; --muted: #666; --link: #1a5fb4; --rule: #ddd; --bg: #fff; --code-bg: #f5f5f5; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --fg: #ddd; --muted: #999; --link: #78aeed; --rule: #333; --bg: #161616; --code-bg: #222; }
}
:root[data-theme="dark"] { --fg: #ddd; --muted: #999; --link: #78aeed; --rule: #333; --bg: #161616; --code-bg: #222; }

* { box-sizing: border-box; }
body {
  margin: 0 auto; max-width: 1040px; padding: 2rem 16px 3rem;
  font: 18px/1.6 "Source Serif 4", Georgia, "Times New Roman", serif;
  color: var(--fg); background: var(--bg);
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* Header and navigation */
.site-header { text-align: center; }
.site-header h1 { margin: 0; font-size: 2rem; font-weight: normal; }
.site-header h1 a { color: inherit; }
.tagline { margin: .25rem 0 1rem; color: var(--muted); font-style: italic; }
.site-nav {
  display: flex; flex-wrap: wrap; align-items: center;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: .4rem 0; margin-bottom: 2rem;
}
.site-nav a { margin-right: 1.25rem; }
.site-nav a.active { color: var(--fg); }
.theme-toggle {
  margin-left: auto; background: none; border: 1px solid var(--rule); border-radius: 4px;
  color: var(--muted); font: inherit; font-size: .85rem; padding: .1rem .6rem; cursor: pointer;
}
.theme-toggle:hover { color: var(--fg); }

/* Headings and text */
h1, h2, h3, h4 { font-weight: normal; line-height: 1.3; }
main > h1, .page-title { font-size: 1.7rem; margin: 0 0 .3rem; }
h2 { font-size: 1.3rem; border-bottom: 1px solid var(--rule); padding-bottom: .2rem; margin-top: 2.25rem; }
h3 { font-size: 1.1rem; margin-top: 1.75rem; }
.meta, .date { color: var(--muted); font-variant-numeric: tabular-nums; }
.meta { font-size: .95rem; margin: 0 0 1.75rem; }
.description { color: var(--muted); font-style: italic; margin-top: 0; }
blockquote { margin: 1rem 0; padding-left: 1rem; border-left: 3px solid var(--rule); color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }

/* Lists */
ul.plain { padding-left: 1.2rem; }
ul.plain li { margin-bottom: .6rem; }
ul.inline { list-style: none; padding: 0; }
ul.inline li { display: inline; margin-right: 1rem; }
.links a, .links span { margin-right: 1rem; }

/* Code, tables, math */
code, pre { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; }
code { background: var(--code-bg); padding: .1em .3em; border-radius: 3px; }
pre { background: var(--code-bg); padding: .8rem 1rem; overflow-x: auto; border-radius: 4px; line-height: 1.45; }
pre code { background: none; padding: 0; }
table { border-collapse: collapse; margin: 1rem 0; display: block; overflow-x: auto; }
th, td { border: 1px solid var(--rule); padding: .35rem .6rem; text-align: left; }
.katex-display { overflow-x: auto; overflow-y: hidden; }

/* Home page */
.portrait { float: right; width: 190px; margin: 0 0 1rem 1.5rem; border-radius: 4px; }
.bio p { margin: 0 0 1rem; }
.bio [hidden] { display: none; }
.lang-switch { margin: 0 0 .75rem; }
.lang-switch button { background: none; border: 0; padding: 0; font: inherit; color: var(--link); cursor: pointer; }
.lang-switch button[aria-pressed="true"] { color: var(--fg); }
.lang-switch button:hover { text-decoration: underline; }

/* Article text in posts and news items: typeset like a printed article,
   not a rendered Markdown file (no rules under headings, booktabs tables). */
.prose h2 { border: 0; padding: 0; font-size: 1.25rem; font-weight: 600; margin: 2.4rem 0 .6rem; }
.prose h3 { font-size: 1.05rem; font-style: italic; margin: 1.8rem 0 .4rem; }
.prose table { border: 0; border-top: 1.5px solid var(--fg); border-bottom: 1.5px solid var(--fg); }
.prose th, .prose td { border: 0; padding: .4rem .75rem; }
.prose thead th { border-bottom: 1px solid var(--muted); font-weight: 600; }
.prose blockquote {
  border: 0; margin: 1.5rem 0; padding: .9rem 1.1rem;
  background: var(--code-bg); border-radius: 4px; color: var(--fg);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr { border: 0; text-align: center; margin: 2.5rem 0; }
.prose hr::after { content: "⁂"; color: var(--muted); font-size: 1.1rem; letter-spacing: .3em; }
.prose ol, .prose ul { padding-left: 1.4rem; }

.lang-note { background: var(--code-bg); border-radius: 4px; padding: .6rem .9rem; margin: -.75rem 0 1.75rem; }

/* Posts and news items */
.toc { font-size: .95rem; border-left: 3px solid var(--rule); padding-left: 1rem; margin: 0 0 2rem; }
.toc ul { padding-left: 1.1rem; margin: .3rem 0; }
.post-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; }

/* Main column and sidebar (search, subscribe, recent posts) */
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 3rem; }
.site-aside { font-size: .92rem; }
.site-aside section { margin-bottom: 1.75rem; }
.site-aside h3 { margin: 0 0 .5rem; font-size: 1rem; border-bottom: 1px solid var(--rule); padding-bottom: .2rem; }
.site-aside p { margin: 0 0 .5rem; }
.site-aside ul { list-style: none; padding: 0; margin: .5rem 0 0; }
.site-aside li { margin-bottom: .45rem; line-height: 1.4; }
.site-aside input, .site-aside button {
  font: inherit; color: var(--fg); background: var(--bg);
  border: 1px solid var(--rule); border-radius: 4px; padding: .3rem .5rem;
}
.site-aside input { width: 100%; }
.subscribe { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .5rem; }
.subscribe button { cursor: pointer; color: var(--link); }
.small { color: var(--muted); font-size: .85rem; }
.comments { margin-top: 2.5rem; }

@media (max-width: 860px) {
  .page-grid { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .site-aside { border-top: 1px solid var(--rule); padding-top: 1.5rem; }
}

/* Footer */
.site-footer { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .9rem; }

@media (max-width: 560px) {
  .portrait { float: none; display: block; margin: 0 auto 1rem; }
  /* bio.html sets an inline justify, which leaves wide gaps on narrow screens */
  .bio { text-align: left !important; }
}
