@layer content-blocks {
/* ===== 016 · 正文里的「块」：待办、折叠、标注框、文字色/高亮、分栏、书签、站内视频音频、B 站 =====
   2026-09-12 Fred：「帮我看看现在网站对 notion page 的适配情况。做得好一点。」

   这些标记由 lib/content.js 的短代码 / sanitize 规则产生，来源有两条：
     · lib/notion-blocks.js 把 Notion 的块写成短代码（同步来的文章、沉思）；
     · 后台编辑器里手写同样的短代码，或 GFM 的 `- [ ]` / `- [x]`。
   所以这份表**不绑定页面**：文章页（.prose-grand）、沉思（.figma-entry-body）、相册正文都走它。

   设计上跟着站里的规矩：
     · 方角。代码块、筛选按钮、外链框都是直角 —— 标注框、书签卡片、勾选框、高亮也一样，
       不做圆角气泡（Fred 2026-09-11：「不要任何气泡」）。
     · Notion 的九种颜色不用它的原色，映射到站里的调色盘：
       文字色取调色盘的「话题色」深版（--topic-* 那一族：#48508e / #2c5478 / #9c3d58 …），
       背景色取粉彩（芍药粉 / 鸢尾紫 / 薰衣草 / 远峰蓝 / 玉绿 / 柠檬草）的半透明。
       Notion 没有、调色盘也没有的（橙、棕、红）按同样的明度补。
     · 深色模式下文字色翻成粉彩、背景压到很淡 —— 和 012 的 --topic-* 深色版同一个做法。
     · 可点击感交给颜色 + 字重，不画下划线（折叠标题、书签标题悬停变色）。
   ========================================================================== */

/* ⚠️ 声明在 body 上，不在 :root 上：`--cb-ink: var(--ink-main, …)` 是在**声明它的元素上**解析的，
   而 --ink-* 定义在 body.page-article / body.craft-collection 上 —— 放在 :root 会永远落到兜底值。 */
body {
  /* 文字色：纸面（#ede7de 一带）上都在 4.5:1 以上 */
  --nc-gray:   #6b6459;
  --nc-brown:  #7a5838;
  --nc-orange: #955024;
  --nc-yellow: #6f5c12;
  --nc-green:  #30572b;
  --nc-blue:   #2c5478;
  --nc-purple: #643f7d;
  --nc-pink:   #9c3d58;
  --nc-red:    #a3302e;
  /* 背景高亮 */
  --nc-bg-gray:   rgba(120, 110, 95, 0.16);
  --nc-bg-brown:  rgba(150, 110, 70, 0.18);
  --nc-bg-orange: rgba(236, 160, 95, 0.28);
  --nc-bg-yellow: rgba(232, 218, 105, 0.45);
  --nc-bg-green:  rgba(176, 220, 168, 0.45);
  --nc-bg-blue:   rgba(167, 193, 217, 0.45);
  --nc-bg-purple: rgba(223, 206, 234, 0.85);
  --nc-bg-pink:   rgba(247, 194, 211, 0.60);
  --nc-bg-red:    rgba(240, 150, 140, 0.35);
  /* 块用的墨色：文章 / 沉思页有 --ink-*（012 / 013 定义），别的页面退到这组 */
  --cb-ink:   var(--ink-main, #151413);
  --cb-muted: var(--ink-muted, #6b6459);
  --cb-line:  var(--ink-line, rgba(43, 40, 35, 0.22));
  --cb-accent: #533963;
}

:is(html[data-theme="dark"] body, body.dark-mode) {
  --nc-gray:   #a49b8f;
  --nc-brown:  #d4b595;
  --nc-orange: #efb88c;
  --nc-yellow: #e4df9a;
  --nc-green:  #bfe3b8;
  --nc-blue:   #a7c1d9;
  --nc-purple: #dfceea;
  --nc-pink:   #f7c2d3;
  --nc-red:    #f4a8a2;
  --nc-bg-gray:   rgba(255, 255, 255, 0.10);
  --nc-bg-brown:  rgba(212, 181, 149, 0.18);
  --nc-bg-orange: rgba(239, 184, 140, 0.20);
  --nc-bg-yellow: rgba(228, 223, 154, 0.20);
  --nc-bg-green:  rgba(191, 227, 184, 0.18);
  --nc-bg-blue:   rgba(167, 193, 217, 0.20);
  --nc-bg-purple: rgba(223, 206, 234, 0.18);
  --nc-bg-pink:   rgba(247, 194, 211, 0.18);
  --nc-bg-red:    rgba(244, 168, 162, 0.20);
  --cb-ink:   var(--ink-main, #f8f6fb);
  --cb-muted: var(--ink-muted, #a49b8f);
  --cb-line:  var(--ink-line, rgba(255, 255, 255, 0.16));
  --cb-accent: #dfceea;
}

/* ── 中文标点（英文界面下的正文）─────────────────────────────────────────────
   style.css 在英文界面（html.en-mode）把中文标点别名从栈里拿掉了 —— 那是给界面文字的。
   用户写的字仍是中文，在这几块字上把栈换回带别名的。--font-heading 要跟着重算一遍：
   012 在 body 上把它写成 var(--font-serif)，自定义属性继承的是**算好的值**，不重写的话
   正文里的小标题拿到的还是 body 那一层（不带别名）的栈。 */
html.en-mode :is(.prose-grand, .figma-entry-body, .figma-entry-content, .comment-text-body, .grand-article-title, .grand-article-lead) {
  --font-sans: "Zh Punct Sans", "Google Sans Flex", "Source Han Sans SC", "Noto Sans SC", sans-serif;
  --font-serif: "Zh Punct Serif", "Newsreader", "Source Han Serif SC", "Noto Serif SC", serif;
  --font-heading: var(--font-serif);
}

/* ── 断行 ─────────────────────────────────────────────────────────────────
   段落的最后一行只剩一个字（「……对不对得 / 齐」）是正文里最扎眼的毛病。text-wrap: pretty
   让浏览器回头调整最后几行，避开这种孤字；标题用 balance，两行标题不再是「一长一截」。
   不支持的浏览器就是原来的贪心断行，不会更坏。 */
:is(.prose-grand, .figma-entry-body, .comment-text-body) :is(p, li, blockquote, figcaption) {
  text-wrap: pretty;
}
:is(.grand-article-title, .grand-article-lead, .prose-grand :is(h2, h3, h4)) {
  text-wrap: balance;
}

/* ── 中文不要合成斜体 ──────────────────────────────────────────────────────
   站里的规矩（001 的 .public-page-title 那段）：中文没有斜体字面，`font-style: italic` 只能让
   浏览器把字形整体拧斜，笔画粗细和重心全是歪的。可文章大标题、几个页头、沉思的引文、
   空状态提示都是整块 italic —— 中文标题全是被拧斜的。
   font-synthesis-style: none 的意思是「字体真有斜体才用斜体」：Newsreader 有，西文照旧是
   真斜体；思源、中文标点别名没有，就保持正体。一条属性，中西混排的标题各得其所。
   无衬线那几条（空状态、「评论已删除」）只在中文界面收：Google Sans Flex 也没有斜体，
   英文界面收了它们就不斜了。 */
:is(.grand-article-title, .archive-main-title, .gal-main-title, .thinking-main-title,
  .figma-entry-content, .figma-timeline-empty, .notes-shelf-empty, .public-page-title) {
  font-synthesis-style: none;
}
html:not(.en-mode) :is(.craft-empty, .comment-text-body.is-deleted, .empty-hint) {
  font-synthesis-style: none;
}

/* ── 中西文间距 ────────────────────────────────────────────────────────────
   中文和西文 / 数字挨着的地方自动留一点空（CSS text-autospace，约 1/8 字宽）。
   站里好些文字是没留空格写的（「拿claude opus 4.6写作业」），挤在一起读着费劲。
   作者自己敲了空格的地方不会再加；不支持的浏览器就是原样。只给读的那几块字（正文、沉思、评论、
   文章标题和导语，以及首页 / 文稿全集 / 搜索里列出来的标题），代码里不加 —— 等宽对齐比好看要紧。
   界面文字不加：竖栏、菜单那些地方的宽度是量过的。 */
:is(.prose-grand, .figma-entry-body, .figma-entry-content, .comment-text-body, .grand-article-title, .grand-article-lead,
  .cr-essay h3, .cr-essay p, .cr-note-title, .story-title, .archive-featured-title, .most-read-title, .nav-search-item-title) {
  text-autospace: normal;
}
:is(.prose-grand, .figma-entry-body, .comment-text-body) :is(pre, code, kbd, samp) {
  text-autospace: no-autospace;
}

/* ── 文字色 / 背景高亮 ─────────────────────────────────────────────────── */
.nc-gray   { color: var(--nc-gray); }
.nc-brown  { color: var(--nc-brown); }
.nc-orange { color: var(--nc-orange); }
.nc-yellow { color: var(--nc-yellow); }
.nc-green  { color: var(--nc-green); }
.nc-blue   { color: var(--nc-blue); }
.nc-purple { color: var(--nc-purple); }
.nc-pink   { color: var(--nc-pink); }
.nc-red    { color: var(--nc-red); }
/* 标红的一段里夹着粗体 / 斜体，那几个字也得是红的 —— 文章页给 strong 单独上了墨色
   （013 的 `.prose-grand :is(strong, b)`），不拦一下，整段红里就剩加粗那截是黑的。
   Notion 在两处都能上色：一段整体标红（块颜色），或者选中几个字标红（行内颜色），两种都会撞上。 */
.nc:not([class*="nc-bg-"]) :is(strong, b, em, i, del, u) {
  color: inherit;
}

[class*="nc-bg-"] {
  padding: 0 0.15em;
  -webkit-box-decoration-break: clone;
          box-decoration-break: clone;   /* 跨行时每一行都有自己的底和留白 */
}
.nc-bg-gray   { background-color: var(--nc-bg-gray); }
.nc-bg-brown  { background-color: var(--nc-bg-brown); }
.nc-bg-orange { background-color: var(--nc-bg-orange); }
.nc-bg-yellow { background-color: var(--nc-bg-yellow); }
.nc-bg-green  { background-color: var(--nc-bg-green); }
.nc-bg-blue   { background-color: var(--nc-bg-blue); }
.nc-bg-purple { background-color: var(--nc-bg-purple); }
.nc-bg-pink   { background-color: var(--nc-bg-pink); }
.nc-bg-red    { background-color: var(--nc-bg-red); }

/* 整段铺底色（Notion 里给一整段选了背景色）：一块方角的色底，不是逐行的高亮。 */
.nc-block[class*="nc-bg-"] {
  margin: 1em 0;
  padding: 0.7em 1em;
}
.nc-block > :first-child { margin-top: 0; }
.nc-block > :last-child  { margin-bottom: 0; }

/* ── 待办 ──────────────────────────────────────────────────────────────────
   `input[type=checkbox]` 在 sanitize 时换成了 span.task-check（input 不进白名单）。
   打勾的那一项跟 Notion 一样：灰掉 + 删除线。 */
li:has(> .task-check),
li:has(> p:first-child > .task-check) {
  list-style: none;
}
ul:has(> li > .task-check),
ul:has(> li > p:first-child > .task-check) {
  padding-left: 0.35em;
}
.task-check {
  display: inline-block;
  position: relative;
  width: 0.92em;
  height: 0.92em;
  margin: 0 0.55em 0 0;
  vertical-align: -0.12em;
  border: 1.5px solid var(--cb-muted);
  border-radius: 0;
  box-sizing: border-box;
}
.task-check.is-checked {
  background: var(--cb-accent);
  border-color: var(--cb-accent);
}
.task-check.is-checked::after {
  content: '';
  position: absolute;
  left: 30%;
  top: 6%;
  width: 28%;
  height: 58%;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
:is(html[data-theme="dark"], body.dark-mode) .task-check.is-checked::after {
  border-color: #0a0a0c;
}
/* 勾掉的是**这一条待办**，不是它底下挂的东西 —— Notion 里也是这样。
   ⚠️ 删除线只能由祖先决定：画在 li 上，子块写 `text-decoration: none` 是**收不回来的**
   （CSS Text Decoration 3：装饰会传给所有在流内的块级后代，后代无权取消）。所以线不画在 li 上，
   画在「待办自己那一行」上：

     · 有子内容时这一项是 loose item，自己那行就是首个 <p>（lib/notion-blocks.js 给 to_do 的
       子块留了空行，就是为了让它有个自己的盒子）；
     · 没有子内容时是 tight item，自己那行是**文本节点**，选不中，只能画在 li 上 —— 反正
       没有子块可连累。 */
li:has(> .task-check.is-checked),
li:has(> p:first-child > .task-check.is-checked) > p:first-child {
  color: var(--cb-muted);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, currentColor 55%, transparent);
}
/* 待办底下挂的段落 / 子列表和**文字**对齐，不和勾选框对齐（框 0.92em + 右边距 0.55em）。
   有子内容的待办会变成 loose item（lib/notion-blocks.js 给 to_do 的子块留了空行），
   于是待办自己那行也成了 <p> —— 它是首个子元素，不缩进。 */
li:has(> .task-check) > :is(p, ul, ol, div, blockquote, pre, figure, details):not(:first-child),
li:has(> p:first-child > .task-check) > :is(p, ul, ol, div, blockquote, pre, figure, details):not(:first-child) {
  margin-left: 1.47em;
}

/* ── 折叠块 ────────────────────────────────────────────────────────────────
   原生 <details>，不要 JS。三角自己画（浏览器自带的那个在 Safari 上还是一个 list-item 标记，
   和正文字号对不齐）。 */
details.notion-toggle {
  margin: 1em 0;
}
details.notion-toggle > summary {
  display: flex;
  align-items: baseline;
  gap: 0.55em;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  color: var(--cb-ink);
  transition: color 0.2s ease;
}
details.notion-toggle > summary::-webkit-details-marker {
  display: none;
}
details.notion-toggle > summary::before {
  content: '';
  flex: none;
  width: 0;
  height: 0;
  border-left: 0.4em solid currentColor;
  border-top: 0.27em solid transparent;
  border-bottom: 0.27em solid transparent;
  transform: translateY(-0.08em);
  transition: transform 0.2s ease;
}
details.notion-toggle[open] > summary::before {
  transform: translateY(-0.08em) rotate(90deg);
}
details.notion-toggle > summary:hover,
details.notion-toggle > summary:focus-visible {
  color: var(--cb-accent);
  outline: none;
}
details.notion-toggle > :not(summary) {
  margin-left: 0.95em;
}
details.notion-toggle > :nth-child(2) { margin-top: 0.6em; }
details.notion-toggle > :last-child  { margin-bottom: 0; }

/* 可折叠标题：summary 里是一个真的 <hN>（目录收得到它，012 的 .sec-num 编号也照插）。
   标题自己的上下外边距挪到 details 上 —— 留在 hN 上的话三角和标题对不齐，
   收起时底下还悬着一截标题的下边距。三角跟着标题字号放大，否则像一个标点。 */
details.notion-toggle-heading {
  margin: 1.8em 0 1em;
}
details.notion-toggle-heading > summary > :is(h2, h3, h4) {
  margin: 0;
  color: inherit;
}
details.notion-toggle-heading > summary::before {
  border-left-width: 0.5em;
  border-top-width: 0.33em;
  border-bottom-width: 0.33em;
  transform: translateY(-0.12em);
}
details.notion-toggle-heading[open] > summary::before {
  transform: translateY(-0.12em) rotate(90deg);
}

@media (prefers-reduced-motion: reduce) {
  details.notion-toggle > summary::before { transition: none; }
}

/* ── 标注框 ────────────────────────────────────────────────────────────────
   方角、一块淡底。颜色用上面那组背景色，再调淡一点 —— 高亮是一两个字，标注框是一整块，
   同样的浓度铺满一块会压过正文。 */
.callout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0 0.7em;
  margin: 1.5em 0;
  padding: 14px 18px;
  border-radius: 0;
  background: color-mix(in srgb, var(--nc-bg-gray) 70%, transparent);
  color: var(--cb-ink);
}
.callout:not(:has(> .callout-icon)) {
  grid-template-columns: minmax(0, 1fr);
}
.callout-icon {
  font-size: 1.1em;
  line-height: inherit;
}
.callout-body > :first-child { margin-top: 0; }
.callout-body > :last-child  { margin-bottom: 0; }
.callout-brown  { background: color-mix(in srgb, var(--nc-bg-brown) 70%, transparent); }
.callout-orange { background: color-mix(in srgb, var(--nc-bg-orange) 70%, transparent); }
.callout-yellow { background: color-mix(in srgb, var(--nc-bg-yellow) 70%, transparent); }
.callout-green  { background: color-mix(in srgb, var(--nc-bg-green) 70%, transparent); }
.callout-blue   { background: color-mix(in srgb, var(--nc-bg-blue) 70%, transparent); }
.callout-purple { background: color-mix(in srgb, var(--nc-bg-purple) 70%, transparent); }
.callout-pink   { background: color-mix(in srgb, var(--nc-bg-pink) 70%, transparent); }
.callout-red    { background: color-mix(in srgb, var(--nc-bg-red) 70%, transparent); }

/* ── 分栏 ──────────────────────────────────────────────────────────────────
   桌面并排，窄屏一列（Notion 自己在手机上也是这么摊的）。 */
.notion-columns {
  display: grid;
  gap: 28px;
  margin: 1.5em 0;
}
/* 列宽默认等分；Notion 里拖过分栏宽度的，--notion-cols 由短代码带来（lib/content.js）。 */
.notion-columns.cols-2 { grid-template-columns: var(--notion-cols, repeat(2, minmax(0, 1fr))); }
.notion-columns.cols-3 { grid-template-columns: var(--notion-cols, repeat(3, minmax(0, 1fr))); }
.notion-columns.cols-4 { grid-template-columns: var(--notion-cols, repeat(4, minmax(0, 1fr))); }
.notion-columns.cols-5 { grid-template-columns: var(--notion-cols, repeat(5, minmax(0, 1fr))); }
.notion-column > :first-child { margin-top: 0; }
.notion-column > :last-child  { margin-bottom: 0; }
@media (max-width: 720px) {
  .notion-columns[class*="cols-"] { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

/* ── 表格：横着滑的容器 ──────────────────────────────────────────────────────
   lib/content.js 给每张表包一层 div.table-scroll。表的上下外边距挪到容器上（各页自己定：
   012 文章 28px、015 沉思 0.6em），这里只管「在自己里面滑」。
   格子里的字不再随正文 `overflow-wrap: anywhere` 逐字可断 —— 那会让表格算最小宽度时
   按单个字符算，列一挤，数字就从中间折开；长网址、行内代码仍然可以断。 */
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
.table-scroll > table {
  margin-top: 0;
  margin-bottom: 0;
}
.table-scroll td {
  overflow-wrap: break-word;
}
.table-scroll td :is(a, code) {
  overflow-wrap: anywhere;
}

/* ── 表格：没开表头行的 ─────────────────────────────────────────────────────
   Markdown 表格必须先有表头行，Notion 里没开 header row 的表只能写一行空表头
   （lib/notion-blocks.js 的 renderTable）。整行都空的表头就不画 —— 原来是一条空表头带，
   读起来像表格上面漏了一行字。手写的空表头同样适用。 */
thead:not(:has(th:not(:empty))) {
  display: none;
}

/* ── 书签卡片 / 附件卡片 ────────────────────────────────────────────────────
   和沉思里那条外链框（015 的 .figma-link-pill-box）一个语汇：直角细框、标题 + 域名 + ↗。
   整张卡都能点 —— 链接的 ::before 铺满卡片。
   同步时抓到了网页简介就排在第二行（最多两行）；作者写的说明在卡片外面，当图注。
   附件卡片（[file]，Notion 的文件 / PDF 块）同一个样子，右边换成文件类型 + ↓。 */
:is(.bookmark-card, .file-card) {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 16px;
  row-gap: 4px;
  margin: 1.5em 0;
  padding: 14px 18px;
  border: 1px solid var(--cb-line);
  border-radius: 0;
  transition: border-color 0.2s ease;
}
:is(.bookmark-card, .file-card) a {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 600;
  color: var(--cb-ink);
  text-decoration: none;
  border-bottom: none;
}
.bookmark-desc {
  grid-column: 1 / -1;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: 0.82em;
  line-height: 1.6;
  color: var(--cb-muted);
}
.bookmark {
  margin: 1.5em 0;
}
.bookmark > .bookmark-card {
  margin: 0;
}
.bookmark-caption {
  margin-top: 8px;
  font-size: 0.82em;
  line-height: 1.6;
  color: var(--cb-muted);
}
:is(.bookmark-card, .file-card) a::before {
  content: '';
  position: absolute;
  inset: 0;
}
:is(.bookmark-card, .file-card):hover {
  border-color: var(--cb-ink);
}
:is(.bookmark-card, .file-card):hover a {
  color: var(--cb-accent);
}
:is(.bookmark-host, .file-kind) {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cb-muted);
}
.bookmark-host::after {
  content: ' ↗';
}
.file-kind::after {
  content: ' ↓';
}
/* 窄屏上域名那一列会把标题挤成一列一两个字（320px 下「抓来的网页标 / 题」）。
   改成一列：标题、域名、简介各占一行。 */
@media (max-width: 520px) {
  :is(.bookmark-card, .file-card) {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── 公式 ──────────────────────────────────────────────────────────────────
   lib/content.js 用 KaTeX 排成 MathML，字体交给浏览器的 `font-family: math`（带 MATH 表的数学字体，
   站里那三套字体都没有）。公式块太宽时在自己内部横向滚，不把手机屏撑宽。 */
.math-block {
  margin: 1.3em 0;
  overflow-x: auto;
  overflow-y: hidden;
  text-align: center;
}
.math-block math {
  font-size: 1.12em;
}
.katex math {
  color: inherit;
}
code.math-fallback {
  color: var(--nc-red);
}

/* ── 图片的大小与对齐 ──────────────────────────────────────────────────────
   Notion 的图注里写 `{size=sm}` / `{align=left}` / `{float=right}`，lib/notion-blocks.js
   把它们变成 `[figure size= align= float=]`，lib/content.js 再变成 .img-size-* / .img-align-*
   / .img-float-* 三族 class。**这三族原来一条都没生效**：它们定义在 style.css 里，而 style.css
   整个在最弱的 `legacy` 层，被 001 的 `body.public-body img { max-width: 100% }`（foundation 层）
   和 012 的 `margin: 30px auto`（article-craft 层）压掉了 —— 写了 {size=sm} 的图照样铺满整栏、
   写了 {align=left} 的照样居中。这一层排在它们之后，在这儿重新给。

   尺寸用 min(100%, …)：sm 在 375px 的屏上是 320px，不会缩成邮票。
   lg 是**没写指令时的默认值**，所以它必须保持「铺满正文栏」—— 改小的话，站里现有的
   Notion 图片会集体缩水。
   ⚠️ 一条一条平铺写，不用 CSS 嵌套：scripts/css-integrity.js 是按顶层规则条数对账的，
   嵌套会让它源码数 118、浏览器数 105，凭空红一条。 */
:is(body.page-article, body.craft-collection, body.page-notes) :is(.prose-grand, .figma-entry-body) .img-size-sm img {
  max-width: min(100%, 320px);
}
:is(body.page-article, body.craft-collection, body.page-notes) :is(.prose-grand, .figma-entry-body) .img-size-md img {
  max-width: min(100%, 540px);
}
:is(body.page-article, body.craft-collection, body.page-notes) :is(.prose-grand, .figma-entry-body) :is(.img-size-lg, .img-size-full) img {
  max-width: 100%;
}
/* 写了 {width=…} 之后 <figure> 自己就窄了，所以对齐要同时给到 figure —— 只给里面的 <img>
   的话，图是「在一个靠左的窄框里居中」，看上去仍然贴着左边。
   012 给的是 `margin: 30px 0`，这里只改左右两边。 */
:is(body.page-article, body.craft-collection, body.page-notes) :is(.prose-grand, .figma-entry-body) .img-align-center {
  margin-left: auto;
  margin-right: auto;
}
:is(body.page-article, body.craft-collection, body.page-notes) :is(.prose-grand, .figma-entry-body) .img-align-right {
  margin-left: auto;
  margin-right: 0;
}
:is(body.page-article, body.craft-collection, body.page-notes) :is(.prose-grand, .figma-entry-body) .img-align-left {
  margin-left: 0;
  margin-right: auto;
}
/* 012 给正文图片的是 `margin: 30px auto`（居中）。左右对齐只改对应那一边的 auto。 */
:is(body.page-article, body.craft-collection, body.page-notes) :is(.prose-grand, .figma-entry-body) .img-align-left img {
  margin-left: 0;
  margin-right: auto;
}
:is(body.page-article, body.craft-collection, body.page-notes) :is(.prose-grand, .figma-entry-body) .img-align-right img {
  margin-left: auto;
  margin-right: 0;
}
:is(body.page-article, body.craft-collection, body.page-notes) :is(.prose-grand, .figma-entry-body) .img-align-left figcaption {
  text-align: left;
}
:is(body.page-article, body.craft-collection, body.page-notes) :is(.prose-grand, .figma-entry-body) .img-align-right figcaption {
  text-align: right;
}
/* 绕排。 */
:is(body.page-article, body.craft-collection, body.page-notes) :is(.prose-grand, .figma-entry-body) :is(.img-float-left, .img-float-right) {
  max-width: 45%;
}
:is(body.page-article, body.craft-collection, body.page-notes) :is(.prose-grand, .figma-entry-body) .img-float-left {
  float: left;
  margin: 6px 28px 12px 0;
}
:is(body.page-article, body.craft-collection, body.page-notes) :is(.prose-grand, .figma-entry-body) .img-float-right {
  float: right;
  margin: 6px 0 12px 28px;
}
:is(body.page-article, body.craft-collection, body.page-notes) :is(.prose-grand, .figma-entry-body) :is(.img-float-left, .img-float-right) img {
  margin: 0;
}
:is(body.page-article, body.craft-collection, body.page-notes) :is(.prose-grand, .figma-entry-body) :is(.img-float-left, .img-float-right) + * {
  overflow: hidden;
}
/* 窄屏不绕 —— 45% 的栏宽在手机上只剩 160px，图和字都读不成。 */
@media (max-width: 640px) {
  :is(body.page-article, body.craft-collection, body.page-notes) :is(.prose-grand, .figma-entry-body) :is(.img-float-left, .img-float-right) {
    float: none;
    max-width: 100%;
    margin: 30px 0;
  }
}

/* ── 站内视频 / 音频、B 站 ────────────────────────────────────────────────── */
.media-figure {
  margin: 1.8em 0;
}
.media-figure video {
  display: block;
  width: 100%;
  max-height: 72vh;
  background: #000;
  border-radius: 0;
}
.media-figure audio {
  display: block;
  width: 100%;
}
/* 浏览器自带的播放控件跟着 color-scheme 走 —— 站里深色模式没有把整页设成 dark，
   不补这一条，深色页面上会横着一条刺眼的浅灰色音频条。 */
:is(html[data-theme="dark"], body.dark-mode) .media-figure :is(video, audio) {
  color-scheme: dark;
}
.embed-bilibili {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 2rem 0;
  overflow: hidden;
  background: #000;
}
.embed-bilibili iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
}
