/* ─────────────────────────────────────────────────────────
   Editor styles — wraps Editor.js + inline AI bubble,
   tight with Graphiquity's typography.
   ───────────────────────────────────────────────────────── */

.editor-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.editor-surface {
  flex: 1;
  padding: var(--s-8) var(--s-6) var(--s-16);
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
  overflow-y: auto;
}

.editor-title {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: var(--fw-bold);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--c-ink);
  font-variation-settings: "opsz" 144, "SOFT" 0;
  padding: 0;
  margin-bottom: var(--s-2);
  resize: none;
  min-height: 1.2em;
}
.editor-title::placeholder { color: var(--c-ink-muted); font-style: italic; font-variation-settings: "opsz" 144, "SOFT" 100; }

.editor-dek {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-ui);
  font-size: var(--fs-lg);
  font-weight: var(--fw-regular);
  line-height: var(--lh-snug);
  color: var(--c-ink-2);
  padding: 0;
  margin-bottom: var(--s-8);
  resize: none;
}
.editor-dek::placeholder { color: var(--c-ink-muted); }

.editor-body {
  font-family: var(--font-ui);
  font-size: 1.02rem;
  line-height: var(--lh-loose);
  color: var(--c-ink);
}

.editor-body .codex-editor__redactor { padding: 0 !important; }
.editor-body .ce-block__content,
.editor-body .ce-toolbar__content { max-width: none; }
.editor-body .ce-header {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 144, "SOFT" 0;
}
.editor-body h2.ce-header { font-size: 1.8rem; margin-top: var(--s-6); }
.editor-body h3.ce-header { font-size: 1.35rem; margin-top: var(--s-5); }
.editor-body h4.ce-header { font-size: 1.15rem; margin-top: var(--s-5); }

/* Editor.js toolbar customization */
.ce-toolbar__plus, .ce-toolbar__settings-btn {
  color: var(--c-ink-3) !important;
  background: var(--c-surface) !important;
  border: 1px solid var(--c-line) !important;
  border-radius: var(--r-sm) !important;
}
.ce-toolbar__plus:hover, .ce-toolbar__settings-btn:hover {
  background: var(--c-surface-2) !important;
  color: var(--c-ink) !important;
}
.ce-popover {
  background: var(--c-surface) !important;
  border: 1px solid var(--c-line) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--sh-md) !important;
  color: var(--c-ink) !important;
}
.ce-popover-item__icon {
  background: var(--c-surface-2) !important;
  border-radius: var(--r-sm) !important;
}
.ce-popover-item:hover {
  background: var(--c-accent-soft) !important;
}
.cdx-block { padding: var(--s-2) 0; }

.editor-body a {
  color: var(--c-accent-ink);
  border-bottom: 1px solid var(--c-accent);
  transition: background var(--t-fast);
}
.editor-body a:hover { background: var(--c-accent-soft); text-decoration: none; }

.editor-body blockquote,
.editor-body .cdx-quote {
  border-left: 3px solid var(--c-accent);
  padding-left: var(--s-4);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-style: italic;
  color: var(--c-ink-2);
  margin: var(--s-5) 0;
  font-variation-settings: "opsz" 144, "SOFT" 100;
}

.editor-body .cdx-simple-image__caption,
.editor-body figcaption {
  font-size: var(--fs-xs);
  color: var(--c-ink-3);
  text-align: center;
  margin-top: var(--s-2);
}

/* Inline AI bubble */
.ai-bubble {
  position: absolute;
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--c-ink);
  color: #fff;
  border-radius: var(--r);
  box-shadow: var(--sh-lg);
  z-index: 40;
  animation: slideUp 180ms ease-out;
}
.ai-bubble button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: rgba(255,255,255,0.85);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast);
}
.ai-bubble button:hover { background: rgba(255,255,255,0.08); color: #fff; }
.ai-bubble button.primary { color: var(--c-ai-2); }
.ai-bubble button.primary:hover { background: rgba(167,139,250,0.16); }

/* Block-level AI action button */
.ai-block-action {
  position: absolute;
  right: -40px;
  top: 4px;
  width: 32px;
  height: 32px;
  border-radius: var(--r);
  border: 1px solid var(--c-ai-soft);
  background: var(--c-surface);
  color: var(--c-ai);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--t-fast), background var(--t-fast);
}
.cdx-block:hover .ai-block-action { opacity: 1; }
.ai-block-action:hover { background: var(--c-ai-soft); }

/* AI streaming indicator */
.ai-streaming {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  background: var(--c-ai-soft);
  color: var(--c-ai-ink);
  border-radius: var(--r);
  font-size: var(--fs-sm);
}
.ai-streaming-dots {
  display: inline-flex;
  gap: 3px;
}
.ai-streaming-dots span {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: currentColor;
  animation: aiDot 1.4s ease-in-out infinite;
}
.ai-streaming-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-streaming-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiDot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ─────────────────────────────────────────────────────────
   Field-history modal — inline clock icon next to editor
   fields opens a split-pane modal with timeline + diff.
   ───────────────────────────────────────────────────────── */
.fh-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--c-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, color 120ms ease, border-color 120ms ease, background 120ms ease;
}
.field:hover .fh-trigger,
.field:focus-within .fh-trigger,
.fh-trigger:focus {
  opacity: 1;
}
.fh-trigger:hover {
  color: var(--c-accent);
  border-color: var(--c-border);
  background: var(--c-surface-2);
}

.fh-row:hover {
  border-color: var(--c-accent) !important;
}
.fh-row.fh-row-active {
  border-color: var(--c-accent) !important;
  background: var(--c-surface-2) !important;
  box-shadow: 0 0 0 1px var(--c-accent) inset;
}

@keyframes fhShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
