/* 回复里的代码块、脑图、Mermaid 图表（结构和行为见 artifacts.js）。
   外框 2.5px 墨线 + 硬投影；标题栏墨底白字（名字，复制、下载等按钮）；代码区浅底。
   颜色、线宽、投影用 app.css 的变量，只有浅色一套。 */

.artifact {
  --artifact-mono: var(--mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace);
  /* 代码高亮配色（GitHub 浅色风格，在浅底上都 ≥4.5:1） */
  --hl-keyword: #cf222e;
  --hl-title: #8250df;
  --hl-constant: #0550ae;
  --hl-string: #0a3069;
  --hl-builtin: #953800;
  --hl-comment: #57606a;
  --hl-tag: #116329;
  --hl-bullet: #953800;
  --hl-add: #116329;
  --hl-add-bg: #dafbe1;
  --hl-del: #82071e;
  --hl-del-bg: #ffebe9;

  margin: 1.5em 0;
  border: var(--bw, 2.5px) solid var(--ink, #111111);
  border-radius: var(--r, 14px);
  background: var(--paper, #ffffff);
  box-shadow: var(--sh, 5px 5px 0 #111111);
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
}

/* 标题栏：左边名字，右边按钮；窄屏时按钮换到下一行 */
.artifact-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 8px 8px 16px;
  background: var(--ink, #111111);
  color: var(--paper, #ffffff);
  font-size: 14px;
  line-height: 1.45;
}
.artifact-name {
  flex: 1 1 8em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--paper, #ffffff);
  font-weight: 800;
}
.artifact-code .artifact-name { font-family: var(--artifact-mono); font-size: 13px; font-weight: 700; }
.artifact-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }

.artifact-btn,
a.artifact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 12px;
  border: var(--bw-thin, 2px) solid var(--paper, #ffffff);
  border-radius: 10px;
  background: transparent;
  color: var(--paper, #ffffff);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: none;
  cursor: pointer;
}
.artifact-btn:hover,
a.artifact-btn:hover,
.artifact-btn:active { background: var(--paper, #ffffff); color: var(--ink, #111111); box-shadow: none; text-decoration: none; }
.artifact-btn[aria-pressed="true"] { background: var(--yellow, #ffd84d); border-color: var(--yellow, #ffd84d); color: var(--ink, #111111); }
/* 墨底上焦点框用黄色 */
.artifact-btn:focus-visible,
a.artifact-btn:focus-visible { outline: 3px solid var(--yellow, #ffd84d); outline-offset: 2px; }

/* 代码和原文：在框里横向滚动，不撑宽页面 */
figure.artifact > pre {
  margin: 0;
  padding: 14px 16px;
  border: 0;
  border-radius: 0;
  background: var(--soft, #f5f5f3);
  color: var(--ink, #111111);
  overflow: auto;
  font-family: var(--artifact-mono);
  font-size: 13.5px;
  line-height: 1.6;
  tab-size: 4;
}
figure.artifact > pre > code {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  white-space: pre;
  overflow-wrap: normal;
}

/* 画好的图。contain: paint 让图里的任何内容都只能画在这个框里 */
.artifact-view {
  position: relative;
  overflow: auto;
  contain: paint;
  background: var(--paper, #ffffff);
}
.artifact-view-mermaid { padding: 16px; }
.artifact-view-mermaid > svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.artifact-view-mindmap > svg {
  display: block;
  width: 100%;
  height: 420px;
  cursor: grab;
  touch-action: pan-x pan-y; /* 单指滑动照常滚动页面，双指缩放/移动脑图 */
}
.artifact-view-mindmap > svg:active { cursor: grabbing; }
@media (max-width: 560px) {
  .artifact-view-mindmap > svg { height: 340px; }
}

/* 图画好以后原文默认收起，点「源码」展开 */
.artifact-rendered:not(.artifact-show-source) > .artifact-source { display: none; }
.artifact-rendered > .artifact-source { border-top: var(--bw-thin, 2px) solid var(--ink, #111111); }

/* Word 文档：标题栏左边一个蓝色「Word」标签 + 文件名，右边「下载 Word」；下面是可以展开的预览 */
.artifact-kind {
  flex: none;
  padding: 2px 8px;
  border: var(--bw-thin, 2px) solid var(--paper, #ffffff);
  border-radius: 6px;
  background: var(--blue, #5b8cff);
  color: var(--ink, #111111);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .02em;
}
.artifact-doc > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 800;
}
.artifact-doc > summary::-webkit-details-marker { display: none; }
.artifact-doc > summary::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  background: var(--i-chevron, none) center / contain no-repeat;
  transform: rotate(-90deg);
  transition: transform .15s;
}
.artifact-doc[open] > summary::before { transform: none; }
.artifact-doc > summary:hover { background: var(--soft, #f5f5f3); }
.artifact-doc > summary:focus-visible { outline: 3px solid var(--ink, #111111); outline-offset: -3px; }
.artifact-doc-meta { color: var(--muted, #4d4d4d); font-weight: 600; }
.artifact-doc[open] > summary { border-bottom: var(--bw-thin, 2px) solid var(--ink, #111111); }
.artifact-doc-body {
  max-height: 70vh;
  padding: 4px 20px 16px;
  overflow: auto;
  overscroll-behavior: contain;
}
.artifact-doc-body > .artifact-doc-title { margin: .6em 0 .4em; font-size: 1.35em; font-weight: 900; line-height: 1.3; }
@media (prefers-reduced-motion: reduce) { .artifact-doc > summary::before { transition: none; } }

/* PPT：标题栏左边一个橙色「PPT」标签；展开是每一页的 16:9 缩略图（拆页和下载的 PPT 一样）。
   缩略图里的颜色照 PPT 本身的配色：白底、主色 #2e5aac，章节页整页主色。 */
.artifact-kind-ppt { background: var(--orange, #ff9150); }
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  gap: 14px;
  max-height: 70vh;
  margin: 0;
  padding: 16px;
  overflow: auto;
  overscroll-behavior: contain;
  list-style: none;
  background: var(--soft, #f5f5f3);
}
.deck-slide { position: relative; min-width: 0; margin: 0; padding: 0; }
.deck-frame {
  display: flex;
  flex-direction: column;
  gap: 4px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  padding: 7% 8% 9%;
  border: var(--bw-thin, 2px) solid var(--ink, #111111);
  border-radius: 8px;
  background: #ffffff;
  color: #1f2328;
  font-size: 10px;
  line-height: 1.4;
}
.deck-frame p { margin: 0; }
.deck-title { font-size: 12.5px; font-weight: 900; line-height: 1.25; overflow-wrap: anywhere; }
.deck-kind-content .deck-title::after { content: ""; display: block; width: 18%; height: 3px; margin-top: 4px; background: #2e5aac; }
.deck-kind-title .deck-frame,
.deck-kind-section .deck-frame { justify-content: center; }
.deck-kind-title .deck-frame { border-left: 8px solid #2e5aac; }
.deck-kind-title .deck-title,
.deck-kind-section .deck-title { font-size: 15px; }
.deck-sub { color: #4b5563; }
.deck-kind-section .deck-frame { background: #2e5aac; color: #ffffff; }
.deck-kind-section .deck-sub { color: #dce4f5; }
.deck-items { margin: 2px 0 0; padding: 0; list-style: none; }
.deck-items > li { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.deck-bullet::before { content: "•"; margin-right: .4em; color: #2e5aac; }
.deck-l1 { padding-left: 1.1em; }
.deck-l2 { padding-left: 2.2em; }
.deck-heading { color: #2e5aac; font-weight: 800; }
.deck-code,
.deck-table,
.deck-more { color: #4b5563; }
.deck-code { font-family: var(--artifact-mono); }
.deck-num { position: absolute; right: 9px; bottom: 6px; color: #4b5563; font-size: 10px; font-weight: 700; }
.deck-kind-section .deck-num { color: #ffffff; }

.artifact-error {
  margin: 0;
  padding: 8px 16px;
  border-bottom: var(--bw-thin, 2px) solid var(--ink, #111111);
  background: var(--pink, #ff7eb6);
  color: var(--ink, #111111);
  font-size: 13px;
  font-weight: 700;
}

/* highlight.js 的高亮记号 */
.artifact .hljs-doctag,
.artifact .hljs-keyword,
.artifact .hljs-meta .hljs-keyword,
.artifact .hljs-template-tag,
.artifact .hljs-template-variable,
.artifact .hljs-type,
.artifact .hljs-variable.language_ { color: var(--hl-keyword); }
.artifact .hljs-title,
.artifact .hljs-title.class_,
.artifact .hljs-title.class_.inherited__,
.artifact .hljs-title.function_ { color: var(--hl-title); }
.artifact .hljs-attr,
.artifact .hljs-attribute,
.artifact .hljs-literal,
.artifact .hljs-meta,
.artifact .hljs-number,
.artifact .hljs-operator,
.artifact .hljs-variable,
.artifact .hljs-selector-attr,
.artifact .hljs-selector-class,
.artifact .hljs-selector-id { color: var(--hl-constant); }
.artifact .hljs-regexp,
.artifact .hljs-string,
.artifact .hljs-meta .hljs-string { color: var(--hl-string); }
.artifact .hljs-built_in,
.artifact .hljs-symbol { color: var(--hl-builtin); }
.artifact .hljs-comment,
.artifact .hljs-code,
.artifact .hljs-formula { color: var(--hl-comment); }
.artifact .hljs-name,
.artifact .hljs-quote,
.artifact .hljs-selector-tag,
.artifact .hljs-selector-pseudo { color: var(--hl-tag); }
.artifact .hljs-subst { color: inherit; }
.artifact .hljs-section { color: var(--hl-constant); font-weight: 700; }
.artifact .hljs-bullet { color: var(--hl-bullet); }
.artifact .hljs-emphasis { font-style: italic; }
.artifact .hljs-strong { font-weight: 700; }
.artifact .hljs-addition { color: var(--hl-add); background: var(--hl-add-bg); }
.artifact .hljs-deletion { color: var(--hl-del); background: var(--hl-del-bg); }
