/* Lecture reading enrichment — figures, charts, result cards, anchors, copy.
 *
 * Loaded on lecture + episode pages. Flat & sharp: border-radius 0, no shadows.
 * Uses only tokens.css custom properties. All selectors are scoped under
 * .lecture-body (or globally inert) so non-lecture pages are unaffected.
 */

/* ---- Figures (lecture.js wraps each .lecture-body img) ---- */
.lecture-figure {
  margin: 1.75rem 0;
  text-align: center;
}
.lecture-figure img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border: 1px solid var(--ink-12);
  cursor: zoom-in;
}
.lecture-figure figcaption {
  font: 0.85rem/1.5 var(--font-mono);
  color: var(--ink-60);
  margin-top: 0.5rem;
  text-align: center;
}

/* Bare images that have not (yet) been wrapped — keep them tidy. */
.lecture-body img {
  max-width: 100%;
  height: auto;
}

/* ---- Lightbox overlay ---- */
.lecture-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: zoom-out;
}
.lecture-lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ---- Interactive charts (markdown ```chart fence) ---- */
.lecture-chart {
  margin: 1.75rem 0;
}
.lecture-chart .lecture-chart-mount {
  width: 100%;
}
.lecture-chart figcaption {
  font: 0.85rem/1.5 var(--font-mono);
  color: var(--ink-60);
  margin-top: 0.5rem;
}

/* ---- Key-result card: > [!result] ---- */
.lecture-body .callout-result {
  border: 1px solid var(--ink-12);
  border-left: 4px solid var(--mint);
  background: var(--surface-alt);
  padding: 0.85rem 1.1rem;
  margin: 1.5rem 0;
}
.lecture-body .callout-result .callout-title {
  font: 600 0.78rem/1.3 var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-60);
  margin-bottom: 0.4rem;
}
.lecture-body .callout-result .callout-body {
  color: var(--ink);
}
.lecture-body .callout-result .callout-body strong {
  color: var(--primary);
}
.lecture-body .callout-result .callout-body p:last-child {
  margin-bottom: 0;
}

/* ---- Generic callouts (note / warning) — keep tasteful, flat ---- */
.lecture-body .callout {
  border: 1px solid var(--ink-12);
  border-left: 4px solid var(--ink-40);
  background: var(--surface-alt);
  padding: 0.85rem 1.1rem;
  margin: 1.5rem 0;
}
.lecture-body .callout .callout-title {
  font: 600 0.78rem/1.3 var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-60);
  margin-bottom: 0.4rem;
}
.lecture-body .callout-note {
  border-left-color: var(--primary);
}
.lecture-body .callout-warning,
.lecture-body .callout-caution,
.lecture-body .callout-danger {
  border-left-color: var(--coral);
}
.lecture-body .callout-tip,
.lecture-body .callout-success {
  border-left-color: var(--mint);
}

/* ---- Pull-quote / blockquote ---- */
.lecture-body blockquote {
  border-left: 3px solid var(--ink-12);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--ink-80);
  font-style: italic;
}

/* ---- Heading anchors (lecture.js appends) ---- */
.lecture-body h2,
.lecture-body h3 {
  position: relative;
}
.heading-anchor {
  opacity: 0;
  margin-left: 0.4em;
  text-decoration: none;
  color: var(--ink-40);
  font-weight: 400;
  transition: opacity var(--motion-short, 120ms) ease;
}
.lecture-body h2:hover .heading-anchor,
.lecture-body h3:hover .heading-anchor,
.heading-anchor:focus {
  opacity: 1;
}

/* ---- Code copy button (lecture.js appends) ---- */
.lecture-body pre {
  position: relative;
}
.code-copy {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  font: 0.75rem var(--font-mono);
  border: 1px solid var(--ink-12);
  background: var(--surface);
  color: var(--ink-60);
  padding: 0.15rem 0.5rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--motion-short, 120ms) ease;
}
.lecture-body pre:hover .code-copy,
.code-copy:focus {
  opacity: 1;
}
.code-copy.is-copied {
  color: var(--mint);
  border-color: var(--mint);
}

/* ---- Interactive curve explorer (.curve-explorer) — showcase widget ----
   Full-bleed: breaks out of the 760px reading column. The reading column is
   viewport-centred, so left:50% + translateX(-50%) recentres a wider block on
   the viewport. Flat/sharp, FIIT tokens. */
.curve-explorer {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: min(1060px, 94vw);
  margin: 2.5rem 0;
  border: 1px solid var(--ink-12);
  background: var(--surface);
  padding: 1.1rem 1.25rem 1.3rem;
}
.curve-explorer .ce-head {
  font: 600 0.95rem/1.35 var(--font-display, inherit);
  color: var(--ink);
  margin-bottom: 0.9rem;
}
.ce-stage { display: flex; gap: 1.4rem; align-items: stretch; }
.ce-svg { flex: 1 1 auto; min-width: 0; height: auto; cursor: crosshair; touch-action: none; }
.ce-svg text { user-select: none; }
.ce-readout { flex: 0 0 218px; display: grid; gap: 0.5rem; align-content: start; }
.ce-stat { border: 1px solid var(--ink-12); border-left: 3px solid var(--ink-12); padding: 0.5rem 0.7rem; }
.ce-stat .ce-k {
  font: 600 0.66rem/1.2 var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-40);
  margin-bottom: 0.15rem;
}
.ce-stat .ce-v { font: 700 1.35rem/1.15 var(--font-display, inherit); color: var(--ink); }
.ce-stat .ce-u { font: 400 0.68rem var(--font-mono); color: var(--ink-40); }
.ce-stat.ce-regime .ce-v { font-size: 1.05rem; }
.ce-controls { margin-top: 1.1rem; }
.ce-controls input[type="range"] { width: 100%; accent-color: var(--primary); cursor: ew-resize; }
.ce-axis {
  display: flex; justify-content: space-between;
  font: 0.72rem var(--font-mono); color: var(--ink-40); margin-top: 0.25rem;
}
.curve-explorer figcaption {
  font: 0.85rem/1.55 var(--font-mono);
  color: var(--ink-60); margin-top: 0.9rem;
}
@media (max-width: 760px) {
  .ce-stage { flex-direction: column; }
  .ce-readout { flex-basis: auto; grid-template-columns: repeat(2, 1fr); }
}
