/* ── Editor.js AV DS integration ─────────────────────────────────────── */

/* Editor container */
.editor-wrap {
  min-height: 400px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 8px;
  background: var(--bg, #fff);
  padding: 0;
  position: relative;
}
.editor-wrap:focus-within {
  border-color: hsl(224 60% 22%);
  box-shadow: 0 0 0 3px hsl(224 60% 22% / 0.08);
}

/* Override Editor.js defaults to match AV DS */
.codex-editor {
  font-family: var(--font-body, "Onest", sans-serif);
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text, #1f2937);
}
.codex-editor .ce-block__content {
  max-width: 100%;
  margin: 0;
  padding: 0 24px;
}
.codex-editor .ce-toolbar__content {
  max-width: 100%;
}
.codex-editor .ce-toolbar__plus,
.codex-editor .ce-toolbar__settings-btn {
  color: hsl(224 60% 22%);
  background: var(--bg-secondary, #f9fafb);
  border-radius: 6px;
}
.codex-editor .ce-toolbar__plus:hover,
.codex-editor .ce-toolbar__settings-btn:hover {
  background: hsl(224 60% 22% / 0.08);
  color: hsl(224 60% 22%);
}

/* Inline toolbar — AV DS navy */
.codex-editor .ce-inline-toolbar {
  background: hsl(224 60% 22%);
  color: #fff;
  border: none;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.codex-editor .ce-inline-toolbar .ce-inline-tool {
  color: #fff;
}
.codex-editor .ce-inline-toolbar .ce-inline-tool:hover {
  background: hsl(224 60% 30%);
}
.codex-editor .ce-inline-toolbar .ce-inline-tool--active {
  color: hsl(44 51% 54%);
}
.codex-editor .ce-inline-toolbar__dropdown {
  border-right-color: hsl(224 60% 30%);
}

/* Conversion toolbar */
.codex-editor .ce-conversion-toolbar {
  background: var(--bg, #fff);
  border: 1px solid var(--border, #d1d5db);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Settings panel */
.codex-editor .ce-settings {
  border: 1px solid var(--border, #d1d5db);
  border-radius: 8px;
  background: var(--bg, #fff);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.codex-editor .cdx-settings-button:hover {
  background: hsl(224 60% 22% / 0.06);
}
.codex-editor .cdx-settings-button--active {
  color: hsl(224 60% 22%);
}

/* Popover (tools menu) */
.codex-editor .ce-popover {
  border: 1px solid var(--border, #d1d5db);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
.codex-editor .ce-popover-item:hover {
  background: hsl(224 60% 22% / 0.06);
}
.codex-editor .ce-popover-item--focused {
  background: hsl(224 60% 22% / 0.08) !important;
}
.codex-editor .ce-popover-item__icon {
  color: hsl(224 60% 22%);
  background: hsl(224 60% 22% / 0.06);
  border-radius: 6px;
}

/* ── Block-specific tweaks ───────────────────────────────────────────── */

/* Headers */
.codex-editor h2.ce-header {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 1em 0 0.3em;
}
.codex-editor h3.ce-header {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0.8em 0 0.3em;
}
.codex-editor h4.ce-header {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0.6em 0 0.2em;
}

/* Quote */
.codex-editor .cdx-quote {
  border-left: 3px solid hsl(224 60% 22%);
  padding-left: 16px;
  font-style: italic;
}
.codex-editor .cdx-quote__caption {
  color: var(--text-secondary, #6b7280);
  font-size: 0.85rem;
}

/* Image */
.codex-editor .cdx-image-wrapper {
  border-radius: 8px;
  overflow: hidden;
}
.codex-editor .image-tool__caption {
  font-size: 0.82rem;
  color: var(--text-secondary, #6b7280);
  padding: 6px 0;
}

/* Delimiter */
.codex-editor .ce-delimiter {
  line-height: 1.6em;
  text-align: center;
  color: var(--text-secondary, #6b7280);
}

/* Code */
.codex-editor .ce-code__textarea {
  font-family: "SF Mono", "Cascadia Code", "Fira Code", monospace;
  font-size: 0.85rem;
  background: var(--bg-secondary, #f3f4f6);
  border: 1px solid var(--border, #d1d5db);
  border-radius: 6px;
  padding: 12px;
}

/* Table */
.codex-editor .tc-table {
  border: 1px solid var(--border, #d1d5db);
  border-radius: 6px;
}

/* Marker (inline highlight) */
.codex-editor mark,
.codex-editor .cdx-marker {
  background: hsl(44 51% 54% / 0.25);
  padding: 2px 4px;
  border-radius: 3px;
}

/* Embed placeholder */
.codex-editor .embed-tool {
  border-radius: 8px;
  overflow: hidden;
}

/* ── Public rendering classes (used by editorjs_render.py) ───────────── */

.editorjs-image {
  margin: 1.5em 0;
}
.editorjs-image img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.editorjs-image figcaption {
  font-size: 0.82rem;
  color: var(--text-secondary, #6b7280);
  margin-top: 6px;
  text-align: center;
}
.editorjs-image--stretched img {
  width: 100%;
}
.editorjs-image--bordered img {
  border: 1px solid var(--border, #d1d5db);
}
.editorjs-image--bg {
  background: var(--bg-secondary, #f3f4f6);
  padding: 16px;
  border-radius: 8px;
}

.editorjs-embed {
  margin: 1.5em 0;
}
.editorjs-embed iframe {
  width: 100%;
  border-radius: 8px;
}
.editorjs-embed--youtube iframe {
  aspect-ratio: 16 / 9;
  height: auto;
}
.editorjs-embed__iframe--telegram,
.editorjs-embed--telegram iframe {
  width: 100%;
  height: 400px;
}
.editorjs-embed__caption {
  font-size: 0.82rem;
  color: var(--text-secondary, #6b7280);
  text-align: center;
  margin-top: 6px;
}

.editorjs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.9rem;
}
.editorjs-table th,
.editorjs-table td {
  border: 1px solid var(--border, #d1d5db);
  padding: 8px 12px;
  text-align: left;
}
.editorjs-table th {
  background: var(--bg-secondary, #f3f4f6);
  font-weight: 600;
}

.editorjs-checklist {
  list-style: none;
  padding-left: 0;
}
.editorjs-checklist li {
  padding: 4px 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
