/* 공지, 사례 연구와 FAQ 답의 풍부한 본문 (이미지, 표, 색, 크기, 정렬, 파일, 동영상, 블록) 과 편집기의 쓰기 영역. 정리기가 허용하는
   클래스마다 규칙 하나 (HtmlSanitizer.allowedClasses); 토큰만. */

.tc-gray { color: var(--text-faint); }
.tc-red { color: var(--crit-text); }
.tc-orange { color: var(--warn-text); }
.tc-green { color: var(--ok-text); }
.tc-blue { color: var(--accent); }
.tc-purple { color: var(--support); }

.hl-yellow, .hl-green, .hl-blue, .hl-red, .hl-purple, .hl-gray {
  padding: 0 2px;
  border-radius: 2px;
  color: var(--text-primary);
}

.hl-yellow { background: var(--warn-fill); }
.hl-green { background: var(--ok-fill); }
.hl-blue { background: var(--accent-tint); }
.hl-red { background: var(--crit-fill); }
.hl-purple { background: var(--support-tint); }
.hl-gray { background: var(--fill-dim); }

.fs-s { font-size: 0.875em; }
.fs-l { font-size: 1.25em; }
.fs-xl { font-size: 1.5em; }

.ta-c { text-align: center; }
.ta-r { text-align: right; }
.ta-j { text-align: justify; word-break: keep-all; }

figure.rt-img {
  width: fit-content;
  max-width: 100%;
  margin: 0 0 var(--sp4);
  break-inside: avoid;
}

.rt-img img {
  display: block;
  max-width: 100%;
  height: auto;
}

.rt-w-s img { width: 240px; }
.rt-w-m img { width: 480px; }
.rt-w-o img { width: auto; }
.rt-img.rt-w-f, .rt-w-f img { width: 100%; }
.rt-img.rt-al-l { margin-right: auto; }
.rt-img.rt-al-c { margin-inline: auto; }
.rt-img.rt-al-r { margin-left: auto; }

.rt-img figcaption {
  margin-top: var(--sp1);
  color: var(--text-dim);
  font-size: var(--fs-sm);
}

.rt-al-c figcaption { text-align: center; }

.rt-table {
  display: block;
  max-width: 100%;
  margin: 0 0 var(--sp4);
  overflow-x: auto;
  border-collapse: collapse;
  break-inside: avoid;
}

.rt-table th, .rt-table td {
  min-width: 80px;
  padding: var(--sp2) var(--sp3);
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.rt-table th {
  background: var(--fill-dim);
  font-weight: 700;
}

.rt-table .ta-c { text-align: center; }
.rt-table .ta-r { text-align: right; }

ul.rt-files {
  margin: 0 0 var(--sp4);
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.rt-file-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp1) var(--sp3);
  min-height: 44px;
  margin: 0;
  padding: var(--sp2) var(--sp4);
}

.rt-file-item + .rt-file-item {
  border-top: 1px solid var(--border);
}

.rt-file {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.rt-size {
  color: var(--text-faint);
  font-size: var(--fs-sm);
}

.rt-video {
  position: relative;
  max-width: 100%;
  margin: 0 0 var(--sp4);
  aspect-ratio: 16 / 9;
}

.rt-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* 블록: 토글, 안내 상자, 코드, 할 일 목록, 단, 중첩 목록, 구분선. 토글은 닫힌 채 보이고 (정리기가 open 을 버린다),
   단은 좁은 화면에서 위아래로 쌓인다. 할 일의 상자와 안내 상자의 아이콘은 ::before 이며, 화면 낭독기에는 대체 글
   ("완료", "안내" 등) 을 읽힌다. */

details.rt-toggle {
  margin: 0 0 var(--sp4);
  padding-left: 1.5em;
}

details.rt-toggle > summary {
  margin-left: -1.5em;
  padding: var(--sp1) 0;
  font-weight: 700;
  cursor: pointer;
}

details.rt-toggle[open] > summary {
  margin-bottom: var(--sp2);
}

details.rt-toggle > :last-child:not(summary) {
  margin-bottom: 0;
}

.rt-callout {
  position: relative;
  margin: 0 0 var(--sp4);
  padding: var(--sp3) var(--sp4) var(--sp3) calc(var(--sp4) + 2em);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-md);
  background: var(--accent-tint);
  color: var(--text-primary);
  break-inside: avoid;
}

.rt-callout::before {
  position: absolute;
  top: calc(var(--sp3) + 0.2em);
  left: var(--sp4);
  box-sizing: border-box;
  width: 1.4em;
  height: 1.4em;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-family: Georgia, serif;
  font-weight: 700;
  line-height: calc(1.4em - 4px);
  text-align: center;
}

.rt-callout-info::before {
  content: "i";
  content: "i" / "안내";
  color: var(--accent);
}

.rt-callout-warn {
  border-color: var(--warn-line);
  background: var(--warn-fill);
}

.rt-callout-warn::before {
  content: "!";
  content: "!" / "주의";
  color: var(--warn-text);
}

.rt-callout > :last-child {
  margin-bottom: 0;
}

pre.rt-code {
  margin: 0 0 var(--sp4);
  padding: var(--sp3) var(--sp4);
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--fill-dim);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: 1.6;
  white-space: pre;
  tab-size: 4;
}

pre.rt-code code {
  font-size: inherit;
}

ul.rt-todo {
  padding-left: 0;
  list-style: none;
}

ul.rt-todo > li {
  position: relative;
  padding-left: 1.75em;
}

ul.rt-todo > li::before {
  content: "";
  content: "" / "할 일";
  position: absolute;
  top: 0.3em;
  left: 0;
  box-sizing: border-box;
  width: 1.15em;
  height: 1.15em;
  border: 2px solid var(--text-faint);
  border-radius: 2px;
  background: var(--panel-bg);
  color: var(--on-accent);
  font-weight: 700;
  line-height: calc(1.15em - 4px);
  text-align: center;
}

ul.rt-todo > li.rt-done::before {
  content: "✓";
  content: "✓" / "완료";
  border-color: var(--accent);
  background: var(--accent);
}

ul.rt-todo > li.rt-done {
  color: var(--text-dim);
}

ul.rt-todo > li.rt-done > :is(ul, ol) {
  color: var(--text-primary);
}

li > ul.rt-todo {
  padding-left: 0.25em;
}

.rt-cols {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: var(--sp5);
  margin: 0 0 var(--sp4);
}

.rt-col > :first-child {
  margin-top: 0;
}

.rt-col > :last-child {
  margin-bottom: 0;
}

:is(.prose, .faq-answer) li > :is(ul, ol) {
  margin: var(--sp1) 0 0;
}

:is(.prose, .faq-answer) ul:not(.rt-todo, .rt-files) ul:not(.rt-todo, .rt-files) {
  list-style-type: circle;
}

:is(.prose, .faq-answer) ul:not(.rt-todo, .rt-files) ul:not(.rt-todo, .rt-files) ul:not(.rt-todo, .rt-files) {
  list-style-type: square;
}

:is(.prose, .faq-answer) ol ol {
  list-style-type: lower-alpha;
}

:is(.prose, .faq-answer) ol ol ol {
  list-style-type: lower-roman;
}

:is(.prose, .faq-answer) hr {
  margin: var(--sp5) 0;
  border: 0;
  border-top: 1px solid var(--border);
}

@media (max-width: 639.98px) {
  .rt-cols {
    grid-auto-flow: row;
    gap: var(--sp4);
  }
}

.faq-answer > :is(figure, .rt-table, .rt-video, .rt-toggle, .rt-callout, .rt-code, .rt-cols) {
  max-width: calc(100% - 2 * var(--sp4));
  margin-top: var(--sp3);
  margin-inline: var(--sp4);
}

.faq-answer > ul.rt-todo {
  padding-left: var(--sp4);
}

.faq-answer > figure.rt-al-c { margin-inline: auto; }
.faq-answer > figure.rt-al-r { margin-left: auto; }

@media print {
  .rt-video { display: none; }
}

/* 인용의 모양 (네이버 블로그의 인용구처럼). 기본 인용 (왼쪽 세로선) 은 공지 스타일이 그린다: 그 규칙은 모양이 없는 인용에만
   걸린다 (blockquote:not([class*="rt-quote-"])). */
.rt-quote-mark,
.rt-quote-bubble,
.rt-quote-note,
.rt-quote-frame {
  margin: var(--sp4) 0;
  color: var(--text-primary);
}

.rt-quote-mark {
  padding: var(--sp2) var(--sp4);
  font-size: var(--fs-lg);
  text-align: center;
}

.rt-quote-mark::before {
  content: "\201C";
  display: block;
  margin-bottom: var(--sp1);
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 3em;
  line-height: 0.8;
}

.rt-quote-bubble {
  position: relative;
  margin-bottom: calc(var(--sp4) + 10px);
  padding: var(--sp3) var(--sp4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel-bg);
}

.rt-quote-bubble::after {
  content: "";
  position: absolute;
  bottom: -9px;
  left: 28px;
  width: 16px;
  height: 16px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--panel-bg);
  transform: rotate(45deg);
}

.rt-quote-note {
  padding: var(--sp3) var(--sp4);
  border-radius: 2px;
  background: var(--warn-fill);
  box-shadow: var(--shadow-card);
}

.rt-quote-frame {
  padding: var(--sp3) var(--sp4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
