/* arXiv-paper look: Latin Modern serif throughout, bold numbered section headings, LaTeX Contents-style TOC. */

/* Latin Modern (GUST successor to cm-super) — matches the heavier stroke/size ratio of the arXiv paper's body. */
@font-face {
  font-family: "Latin Modern";
  src: url("https://cdn.jsdelivr.net/gh/vincentdoerig/latex-css@master/fonts/LM-regular.woff2") format("woff2");
  font-weight: normal; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Latin Modern";
  src: url("https://cdn.jsdelivr.net/gh/vincentdoerig/latex-css@master/fonts/LM-italic.woff2") format("woff2");
  font-weight: normal; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Latin Modern";
  src: url("https://cdn.jsdelivr.net/gh/vincentdoerig/latex-css@master/fonts/LM-bold.woff2") format("woff2");
  font-weight: bold; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Latin Modern";
  src: url("https://cdn.jsdelivr.net/gh/vincentdoerig/latex-css@master/fonts/LM-bold-italic.woff2") format("woff2");
  font-weight: bold; font-style: italic; font-display: swap;
}

:root {
  --bg:      #f0eeea;   /* warm paper */
  --surface: #f6f4f0;
  --fg:      #1a1714;
  --muted:   #7c756c;
  --accent:  #b31b1b;   /* links: arXiv red */
  --border:  #e2ded7;
  --code-bg: #eae7e1;
  --sans: "Latin Modern", Georgia, "Times New Roman", serif;
  --display: "Latin Modern", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #14120f;
    --surface: #1a1815;
    --fg:      #e8e4dd;
    --muted:   #938b80;
    --accent:  #e06666;   /* arXiv red, lightened for dark-mode contrast */
    --border:  #2a2621;
    --code-bg: #201d19;
  }
}

* { box-sizing: border-box; }

html { text-rendering: optimizeLegibility; }

body {
  font-family: var(--sans);
  color: var(--fg);
  background: var(--bg);
  max-width: 780px;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 8rem;
  line-height: 1.7;
  font-size: 19px;
  font-weight: normal;
  letter-spacing: -0.01em;
}

/* Table of contents — placed before section 1, styled like a paper's Contents */
.toc { margin: 2rem 0 3rem; }
.toc-label {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--fg);
  margin-bottom: 0.85rem;
}
.toc nav { display: flex; flex-direction: column; }
.toc nav a {
  color: var(--fg);
  font-size: 1rem;
  line-height: 1.5;
  padding: 0.12rem 0;
  display: flex;
  gap: 0.6em;
}
/* Full sections bold; subsections read like normal body text */
.toc nav a:not(.sub) { font-weight: bold; }
.toc nav a.sub { padding-left: 1.7rem; }
.toc nav a .toc-num { flex: 0 0 auto; min-width: 1.5em; }
.toc nav a.sub .toc-num { min-width: 2em; }
.toc nav a:hover { opacity: 0.7; }

/* Links — arXiv red, never underlined */
a { color: var(--accent); text-decoration: none; transition: opacity .15s; }
a:hover { opacity: 0.7; }

/* People's names: normal text color with a dotted underline (like sepehr.assadi.info) */
a.person { color: var(--fg); text-decoration: underline dotted; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* Header — arXiv running-head feel: short-title left, quiet nav right, hairline rule beneath */
header.site {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3.5rem;
}
header.site .name { font-family: var(--display); font-weight: 600; letter-spacing: 0; }
header.site .name a,
header.site nav a { border-bottom: none; }
/* Masthead title reads clean — no dotted person-underline in the header */
header.site .name a.person { text-decoration: none; }
header.site nav {
  font-size: 0.92rem;
  letter-spacing: 0.03em;
}
header.site nav a { margin-left: 1.2rem; color: var(--muted); }
header.site nav a:hover { color: var(--fg); }

/* Headings — Latin Modern bold, like the arXiv paper's numbered sections */
h1, h2, h3 { font-family: var(--display); line-height: 1.25; font-weight: bold; letter-spacing: 0; }
h1 { font-size: 1.85rem; margin: 0 0 1.75rem; text-align: center; }
h2 { font-size: 1.4rem; margin: 2.75rem 0 0.85rem; }
h3 { font-size: 1.12rem; margin: 2rem 0 0.55rem; }

/* LaTeX-style section number prefixed to each heading (added by the post renderer) */
.secnum { margin-right: 0.55em; }

/* Post title block: date sits close under the centered title */
.post-page article > .meta { text-align: center; }
.post-page article > h1 { margin: 0.5rem 0 0.4rem; }

p, ul, ol { margin: 1.15rem 0; }

/* Self-defined terms: underline instead of bold */
#content strong { font-weight: normal; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* Post list */
ul.posts { list-style: none; padding: 0; margin-top: 2.5rem; }
ul.posts li { margin-bottom: 2.25rem; }
ul.posts .title { font-family: var(--display); font-size: 1.15rem; font-weight: 500; letter-spacing: -0.01em; }
ul.posts .date { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.02em; margin-top: 0.2rem; }
ul.posts .excerpt { color: var(--muted); margin-top: 0.4rem; font-size: 0.95rem; }

/* Post meta line */
article .meta { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.02em; margin-bottom: 3rem; }
article img { max-width: 100%; border-radius: 6px; }

/* Code */
code {
  font-family: var(--mono);
  background: var(--code-bg);
  padding: 0.12em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
}
pre {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1rem 1.15rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
}
pre code { background: none; padding: 0; font-size: 1em; }

blockquote {
  border-left: 2px solid var(--border);
  margin: 1.4rem 0;
  padding: 0.1rem 0 0.1rem 1.1rem;
  color: var(--muted);
  font-style: italic;
}

hr { border: none; border-top: 1px solid var(--border); margin: 3rem 0; }

/* KaTeX display math scrolls instead of overflowing */
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 0.4rem 0; }
#content .katex { font-size: 1em; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* pseudocode.js algorithm blocks — its CSS hardcodes #000 borders, so recolor for dark mode */
.ps-root { color: var(--fg); margin: 1.75rem 0 0.4rem; overflow-x: auto; font-size: 0.95rem; }
.ps-root .ps-algorithm { border-top-color: var(--fg) !important; border-bottom-color: var(--fg) !important; }
.ps-root .ps-algorithm.with-caption > .ps-line:first-child { border-bottom-color: var(--fg) !important; }

/* Figure-style caption below an algorithm box */
.algo-caption { font-size: 0.85rem; color: var(--muted); margin: 0 0 1.75rem; }

/* LaTeX-style citation links: the key is citation-green; the surrounding [ ] stay black text */
.cite { color: #2f7d32; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .cite { color: #6cc077; } }

/* SVG figures served as standalone files (theme-aware via their own prefers-color-scheme) */
.ers-fig { margin: 1.75rem 0 0.4rem; }
.ers-fig img { display: block; width: 100%; height: auto; max-width: 620px; margin: 0 auto; border-radius: 0; }

.back {
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  border-bottom: none;
  display: inline-block;
  margin-bottom: 2rem;
}
.back:hover { color: var(--fg); }

footer.site {
  margin-top: 6rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.01em;
}
