/* Block Editor shared stylesheet — the ONLY typography source for both admin canvas and front-end article.
   Do not put colors or font metrics in templates / editor JS / database. Change here, bump ?v= in dr_block_css_url(). */

.be-doc,
.be-editor {
  --be-ink: #1f2937;
  --be-muted: #5b6472;
  --be-faint: #94a3b8;
  --be-primary: #1b3b8b;
  --be-accent: #2f6bff;
  --be-gold: #c8a24b;
  --be-emphasis: #c0392b;
  --be-line: #e5eaf2;
  --be-surface: #f7f9fc;
  --be-code-bg: #1e2a44;
  --be-font: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --be-body-size: 15px;
  --be-line-height: 1.9;
  --be-para-gap: 1.05em;
}

.be-doc,
.be-editor {
  font-family: var(--be-font);
  font-size: var(--be-body-size);
  font-weight: 400;
  line-height: var(--be-line-height);
  color: var(--be-ink);
  word-break: break-word;
  -webkit-font-smoothing: antialiased;
}

/* ---- blocks: canonical HTML uses [data-be-block], editor DOM uses [data-content-type] ---- */

.be-doc [data-be-block="paragraph"],
.be-doc [data-be-block="quote"] > p,
.be-editor [data-content-type="paragraph"] {
  margin: 0 0 var(--be-para-gap);
}

.be-doc [data-be-block="heading"],
.be-editor [data-content-type="heading"] {
  margin: 1.9em 0 0.85em;
  font-weight: 700;
  line-height: 1.45;
  color: var(--be-primary);
  letter-spacing: 0.01em;
}

.be-doc h2[data-be-block="heading"],
.be-editor [data-content-type="heading"][data-level="2"],
.be-editor h2 {
  font-size: 18px;
}

.be-doc h3[data-be-block="heading"],
.be-editor [data-content-type="heading"][data-level="3"],
.be-editor h3 {
  font-size: 16px;
  font-weight: 600;
}

.be-doc .be-heading,
.be-editor .be-heading {
  color: var(--be-primary);
  font-weight: 700;
}

.be-doc [data-be-block="bulletList"],
.be-doc [data-be-block="numberedList"],
.be-editor [data-content-type="bulletListItem"],
.be-editor [data-content-type="numberedListItem"] {
  margin: 0 0 var(--be-para-gap);
  padding-left: 1.6em;
}

.be-doc [data-be-block="bulletList"] li,
.be-doc [data-be-block="numberedList"] li {
  margin: 0.25em 0;
}

.be-doc [data-be-block="quote"],
.be-editor [data-content-type="quote"] {
  margin: 1.2em 0;
  padding: 0.55em 0 0.55em 1.1em;
  border-left: 3px solid var(--be-gold);
  background: var(--be-surface);
  color: var(--be-muted);
}

.be-doc [data-be-block="quote"] > p:last-child,
.be-editor [data-content-type="quote"] > p:last-child {
  margin-bottom: 0;
}

.be-doc [data-be-block="codeBlock"],
.be-editor [data-content-type="codeBlock"] {
  margin: 1.3em 0;
  padding: 1em 1.15em;
  border-radius: 10px;
  background: var(--be-code-bg);
  color: #e8eefc;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre-wrap;
}

.be-doc [data-be-block="codeBlock"] code,
.be-editor [data-content-type="codeBlock"] code {
  font: inherit;
  color: inherit;
  background: none;
  padding: 0;
}

.be-doc [data-be-block="table"],
.be-editor [data-content-type="table"] {
  width: 100%;
  margin: 1.3em 0;
  border-collapse: collapse;
  font-size: 14px;
}

.be-doc [data-be-block="table"] th,
.be-doc [data-be-block="table"] td,
.be-editor [data-content-type="table"] th,
.be-editor [data-content-type="table"] td {
  border: 1px solid var(--be-line);
  padding: 0.55em 0.8em;
  text-align: left;
  vertical-align: top;
}

.be-doc [data-be-block="table"] th,
.be-editor [data-content-type="table"] th {
  background: var(--be-surface);
  color: var(--be-primary);
  font-weight: 600;
}

.be-doc [data-be-block="image"],
.be-editor [data-content-type="image"] {
  margin: 1.5em 0;
  text-align: center;
}

.be-doc [data-be-block="image"] img,
.be-editor [data-content-type="image"] img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.be-doc figcaption,
.be-editor figcaption {
  margin-top: 0.5em;
  font-size: 12px;
  color: var(--be-faint);
}

/* ---- business-specific block: image placeholder (dashed frame from the Word draft) ---- */

.be-doc [data-be-block="imagePlaceholder"],
.be-editor [data-be-block="imagePlaceholder"],
.be-editor .be-placeholder-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  margin: 1.35em 0;
  padding: 0.75em 1.1em;
  border: 1px dashed var(--be-faint);
  border-radius: 8px;
  background: repeating-linear-gradient(135deg, #fbfcfe 0 8px, #f7f9fc 8px 16px);
  color: var(--be-muted);
  font-size: 13px;
  font-style: italic;
  text-align: center;
  line-height: 1.6;
}

.be-doc [data-be-block="divider"],
.be-editor [data-content-type="divider"] {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--be-line);
}

/* ---- inline styles: semantic classes only, colors live here ---- */

.be-doc strong,
.be-editor strong {
  font-weight: 600;
  color: inherit;
}

.be-doc .be-emphasis,
.be-editor .be-emphasis {
  color: var(--be-emphasis);
  font-weight: 600;
}

.be-doc .be-highlight,
.be-editor .be-highlight {
  color: var(--be-gold);
  font-weight: 600;
}

.be-doc mark,
.be-editor mark {
  background: #fff2c4;
  color: inherit;
  padding: 0 0.15em;
  border-radius: 2px;
}

.be-doc code,
.be-editor code {
  padding: 0.12em 0.35em;
  border-radius: 4px;
  background: var(--be-surface);
  color: var(--be-primary);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9em;
}

.be-doc a,
.be-editor a {
  color: var(--be-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.18s ease;
}

.be-doc a:hover,
.be-editor a:hover {
  color: var(--be-primary);
}

.be-doc u,
.be-editor u {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- editor-only interaction states (never change typography) ---- */

.be-shell[data-be-mode="edit"] .be-editor [data-content-type]:hover {
  background: rgba(47, 107, 255, 0.035);
  border-radius: 4px;
  transition: background 0.15s ease;
}

.be-shell[data-be-mode="edit"] .be-editor [data-content-type]:focus-within {
  background: rgba(47, 107, 255, 0.055);
  box-shadow: inset 2px 0 0 var(--be-accent);
  border-radius: 4px;
}

.be-editor .be-placeholder-card .be-placeholder-action {
  margin-left: auto;
  padding: 2px 8px;
  border: 1px solid var(--be-line);
  border-radius: 6px;
  background: #fff;
  color: var(--be-primary);
  font-size: 12px;
  font-style: normal;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.be-editor .be-placeholder-card .be-placeholder-action:hover {
  border-color: var(--be-accent);
  transform: translateY(-1px);
}

/* ---- narrow screens ---- */

@media (max-width: 768px) {
  .be-doc,
  .be-editor {
    font-size: 15px;
    line-height: 1.8;
  }

  .be-doc [data-be-block="table"],
  .be-editor [data-content-type="table"] {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .be-doc [data-be-block="imagePlaceholder"],
  .be-editor [data-be-block="imagePlaceholder"],
  .be-editor .be-placeholder-card {
    white-space: normal;
  }
}
