/* ============================================================
   Lateral Intelligence — Computer Modern (LaTeX) theme
   Direction A: typeset-paper look, near-white warm ground,
   restrained maroon accent.
   ============================================================ */

:root {
  --bg:        #fcfcfa;   /* near-white, faint warmth */
  --ink:       #1c1a17;
  --body:      #322f29;
  --muted:     #7a766d;
  --faint:     #b6b1a4;
  --line:      #e8e6df;
  --line-soft: #efeee8;
  --accent:    #7c1f2b;   /* restrained maroon */
  --accent-bd: #d9c2c0;
  --accent-ul: #cda9a5;
  --box:       #f4f3ee;
  --box-bd:    #e7e4dc;
  --serif: "Computer Modern Serif", Georgia, "Times New Roman", serif;
  --mono:  "Computer Modern Typewriter", "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: #e5dccb; }

a { color: inherit; }

/* ---------- layout ---------- */
.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ---------- header ---------- */
.site-head {
  max-width: 760px;
  margin: 0 auto;
  padding: 26px 32px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  white-space: nowrap;
  font-size: 20px;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}
.wordmark .tick {
  width: 10px;
  height: 10px;
  background: var(--accent);
  display: inline-block;
}
.site-nav {
  display: flex;
  gap: 28px;
  font-variant: small-caps;
  font-size: 16px;
  letter-spacing: 0.05em;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color .15s ease;
}
.site-nav a:hover { color: var(--accent); }

/* ---------- home hero ---------- */
.home-hero {
  padding: 64px 0 46px;
  max-width: 680px;
}
.hero-kicker {
  font-variant: small-caps;
  font-size: 17px;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 20px;
}
.home-hero h1 {
  font-size: 40px;
  line-height: 1.16;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 22px;
}
.lede {
  font-size: 20px;
  line-height: 1.6;
  color: var(--body);
  margin: 0;
}

/* ---------- section labels ---------- */
.section-label {
  font-variant: small-caps;
  font-size: 17px;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.research-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.research-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
}

/* ---------- research list ---------- */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.post-list li {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 32px;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}
.p-side .p-date {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}
.p-badge {
  margin-top: 12px;
  display: inline-block;
  font-variant: small-caps;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid var(--accent-bd);
  border-radius: 2px;
  padding: 2px 9px;
}
.p-title {
  display: block;
  font-size: 24px;
  line-height: 1.28;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  margin: 0 0 8px;
}
.p-title:hover { color: var(--accent); }
.p-author {
  font-style: italic;
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 12px;
}
.p-sub {
  font-size: 17.5px;
  line-height: 1.58;
  color: var(--body);
  margin: 0 0 16px;
}
.p-links {
  display: flex;
  gap: 22px;
  font-size: 16px;
}
.p-links a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-ul);
  padding-bottom: 1px;
}
.p-links a:hover { border-bottom-color: var(--accent); }

/* ---------- home about ---------- */
.home-about {
  padding: 50px 0 8px;
  max-width: 680px;
}
.home-about p {
  font-size: 19px;
  line-height: 1.62;
  color: var(--body);
  margin: 18px 0 16px;
}
.join {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
}
.join span { color: var(--faint); }

/* ---------- post header ---------- */
article { padding-bottom: 8px; }
.post-header {
  padding: 50px 0 0;
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
}
.kicker {
  font-variant: small-caps;
  font-size: 15px;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 18px;
}
.post-header h1 {
  font-size: 34px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
}
.post-author {
  font-size: 18px;
  font-style: italic;
  color: var(--body);
  margin-bottom: 12px;
}
.subtitle {
  font-size: 18px;
  line-height: 1.55;
  color: var(--body);
  margin: 0 auto 4px;
}
.paper-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 22px;
  font-size: 16px;
}
.paper-links a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-ul);
  padding-bottom: 1px;
}
.paper-links a:hover { border-bottom-color: var(--accent); }

/* ---------- table of contents ---------- */
.toc {
  margin: 40px auto 0;
  max-width: 680px;
  padding: 18px 22px;
  background: var(--box);
  border-left: 2px solid var(--accent);
}
.toc-title {
  font-variant: small-caps;
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 36px;
}
.toc li { margin: 0 0 6px; }
.toc a {
  color: var(--body);
  text-decoration: none;
  font-size: 16px;
}
.toc a:hover { color: var(--accent); }
.toc-h3 a { padding-left: 16px; color: var(--muted); font-size: 15px; }

/* ---------- article content ---------- */
.content {
  max-width: 680px;
  margin: 36px auto 0;
  font-size: 19px;
  line-height: 1.74;
  color: var(--body);
  counter-reset: section;
}
.content > p { margin: 0 0 20px; }

.content h2 {
  counter-increment: section;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  margin: 40px 0 14px;
  line-height: 1.25;
  scroll-margin-top: 24px;
}
.content h2::before {
  content: counter(section);
  font-family: var(--mono);
  font-size: 17px;
  color: var(--accent);
  margin-right: 12px;
}
.content h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 30px 0 12px;
  scroll-margin-top: 24px;
}

.content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-ul);
}
.content a:hover { border-bottom-color: var(--accent); }

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

.content ul, .content ol {
  margin: 0 0 20px;
  padding-left: 26px;
}
.content li { margin: 0 0 8px; }

.content blockquote {
  margin: 0 0 22px;
  padding: 4px 0 4px 22px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-style: italic;
}

.content code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--box);
  padding: 1px 5px;
  border-radius: 2px;
}
.content pre {
  background: var(--box);
  border: 1px solid var(--box-bd);
  border-radius: 3px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 15px;
  line-height: 1.5;
}
.content pre code { background: none; padding: 0; }

/* ---------- TL;DR / abstract box ---------- */
.tldr {
  background: var(--box);
  border: 1px solid var(--box-bd);
  border-left: 2px solid var(--accent);
  padding: 18px 22px;
  margin: 0 0 30px;
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--body);
}
.tldr-label {
  display: block;
  font-variant: small-caps;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}

/* ---------- tables (booktabs style) ---------- */
.content table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
  font-size: 15px;
  line-height: 1.4;
  border-top: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
}
.content thead th {
  font-weight: 700;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1.5px solid var(--ink);
}
.content tbody td {
  padding: 7px 10px;
  font-variant-numeric: tabular-nums;
}
.content table:not(.data-table) th:not(:first-child),
.content table:not(.data-table) td:not(:first-child) { text-align: right; }

.table-figure { margin: 24px 0; }
.table-figure .scroll { overflow-x: auto; }
.data-table .num { text-align: right; }
.data-table .grp {
  vertical-align: top;
  font-weight: 700;
  color: var(--ink);
  padding-right: 16px;
}
.data-table .best { font-weight: 700; color: var(--accent); }
.data-table .toprule td { border-top: 1.5px solid var(--ink); }
.data-table .midrule td { border-top: 1px solid var(--line); }
.data-table .subhead td {
  font-style: italic;
  color: var(--muted);
  padding-top: 12px;
  text-align: left;
}
.fig-label { font-weight: 700; color: var(--ink); }

.references ol {
  margin: 0;
  padding-left: 26px;
  font-size: 16px;
  line-height: 1.55;
}
.references li { margin: 0 0 8px; }

.content hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 38px 0 26px;
}

figure { margin: 24px 0; }
figure img,
figure video,
.content img { width: 100%; height: auto; display: block; }
figcaption {
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 12px;
}
figcaption strong, .content table + .caption strong { color: var(--ink); }

/* ---------- KaTeX ---------- */
.katex-display {
  margin: 24px 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0;
}
.katex { font-size: 1.04em; }

/* ---------- back link ---------- */
.back-link {
  display: inline-block;
  max-width: 680px;
  margin: 30px auto 0;
  font-size: 16px;
  color: var(--muted);
  text-decoration: none;
}
.content + .back-link { display: block; }
.back-link:hover { color: var(--accent); }

/* ---------- footer ---------- */
.site-foot {
  max-width: 760px;
  margin: 50px auto 0;
  padding: 22px 32px 40px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
}
.site-foot a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.site-foot a:hover { color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .site-head {
    flex-wrap: wrap;
    gap: 8px 18px;
    padding: 20px 20px 16px;
  }
  .site-nav { gap: 22px; }
  .wrap { padding: 0 20px; }
  .site-foot { padding-left: 20px; padding-right: 20px; }
}

@media (max-width: 640px) {
  body { font-size: 18px; }
  .home-hero { padding: 44px 0 38px; }
  .home-hero h1 { font-size: 30px; }
  .lede { font-size: 18.5px; }
  .home-about { padding: 40px 0 8px; }
  .home-about p { font-size: 18px; }
  .post-header { padding-top: 38px; }
  .post-header h1 { font-size: 26px; }
  .post-list li { grid-template-columns: 1fr; gap: 10px; }
  .p-side { display: flex; align-items: center; gap: 14px; }
  .p-badge { margin-top: 0; }
  .p-title { font-size: 21px; }
  .toc ul { columns: 1; }
  /* wide tables scroll instead of overflowing the viewport */
  .content table {
    display: block;
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
  }
  .content pre { font-size: 13.5px; }
}

@media (max-width: 420px) {
  .site-head { padding: 16px 16px 14px; }
  .wordmark { font-size: 18px; gap: 9px; }
  .site-nav { font-size: 14px; gap: 18px; }
  .wrap { padding: 0 16px; }
  .home-hero h1 { font-size: 26px; }
  .post-header h1 { font-size: 24px; }
  .site-foot {
    flex-direction: column;
    gap: 6px;
    padding: 22px 16px 36px;
  }
}
