/* --- Reset & Base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --rule: #d4d4d4;
  --bg: #fdfdfd;
  --link: #1a1a1a;
  --link-hover: #555;
  --font-body: 'Newsreader', 'Times New Roman', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
  --measure: 38em;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #d8d8d8;
    --muted: #8a8a8a;
    --rule: #3a3a3a;
    --bg: #111;
    --link: #d8d8d8;
    --link-hover: #aaa;
  }
}

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,300;0,6..72,400;0,6..72,500;1,6..72,300;1,6..72,400&display=swap');

html {
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  font-weight: 300;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
}

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}

/* --- Typography --- */
h1 {
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-bottom: 0.3rem;
}

h2 {
  font-size: 0.8rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 1.2rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.2s;
}

a:hover {
  color: var(--link-hover);
  border-color: var(--link-hover);
}

/* --- Index page --- */
.tagline {
  font-size: 0.95rem;
  color: var(--muted);
  font-style: italic;
}

.contact {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
  margin-bottom: 3rem;
}

.papers { margin-top: 0; }

.paper-list {
  list-style: none;
  counter-reset: paper;
}

.paper-list li {
  margin-bottom: 1.8rem;
}

.paper-list li > a {
  font-size: 1.05rem;
  font-weight: 400;
}

.version {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  margin-left: 0.5em;
  vertical-align: 0.1em;
}

.paper-list .summary {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.35rem;
  line-height: 1.55;
}

/* --- Paper page --- */
.paper-header {
  margin-bottom: 3rem;
}

.paper-header h1 {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 0.3rem;
}

.paper-meta {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.paper-body h2 {
  font-size: 1.05rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  margin-top: 2.5rem;
  margin-bottom: 0.6rem;
  border-bottom: none;
  padding-bottom: 0;
}

.paper-body h3 {
  font-size: 0.95rem;
  font-weight: 500;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.paper-body p {
  margin-bottom: 1rem;
}

.paper-body ol,
.paper-body ul {
  margin: 0.8rem 0 1rem 1.5em;
}

.paper-body li {
  margin-bottom: 0.4rem;
}

.paper-body code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: rgba(128,128,128,0.08);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.paper-body .note {
  font-size: 0.88rem;
  font-style: italic;
  color: var(--muted);
  margin: 1.2rem 0;
  padding-left: 1.2rem;
  border-left: 2px solid var(--rule);
}

.paper-body .definition {
  margin: 1rem 0;
}

.paper-body .definition p {
  margin-bottom: 0.4rem;
  padding-left: 1rem;
  text-indent: -1rem;
}

.back {
  display: inline-block;
  margin-bottom: 2.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-bottom-color: transparent;
}

.back:hover {
  color: var(--text);
  border-bottom-color: var(--rule);
}

.prior-work {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 2rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--rule);
}

.prior-work a {
  word-break: break-all;
}

/* --- Diagrams --- */
.diagram {
  margin: 1.8rem 0;
}

.diagram svg {
  width: 100%;
  height: auto;
  display: block;
}

.diagram figcaption {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.5rem;
  line-height: 1.45;
  font-style: italic;
}

.diagram img {
  width: 100%;
  max-width: 580px;
  height: auto;
  display: block;
  margin: 0 auto;
}
