/* Shared document blocks for the authoring preview and published articles. */
.prose {
  --rich-info-bg: #edf4ff;
  --rich-info-line: #8badde;
  --rich-info-label: #285d9c;
  --rich-tip-bg: #edf7f2;
  --rich-tip-line: #80b79b;
  --rich-tip-label: #28694e;
  --rich-warning-bg: #fff6e5;
  --rich-warning-line: #dfb460;
  --rich-warning-label: #8e6018;
  min-width: 0;
}

[data-theme=dark] .prose {
  --rich-info-bg: #192c3f;
  --rich-info-line: #476e99;
  --rich-info-label: #a1c8f2;
  --rich-tip-bg: #1a302a;
  --rich-tip-line: #457d63;
  --rich-tip-label: #a0d7bb;
  --rich-warning-bg: #342c1d;
  --rich-warning-line: #9c7942;
  --rich-warning-label: #e8c589;
}

.prose h4 { line-height: 1.6; }
.prose :is(h2, h3, h4) { scroll-margin-top: 120px; }
.toc nav a.sub-sub { padding-left: 24px; font-size: .75rem; }

.prose ul[data-type=taskList] {
  list-style: none;
  padding-inline-start: 0;
  margin: 20px 0 26px;
}
.prose li[data-type=taskItem] {
  display: flex;
  align-items: flex-start;
  gap: .7em;
  margin: 8px 0;
  padding: 0;
}
.prose li[data-type=taskItem] > label {
  flex: 0 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: .42em 0 0;
  padding: 0;
  line-height: 1;
  user-select: none;
}
.prose li[data-type=taskItem] > label input[type=checkbox] {
  appearance: none;
  display: inline-grid;
  place-content: center;
  width: 17px;
  height: 17px;
  margin: 0;
  border: 1.5px solid var(--muted);
  border-radius: 4px;
  background: var(--bg);
  vertical-align: middle;
  opacity: 1;
}
.prose li[data-type=taskItem] > label input[type=checkbox]:checked {
  border-color: var(--accent);
  background: var(--accent);
}
.prose li[data-type=taskItem] > label input[type=checkbox]:checked::before {
  content: "";
  width: 4px;
  height: 8px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}
.prose li[data-type=taskItem] > label input:disabled { cursor: default; }
.prose li[data-type=taskItem] > div { flex: 1; min-width: 0; }
.prose li[data-type=taskItem] > div > p { margin: 0 0 6px; }
.prose li[data-type=taskItem] > div > :last-child { margin-bottom: 0; }
.prose li[data-type=taskItem] ul[data-type=taskList] { margin: 8px 0 4px; }

.prose [data-callout] {
  --rich-callout-bg: var(--rich-info-bg);
  --rich-callout-line: var(--rich-info-line);
  --rich-callout-label: var(--rich-info-label);
  border: 1px solid var(--rich-callout-line);
  border-inline-start-width: 4px;
  border-radius: 8px;
  background: var(--rich-callout-bg);
  padding: 16px 22px;
  margin: 26px 0;
  color: var(--text);
}
.prose [data-callout=tip] {
  --rich-callout-bg: var(--rich-tip-bg);
  --rich-callout-line: var(--rich-tip-line);
  --rich-callout-label: var(--rich-tip-label);
}
.prose [data-callout=warning] {
  --rich-callout-bg: var(--rich-warning-bg);
  --rich-callout-line: var(--rich-warning-line);
  --rich-callout-label: var(--rich-warning-label);
}
.prose [data-callout]::before {
  content: "信息";
  display: block;
  color: var(--rich-callout-label);
  font-size: .8rem;
  font-weight: 650;
  line-height: 1.6;
  margin-bottom: 7px;
}
.prose [data-callout=tip]::before { content: "提示"; }
.prose [data-callout=warning]::before { content: "注意"; }
.prose [data-callout] > :first-child { margin-top: 0; }
.prose [data-callout] > :last-child { margin-bottom: 0; }

.prose details {
  margin: 26px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}
.prose details > summary {
  padding: 13px 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: .95em;
  line-height: 1.8;
  border-radius: 7px;
  background: var(--surface);
}
.prose details > summary::marker { color: var(--accent); }
.prose details > summary:focus-visible { outline-offset: -3px; }
.prose details[open] > summary {
  border-bottom: 1px solid var(--border);
  border-radius: 7px 7px 0 0;
  margin-bottom: 18px;
}
.prose details > :not(summary) { margin-inline: 20px; }
.prose details > :nth-child(2) { margin-top: 0; }
.prose details > :last-child:not(summary) { margin-bottom: 18px; }

.prose figure[data-type=editorImage] {
  width: 100%;
  max-width: 100%;
  margin: 28px auto;
}
.prose figure[data-type=editorImage] > img {
  width: 100%;
  height: auto;
  margin: 0 auto;
}
.prose figure[data-type=editorImage] > figcaption {
  margin: 10px 0 0;
  font-size: .83rem;
  line-height: 1.75;
  white-space: pre-wrap;
}

.prose mark {
  color: inherit;
  background-color: #fff1b8;
  padding: .08em .15em;
  border-radius: 3px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
/* Keep custom highlights soft and legible on dark pages. */
[data-theme=dark] .prose mark {
  color: #e2ecf0;
  background-color: #635126 !important;
}
[data-theme=dark] .prose span:is([style*="#d83931" i], [style*="rgb(216, 57, 49)"]) { color: #ffaaa3 !important; }
[data-theme=dark] .prose span:is([style*="#d97706" i], [style*="rgb(217, 119, 6)"]) { color: #f4bf75 !important; }
[data-theme=dark] .prose span:is([style*="#217a56" i], [style*="rgb(33, 122, 86)"]) { color: #8dd9b4 !important; }
[data-theme=dark] .prose span:is([style*="#2563eb" i], [style*="rgb(37, 99, 235)"]) { color: #a6c8ff !important; }
[data-theme=dark] .prose span:is([style*="#7c3aed" i], [style*="rgb(124, 58, 237)"]) { color: #d1b0ff !important; }
[data-theme=dark] .prose mark:is([data-color="#d3f9d8" i], [style*="#d3f9d8" i], [style*="rgb(211, 249, 216)"]) { background-color: #244b3a !important; }
[data-theme=dark] .prose mark:is([data-color="#dbeafe" i], [style*="#dbeafe" i], [style*="rgb(219, 234, 254)"]) { background-color: #263f66 !important; }
[data-theme=dark] .prose mark:is([data-color="#f3d9fa" i], [style*="#f3d9fa" i], [style*="rgb(243, 217, 250)"]) { background-color: #4d315c !important; }

.prose .rich-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  margin: 25px 0;
  border-radius: 6px;
  scrollbar-width: thin;
}
.prose .rich-table-scroll > table {
  display: table;
  table-layout: fixed;
  min-width: 480px;
  width: 100%;
  margin: 0;
}
.prose :is(td, th) { vertical-align: top; }
.prose :is(td, th) > :last-child { margin-bottom: 0; }
.prose :is(td, th) > :first-child { margin-top: 0; }

@media (max-width: 560px) {
  .prose [data-callout] { padding: 14px 16px; }
  .prose details > summary { padding: 12px 14px; }
  .prose details > :not(summary) { margin-inline: 14px; }
  .prose figure[data-type=editorImage] { width: 100% !important; }
  .prose li[data-type=taskItem] { gap: .6em; }
  .prose :is(td, th) { padding: 9px 12px; }
}

@media (forced-colors: active) {
  .prose li[data-type=taskItem] > label input[type=checkbox] { appearance: auto; }
  .prose li[data-type=taskItem] > label input[type=checkbox]::before { display: none; }
}
