.blog-post-layout > .blog-sidebar,
.blog-post-layout > .blog-post-content {
  min-width: 0;
}

.blog-post-content .post-series-nav {
  flex-wrap: wrap;
}

.blog-post-content .katex-display {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.2rem;
}

.note-figure {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 1.4rem 0;
  padding: 1rem 1.1rem;
  text-align: center;
}

.note-figure svg {
  height: auto;
  max-width: 100%;
}

.note-figure figcaption {
  color: var(--ink-muted);
  font-size: 0.84rem;
  font-style: italic;
  margin-top: 0.6rem;
}

.key-eq {
  background: rgba(10, 143, 106, 0.06);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 1.1rem 0;
  overflow-x: auto;
  padding: 0.6rem 1rem;
}

.df-controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0.85rem 0;
}

.df-controls label {
  color: var(--ink-muted);
  font: 700 0.8rem/1.4 "Manrope", sans-serif;
}

.df-controls input[type="range"] {
  accent-color: var(--brand);
  min-width: 165px;
}

.df-metrics {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 1rem 0;
}

.df-metric {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
  padding: 0.78rem;
  text-align: center;
}

.df-metric strong {
  color: var(--brand);
  display: block;
  font: 800 1.08rem/1.25 "Syne", sans-serif;
  overflow-wrap: anywhere;
}

.df-metric span {
  color: var(--ink-muted);
  font-size: 0.72rem;
}

.df-two-col {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 1rem 0;
}

.df-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
  padding: 0.9rem 1rem;
}

.df-panel h3 {
  color: var(--brand);
  font-family: "Syne", sans-serif;
  margin: 0 0 0.35rem;
}

.df-table-wrap {
  margin: 1rem 0;
  max-width: 100%;
  overflow-x: auto;
}

.df-table {
  border-collapse: collapse;
  font-size: 0.86rem;
  width: 100%;
}

.df-table th,
.df-table td {
  border: 1px solid var(--line);
  padding: 0.62rem;
  text-align: left;
  vertical-align: top;
}

.df-table th {
  background: rgba(10, 143, 106, 0.08);
  color: var(--brand);
  font-family: "Syne", sans-serif;
}

.df-status {
  background: rgba(10, 143, 106, 0.05);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-muted);
  font-size: 0.86rem;
  min-height: 2.5rem;
  padding: 0.7rem 0.85rem;
}

.df-flow {
  align-items: stretch;
  display: grid;
  gap: 0.55rem;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  margin: 1rem 0;
}

.df-flow-node {
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 92px;
  padding: 0.7rem;
  text-align: center;
}

.df-flow-node strong {
  color: var(--brand);
  font-family: "Syne", sans-serif;
}

.df-flow-node span {
  color: var(--ink-muted);
  font-size: 0.78rem;
  margin-top: 0.2rem;
}

.df-flow-arrow {
  align-items: center;
  color: var(--brand-2);
  display: flex;
  font-size: 1.4rem;
  font-weight: 800;
}

.df-algorithm {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 1.1rem 0;
  overflow: hidden;
}

.df-algorithm-title {
  background: #1a2b22;
  color: #d4e8dc;
  font: 800 0.94rem/1.4 "Syne", sans-serif;
  padding: 0.8rem 1rem;
}

.df-algorithm-body {
  padding: 0.8rem 1rem 1rem;
}

.df-algorithm-line {
  align-items: baseline;
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 1.4rem minmax(0, 1fr);
  padding: 0.38rem 0;
}

.df-algorithm-line.indent {
  border-left: 3px solid var(--brand);
  margin-left: 0.6rem;
  padding-left: 0.75rem;
}

.df-algorithm-number {
  color: var(--ink-muted);
  font: 700 0.72rem/1.4 "Manrope", sans-serif;
  text-align: right;
}

.df-algorithm-keyword {
  color: var(--brand-2);
  font-weight: 800;
}

.df-figure-svg {
  height: auto;
  max-width: 100%;
  width: 100%;
}

.l2-definition {
  background: linear-gradient(135deg, rgba(10, 143, 106, 0.07), rgba(58, 123, 213, 0.05));
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  margin: 1.1rem 0;
  padding: 0.85rem 1rem;
}

.l2-definition strong:first-child {
  color: var(--brand);
  font-family: "Syne", sans-serif;
}

.l2-equation-chain {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 1.1rem 0;
  overflow: hidden;
}

.l2-equation-step {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0.8rem;
  grid-template-columns: 2rem minmax(0, 1fr);
  padding: 0.85rem 1rem;
}

.l2-equation-step:last-child {
  border-bottom: 0;
}

.l2-equation-step > strong {
  align-items: center;
  background: var(--brand);
  border-radius: 50%;
  color: white;
  display: flex;
  font: 800 0.78rem/1 "Syne", sans-serif;
  height: 2rem;
  justify-content: center;
  width: 2rem;
}

.l2-equation-step p {
  margin: 0.1rem 0 0.35rem;
}

.l2-posterior-bars {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0.9rem 0;
}

.l2-posterior-bar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  padding: 0.65rem;
  text-align: left;
}

.l2-posterior-bar > span {
  color: var(--ink-muted);
  display: block;
  font-size: 0.74rem;
}

.l2-posterior-bar > strong {
  color: var(--brand);
  font-family: "Syne", sans-serif;
}

.l2-bar-track {
  background: rgba(107, 122, 114, 0.14);
  border-radius: 999px;
  height: 8px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.l2-bar-fill {
  background: var(--brand);
  border-radius: inherit;
  height: 100%;
  transition: width 120ms ease;
}

.l2-bar-fill.alt {
  background: var(--brand-2);
}

.l2-proof-note {
  border-left: 3px solid var(--brand-2);
  color: var(--ink-muted);
  margin: 1rem 0;
  padding: 0.2rem 0 0.2rem 0.9rem;
}

.l2-legend {
  align-items: center;
  color: var(--ink-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.76rem;
  gap: 0.8rem;
  justify-content: center;
  margin: 0.6rem 0;
}

.l2-legend span {
  align-items: center;
  display: inline-flex;
  gap: 0.3rem;
}

.l2-swatch {
  border-radius: 999px;
  display: inline-block;
  height: 4px;
  width: 20px;
}

.l2-swatch.green { background: #0a8f6a; }
.l2-swatch.blue { background: #3a7bd5; }
.l2-swatch.gold { background: #c98a2b; }
.l2-swatch.gray { background: #9eaaa4; }

.l2-takeaway {
  align-items: center;
  background: #1a2b22;
  border-radius: 12px;
  color: #d4e8dc;
  display: grid;
  gap: 0.8rem;
  grid-template-columns: auto minmax(0, 1fr);
  margin: 1.2rem 0;
  padding: 1rem;
}

.l2-takeaway > strong {
  color: #8ee0bd;
  font: 800 0.82rem/1.3 "Syne", sans-serif;
  text-transform: uppercase;
}

.l2-takeaway p {
  margin: 0;
}

.l2-warning {
  background: rgba(201, 138, 43, 0.08);
  border: 1px solid rgba(201, 138, 43, 0.3);
  border-radius: 10px;
  margin: 1rem 0;
  padding: 0.8rem 1rem;
}

.l2-solution {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 0.8rem 0;
  padding: 0.85rem 1rem;
}

.l2-solution summary {
  cursor: pointer;
  font-weight: 700;
}

.l2-solution summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
}

.l2-solution[open] summary {
  margin-bottom: 0.75rem;
}

.l2-solution p:last-child {
  margin-bottom: 0;
}

@media (max-width: 680px) {
  .df-metrics,
  .df-two-col,
  .l2-posterior-bars {
    grid-template-columns: 1fr;
  }

  .df-flow {
    grid-template-columns: 1fr;
  }

  .df-flow-arrow {
    justify-content: center;
    transform: rotate(90deg);
  }

  .df-controls input[type="range"] {
    flex: 1 1 145px;
    min-width: 120px;
  }

  .df-table {
    table-layout: fixed;
  }

  .df-table th,
  .df-table td {
    overflow-wrap: anywhere;
    padding: 0.45rem 0.35rem;
  }

  .l2-equation-step {
    grid-template-columns: 1fr;
  }

  .l2-takeaway {
    grid-template-columns: 1fr;
  }
}

.path-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: .75rem; align-items: center; }
.path-layout > svg { width: 100%; min-width: 0; }
.path-formulas { display: grid; gap: .75rem; min-width: 0; margin: 0; }
.path-formula-panel { background: rgba(201,138,43,.09); border: 1px solid var(--line); border-radius: 10px; padding: .7rem; text-align: left; min-width: 0; }
.path-formula-panel h3 { margin: 0 0 .5rem; font-size: .95rem; }
.path-orange { color: #a76e17; font-weight: 700; }
.path-green { color: #0a8f6a; font-weight: 700; }
.path-marginal-card h3 { color: #3a7bd5; }
.path-formula-panel p { margin: .45rem 0; font-size: .8rem; line-height: 1.5; }
.path-formula-panel .katex-display { font-size: .8rem; margin: .5rem 0; }
.path-formula-panel [hidden] { display: none !important; }
@media (max-width: 700px) { .path-layout { grid-template-columns: minmax(0, 1fr); } }

.six-formulas { table-layout: fixed; min-width: 740px; }
.six-formulas th:first-child { width: 19%; }
.six-formulas .katex-display { font-size: .76rem; margin: .4rem 0; }

.six-formula-wrap { width: 100%; position: relative; contain: inline-size layout paint; }

#marginal-left-bar { background: #c98a2b; }
#marginal-right-bar { background: #0a8f6a; }
#marginal-cloud-state { font-size: .85rem; line-height: 1.5; text-align: left; }

.marginal-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem .65rem; flex: 1 1 240px; min-width: 0; text-align: left; }
.marginal-control label { grid-column: 1 / -1; }
.marginal-control input[type="range"] { width: 100%; min-width: 0; }
