/* Editor panel — GitHub Pages only. Not included in binary builds. */

.mdopen-editor-header {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--borderColor-default, #d0d7de);
}

.mdopen-editor-back {
  font-size: 13px;
  color: var(--fgColor-muted, #57606a);
  text-decoration: none;
}

.mdopen-editor-back:hover {
  color: var(--fgColor-default, #1f2328);
}

.mdopen-editor-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--borderColor-default, #d0d7de);
  background: var(--bgColor-default, #ffffff);
}

.mdopen-editor-panel textarea {
  flex: 1;
  width: 100%;
  box-sizing: border-box;
  padding: 16px;
  border: 0;
  outline: 0;
  resize: none;
  overflow: auto;
  background: transparent;
  color: var(--fgColor-default, #1f2328);
  font-family: var(--mdopen-font-code, ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace);
  font-size: 14px;
  line-height: 1.5;
  tab-size: 2;
}

.mdopen-editor-panel textarea::placeholder {
  color: var(--fgColor-muted, #57606a);
}

/* File open/save buttons in editor header */
.mdopen-editor-open,
.mdopen-editor-save {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  color: var(--fgColor-default, #1f2328);
  line-height: 1;
}

.mdopen-editor-open:hover,
.mdopen-editor-save:hover {
  opacity: 0.8;
}

.mdopen-editor-dirty {
  font-size: 14px;
  color: var(--fgColor-muted, #57606a);
  line-height: 1;
  padding-left: 2px;
}

/* Draggable divider between editor and preview */
.mdopen-editor-divider {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 6px;
  z-index: 9;
  cursor: col-resize;
  background: transparent;
  margin-left: -3px;
}

.mdopen-editor-divider:hover,
.mdopen-editor-divider:active {
  background: var(--borderColor-default, #d0d7de);
}

/* Pencil button in toolbar */
.mdopen-editor-button {
  font-size: 17px;
}

/* When editor is open, article gets dynamic width via JS */
html[data-mdopen-editor="open"] .markdown-body {
  box-sizing: border-box;
  overflow-x: auto;
}

/* Hide pencil button on pages without editor */
.mdopen-editor-button[data-mdopen-editor-hidden] {
  display: none;
}

/* Mobile: vertical stack */
@media (max-width: 767px) {
  .mdopen-editor-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 50%;
    width: 100% !important;
    border-right: 0;
    border-bottom: 1px solid var(--borderColor-default, #d0d7de);
  }

  .mdopen-editor-divider {
    display: none;
  }

  html[data-mdopen-editor="open"] .markdown-body {
    margin-left: 0 !important;
    margin-top: 50vh;
    width: 100% !important;
    padding: 32px 16px;
  }

  html[data-mdopen-editor="open"] .mdopen-toolbar {
    top: auto;
    bottom: calc(50% + 4px);
  }
}

/* Print: hide editor panel, restore full-width article */
@media print {
  .mdopen-editor-panel {
    display: none;
  }

  .mdopen-editor-divider {
    display: none;
  }

  html[data-mdopen-editor="open"] .markdown-body {
    margin: 0 auto;
    width: auto;
    max-width: 980px;
    padding: 0;
  }

  html[data-mdopen-editor="open"] .mdopen-toolbar {
    display: none;
  }

  .mdopen-editor-button {
    display: none;
  }
}
