/* ==========================================================================
   blog.css — shared stylesheet for all blog posts
   Style: Distill.pub-inspired: serif body text, sans-serif headings and
   captions, a formal byline block, a sticky outline on the left, and
   margin notes on the right.

   Layout contract (used by every post):
     .content-margin-container  — one horizontal band of the article
       .margin-left-block       — outline column (first band only)
       .main-content-block      — the article column
       .margin-right-block      — margin note column
   ========================================================================== */

:root {
  --text: rgba(0, 0, 0, 0.84);
  --text-light: #5f6b76;
  --heading: #111827;
  --link: #0b6396;
  --link-hover: #1289c7;
  --border: #e5e7eb;
  --accent: #0b6396;
  --note-bg: #f5f7fa;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: #ffffff;
  color: var(--text);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.7;
}

/* --------------------------------------------------------------------------
   Three-column band layout
   -------------------------------------------------------------------------- */

.content-margin-container {
  display: flex;
  justify-content: center;
  gap: 36px;
  width: 100%;
  padding: 0 24px;
}

.margin-left-block {
  width: 165px;
  flex-shrink: 0;
  font-family: var(--sans);
  font-size: 13px;
}

.main-content-block {
  width: 100%;
  max-width: 680px;
  min-width: 0;
  padding: 10px 0;
}

.margin-right-block {
  width: 225px;
  flex-shrink: 0;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-light);
  padding: 14px 0;
}

.margin-right-block:not(:empty)::before {
  content: "";
  display: block;
  width: 28px;
  border-top: 2px solid var(--border);
  margin-bottom: 8px;
}

/* --------------------------------------------------------------------------
   Post header and byline
   -------------------------------------------------------------------------- */

.post-header .main-content-block {
  padding-top: 48px;
}

h1.post-title {
  font-family: var(--sans);
  font-size: 38px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--heading);
  margin: 0 0 24px;
}

.byline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 48px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text-light);
}

.byline-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 2px;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1 {
  font-family: var(--sans);
  font-size: 25px;
  font-weight: 700;
  color: var(--heading);
  line-height: 1.3;
  margin: 26px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

h2 {
  font-family: var(--sans);
  font-size: 19px;
  font-weight: 700;
  color: var(--heading);
  margin: 20px 0 6px;
}

p {
  margin: 0.7em 0;
}

ul {
  margin-top: 0.4em;
}

a:link,
a:visited {
  color: var(--link);
  text-decoration: none;
}

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

code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 4px;
}

hr {
  height: 1px;
  border: none;
  background-color: var(--border);
  margin: 28px 0;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: auto;
}

/* --------------------------------------------------------------------------
   Callouts
   -------------------------------------------------------------------------- */

div.hypothesis {
  background: var(--note-bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.6;
  margin: 22px 0;
  padding: 14px 18px;
  color: #1f2937;
}

.takeaway {
  border-left: 3px solid var(--accent);
  background: #fafafa;
  border-radius: 0 8px 8px 0;
  padding: 12px 18px;
  margin: 18px 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  color: #374151;
}

/* --------------------------------------------------------------------------
   Equations
   -------------------------------------------------------------------------- */

.equation {
  margin: 18px auto;
  padding: 4px 0;
  text-align: center;
  overflow-x: auto;
  color: var(--heading);
  font-size: 19px;
}

.equation math {
  font-family: var(--serif);
}

/* --------------------------------------------------------------------------
   Figures and tables
   -------------------------------------------------------------------------- */

.image-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  align-items: start;
  margin: 18px 0 6px;
}

.image-row.two {
  grid-template-columns: repeat(2, 1fr);
}

.panel-label {
  text-align: center;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--text-light);
  margin-top: 6px;
}

.figure-caption {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--text-light);
  line-height: 1.55;
  margin: 10px 0 22px;
}

.small-table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--sans);
  font-size: 13.5px;
  margin: 16px 0;
}

.small-table caption {
  caption-side: top;
  text-align: left;
  font-size: 13.5px;
  color: var(--text-light);
  margin-bottom: 8px;
  line-height: 1.55;
}

.small-table th {
  border-bottom: 2px solid #d1d5db;
  padding: 6px 8px;
  text-align: right;
  color: var(--heading);
}

.small-table td {
  border-bottom: 1px solid var(--border);
  padding: 6px 8px;
  text-align: right;
}

.small-table th:first-child,
.small-table td:first-child {
  text-align: left;
}

/* --------------------------------------------------------------------------
   Outline (table of contents)
   -------------------------------------------------------------------------- */

.toc {
  position: sticky;
  top: 48px;
  padding-top: 10px;
}

.toc-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 12px;
}

.toc a {
  display: block;
  color: var(--text-light);
  font-size: 13px;
  line-height: 1.5;
  padding: 4px 0;
  border-left: 2px solid transparent;
}

.toc a:hover {
  color: var(--heading);
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   References
   -------------------------------------------------------------------------- */

.citation {
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-light);
  padding: 10px 0;
}

.references-title {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--heading);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .margin-left-block {
    display: none;
  }
}

@media (max-width: 900px) {
  .content-margin-container {
    display: block;
    padding: 0 20px;
  }

  .main-content-block {
    max-width: 680px;
    margin: 0 auto;
  }

  .margin-left-block,
  .margin-right-block {
    display: none;
  }

  h1.post-title {
    font-size: 30px;
  }

  .image-row,
  .image-row.two {
    grid-template-columns: 1fr;
  }
}
