@charset "utf-8";
/**
 * 题目内容图片自适应（公共样式）
 *
 * 适用页面：
 *   - 题库管理题目列表          application/views/question/index.php
 *   - 题目编辑页解析内容预览弹窗 application/views/question/input_question.php
 *   - 知识点内容（以例悟道 / 升维思考 / 题目列表） application/views/point/content.php
 *
 * 维护约定：图片尺寸上限只改本文件，三处页面同时生效。
 * 用法：给承载题目内容的容器加 class="q-content-adapt"（动态渲染的容器在渲染完成后
 *       调用公共方法 adaptQuestionContentImages($容器)，见 static/common/js/question-content.js）。
 */

/* 正文行距放宽：行内公式图撑高行时不与上下行粘连 */
.q-content-adapt{
	line-height: 1.8;
}

/* 题目顶部信息条（题型/知识点/难度/操作）保持紧凑，不参与行高放宽 */
.q-content-adapt > .mb-1:first-child{
	line-height: 1.5;
}

/* 图片兜底：任何图片都不超出容器宽度 */
.q-content-adapt img{
	max-width: 100%;
}

/* 作者已指定宽/高：保留行内 style 或 HTML 尺寸属性，不套用行高/视口高度上限。
   该规则也覆盖列表页 tbody tr td img 的 100px 兜底限制。 */
.q-content-adapt img.qc-img-sized{
	max-width: 100% !important;
	max-height: none !important;
	vertical-align: middle;
}

/* 测量作者尺寸；只在同一次同步计算中短暂使用。 */
.q-content-adapt img.qc-img-sized.qc-img-measuring{
	max-width: none !important;
}

/* 只有超宽时覆盖显示宽高，缩放比例来自作者尺寸，不采用高分辨率原图尺寸。
   容器变宽后脚本移除该类，自动恢复原有排版。 */
.q-content-adapt img.qc-img-sized.qc-img-fit{
	width: var(--qc-fit-width) !important;
	height: var(--qc-fit-height) !important;
}

/* 行内图片：高度上限取正文字号的 2.6 倍（约 1.7 行）。
   Word 导入的公式是 220～576dpi 的高分图，压缩过狠就看不清；
   2.6em 既能容纳分式/根式/上下标等复杂结构，又不会撑破行；
   本身小于该尺寸的图（图标、题库小图）不会被放大（max-height 只缩不放）。

   .qc-img-option 用于「选项值本身就是一张图」的场景（选项行形如
   标签 A/B/C/D + 内容，如 application/controllers/Question.php:531 生成的
   <div style="display:flex"><div class="div_option_item">A</div><div class="ml-1">图</div></div>）：
   这类图所在单元格没有文字，但不是独占一行的插图，必须与其它选项文字同尺度，
   否则单个选项图会被按原尺寸放大到几百像素，整道题看起来就不协调。
   选项图如需单独调整大小，只改这一条选择器即可。 */
.q-content-adapt img.qc-img-inline,
.q-content-adapt img.qc-img-option{
	max-height: 2.6em !important;
	max-width: 100% !important;
	height: auto !important;
	width: auto !important;
	vertical-align: middle;
}

/* 块级图片：放宽限制，但仍限定最大宽高，防止超出容器 */
.q-content-adapt img.qc-img-block{
	display: block;
	max-width: 100% !important;
	max-height: 60vh !important;
	height: auto !important;
	margin: 10px auto;
}

/* 公式图片(kfformula/Wirisformula/data-latex)：图片本体尺寸随公式复杂度变化。
   不再限制高度（允许撑高行），按原尺寸显示，保证复杂公式清晰可辨；
   宽度仍不超过容器，避免撑破布局 */
.q-content-adapt img.qc-img-formula{
	max-width: 100% !important;
	max-height: none !important;
	height: auto !important;
	width: auto !important;
	vertical-align: middle;
}

/* 独立成行的公式图片：居中显示，同样不做高度压缩，超高时由外层容器滚动承载 */
.q-content-adapt img.qc-img-formula.qc-img-formula-block{
	display: block;
	max-height: none !important;
	margin: 10px auto;
}
