/* Native text + math blocks.  Shared verbatim by the workbench and the exported player
   (html_export.py inlines this file), so every inherited typographic property is set here
   explicitly -- layout never depends on the surrounding page's styles. */

.nm-slide {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden; background: #fff;
}
.nm-obj { position: absolute; display: block; margin: 0; }
/* Ordinary prose uses the bundled TeX roman face; CJK falls back to Song.
   Math keeps KaTeX's own semantic font selection and baseline calibration. */
.nm-block {
  display: block; box-sizing: content-box; padding: 0; margin: 0;
  font-family: "KaTeX_Main", "SimSun", "宋体", "Songti SC", "STSong", serif;
  font-weight: 400; font-style: normal; color: #000; text-align: left; letter-spacing: normal; word-spacing: normal;
  text-indent: 0; text-transform: none; word-break: normal; overflow-wrap: break-word; line-break: auto;
  font-kerning: auto; font-variant: normal; tab-size: 4; -webkit-text-size-adjust: none; text-size-adjust: none;
}
/* Match the authored text size instead of KaTeX's default 1.21em. */
.nm-block .katex { font-size: 1em; }
/* Let the authored block line-height set the baseline grid. Transparent inline
   wrappers must not add KaTeX's independent 1.2em line strut. Its existing .katex-base
   boxes retain real math height/depth and operator break opportunities. Scope
   this to top-level inline math; display math and nested math layout stay intact. */
.nm-block .nm-math:not(.nm-display):not(.nm-error),
.nm-block .nm-math:not(.nm-display) > .katex,
.nm-block .nm-math:not(.nm-display) > .katex > .katex-html {
  display: contents;
  line-height: 0;
}
/* Match the shared text/math baseline measured in the XeLaTeX reference.
   Do not introduce a font-size-dependent optical offset. See
   evidence/baseline-calibration/{tex-baselines,browser-baselines}.json. */
.nm-block .nm-math:not(.nm-display) > .katex > .katex-html > .katex-base {
  vertical-align: baseline;
}
.nm-block .nm-display { display: block; }
.nm-block .katex-display { margin: 0.25em 0; }
.nm-block .nm-error {
  color: #c4372b; background: rgba(196, 55, 43, .08); text-decoration: underline wavy rgba(196, 55, 43, .6);
  font-family: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: .8em; white-space: pre-wrap;
}
.nm-block.nm-empty { min-width: 1.5em; min-height: 1.2em; }
.nm-img { position: absolute; display: block; }

/* Chinese inside math uses the same Song typeface as surrounding text. */
.nm-block .katex .cjk_fallback { font-family: "SimSun", "宋体", "Songti SC", "STSong", serif; }

/* Space only the outer edges of inline math, preserving its operator wrapping. */
.nm-block .nm-gap-before > .katex > .katex-html > .katex-base:first-child { margin-inline-start: 0.25em; }
.nm-block .nm-gap-after > .katex > .katex-html > .katex-base:last-child { margin-inline-end: 0.25em; }
.nm-block .nm-error.nm-gap-before { margin-inline-start: 0.25em; }
.nm-block .nm-error.nm-gap-after { margin-inline-end: 0.25em; }

/* TikZ figures: a whole box; the runtime's WebGL canvas fills it (laid out at the box's
   design size, scaled with the slide).  The note is the placeholder / status text. */
.tz-obj { position: absolute; display: block; margin: 0; overflow: hidden; background: #fff; }
.tz-host { position: absolute; inset: 0; pointer-events: none; }
.tz-host canvas { display: block; width: 100% !important; height: 100% !important; }
.tz-note {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 6px;
  text-align: center; color: #6b7280; font: 13px/1.4 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  pointer-events: none;
}
.tz-note:empty { display: none; }
.tz-obj[data-tz-state="loading"], .tz-obj[data-tz-state="failed"] { box-shadow: inset 0 0 0 1px #b8c0cc; }
.tz-obj[data-tz-state="failed"] .tz-note { color: #c4372b; }
.tz-thumb { position: absolute; display: flex; align-items: center; justify-content: center; box-sizing: border-box;
  border: 3px dashed #9aa6b8; background: #f6f8fb; color: #6b7280; font: 600 28px/1 sans-serif; }

/* 数学画板 (construction) objects: a whole box; the JSXGraph board (SVG) is laid out at the
   box's design size, letterboxed (the view aspect is kept) and never takes pointer input on
   the slide -- it is edited in the workbench dock only. */
.cx-obj { position: absolute; display: block; margin: 0; overflow: hidden; background: #fff; }
.cx-host { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.cx-host .cx-board { flex: none; position: relative; overflow: hidden; background: #fff; border: 0; border-radius: 0; }
/* Inert (canvas) and player boards take NO pointer events, descendants included: JSXGraph gives its
   SVG / HTML nodes their own pointer-events, which beats an inherited `none` and would swallow the
   canvas's pointerdown → click / dblclick on .cx-obj.  Edit boards (.cx-edit) stay interactive. */
.cx-board.cx-inert, .cx-board.cx-player,
.cx-board.cx-inert *, .cx-board.cx-player * { pointer-events: none !important; }
.cx-note {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 6px;
  text-align: center; color: #6b7280; font: 13px/1.4 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  pointer-events: none;
}
.cx-note:empty { display: none; }
.cx-obj[data-cx-state="loading"], .cx-obj[data-cx-state="failed"] { box-shadow: inset 0 0 0 1px #b8c0cc; }
.cx-obj[data-cx-state="failed"] .cx-note { color: #c4372b; }
