/* 前台编辑模式：只对管理员可见 */
.edit-bar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 9px 16px;
  border: 1px solid rgba(240, 160, 60, 0.32);
  border-radius: 999px;
  background: rgba(12, 10, 8, 0.94);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
  font-family: "Manrope", -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  color: #cbc2b6;
  white-space: nowrap;
  max-width: calc(100vw - 24px);
}

.edit-bar__who {
  color: #8f8578;
  font-size: 11.5px;
}

.edit-bar__btn {
  padding: 6px 14px;
  border: 1px solid rgba(238, 226, 208, 0.16);
  border-radius: 999px;
  background: transparent;
  color: #d8cfc3;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.edit-bar__btn:hover {
  border-color: rgba(240, 160, 60, 0.55);
  color: #f0a03c;
}

.edit-bar__btn--primary {
  border-color: transparent;
  background: #f0a03c;
  color: #1a1206;
  font-weight: 600;
}

.edit-bar__btn--primary:hover {
  background: #ffb85c;
  color: #1a1206;
}

.edit-bar__btn.is-hot {
  border-color: rgba(240, 160, 60, 0.8);
  background: rgba(240, 160, 60, 0.16);
  color: #ffcf85;
}

.edit-bar__link {
  color: #8f8578;
  font-size: 11.5px;
  text-decoration: none;
}

.edit-bar__link:hover {
  color: #f0a03c;
}

.edit-bar__tip {
  max-width: 340px;
  color: #8fdc8a;
  font-size: 11.5px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.edit-img-btn { display: none; }
.edit-bar [hidden] { display: none !important; }
.edit-bar__btn:disabled, .edit-img-btn:disabled { opacity: .5; cursor: wait; }
.edit-bar__btn:focus-visible, .edit-bar__link:focus-visible, .edit-img-btn:focus-visible { outline: 2px solid #ffc46b; outline-offset: 3px; }

.edit-bar__tip[data-error="1"] {
  color: #ff9d84;
}

/* 编辑态：可编辑元素描边 */
body.is-editing [data-cms] {
  outline: 1px dashed rgba(240, 160, 60, 0.45);
  outline-offset: 3px;
  border-radius: 2px;
  cursor: text;
  transition: outline-color 0.15s ease, background 0.15s ease;
}

body.is-editing [data-cms]:hover {
  outline-color: rgba(240, 160, 60, 0.85);
  background: rgba(240, 160, 60, 0.07);
}

body.is-editing [data-cms]:focus {
  outline: 2px solid #f0a03c;
  outline-offset: 3px;
  background: rgba(240, 160, 60, 0.1);
}

body.is-editing [data-cms]:empty::before {
  content: "点这里输入…";
  color: rgba(240, 160, 60, 0.6);
}

/* 编辑态：图片槽位 */
body.is-editing .edit-img-holder {
  position: relative;
}

body.is-editing .edit-img-holder .edit-img-btn {
  display: block;
  position: absolute;
  top: calc(10px + var(--edit-image-index, 0) * 36px);
  right: 10px;
  z-index: 6;
  padding: 6px 12px;
  border: 1px solid rgba(240, 160, 60, 0.55);
  border-radius: 999px;
  background: rgba(12, 10, 8, 0.86);
  color: #f0a03c;
  font-family: "Manrope", -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 11.5px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

body.is-editing .edit-img-holder .edit-img-btn:hover {
  background: #f0a03c;
  color: #1a1206;
}

body.is-editing .edit-img-holder img {
  outline: 1px dashed rgba(240, 160, 60, 0.5);
  outline-offset: -1px;
}

@media (max-width: 760px) {
  .edit-bar {
    left: 12px;
    right: 12px;
    bottom: 12px;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    transform: none;
    white-space: normal;
  }

  .edit-bar__who { display: none; }
  .edit-bar__tip { flex-basis: 100%; max-width: none; text-align: center; }
}

/* 编辑态：动效未触发的元素也要看得见 */
body.is-editing [data-reveal] {
  opacity: 1 !important;
  transform: none !important;
  visibility: visible !important;
}

/* 首屏图片的换图按钮挂到 .hero 上，避免塞进装饰层撑坏布局 */
body.is-editing .hero.edit-img-holder {
  position: relative;
}

body.is-editing .hero .edit-img-btn {
  top: 96px;
  right: 24px;
}
