/* Cascadia Code */
@font-face {
  font-family: "Cascadia Code";
  src: url("../fonts/CascadiaCode/CascadiaCode-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "Cascadia Code";
  src: url("../fonts/CascadiaCode/CascadiaCode-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
}

/* Nanum Gothic */
@font-face {
  font-family: "Nanum Gothic";
  src: url("../fonts/NanumGothic/NanumGothic.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "Nanum Gothic";
  src: url("../fonts/NanumGothic/NanumGothicBold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
}

/* Base */
html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: #1f252d;
  font-family: Arial, "Nanum Gothic", sans-serif;
}

/* App Layout */
.editor-app {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header 아래 전체 작업 영역 */
.editor-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

/* 파일트리 오른쪽 영역 */
.editor-workarea {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Tabs 아래 에디터 + 프리뷰 */
.editor-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

/* Editor / Preview Pane */
/* ==================================================
   Editor / Preview Split Layout
================================================== */

.editor-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* 에디터 영역 */
.editor-pane {
  flex: 0 0 50%;
  min-width: 280px;
  height: 100%;
  overflow: hidden;
  position: relative;
}

/* 프리뷰 영역 */
.preview-pane {
  flex: 1 1 0;
  min-width: 280px;
  height: 100%;
  overflow: auto;
  background: #e5e5e5;
}

/* ==================================================
   Draggable Divider
================================================== */

.editor-divider {
  position: relative;
  flex: 0 0 7px;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  background: #252b34;
  user-select: none;
  touch-action: none;
  z-index: 30;
  transition: background-color 0.12s ease;
}

.editor-divider:hover,
.editor-divider:focus-visible,
.editor-divider.is-dragging {
  background: #4c91d9;
}

.editor-divider:focus-visible {
  outline: none;
}

/* 가운데 작은 손잡이 */
.editor-divider-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 42px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.editor-divider:hover .editor-divider-handle,
.editor-divider:focus-visible .editor-divider-handle,
.editor-divider.is-dragging .editor-divider-handle {
  background: rgba(255, 255, 255, 0.85);
}

/* 드래그 중 iframe, 텍스트 선택 방지 */
body.editor-resizing {
  cursor: col-resize !important;
  user-select: none !important;
}

body.editor-resizing * {
  cursor: col-resize !important;
}

/* ==================================================
   Preview Off
================================================== */

.editor-main.preview-off .preview-pane {
  display: none;
}

.editor-main.preview-off .editor-divider {
  display: none;
}

.editor-main.preview-off .editor-pane {
  flex: 1 1 auto !important;
  min-width: 0;
}

/* 작은 화면에서는 최소폭을 조금 줄임 */
@media (max-width: 900px) {
  .editor-pane,
  .preview-pane {
    min-width: 200px;
  }
}

#markdownEditor {
  display: none;
}

.manual-preview {
  padding: 20px;
}

/* Status Bar */
.editor-statusbar {
  height: 26px;
  flex-shrink: 0;
  background: #18202b;
  color: #cbd5e1;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  box-sizing: border-box;
}

/* CodeMirror */
.CodeMirror {
  height: 100%;
  font-family: "Cascadia Code", "Nanum Gothic", monospace;
  font-size: 15px;
  line-height: 1.6;
}

/* 행번호와 코드 사이 간격 */
.CodeMirror-gutters {
  padding-right: 8px;
}

.CodeMirror-linenumber {
  padding: 0 10px 0 8px;
  min-width: 32px;
}

/* 코드 본문 왼쪽 여백 */
.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like {
  padding-left: 15px;
}

/* 현재 줄 */
.cm-s-material-darker .CodeMirror-activeline-background {
  background: #2c313c !important;
}

/* 현재 줄 번호칸 */
.cm-s-material-darker .CodeMirror-activeline-gutter {
  background: #2c313c !important;
}

/* 현재 줄 번호 */
.cm-s-material-darker .CodeMirror-activeline-gutter .CodeMirror-linenumber {
  color: #ffffff !important;
}

/* 기본 글자 */
.cm-s-material-darker.CodeMirror {
  color: #d0d4dc !important;
}

/* 제목(#) */
.cm-header {
  color: #d7ba7d;
  font-weight: 400;
}

/* **Bold** */
.cm-strong {
  color: #d7ba7d;
  font-weight: 400;
}

/* *Italic* */
.cm-em {
  color: #c586c0;
}

/* `code` */
.cm-comment {
  color: #ce9178;
}

/* 링크 */
.cm-link {
  color: #4fc1ff;
}

/* 인용 */
.cm-quote {
  color: #66a04b;
}

/* %특수명령 */
.cm-mk-command {
  color: #ff9800;
  font-weight: bold;
  font-size: 16px;
}

.cm-mk-command-invalid {
  color: #b388ff;   /* 연보라 */
  font-weight: bold;
  font-size: 16px;
}

.preview blockquote,
.manual-page blockquote {
  margin: 12px 0;
  padding: 8px 12px;
  border-left: 4px solid #9ca3af;
  background: #f3f4f6;
  color: #374151;
}

.preview blockquote p,
.manual-page blockquote p {
  margin: 0;
}

/* Main content area */
.page-view {
  width: 170mm;
  margin: 0 auto 16px;
}

.page {
  width: 170mm;
  height: 237mm;
  overflow: hidden;
  background: #fff;
  --heading-number-width: 64px;
}

.preview-page-number {
  margin-top: 2px;
  text-align: center;
  font-size: 11px;
  color: #888;
  user-select: none;
}


.page h1 {
  margin: 1.6em 0 0.8em;
}

.page h2 {
  margin: 1.6em 0 0.45em;
}

.page h3 {
  margin: 1.35em 0 0.4em;
}

.page h4,
.page h5,
.page h6 {
  margin: 1.15em 0 0.35em;
}

.page p {
  margin: 0 0 0.75em;
}

.manual-heading {
  display: flex;
  align-items: baseline;
}

.manual-heading-title {
  min-width: 0;
}

.manual-subheading {
  margin-top: 16px;
  margin-bottom: 6px;
  font-weight: 700;
  line-height: 1.4;
}

.manual-heading-number {
  flex: 0 0 var(--heading-number-width);
  color: #009fe3;
  font-weight: 700;
}

.manual-numbered-content > p,
.manual-numbered-content > ul,
.manual-numbered-content > ol,
.manual-numbered-content > blockquote,
.manual-numbered-content > pre,
.manual-numbered-content > table,
.manual-numbered-content > .manual-subheading {
  margin-left: var(--heading-number-width);
}

.export-wrap {
  position: relative;
  display: inline-flex;
  margin-left: 14px;
}

.export-main,
.export-toggle {
  height: 32px;
  border: 1px solid #3c4657;
  background: #242b36;
  color: #e9edf5;
  font: inherit;
  cursor: pointer;
}

.export-main {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border-radius: 5px 0 0 5px;
}

.export-toggle {
  width: 28px;
  padding: 0;
  border-left: 0;
  border-radius: 0 5px 5px 0;
  color: #9ba8bc;
}

.export-main:hover,
.export-toggle:hover {
  background: #303949;
  border-color: #536179;
}

.export-icon {
  font-size: 15px;
  color: #a9c7ff;
}

.export-menu {
  display: none;
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 1000;
  width: 260px;
  padding: 6px;
  border: 1px solid #3b4555;
  border-radius: 8px;
  background: #202630;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.25);
}

.export-menu.is-open {
  display: block;
}

.export-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #edf1f7;
  text-align: left;
  cursor: pointer;
}

.export-option:hover {
  background: #2b3442;
}

.option-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 5px;
  background: #303a49;
  color: #aac7ff;
  font-size: 13px;
  font-weight: 700;
}

.option-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.option-text strong {
  font-size: 13px;
  font-weight: 600;
}

.option-text small {
  color: #8f9bae;
  font-size: 11px;
}

.export-divider {
  height: 1px;
  margin: 5px 7px;
  background: #343d4a;
}

.export-option.compact {
  padding-top: 8px;
  padding-bottom: 8px;
}