/* Structured forum editor and published document.
 * Scoped here so legacy page themes cannot reshape the document model.
 */
.forum-editor {
  --forum-line: #d8e1dd;
  --forum-line-strong: #b7c7c0;
  --forum-ink: #17201d;
  --forum-muted: #66736e;
  --forum-accent: #0f654b;
  --forum-soft: #f3f8f6;
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--forum-line);
  border-radius: 8px;
  background: #fff;
}

.forum-editor-fallback {
  display: block;
  width: 100%;
  min-height: 220px;
  border: 0;
  border-radius: 0;
  padding: 18px;
  resize: vertical;
}

.forum-editor.is-editor-mounted .forum-editor-fallback {
  display: none;
}

.forum-editor-toolbar {
  display: none;
  border-bottom: 1px solid var(--forum-line);
  background: #fbfcfc;
}

.forum-editor.is-editor-mounted .forum-editor-toolbar {
  display: block;
}

.forum-editor-toolbar-main,
.forum-editor-toolbar-more {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
}

.forum-editor-toolbar-main {
  overflow-x: auto;
  padding: 7px;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}

.forum-tool-button,
.forum-tool-select select,
.forum-editor-more > summary {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #34413c;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  white-space: nowrap;
}

.forum-tool-button {
  display: inline-grid;
  min-width: 34px;
  place-items: center;
  padding: 0 9px;
  cursor: pointer;
}

.forum-tool-button:hover,
.forum-tool-button:focus-visible,
.forum-tool-button.is-active,
.forum-tool-button[aria-pressed="true"] {
  border-color: #b9d7cc;
  outline: none;
  background: #e9f4ef;
  color: var(--forum-accent);
}

.forum-tool-select select {
  max-width: 122px;
  padding: 0 27px 0 9px;
  cursor: pointer;
}

.forum-tool-select select:focus-visible {
  border-color: var(--forum-accent);
  outline: 2px solid rgba(15, 101, 75, 0.15);
  outline-offset: 1px;
}

.forum-editor-more {
  border-top: 1px solid #edf1ef;
}

.forum-editor-more > summary {
  display: flex;
  align-items: center;
  width: max-content;
  margin: 5px 7px;
  padding: 0 10px;
  cursor: pointer;
  list-style: none;
}

.forum-editor-more > summary::-webkit-details-marker {
  display: none;
}

.forum-editor-more[open] > summary {
  background: var(--forum-soft);
  color: var(--forum-accent);
}

.forum-editor-toolbar-more {
  flex-wrap: wrap;
  padding: 4px 7px 9px;
}

.forum-editor-content {
  display: none;
}

.forum-editor.is-editor-mounted .forum-editor-content {
  display: block;
}

.forum-editor-prosemirror,
.forum-document {
  color: var(--forum-ink, #17201d);
  font-size: 16px;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.forum-editor-prosemirror {
  min-height: 240px;
  max-height: min(68vh, 760px);
  overflow: auto;
  padding: 20px;
  outline: none;
  caret-color: var(--forum-accent);
}

.forum-editor-prosemirror:focus {
  box-shadow: inset 0 0 0 2px rgba(15, 101, 75, 0.1);
}

.forum-editor-prosemirror p.is-editor-empty:first-child::before {
  float: left;
  height: 0;
  color: #98a39f;
  content: attr(data-placeholder);
  pointer-events: none;
}

.forum-editor-footer {
  display: none;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #edf1ef;
  padding: 6px 10px;
  background: #fbfcfc;
  color: var(--forum-muted);
  font-size: 11px;
}

.forum-editor.is-editor-mounted .forum-editor-footer {
  display: flex;
}

.forum-editor.is-uploading::after {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.82);
  color: var(--forum-accent);
  content: "이미지를 안전하게 처리하고 있습니다";
  font-size: 13px;
  font-weight: 700;
}

.forum-document {
  min-width: 0;
}

.forum-document > :first-child,
.forum-editor-prosemirror > :first-child {
  margin-top: 0;
}

.forum-document > :last-child,
.forum-editor-prosemirror > :last-child {
  margin-bottom: 0;
}

.forum-document p,
.forum-editor-prosemirror p {
  margin: 0 0 0.9em;
}

.forum-document h2,
.forum-document h3,
.forum-document h4,
.forum-editor-prosemirror h2,
.forum-editor-prosemirror h3,
.forum-editor-prosemirror h4 {
  margin: 1.6em 0 0.55em;
  color: #15201c;
  line-height: 1.35;
  letter-spacing: 0;
}

.forum-document h2,
.forum-editor-prosemirror h2 { font-size: 1.45em; }
.forum-document h3,
.forum-editor-prosemirror h3 { font-size: 1.22em; }
.forum-document h4,
.forum-editor-prosemirror h4 { font-size: 1.08em; }

.forum-document ul,
.forum-document ol,
.forum-editor-prosemirror ul,
.forum-editor-prosemirror ol {
  margin: 0.65em 0 1em;
  padding-left: 1.55em;
}

.forum-document li + li,
.forum-editor-prosemirror li + li { margin-top: 0.25em; }

.forum-document blockquote,
.forum-editor-prosemirror blockquote {
  margin: 1.15em 0;
  border-left: 3px solid #82b3a1;
  padding: 0.35em 0 0.35em 1em;
  color: #4e5d57;
}

.forum-document pre,
.forum-editor-prosemirror pre {
  max-width: 100%;
  overflow: auto;
  margin: 1em 0;
  border: 1px solid #26332e;
  border-radius: 6px;
  background: #17201d;
  padding: 14px;
  color: #f4f8f6;
  font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace;
  tab-size: 2;
}

.forum-document :not(pre) > code,
.forum-editor-prosemirror :not(pre) > code {
  border-radius: 4px;
  background: #edf2f0;
  padding: 0.12em 0.35em;
  color: #23483b;
  font-size: 0.9em;
}

.forum-document hr,
.forum-editor-prosemirror hr {
  height: 1px;
  margin: 1.8em 0;
  border: 0;
  background: var(--forum-line, #d8e1dd);
}

.forum-align-left { text-align: left; }
.forum-align-center { text-align: center; }
.forum-align-right { text-align: right; }

.forum-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  margin: 1em 0;
  border: 1px solid var(--forum-line, #d8e1dd);
  border-radius: 6px;
}

.forum-document table,
.forum-editor-prosemirror table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  table-layout: fixed;
}

.forum-document th,
.forum-document td,
.forum-editor-prosemirror th,
.forum-editor-prosemirror td {
  min-width: 90px;
  border: 1px solid var(--forum-line, #d8e1dd);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.forum-document th,
.forum-editor-prosemirror th {
  background: #f3f7f5;
  font-weight: 750;
}

.forum-editor-prosemirror .selectedCell::after {
  position: absolute;
  inset: 0;
  background: rgba(15, 101, 75, 0.1);
  content: "";
  pointer-events: none;
}

.forum-image {
  max-width: 100%;
  margin: 1.25em auto;
}

.forum-image img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.forum-editor-prosemirror .forum-image-editable {
  cursor: pointer;
}

.forum-editor-prosemirror .forum-image-editable.ProseMirror-selectednode {
  outline: 2px solid var(--forum-accent, #0f654b);
  outline-offset: 4px;
}

.forum-editor-prosemirror .forum-image-editable img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.forum-image-small { width: min(280px, 100%); }
.forum-image-medium { width: min(520px, 100%); }
.forum-image-large { width: min(760px, 100%); }
.forum-image-full { width: 100%; }
.forum-image figcaption {
  margin-top: 6px;
  color: var(--forum-muted, #66736e);
  font-size: 12px;
  text-align: center;
}

.forum-math-inline,
.forum-math-block {
  max-width: 100%;
  color: #15201c;
}

.forum-math-block {
  overflow-x: auto;
  margin: 1.2em 0;
  padding: 8px 2px;
  text-align: center;
}

.forum-math-editable {
  cursor: pointer;
}

.forum-math-editable:focus-visible {
  outline: 2px solid var(--forum-accent, #0f654b);
  outline-offset: 3px;
}

.forum-learning-block,
.forum-callout,
.forum-details {
  margin: 1.1em 0;
  border: 1px solid #cad8d2;
  border-left-width: 4px;
  border-radius: 6px;
  background: #f7faf9;
  padding: 13px 15px;
}

.forum-callout-important,
.forum-answer { border-left-color: #175cd3; background: #f3f7ff; }
.forum-callout-tip,
.forum-solution { border-left-color: #0f8a5f; background: #f1f9f5; }
.forum-callout-warning { border-left-color: #d97706; background: #fff8eb; }
.forum-callout-error { border-left-color: #d92d20; background: #fff4f2; }
.forum-problem { border-left-color: #667085; }

.forum-learning-block > header,
.forum-learning-block > summary,
.forum-details > summary {
  margin-bottom: 7px;
  color: #26342f;
  font-weight: 750;
  cursor: pointer;
}

.forum-document mark,
.forum-editor-prosemirror mark {
  border-radius: 2px;
  background: var(--forum-highlight, #fff3bf);
  padding: 0 0.08em;
}

.forum-document a,
.forum-editor-prosemirror a {
  color: #0b63ce;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

@media (max-width: 760px) {
  .forum-editor {
    margin-inline: 0;
  }

  .forum-editor-toolbar-main {
    padding: 5px;
  }

  .forum-tool-button,
  .forum-tool-select select,
  .forum-editor-more > summary {
    min-height: 42px;
  }

  .forum-tool-button { min-width: 42px; padding-inline: 8px; }
  .forum-editor-prosemirror { min-height: 210px; padding: 15px 13px; font-size: 15px; }
  .forum-editor-footer { min-height: 30px; padding-block: 4px; }
  .forum-document { font-size: 15px; line-height: 1.7; }
  .forum-table-scroll { margin-inline: -2px; }
}

@media (prefers-reduced-motion: reduce) {
  .forum-editor *,
  .forum-document * {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
