/* Shared skin for lecture/blog pages generated under /blogs. */
body {
  --paper: #000000;
  --paper-dark: #0f0f0f;
  --panel-hover: #1a1a1a;
  --ink: #ffffff;
  --ink-2: #b8ff8f;
  --ink-3: #6f7c6f;
  --footer-bg: #000000;
  --footer-fg: #ffffff;
  --red: #ffffff;
  --green: #00ff41;
  --green-soft: rgba(0, 255, 65, 0.09);
  --green-glow: rgba(0, 255, 65, 0.35);
  --blue: #ffffff;
  --yellow: #66ff00;
  --rule: #1a4d1a;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

body.theme-bright {
  --paper: #ffffff;
  --paper-dark: #f5f5f5;
  --panel-hover: #ededed;
  --ink: #1a1a1a;
  --ink-2: #4a4a4a;
  --ink-3: #777777;
  --footer-bg: #1a1a1a;
  --footer-fg: #ffffff;
  --red: #00aa00;
  --green: #00aa00;
  --green-soft: rgba(0, 170, 0, 0.08);
  --green-glow: rgba(0, 170, 0, 0.24);
  --blue: #0066cc;
  --yellow: #ffaa00;
  --rule: #e0e0e0;
}

body.theme-dark {
  --paper: #000000;
  --paper-dark: #0f0f0f;
  --panel-hover: #1a1a1a;
  --ink: #ffffff;
  --ink-2: #b8ff8f;
  --ink-3: #6f7c6f;
  --footer-bg: #000000;
  --footer-fg: #ffffff;
  --red: #ffffff;
  --green: #00ff41;
  --green-soft: rgba(0, 255, 65, 0.09);
  --green-glow: rgba(0, 255, 65, 0.35);
  --blue: #ffffff;
  --yellow: #66ff00;
  --rule: #1a4d1a;
}

.blog-tape {
  background: var(--yellow);
  color: var(--ink);
  text-align: center;
  padding: 6px 16px;
  font-family: 'Caveat', cursive;
  font-size: 20px;
  border-bottom: 1px dashed rgba(0,0,0,0.15);
}

body.theme-dark .blog-tape {
  background: #000;
  color: #fff;
  border-bottom-color: #1a4d1a;
}

.blog-nav {
  max-width: 1700px;
}

.blog-lesson-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 56px;
  max-width: 1700px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

.blog-nav .brand::before {
  content: '* ';
  color: var(--green);
}

#page.post {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 0 0;
  min-width: 0;
}

#page.post::before {
  content: 'research note';
  display: inline-block;
  margin-bottom: 10px;
  color: var(--red);
  font-family: 'Caveat', cursive;
  font-size: 24px;
  transform: rotate(-0.8deg);
}

#page.post .title,
#page.post h1.title {
  color: var(--ink);
  font-family: 'Newsreader', serif;
  font-size: clamp(38px, 6vw, 68px);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.04;
  margin: 0 0 14px;
}

#page.post .post-date {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0 0 42px;
  padding: 5px 12px;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  background: var(--paper-dark);
  font-family: 'Caveat', cursive;
  font-size: 19px;
}

#page.post .share-buttons,
#page.post .twitter-share-button,
#page.post .linkedin-share-button,
#page.post .facebook-share-button,
#page.post .telegram-share-button,
#page.post .pinterest-share-button {
  display: none !important;
}

.lesson-map {
  margin: 8px 0 42px;
  padding: 22px 24px 24px;
  color: var(--ink);
  background: var(--paper-dark);
  border: 1.5px solid var(--ink);
  box-shadow: 6px 6px 0 var(--green);
}

.editorial-hook {
  margin: 8px 0 28px;
  padding: 20px 24px 18px;
  color: var(--ink);
  background: var(--paper-dark);
  border: 1.5px solid var(--ink);
  box-shadow: 6px 6px 0 var(--green);
}

.editorial-hook__eyebrow {
  color: var(--green);
  font-family: 'Caveat', cursive;
  font-size: 22px;
  line-height: 1;
}

#page.post .editorial-hook h2 {
  margin: 5px 0 10px;
  font-size: clamp(24px, 3vw, 34px);
}

#page.post .editorial-hook h2::before {
  content: none;
}

#page.post .editorial-hook p {
  margin-bottom: 12px;
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.6;
}

.editorial-hook__list {
  margin: 0;
  padding-left: 20px;
}

#page.post .editorial-hook__list li {
  margin: 0 0 6px;
  color: var(--ink);
  line-height: 1.45;
}

.lesson-map__eyebrow {
  color: var(--green);
  font-family: 'Caveat', cursive;
  font-size: 22px;
  line-height: 1;
}

#page.post .lesson-map h2 {
  margin: 4px 0 10px;
  font-size: clamp(24px, 3vw, 34px);
}

#page.post .lesson-map h2::before {
  content: none;
}

#page.post .lesson-map p {
  margin-bottom: 16px;
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.55;
}

.lesson-map__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  margin: 0;
  padding-left: 22px;
}

#page.post .lesson-map__list li {
  margin: 0;
  color: var(--green);
  font-size: 15px;
  line-height: 1.35;
}

.lesson-map__list a {
  color: var(--ink);
  text-decoration-thickness: 1px;
}

#page.post > div:last-of-type {
  border-top: 2px dashed var(--rule);
  padding-top: 34px;
}

#page.post p,
#page.post li {
  color: var(--ink);
  font-family: 'Atkinson Hyperlegible', sans-serif;
  font-size: 17px;
  line-height: 1.72;
}

#page.post p {
  margin: 0 0 22px;
}

#page.post h2,
#page.post h3,
#page.post h4 {
  color: var(--ink);
  font-family: 'Newsreader', serif;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.12;
  margin: 42px 0 14px;
}

#page.post h1:not(.title) {
  color: var(--ink);
  font-family: 'Newsreader', serif;
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.12;
  margin: 42px 0 14px;
}

#page.post h2 { font-size: clamp(30px, 4vw, 42px); }
#page.post h3 { font-size: clamp(24px, 3vw, 32px); }
#page.post h4 { font-size: 22px; }

#page.post h1:not(.title)::before,
#page.post h2::before,
#page.post h3::before {
  content: '# ';
  color: var(--green);
  font-family: 'Caveat', cursive;
}

#page.post a {
  color: var(--blue);
  text-decoration-color: var(--green);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}

#page.post a:hover {
  background: var(--paper-dark);
}

#page.post ul,
#page.post ol {
  margin: 0 0 26px 24px;
  padding-left: 18px;
}

#page.post li + li {
  margin-top: 8px;
}

#page.post strong {
  color: var(--ink);
}

#page.post hr {
  border: 0;
  border-top: 2px dashed var(--rule);
  margin: 42px 0;
}

#page.post img {
  display: block;
  width: min(100%, 680px);
  max-width: 100%;
  height: auto;
  margin: 28px auto;
  border: 1.5px solid var(--rule);
  background: #fff;
}

#page.post .highlight,
#page.post .chroma,
#page.post .lntable,
#page.post .lntd {
  max-width: 100%;
}

#page.post .highlight,
#page.post .chroma {
  overflow-x: auto;
}

#page.post .lntable {
  display: block;
}

.concept-diagram {
  margin: 34px auto 38px;
  padding: 0 0 2px;
  overflow: hidden;
  border: 1.5px solid var(--green);
  border-radius: 2px;
  background: var(--paper-dark);
  box-shadow: 6px 6px 0 var(--green);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.concept-diagram:hover {
  box-shadow: 8px 8px 0 var(--green);
  transform: translate(-2px, -2px);
}

.concept-diagram__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 24px 14px;
}

.scifig-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.concept-diagram__label {
  color: var(--green);
  font-family: 'Caveat', cursive;
  font-size: 20px;
  white-space: nowrap;
}

.scifig-eyebrow {
  color: var(--green);
}

.scifig-title {
  color: var(--ink);
  font-family: 'Newsreader', serif;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 500;
  line-height: 1.1;
  text-align: right;
}

#page.post .concept-diagram h3 {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
  text-align: right;
}

#page.post .concept-diagram h3::before {
  content: '';
}

.concept-diagram__stage {
  position: relative;
  overflow: hidden;
  min-height: 120px;
  margin: 0 16px;
  padding: 28px 22px;
  border: 0;
  border-radius: 2px;
  background: #ffffff;
}

.scifig-plate {
  position: relative;
}

.scifig-num {
  position: absolute;
  top: 10px;
  right: 14px;
  color: #666666;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  z-index: 2;
}

.concept-diagram--mixture-plot .concept-diagram__stage {
  background: #ffffff;
}

.concept-diagram.is-static .concept-diagram__stage,
.concept-diagram--cluster-figure .concept-diagram__stage,
.concept-diagram--latent-plate .concept-diagram__stage {
  background: #ffffff;
}

.concept-diagram svg,
.concept-diagram canvas {
  display: block;
  width: 100%;
  height: auto;
}

.plate-svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.diagram-panel-grid {
  display: grid;
  gap: 12px;
}

.diagram-panel-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.diagram-panel-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.diagram-panel-cell {
  min-width: 0;
  padding: 8px;
  border: 1px solid #e5e5e5;
  border-radius: 2px;
  background: #ffffff;
}

.diagram-panel-cell-label {
  margin-bottom: 2px;
  color: #666666;
  font-family: 'Newsreader', serif;
  font-size: 14px;
  font-style: italic;
  text-align: center;
}

#page.post .concept-diagram__caption,
.concept-diagram__status {
  color: var(--green);
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
  padding: 14px 24px 18px;
}

#page.post .scifig-caption {
  color: var(--green);
}

.concept-diagram__status {
  font-family: 'Atkinson Hyperlegible', sans-serif;
  color: var(--ink-2);
  padding-top: 0;
}

.concept-diagram__button {
  margin-top: 14px;
  padding: 5px 12px;
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: 'Caveat', cursive;
  font-size: 18px;
}

.scifig-btn {
  border: 1.5px solid var(--ink-2);
  border-radius: 4px;
  color: var(--ink);
  font-family: 'Caveat', cursive;
  font-size: 17px;
  padding: 5px 14px;
}

.scifig-btn.active,
.scifig-btn:hover {
  border-color: var(--green);
  color: var(--green);
  background: rgba(74, 222, 128, 0.12);
}

.concept-diagram__button:hover {
  background: var(--paper);
}

.concept-diagram__controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.scifig-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 22px 16px;
}

.scifig-controls.concept-diagram__controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 12px 24px 18px;
}

.concept-diagram__controls label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 10px;
  color: var(--ink-2);
  font-size: 14px;
  align-items: center;
}

.concept-diagram__control-label {
  color: var(--ink);
}

.concept-diagram__value {
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.concept-diagram__controls input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--green);
}

.diagram-node {
  stroke: #111111;
  stroke-width: 3;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.diagram-node--latent {
  fill: #ffffff;
}

.diagram-node--observed {
  fill: #f6fff1;
  stroke: var(--green);
}

body.theme-bright .diagram-node--observed {
  fill: #ffffff;
  stroke: var(--green);
}

.diagram-node-label,
.diagram-edge-label,
.diagram-plate-label {
  fill: #111111;
  font-family: 'Newsreader', serif;
  font-size: 28px;
}

.diagram-node-label {
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 3px;
  stroke-linejoin: round;
}

.diagram-edge-label,
.diagram-plate-label {
  fill: var(--ink-2);
  font-family: 'Atkinson Hyperlegible', sans-serif;
  font-size: 16px;
}

.diagram-arrow,
.diagram-flow,
.diagram-reverse {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 260;
  animation: diagram-draw 2.8s ease-in-out infinite;
}

.diagram-arrowhead {
  fill: var(--ink);
}

.concept-diagram--bayes-graph .diagram-arrow,
.concept-diagram--bayes-graph .diagram-flow {
  stroke: #111111;
}

.concept-diagram--bayes-graph .diagram-arrowhead {
  fill: #111111;
}

.diagram-plate {
  fill: transparent;
  stroke: var(--rule);
  stroke-width: 2;
  stroke-dasharray: 8 8;
}

.diagram-paper-node {
  stroke: #111111;
  stroke-width: 2.5;
}

.diagram-paper-node--latent {
  fill: #ffffff;
}

.diagram-paper-node--observed {
  fill: #e6e6e6;
  stroke-dasharray: 5 4;
}

.diagram-paper-node--observed-red {
  fill: #e23a3a;
  stroke: #e23a3a;
}

.diagram-paper-plate {
  fill: transparent;
  stroke: #111111;
  stroke-width: 2;
}

.diagram-paper-edge {
  stroke: #111111;
  stroke-width: 2;
  opacity: 0.78;
}

.diagram-paper-box,
.diagram-paper-node--latent-box {
  fill: #ffffff;
  stroke: #111111;
  stroke-width: 2;
}

.diagram-paper-box--agent {
  fill: #2d8c50;
  stroke: #111111;
}

.diagram-paper-box--environment {
  fill: #3b4ba3;
  stroke: #111111;
}

.diagram-paper-node--latent-box {
  fill: #f4f4f4;
  stroke-dasharray: 6 5;
}

.diagram-paper-output {
  fill: #f7fbff;
}

.diagram-paper-arrow {
  fill: none;
  stroke: #111111;
  stroke-width: 2.3;
  stroke-linecap: round;
}

.diagram-paper-arrow--thin {
  stroke-width: 1.6;
  opacity: 0.8;
}

.diagram-paper-arrowhead {
  fill: #111111;
}

.concept-diagram--single-plate .diagram-paper-arrow,
.concept-diagram--iid-plate .diagram-paper-arrow {
  stroke: #111111;
  opacity: 0.95;
}

.concept-diagram--single-plate .diagram-paper-arrowhead,
.concept-diagram--iid-plate .diagram-paper-arrowhead {
  fill: #111111;
}

.concept-diagram--single-plate .diagram-paper-node--observed-red,
.concept-diagram--iid-plate .diagram-paper-node--observed-red {
  fill: #ffffff;
  stroke: var(--green);
}

.concept-diagram--single-plate .diagram-paper-math--white,
.concept-diagram--iid-plate .diagram-paper-math--white,
.concept-diagram--single-plate .diagram-paper-math--white .diagram-paper-math-symbol,
.concept-diagram--single-plate .diagram-paper-math--white .diagram-paper-math-sub,
.concept-diagram--iid-plate .diagram-paper-math--white .diagram-paper-math-symbol,
.concept-diagram--iid-plate .diagram-paper-math--white .diagram-paper-math-sub {
  fill: #111111;
}

.diagram-paper-dot {
  fill: #1f77b4;
}

.diagram-table {
  fill: #ffffff;
  stroke: #111111;
  stroke-width: 2;
}

.diagram-table-customer {
  stroke: #ffffff;
  stroke-width: 2;
}

.diagram-attention-matrix {
  fill: #fbfcff;
}

.diagram-attention-cell {
  fill: #111111;
}

.concept-diagram--sequence-figure .diagram-step {
  opacity: 0;
  animation-duration: 8.5s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

.concept-diagram--sequence-figure .diagram-step--1 { animation-name: sequence-step-1; }
.concept-diagram--sequence-figure .diagram-step--link-1 { animation-name: sequence-step-link-1; }
.concept-diagram--sequence-figure .diagram-step--2 { animation-name: sequence-step-2; }
.concept-diagram--sequence-figure .diagram-step--link-2 { animation-name: sequence-step-link-2; }
.concept-diagram--sequence-figure .diagram-step--3 { animation-name: sequence-step-3; }
.concept-diagram--sequence-figure .diagram-step--link-3 { animation-name: sequence-step-link-3; }
.concept-diagram--sequence-figure .diagram-step--4 { animation-name: sequence-step-4; }
.concept-diagram--sequence-figure .diagram-step--link-4 { animation-name: sequence-step-link-4; }
.concept-diagram--sequence-figure .diagram-step--5 { animation-name: sequence-step-5; }

@keyframes sequence-step-1 {
  0%, 3% { opacity: 0; transform: translateY(8px); }
  8%, 92% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(0); }
}

@keyframes sequence-step-link-1 {
  0%, 12% { opacity: 0; transform: translateX(-8px); }
  17%, 92% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(0); }
}

@keyframes sequence-step-2 {
  0%, 20% { opacity: 0; transform: translateY(8px); }
  25%, 92% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(0); }
}

@keyframes sequence-step-link-2 {
  0%, 30% { opacity: 0; transform: translateX(-8px); }
  35%, 92% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(0); }
}

@keyframes sequence-step-3 {
  0%, 38% { opacity: 0; transform: translateY(8px); }
  43%, 92% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(0); }
}

@keyframes sequence-step-link-3 {
  0%, 50% { opacity: 0; transform: translateX(-8px); }
  55%, 92% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(0); }
}

@keyframes sequence-step-4 {
  0%, 58% { opacity: 0; transform: translateY(8px); }
  63%, 92% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(0); }
}

@keyframes sequence-step-link-4 {
  0%, 70% { opacity: 0; transform: translateX(-8px); }
  75%, 92% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(0); }
}

@keyframes sequence-step-5 {
  0%, 78% { opacity: 0; transform: translateY(8px); }
  83%, 92% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(0); }
}

.diagram-paper-label,
.diagram-paper-param,
.diagram-paper-small,
.diagram-paper-math {
  fill: #111111;
  font-family: 'Newsreader', serif;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -0.01em;
  text-rendering: geometricPrecision;
}

.diagram-paper-label {
  font-size: 28px;
  font-style: italic;
  font-weight: 500;
}

.diagram-paper-label--large {
  font-size: 40px;
}

.diagram-paper-label--white,
.diagram-paper-math--white,
.diagram-paper-math--white .diagram-paper-math-symbol,
.diagram-paper-math--white .diagram-paper-math-sub {
  fill: #ffffff;
  stroke: none;
}

.diagram-paper-param {
  font-size: 24px;
  font-style: italic;
  font-weight: 500;
}

.diagram-paper-small {
  font-size: 16px;
  font-style: italic;
  font-weight: 450;
}

.diagram-paper-math {
  dominant-baseline: middle;
  font-size: 25px;
  text-anchor: middle;
}

.diagram-paper-math--left {
  text-anchor: start;
  font-size: 22px;
}

.diagram-paper-math-symbol {
  font-style: italic;
  font-weight: 520;
}

.diagram-paper-math-sub {
  font-size: 13px;
  font-style: normal;
  font-weight: 500;
}

.diagram-paper-label--small {
  font-size: 24px;
}

.diagram-paper-note {
  fill: #666666;
  font-family: 'Caveat', cursive;
  font-size: 20px;
  font-style: normal;
}

.diagram-paper-note--green { fill: #2d8c50; }
.diagram-paper-note--orange { fill: #e8693f; }
.diagram-paper-note--pink { fill: #c44488; }
.diagram-paper-note--purple { fill: #7e4dc8; }
.diagram-paper-note--red { fill: #c4453a; }

.diagram-figure-cross {
  fill: none;
  stroke: #2b78d6;
  stroke-linecap: round;
  stroke-width: 2.2;
}

.diagram-figure-mean {
  fill: #2d8c50;
}

.diagram-figure-axis {
  stroke: #7e4dc8;
  stroke-linecap: round;
  stroke-width: 2.6;
}

.diagram-figure-axis-line {
  stroke: #111111;
  stroke-linecap: round;
  stroke-width: 2.2;
}

.diagram-figure-axis-line--blue {
  stroke: #3b6cb8;
}

.diagram-figure-arrowhead {
  fill: #111111;
}

.diagram-figure-arrowhead--purple {
  fill: #7e4dc8;
}

.diagram-figure-curve,
.diagram-gp-path {
  fill: none;
  stroke: #2d8c50;
  stroke-linecap: round;
  stroke-width: 3;
}

.diagram-gp-path {
  stroke: #111111;
}

.diagram-figure-guide {
  stroke: #111111;
  stroke-dasharray: 4 4;
  stroke-width: 1.3;
}

.diagram-figure-guide--pink,
.diagram-figure-tick.diagram-figure-guide--pink {
  stroke: #c44488;
  stroke-dasharray: none;
  stroke-width: 2;
}

.diagram-figure-guide--red {
  stroke: #c4453a;
}

.diagram-figure-chord {
  stroke: #7e4dc8;
  stroke-linecap: round;
  stroke-width: 2.8;
}

.diagram-figure-chord-dot {
  fill: #7e4dc8;
}

.diagram-figure-mid-dot {
  fill: #c4453a;
}

.diagram-mini-axis {
  stroke: #333333;
  stroke-width: 0.9;
}

.diagram-mini-truth,
.diagram-mini-mean {
  fill: none;
  stroke-linecap: round;
  stroke-width: 2;
}

.diagram-mini-truth {
  stroke: #2d8c50;
}

.diagram-mini-mean {
  stroke: #c4453a;
}

.diagram-mini-observation {
  fill: #ffffff;
  stroke: #3b6cb8;
  stroke-width: 1.5;
}

.diagram-figure-draw {
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: diagram-figure-draw 2.8s ease-out forwards;
}

.diagram-paper-math--sequence {
  font-size: 28px;
}

.diagram-comparison-table {
  width: 100%;
  border-collapse: collapse;
  color: #111111;
  background: #ffffff;
  font-family: 'Atkinson Hyperlegible', sans-serif;
}

.diagram-comparison-table th,
.diagram-comparison-table td {
  padding: 13px 16px;
  border-right: 1.5px solid #111111;
  text-align: left;
  vertical-align: top;
}

.diagram-comparison-table th:last-child,
.diagram-comparison-table td:last-child {
  border-right: 0;
}

.diagram-comparison-table th {
  border-bottom: 1.5px solid #111111;
  font-size: 19px;
  font-weight: 700;
}

.diagram-comparison-table td {
  font-size: 17px;
  line-height: 1.35;
}

.diagram-plate-draw {
  stroke-dasharray: 450;
  stroke-dashoffset: 450;
  animation: diagram-plate-draw 3.8s ease-in-out infinite;
}

.concept-diagram--iid-plate .diagram-copy {
  opacity: 0;
  animation: diagram-fade-copy 3.8s ease-in-out infinite;
}

.concept-diagram--iid-plate .diagram-copy--1 { animation-delay: 0.2s; }
.concept-diagram--iid-plate .diagram-copy--2 { animation-delay: 0.65s; }
.concept-diagram--iid-plate .diagram-copy--3 { animation-delay: 1.1s; }
.concept-diagram--iid-plate .diagram-copy--4 { animation-delay: 1.55s; }

.diagram-simplex-base {
  fill: #fff9ba;
  stroke: #111111;
  stroke-width: 1.5;
}

.diagram-simplex-contour {
  fill: none;
  stroke: #e23a3a;
  stroke-width: 2;
  animation: diagram-contour-pulse 4.2s ease-in-out infinite;
}

.diagram-simplex-dot {
  fill: #111111;
  animation: diagram-dot-pulse 4.2s ease-in-out infinite;
}

.diagram-loop-action,
.diagram-loop-state,
.diagram-loop-reward {
  stroke-dasharray: 520;
  stroke-dashoffset: 520;
  animation: diagram-loop-draw 5.4s ease-in-out infinite;
}

.diagram-loop-state { animation-delay: 1.1s; }
.diagram-loop-reward { animation-delay: 2s; }

.diagram-copy {
  opacity: 0;
  transform: translateX(-20px);
}

.concept-diagram.is-expanded .diagram-copy {
  opacity: 1;
  transform: translateX(0);
}

.diagram-reverse,
.diagram-reverse-label {
  opacity: 0.2;
}

.concept-diagram.is-inference .diagram-flow,
.concept-diagram.is-inference .diagram-forward-label {
  opacity: 0.2;
}

.concept-diagram.is-inference .diagram-reverse,
.concept-diagram.is-inference .diagram-reverse-label {
  opacity: 1;
}

@keyframes diagram-draw {
  0% { stroke-dashoffset: 260; }
  45%, 100% { stroke-dashoffset: 0; }
}

@keyframes diagram-plate-draw {
  0%, 12% { stroke-dashoffset: 450; }
  42%, 86% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 450; }
}

@keyframes diagram-fade-copy {
  0%, 32% { opacity: 0; transform: translateY(6px); }
  48%, 86% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(0); }
}

@keyframes diagram-contour-pulse {
  0%, 100% { transform: scale(0.985); opacity: 0.38; }
  50% { transform: scale(1); opacity: 0.92; }
}

@keyframes diagram-dot-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

@keyframes diagram-loop-draw {
  0%, 12% { stroke-dashoffset: 520; }
  45%, 82% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -520; }
}

@keyframes diagram-figure-draw {
  to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .diagram-arrow,
  .diagram-flow,
  .diagram-reverse,
  .concept-diagram--sequence-figure .diagram-step,
  .diagram-plate-draw,
  .concept-diagram--iid-plate .diagram-copy,
  .diagram-simplex-contour,
  .diagram-simplex-dot,
  .diagram-loop-action,
  .diagram-loop-state,
  .diagram-loop-reward,
  .diagram-figure-draw {
    animation: none;
    opacity: 1;
    transform: none;
    stroke-dashoffset: 0;
  }
}

@media (max-width: 700px) {
  .diagram-panel-grid--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .diagram-panel-grid--2,
  .diagram-panel-grid--3 {
    grid-template-columns: 1fr;
  }
}

#page.post table {
  width: 100%;
  border-collapse: collapse;
  margin: 28px 0;
  color: var(--ink);
}

#page.post th,
#page.post td {
  border-bottom: 1px dashed var(--rule);
  padding: 10px;
  text-align: left;
}

#page.post code,
#page.post pre {
  color: var(--ink);
  background: var(--paper-dark);
  border: 1px solid var(--rule);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

#page.post code {
  padding: 2px 5px;
}

#page.post pre {
  overflow-x: auto;
  padding: 16px;
  margin: 28px 0;
}

mjx-container {
  color: var(--ink) !important;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
}

.blog-footer {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 32px 56px;
  border-top: 1px dashed var(--rule);
  color: var(--ink-2);
  font-size: 14px;
}

.blog-footer a {
  color: var(--blue);
  text-decoration-color: var(--green);
  text-underline-offset: 4px;
}

.post-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1.5px dashed var(--rule);
}

.post-nav-card {
  display: block;
  min-width: 0;
  padding: 16px 20px;
  color: var(--ink);
  background: var(--paper-dark);
  border: 1.5px solid var(--rule);
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.post-nav-card:hover {
  border-color: var(--green);
  box-shadow: 4px 4px 0 var(--green);
  transform: translate(-2px, -2px);
}

.post-nav-card.next {
  text-align: right;
}

.post-nav-card-eyebrow,
.post-nav-card-title {
  display: block;
}

.post-nav-card-eyebrow {
  margin-bottom: 4px;
  color: var(--green);
  font-family: 'Caveat', cursive;
  font-size: 18px;
  line-height: 1;
}

.post-nav-card-title {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.playlist-wrap {
  position: sticky;
  top: 24px;
  align-self: start;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  min-width: 0;
}

.playlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  background: var(--paper-dark);
  border: 1.5px solid var(--rule);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.playlist-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
  font-family: 'Newsreader', serif;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.15;
}

.playlist-icon {
  flex: 0 0 auto;
  color: var(--green);
  font-family: 'Atkinson Hyperlegible', sans-serif;
  font-size: 20px;
  line-height: 1;
}

.playlist-progress {
  flex: 0 0 auto;
  color: var(--ink-2);
  font-family: 'Caveat', cursive;
  font-size: 18px;
  line-height: 1;
}

.playlist-progress .current-num {
  color: var(--green);
  font-weight: 700;
}

.playlist-subhead {
  padding: 0 20px 14px;
  color: var(--ink-3);
  background: var(--paper-dark);
  border-left: 1.5px solid var(--rule);
  border-right: 1.5px solid var(--rule);
  font-family: 'Caveat', cursive;
  font-size: 16px;
  line-height: 1.2;
}

.playlist-subhead a {
  color: var(--green);
  text-decoration: none;
}

.playlist-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  background: var(--paper-dark);
  border: 1.5px solid var(--rule);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  scrollbar-color: var(--rule) transparent;
  scrollbar-width: thin;
}

.playlist-body::-webkit-scrollbar {
  width: 6px;
}

.playlist-body::-webkit-scrollbar-track {
  background: transparent;
}

.playlist-body::-webkit-scrollbar-thumb {
  background: var(--rule);
  border-radius: 3px;
}

.playlist-body::-webkit-scrollbar-thumb:hover {
  background: var(--green);
}

.pl-section-head {
  margin-top: 6px;
  padding: 14px 16px 6px;
  color: var(--green);
  border-top: 1px dashed var(--rule);
  font-family: 'Caveat', cursive;
  font-size: 17px;
  letter-spacing: 0;
  line-height: 1.1;
}

.pl-section-head:first-child {
  margin-top: 0;
  padding-top: 10px;
  border-top: 0;
}

.pl-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  color: var(--ink);
  background: transparent;
  border-left: 3px solid transparent;
  text-decoration: none;
  transition: background 120ms ease;
}

.pl-item:hover {
  background: var(--panel-hover);
}

.pl-num {
  color: var(--ink-3);
  font-family: 'Caveat', cursive;
  font-size: 16px;
  line-height: 1;
  text-align: center;
}

.pl-content {
  min-width: 0;
}

.pl-title {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.pl-meta {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
  font-family: 'Caveat', cursive;
  font-size: 14px;
  line-height: 1.1;
}

.pl-duration {
  white-space: nowrap;
  padding: 2px 6px;
  color: var(--ink-3);
  background: var(--paper);
  border-radius: 3px;
  font-family: 'Atkinson Hyperlegible', sans-serif;
  font-size: 11px;
  line-height: 1.3;
}

.pl-item.watched .pl-num {
  color: var(--green);
  font-family: 'Atkinson Hyperlegible', sans-serif;
  font-size: 13px;
}

.pl-item.watched .pl-num::before {
  content: '\2713';
}

.pl-item.watched .pl-title {
  color: var(--ink-2);
}

.pl-item.current {
  background: var(--green-soft);
  border-left-color: var(--green);
}

.pl-item.current:hover {
  background: var(--green-soft);
}

.pl-item.current .pl-num {
  color: var(--green);
  font-family: 'Atkinson Hyperlegible', sans-serif;
  font-size: 11px;
  filter: drop-shadow(0 0 4px var(--green-glow));
}

.pl-item.current .pl-num::before {
  content: '\25b6';
}

.pl-item.current .pl-title {
  color: var(--green);
}

.pl-now-playing {
  display: block;
  margin-top: 2px;
  color: var(--green);
  font-family: 'Caveat', cursive;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.1;
}

.pl-now-playing::before {
  content: '* ';
}

.up-next-strip {
  display: block;
  margin-top: 12px;
  padding: 16px 18px;
  color: var(--ink);
  background: var(--paper-dark);
  border: 1.5px solid var(--green);
  border-radius: 4px;
  box-shadow: 4px 4px 0 var(--green);
  text-decoration: none;
}

.up-next-eyebrow,
.up-next-title,
.up-next-meta {
  display: block;
}

.up-next-eyebrow {
  margin-bottom: 4px;
  color: var(--green);
  font-family: 'Caveat', cursive;
  font-size: 16px;
  line-height: 1;
}

.up-next-eyebrow::before {
  content: '\25b6 ';
  font-family: 'Atkinson Hyperlegible', sans-serif;
  font-size: 11px;
}

.up-next-title {
  margin-bottom: 6px;
  color: var(--ink);
  font-family: 'Newsreader', serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
}

.up-next-strip:hover .up-next-title {
  color: var(--green);
}

.up-next-meta {
  color: var(--ink-2);
  font-family: 'Caveat', cursive;
  font-size: 15px;
  line-height: 1.1;
}

@media (max-width: 1100px) {
  .blog-lesson-layout {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 32px 20px 80px;
  }

  .playlist-wrap {
    position: static;
    max-height: none;
    order: 99;
  }

  .playlist-body {
    max-height: 480px;
  }
}

@media (max-width: 720px) {
  #page.post {
    padding-top: 6px;
  }

  #page.post .post-date {
    font-size: 17px;
  }

  #page.post p,
  #page.post li {
    font-size: 16px;
  }

  .concept-diagram__head {
    align-items: flex-start;
    flex-direction: column;
  }

  #page.post .concept-diagram h3 {
    text-align: left;
  }

  .scifig-title {
    text-align: left;
    font-size: 19px;
  }

  .concept-diagram__controls {
    grid-template-columns: 1fr;
  }

  .scifig-controls.concept-diagram__controls {
    grid-template-columns: 1fr;
  }

  .post-nav {
    grid-template-columns: 1fr;
  }

  .post-nav-card.next {
    text-align: left;
  }

  .playlist-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 900px) {
  .blog-nav {
    padding: 16px 20px;
    position: relative;
    gap: 12px;
    align-items: center;
  }

  .blog-nav .nav-right {
    display: flex;
    gap: 8px;
    margin-left: auto;
  }

  .blog-nav .brand {
    font-size: 22px;
  }

  .blog-nav .menu-toggle {
    display: inline-flex;
  }

  .blog-nav .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 20px;
    z-index: 20;
    width: min(220px, calc(100vw - 40px));
    padding: 10px;
    background: var(--paper);
    border: 1.5px solid var(--ink);
    box-shadow: 4px 4px 0 var(--green);
  }

  body.nav-open .blog-nav .nav-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
}
