/* Inspired by lilianweng.github.io (PaperMod / Hugo) light theme tokens */
:root {
  --gap: 24px;
  --content-gap: 20px;
  --main-width: 720px;
  --radius: 8px;
  --theme: rgb(255, 255, 255);
  --entry: rgb(255, 255, 255);
  --primary: rgb(30, 30, 30);
  --secondary: rgb(108, 108, 108);
  --tertiary: rgb(214, 214, 214);
  --content: rgb(31, 31, 31);
  --hljs-bg: rgb(28, 29, 33);
  --code-bg: rgb(245, 245, 245);
  --border: rgb(238, 238, 238);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  word-break: break-word;
  color: var(--content);
  background: var(--theme);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

/* In-content link style: subtle bottom edge like PaperMod */
article a:not(.post-link),
footer.site a {
  box-shadow: 0 1px 0 var(--primary);
}

article a:not(.post-link):hover {
  color: #aaa;
}

footer.site a {
  color: inherit;
  box-shadow: 0 1px 0 var(--secondary);
}

footer.site a:hover {
  color: var(--primary);
  box-shadow: 0 1px 0 var(--primary);
}

.wrap {
  max-width: calc(var(--main-width) + var(--gap) * 2);
  margin: 0 auto;
  padding: var(--gap);
  min-height: calc(100vh - 120px);
}

.site-nav {
  margin-bottom: var(--gap);
  font-size: 16px;
}

.site-nav a {
  color: var(--primary);
}

.site-nav a:hover {
  color: var(--secondary);
}

header.site {
  margin: var(--gap) auto var(--content-gap);
}

header.site h1 {
  font-family: var(--font);
  font-weight: 600;
  font-size: 36px;
  line-height: 1.2;
  margin: 0 0 2px;
  letter-spacing: -0.02em;
  color: var(--primary);
}

header.site .tagline {
  margin: 10px 0 5px;
  color: var(--secondary);
  font-size: 16px;
  line-height: 1.6;
}

article {
  color: var(--content);
}

article h2 {
  font-family: var(--font);
  font-weight: 600;
  font-size: 24px;
  line-height: 1.2;
  margin: 24px auto 16px;
  letter-spacing: -0.01em;
  color: var(--primary);
}

article h2:first-of-type {
  margin-top: 0;
}

article h3 {
  font-size: 18px;
  line-height: 1.2;
  margin: 24px 0 16px;
  color: var(--primary);
}

article p {
  margin: 0 0 var(--content-gap);
}

article .lead {
  font-size: 16px;
  color: var(--content);
}

.post-list-heading {
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  color: var(--secondary);
  margin: 0 0 12px;
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-item {
  margin: 0 0 var(--gap);
  padding: var(--gap);
  background: var(--entry);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.post-item:first-child {
  margin-top: 0;
}

.post-item:last-child {
  margin-bottom: 0;
}

.post-link {
  font-family: var(--font);
  font-weight: 600;
  font-size: 24px;
  line-height: 1.3;
  color: var(--primary);
  box-shadow: none;
}

.post-link:hover {
  color: var(--primary);
  box-shadow: 0 1px 0 var(--primary);
}

.post-excerpt {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--secondary);
  line-height: 1.6;
}

article .article-list {
  margin: 0 0 var(--content-gap);
  padding-inline-start: 20px;
  color: var(--content);
}

article .article-list li {
  margin-top: 5px;
}

article .article-list li:first-child {
  margin-top: 0;
}

article .article-list li:last-child {
  margin-bottom: 0;
}

article ol.article-list {
  margin: 0 0 var(--content-gap);
  padding-inline-start: 20px;
}

article .article-list li p {
  margin-bottom: 0;
}

/* KaTeX: PaperMod / Lilian Weng–style — match prose color, no extra weight; MathJax there uses defaults only */
.katex {
  color: var(--content);
}

.katex-display {
  margin: 1.1em auto !important;
  overflow-x: auto;
  overflow-y: hidden;
}

.figure-block {
  margin: 24px 0;
  padding: var(--gap);
  background: var(--entry);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.figure-block h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--secondary);
  margin: 0 0 12px;
}

.figure-block canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  background: var(--code-bg);
}

.anim-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 16px;
  font-size: 14px;
}

.anim-controls button {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--entry);
  color: var(--primary);
  cursor: pointer;
}

.anim-controls button:hover {
  border-color: var(--tertiary);
  background: var(--code-bg);
}

.anim-controls button:active {
  transform: scale(0.99);
}

.anim-controls .hint {
  color: var(--secondary);
  font-size: 14px;
}

footer.site {
  margin-top: 40px;
  padding-top: calc((60px - var(--gap)) / 2);
  font-size: 12px;
  line-height: 24px;
  color: var(--secondary);
  text-align: center;
}

code {
  font-family: var(--mono);
  font-size: 0.78em;
  line-height: 1.5;
  background: var(--code-bg);
  padding: 4px 6px;
  margin: auto 2px;
  border-radius: 2px;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 32px;
  -webkit-overflow-scrolling: touch;
}

.article-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.article-table th,
.article-table td {
  min-width: 80px;
  padding: 6px 4px;
  line-height: 1.25;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.article-table th {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

.article-table td:last-child {
  font-variant-numeric: tabular-nums;
}

article pre {
  margin: 10px auto;
  padding: 0;
  background: var(--hljs-bg) !important;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.5;
}

article pre code {
  display: block;
  margin: 0;
  padding: 10px;
  color: #d5d5d6;
  background: transparent;
  font-size: inherit;
  border-radius: 2px;
  word-break: break-all;
  text-wrap: wrap;
}

article hr.divider {
  margin: 30px 0;
  height: 2px;
  background: var(--tertiary);
  border: none;
}

.figure-caption {
  margin: 10px 0 0;
  font-size: 15px;
  color: #888;
  line-height: 1.35;
  text-align: center;
}

.demo-slider-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 16px;
  font-size: 14px;
}

.demo-slider-row input[type="range"] {
  flex: 1;
  min-width: 140px;
  max-width: 280px;
  accent-color: var(--primary);
}

.head-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.head-picker button {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--entry);
  color: var(--primary);
  cursor: pointer;
}

.head-picker button:hover {
  background: var(--code-bg);
}

.head-picker button.is-active {
  border-color: var(--primary);
  background: var(--code-bg);
}

.post-deck {
  font-size: 16px;
  color: var(--secondary);
  margin: 10px 0 5px;
  line-height: 1.6;
}

.post-tldr {
  font-size: 15px;
  color: var(--content);
  margin: 0 0 1.25em;
  line-height: 1.65;
}

.section-tldr {
  font-size: 15px;
  color: var(--content);
  margin: 0 0 1.25em;
  padding: 12px 14px;
  border-inline-start: 3px solid var(--primary);
  background: var(--entry);
  line-height: 1.65;
}

.editor-note {
  margin: 14px 0;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--secondary);
  background: var(--code-bg);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  line-height: 1.55;
}

.post-byline {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--secondary);
}

article blockquote {
  margin: 20px 0;
  padding: 0 14px;
  border-inline-start: 3px solid var(--primary);
  color: var(--content);
}
