/* ══════════════════════════════════════════
   EDITOR
   Editor wrap, line numbers, syntax
   highlight overlay, textarea, hl spans.
══════════════════════════════════════════ */

.editor-wrap {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  background: var(--editor-bg);
}

.line-numbers {
  flex-shrink: 0;
  width: 48px;
  background: var(--gutter-bg);
  border-right: 1px solid var(--gutter-border);
  overflow: hidden;
  padding: 14px 0;
  font-family: var(--font-code);
  font-size: 12px;
  line-height: 21px;
  color: var(--text-faint);
  text-align: right;
  padding-right: 10px;
  user-select: none;
}
.line-number { display: block; }
.line-number.has-error   { color: var(--error);   background: #FFF5F5; margin-right: -1px; padding-right: 11px; font-weight: 600; }
.line-number.has-warning { color: var(--warning); background: #FFFDF0; margin-right: -1px; padding-right: 11px; font-weight: 600; }
[data-theme="dark"] .line-number.has-error   { background: rgba(220,38,38,.12); }
[data-theme="dark"] .line-number.has-warning { background: rgba(217,119,6,.10); }

/* ── Editor body: stacks textarea over highlight div ── */
.editor-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-width: 0;
  background: var(--editor-bg);
}

.editor-highlight {
  position: absolute;
  top: 0; left: 0;
  padding: 14px 18px;
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 21px;
  white-space: pre;
  word-break: normal;
  pointer-events: none;
  z-index: 0;
  color: var(--text);
  background: transparent;
  tab-size: 2;
  min-width: 100%;
  min-height: 100%;
  will-change: transform;
  overflow: hidden;
}

textarea#editor {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 21px;
  padding: 14px 18px;
  color: transparent;
  background: transparent;
  caret-color: #E2A800;
  white-space: pre;
  overflow: auto;
  z-index: 1;
  tab-size: 2;
}
textarea#editor::placeholder {
  color: var(--border-strong);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.6;
}
textarea#editor:focus { outline: none; }

/* ── Syntax highlight spans ── */
.hl-delim    { color: var(--hl-delim); }
.hl-key      { color: var(--hl-key); font-weight: 600; }
.hl-punct    { color: var(--hl-punct); }
.hl-val      { color: var(--hl-val); }
.hl-val-cont { color: var(--hl-val-cont); }
.hl-comment  { color: var(--hl-comment); font-style: italic; }
.hl-fence    { color: var(--hl-fence); }
.hl-code     { color: var(--hl-code-line); }
.hl-h1       { color: var(--hl-h1); font-weight: 700; }
.hl-h2       { color: var(--hl-h2); font-weight: 600; }
.hl-h3       { color: var(--hl-h3); font-weight: 600; }
.hl-h-sym    { color: var(--hl-h-sym); }
.hl-list     { color: var(--hl-list); font-weight: 600; }
.hl-bq       { color: var(--hl-bq); }
.hl-bold     { color: var(--hl-bold); font-weight: 700; }
.hl-italic   { color: var(--hl-italic); font-style: italic; }
.hl-icode    { color: var(--hl-icode); background: var(--hl-icode-bg); border-radius: 3px; }
.hl-link     { color: var(--hl-link); }
.hl-url      { color: var(--hl-url); text-decoration: underline; text-decoration-color: var(--border); }
.hl-bracket  { color: var(--hl-h-sym); }

/* ── Drop overlay ── */
.drop-overlay {
  display: none;
  position: absolute;
  inset: 4px;
  background: rgba(255,255,255,.92);
  border: 2.5px dashed var(--brand);
  border-radius: var(--r-lg);
  align-items: center;
  justify-content: center;
  z-index: 10;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-mid);
  gap: 8px;
  pointer-events: none;
  backdrop-filter: blur(2px);
}
.drop-overlay.active { display: flex; }

/* ── Line flash animation ── */
@keyframes lineFlash {
  0%   { background: rgba(66,176,213,.25); }
  100% { background: transparent; }
}
.line-flash { animation: lineFlash 1s ease-out; }
