/* Minimal LaTeX-like academic styling (no external deps) */
:root {
  --text: #111;
  --muted: #555;
  --bg: #fff;
  --accent: #003366;
  --code-bg: #f6f6f6;
  --border: #e0e0e0;
}

html { font-size: 16px; }
@media print { html { font-size: 12pt; } }

body {
  color: var(--text);
  background: var(--bg);
  font-family: Georgia, 'Times New Roman', Times, serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
}

.container {
  max-width: 760px;
  margin: 2.5rem auto 6rem;
  padding: 0 1rem;
}

header.site-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

.title { font-size: 1.8rem; margin: 0; font-weight: 600; }
.author { color: var(--muted); margin-top: .3rem; font-size: 0.95rem; }
.subtitle { color: var(--muted); margin-top: .25rem; font-size: 1rem; }

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  margin: 2rem 0 0.75rem;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: .25rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p { margin: 0.75rem 0; }

em { font-style: italic; }
strong { font-weight: 700; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

blockquote {
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
  background: #fbfbfb;
}

code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}
code { background: var(--code-bg); padding: 0.1rem 0.3rem; border-radius: 4px; }
pre { background: var(--code-bg); padding: 1rem; border-radius: 6px; overflow: auto; border: 1px solid var(--border); }
pre code { background: transparent; padding: 0; }

ul, ol { margin: 0.5rem 0 1rem 1.5rem; }
li { margin: 0.25rem 0; }

/* Table of contents */
/* Default (mobile/tablet): inline above content, minimal styling */
.toc {
  margin: 1.5rem 0 2rem;
  padding: 0;           /* no container look */
  border: 0;            /* no border */
  background: transparent; /* no different background */
}
.toc h2 { border: none; margin: 0 0 0.25rem; padding: 0; font-size: 1rem; color: var(--muted); }
.toc ul { margin: 0.25rem 0 0 1rem; }
.toc a { text-decoration: none; }

/* Desktop: move TOC to a subtle sidebar */
@media (min-width: 1200px) {
  .container {
    display: grid;
    max-width: 1200px; /* wider layout for breathing room */
    grid-template-columns: 280px minmax(0, 1fr);
    grid-template-areas:
      "header header"
      "toc content";
    column-gap: 3rem; /* more space between TOC and content */
  }
  header.site-header { grid-area: header; }
  .toc {
    grid-area: toc;
    align-self: start;
    position: sticky;
    top: 1rem;
    font-size: 0.9rem;   /* smaller, more discreet */
    line-height: 1.4;
    color: var(--muted);
    margin: 1rem 0 0;    /* reduce visual weight */
  }
  .toc h2 { font-size: 0.85rem; margin: 0 0 0.4rem; }
  .toc ul { margin: 0.2rem 0 0 0; padding-left: 0; list-style: none; }
  .toc ul ul { margin-left: 0.75rem; }
  .toc li { margin: 0.15rem 0; }
  .toc a { color: inherit; }
  .toc a:hover { text-decoration: underline; }
  article { grid-area: content; }
}

/* Figures and tables */
table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
th, td { border: 1px solid var(--border); padding: 0.5rem 0.75rem; }
th { background: #f3f3f3; }

/* Print tweaks */
@media print {
  .container { margin: 0; max-width: none; padding: 0; }
  header.site-header { border: 0; margin-bottom: 0.5rem; }
  a { color: inherit; text-decoration: none; }
}

/* MathJax (SVG) adjustments for paper-like look */
mjx-container[jax="SVG"][display="true"] {
  display: block;
  margin: 1rem 0;    /* space like display equations in papers */
  text-align: center;
}
mjx-container[jax="SVG"] svg {
  fill: currentColor; /* inherit text color for consistent tone */
}
