body {
  margin: 0;
  background: #ffffff;
  color: #111827;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}

.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 44px 20px 80px;
}

a {
  color: #1d4ed8;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

.citation {
  position: relative;
  white-space: nowrap;
}

.citation::after {
  position: absolute;
  left: 50%;
  bottom: 135%;
  z-index: 20;
  width: min(23rem, 82vw);
  padding: 0.6rem 0.7rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(17, 24, 39, 0.16);
  color: #111827;
  content: attr(data-cite);
  font-size: 0.86rem;
  font-weight: 400;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translate(-50%, 0.35rem);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: normal;
}

.citation:hover::after,
.citation:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.08;
  margin: 0.35em 0 0.2em;
}

.post-dek {
  color: #374151;
  font-size: 1.08rem;
  line-height: 1.55;
  margin: 0.45rem 0 0.7rem;
}

h2 {
  font-size: 1.65rem;
  line-height: 1.25;
  margin-top: 2.2em;
}

h3 {
  font-size: 1.25rem;
  line-height: 1.3;
  margin-top: 1.85em;
}

.post-part {
  border-top: 1px solid #e5e7eb;
  margin-top: 3.1rem;
  padding-top: 1.35rem;
}

.post-part h2 {
  margin-top: 0.1rem;
}

.part-label {
  color: #6b7280;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  margin: 0;
  text-transform: uppercase;
}

.entry-date {
  color: #6b7280;
  margin-bottom: 2.2em;
}

figure {
  margin: 2rem 0;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

figcaption {
  margin-top: 0.7rem;
  color: #4b5563;
  font-size: 0.95rem;
}

pre {
  overflow-x: auto;
  padding: 1rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.MathJax {
  font-size: 1.02em !important;
}

.algorithm {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 1rem 1.15rem;
  background: #fbfdff;
}

.algorithm figcaption {
  margin-top: 0;
  margin-bottom: 0.8rem;
  color: #111827;
  font-weight: 650;
}

.algorithm ol {
  margin: 0;
  padding-left: 1.4rem;
}

.algorithm li {
  margin: 0.45rem 0;
}

.latex-algorithm {
  overflow-x: auto;
}

.latex-algorithm .MathJax {
  min-width: max-content;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6rem 0;
  font-size: 0.95rem;
}

th,
td {
  border-bottom: 1px solid #e5e7eb;
  padding: 0.75rem 0.55rem;
  vertical-align: top;
}

th {
  text-align: left;
  font-weight: 650;
}

.experiment-details {
  margin: -0.7rem 0 1.8rem;
  padding: 0;
  color: #4b5563;
  font-size: 0.95rem;
}

.experiment-details summary {
  cursor: pointer;
  display: inline-block;
  font-weight: 550;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.experiment-details p {
  margin: 0.65rem 0;
}

.experiment-details p:last-child {
  margin-bottom: 0;
}

.caption-details {
  margin-top: 0.65rem;
}

.caption-details summary {
  cursor: pointer;
  display: inline-block;
  font-weight: 550;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.caption-details p {
  margin: 0.65rem 0;
}

.caption-details p:last-child {
  margin-bottom: 0;
}

.references {
  padding-left: 1.35rem;
  font-size: 0.94rem;
}

.references li {
  margin: 0.55rem 0;
}

/* Site override: make part boundaries visibly separated after sync. */
.post-part {
  border-top: 1px solid #cbd5e1;
  margin-top: 3.6rem;
  padding-top: 1.55rem;
}

.entry-date {
  border-bottom: 1px solid #cbd5e1;
  margin-bottom: 2.2em;
  padding-bottom: 1.35rem;
}

/* Site override: connect synced blog styles to the site theme toggle. */
body {
  background: var(--bg);
  color: var(--text);
}

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

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

.citation::after,
.algorithm {
  background: var(--soft);
  color: var(--text);
}

.post-dek,
.part-label,
.entry-date,
figcaption,
.experiment-details {
  color: var(--muted);
}

figure img,
.algorithm,
th,
td {
  border-color: var(--faint);
}

:root[data-theme="dark"] .MathJax {
  color: var(--text);
}
