/* Book Stages — fixed layout; text / image / background editable */

.shop-book-stages {
  --book-stages-bg: #ffffff;
  --book-stages-panel: #f9f8f6;
  --book-stages-title: #1c1917;
  --book-stages-body: #3f3f46;
  --book-stages-accent: #c0392b;
  --book-stages-radius: 0;
  --book-stages-font: var(--font-body, Arial, Helvetica, sans-serif);
  --book-stages-serif:
    "Noto Serif SC", "Songti SC", "SimSun", "STSong", Georgia, serif;

  box-sizing: border-box;
  width: 100%;
  margin: 1.75em 0;
  padding: 36px 32px;
  background: var(--book-stages-bg);
  border-radius: var(--book-stages-radius);
  font-family: var(--book-stages-font);
  color: var(--book-stages-body);
}

/* Full-bleed background (frontend only): the block background spans the full
   viewport width, while __inner stays centered at max-width:1100px so the
   internal layout is unchanged. Editor (.is-editor) keeps the card look. */
.shop-book-stages:not(.is-editor) {
  width: 100vw;
  max-width: 100vw;
  margin-top: 0;
  margin-bottom: 0;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  border-radius: 0;
}

/* Deletable elements: hover an element in the editor to reveal its × button.
   Only rendered inside the editor (root has .is-editor). */
.shop-book-stages .is-deletable {
  position: relative;
}
.shop-book-stages__icon-slot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.shop-book-stages .shop-del-btn {
  position: absolute;
  top: -9px;
  right: -9px;
  z-index: 6;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid #e11d48;
  border-radius: 50%;
  background: #fff;
  color: #e11d48;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.is-editor .is-deletable:hover > .shop-del-btn,
.is-editor .shop-del-btn:focus {
  display: inline-flex;
}

/* Preserve the decorative layout when is-deletable is added:
   callouts stay absolutely positioned, and the arrows layer keeps
   covering the diagram while still receiving hover in the editor. */
.shop-book-stages .shop-book-stages__callout.is-deletable {
  position: absolute;
}
.shop-book-stages .shop-book-stages__arrows.is-deletable {
  pointer-events: auto;
}
.shop-book-stages__arrows svg {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.shop-book-stages *,
.shop-book-stages *::before,
.shop-book-stages *::after {
  box-sizing: border-box;
}

.shop-book-stages__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 32px 40px;
  align-items: center;
  max-width: 70%;
  margin: 0 auto;
}

.shop-book-stages__copy {
  text-align: center;
  min-width: 0;
}

/* 用户通过对齐工具栏选择的对齐方式覆盖默认居中 */
.shop-book-stages.has-text-align-left .shop-book-stages__copy,
.shop-book-stages.has-text-align-right .shop-book-stages__copy {
  text-align: inherit;
}

.shop-book-stages__title {
  margin: 0 0 14px;
  font-family: var(--book-stages-serif);
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  font-weight: 700;
  line-height: 1.3;
  color: var(--book-stages-title);
}

.shop-book-stages__intro {
  margin: 0 0 28px;
  font-size: clamp(0.95rem, 1.2vw, 1.05rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.65;
  color: var(--book-stages-body);
}

.shop-book-stages__list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.shop-book-stages__item {
  margin: 0;
  font-size: clamp(0.92rem, 1.1vw, 1rem);
  line-height: 1.55;
  color: var(--book-stages-body);
}

.shop-book-stages__item-heading {
  font-weight: 700;
  color: var(--book-stages-title);
}

.shop-book-stages__item-sep {
  margin: 0 0.2em;
  font-weight: 400;
}

.shop-book-stages__item-desc {
  font-weight: 400;
}

.shop-book-stages__diagram {
  position: relative;
  min-height: 360px;
  padding: 28px 24px;
  background: var(--book-stages-panel);
  border-radius: 16px;
  box-shadow: none;
}

.shop-book-stages__arrows {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.shop-book-stages__book {
  position: relative;
  z-index: 2;
  width: min(150px, 38%);
  margin: 72px auto;
}

.shop-book-stages__image {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center;
  border-radius: 4px;
  box-shadow: 0 10px 28px rgba(28, 25, 23, 0.18);
  background: transparent;
}

.shop-book-stages__image-placeholder {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 4px;
  background: #e8e4de;
  box-shadow: 0 10px 28px rgba(28, 25, 23, 0.12);
}

.shop-book-stages__callout {
  position: absolute;
  z-index: 2;
  max-width: 42%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shop-book-stages__callout--tl {
  top: 18px;
  left: 18px;
  text-align: left;
  align-items: flex-start;
}

.shop-book-stages__callout--tr {
  top: 18px;
  right: 18px;
  text-align: right;
  align-items: flex-end;
}

.shop-book-stages__callout--bl {
  bottom: 18px;
  left: 18px;
  text-align: left;
  align-items: flex-start;
}

.shop-book-stages__callout--br {
  bottom: 18px;
  right: 18px;
  text-align: right;
  align-items: flex-end;
}

.shop-book-stages__callout-title {
  font-size: clamp(0.85rem, 1.05vw, 0.98rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--book-stages-accent);
}

.shop-book-stages__callout-sub {
  font-size: clamp(0.78rem, 0.95vw, 0.88rem);
  font-weight: 400;
  line-height: 1.3;
  color: var(--book-stages-body);
}

/* ---------- Editor ---------- */
.shop-book-stages.is-editor
  .shop-book-stages__title.block-editor-rich-text__editable,
.shop-book-stages.is-editor
  .shop-book-stages__intro.block-editor-rich-text__editable,
.shop-book-stages.is-editor
  .shop-book-stages__item-heading.block-editor-rich-text__editable,
.shop-book-stages.is-editor
  .shop-book-stages__item-desc.block-editor-rich-text__editable,
.shop-book-stages.is-editor
  .shop-book-stages__callout-title.block-editor-rich-text__editable,
.shop-book-stages.is-editor
  .shop-book-stages__callout-sub.block-editor-rich-text__editable {
  outline: none;
}

.shop-book-stages__image-btn {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.shop-book-stages__image-hint {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(28, 25, 23, 0.72);
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.shop-book-stages__image-btn:hover .shop-book-stages__image-hint,
.shop-book-stages__image-btn:focus-visible .shop-book-stages__image-hint {
  opacity: 1;
}

.shop-book-stages__image-placeholder.is-button {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #c5c0b8;
  background: #efeae4;
  color: #57534e;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .shop-book-stages {
    padding: 24px 18px;
  }

  .shop-book-stages__inner {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .shop-book-stages__diagram {
    min-height: 340px;
  }

  .shop-book-stages__book {
    width: min(130px, 36%);
    margin: 64px auto;
  }
}

@media (max-width: 520px) {
  .shop-book-stages {
    padding: 18px 14px;
    border-radius: 14px;
  }

  .shop-book-stages__callout {
    max-width: 46%;
  }

  .shop-book-stages__diagram {
    padding: 18px 14px;
    min-height: 300px;
  }
}

/* ---------- Rich-text inline formats (system toolbar) ---------- */
.shop-book-stages mark,
.shop-book-stages mark.has-inline-background-color {
  padding: 0.05em 0.25em;
  border-radius: 3px;
  background-color: #fdeeb3;
  color: inherit;
}

.shop-book-stages code {
  padding: 0.1em 0.4em;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.shop-book-stages kbd {
  padding: 0.1em 0.4em;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.04);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
}

.shop-book-stages a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.shop-book-stages sub,
.shop-book-stages sup {
  font-size: 0.72em;
  line-height: 0;
}

.shop-book-stages img {
  max-width: 100%;
  height: auto;
}

.shop-book-stages .rich-text *,
.shop-book-stages [data-rich-text-format-boundary] {
  box-sizing: border-box;
}
