/* ============================================================
   板块化内容 · 浏览态样式
   依赖 css/style.css 里的设计变量（--accent / --border / --card ...）
   ============================================================ */

.blk { margin-bottom: 30px; }
.blk:last-child { margin-bottom: 0; }

.blk-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 14px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  line-height: 1.5;
}

.blk-el + .blk-el { margin-top: 14px; }

/* 文字 */
.blk-text p {
  margin: 0 0 12px;
  line-height: 1.9;
  color: var(--text-dim);
  font-size: 0.95rem;
}
.blk-text p:last-child { margin-bottom: 0; }
.blk-text strong { color: var(--text); }

/* 图片 */
.blk-image { margin: 0; }
.blk-image img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: block;
}
.blk-image figcaption {
  margin-top: 8px;
  font-size: 0.86rem;
  color: var(--text-faint);
  text-align: center;
}

/* 代码（可折叠，零 JS 依赖原生 details） */
.blk-code {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  overflow: hidden;
}
.blk-code > summary {
  cursor: pointer;
  padding: 11px 16px;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent);
  background: var(--bg-soft);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.blk-code > summary::-webkit-details-marker { display: none; }
.blk-code > summary::before {
  content: "▸";
  color: var(--text-faint);
  font-size: 0.9rem;
}
.blk-code[open] > summary::before { content: "▾"; }
.blk-code > summary .blk-code-hint {
  margin-left: auto;
  color: var(--text-faint);
  font-size: 0.76rem;
}
.blk-code pre {
  margin: 0;
  overflow-x: auto;
  border-top: 1px solid var(--border);
}
.blk-code pre > code.hljs {
  display: block;
  padding: 16px 18px;
  background: #fbfcfe;
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.75;
}

/* 需要登录 / 空状态 / 错误 */
.blk-state {
  border: 1px dashed var(--border-strong);
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 40px 22px;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.92rem;
}
.blk-state .icon { font-size: 1.9rem; display: block; margin-bottom: 10px; }
.blk-state .title { color: var(--text); font-weight: 600; margin-bottom: 6px; }
.blk-state .actions { margin-top: 18px; }

/* 加载骨架 */
.blk-skeleton {
  height: 90px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--bg-soft) 25%, #fff 37%, var(--bg-soft) 63%);
  background-size: 400% 100%;
  animation: blk-shimmer 1.3s ease-in-out infinite;
  margin-bottom: 14px;
}
@keyframes blk-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* 移动端微调 */
@media (max-width: 600px) {
  .blk { margin-bottom: 24px; }
  .blk-code pre > code.hljs { font-size: 0.78rem; padding: 13px 14px; }
}

/* ============================================================
   编辑态（仅在 ?edit=1 且管理员时加载 editor.js 后出现）
   ============================================================ */

/* 顶部编辑条 */
.editor-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin-bottom: 26px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--accent-soft);
}
.editor-bar .label {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent);
  letter-spacing: 1px;
}
.editor-bar .spacer { flex: 1; }
.editor-bar .editor-status {
  font-size: 0.82rem;
  color: var(--text-faint);
  font-family: var(--mono);
}
.editor-bar .editor-status.saving { color: var(--amber); }
.editor-bar .editor-status.saved { color: var(--green); }
.editor-bar .editor-status.error { color: var(--red); }

/* 板块容器（编辑态加边框，便于看清范围） */
.editing .blk {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 16px 16px 8px;
  background: rgba(8, 145, 178, 0.02);
}
.editing .blk:hover { border-color: var(--accent); }

/* 悬浮工具栏 */
.blk-toolbar,
.blk-el-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  opacity: 0;
  transition: opacity 0.2s;
}
.blk-toolbar {
  justify-content: flex-end;
  margin-bottom: 10px;
}
.blk:hover > .blk-toolbar,
.blk-el:hover > .blk-el-toolbar { opacity: 1; }
.editing .blk-toolbar,
.editing .blk-el-toolbar { opacity: 1; }

.blk-toolbar button,
.blk-el-toolbar button {
  font-family: var(--sans);
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}
.blk-toolbar button:hover,
.blk-el-toolbar button:hover { color: var(--accent); border-color: var(--accent); }
.blk-toolbar button.danger:hover,
.blk-el-toolbar button.danger:hover { color: var(--red); border-color: rgba(220, 38, 38, 0.4); }

.drag-handle {
  cursor: grab;
  border: 1px dashed var(--border-strong);
  background: var(--bg-soft);
  color: var(--text-faint);
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 0.8rem;
  user-select: none;
}
.drag-handle:active { cursor: grabbing; }

.blk-el-wrapper { margin: 0 0 12px; }
.blk-el-toolbar { margin-bottom: 6px; justify-content: flex-start; }
.blk-el-wrapper.editing-el { border-left: 3px solid var(--accent); padding-left: 12px; }

/* 行内编辑表单 */
.blk-edit-form { display: flex; flex-direction: column; gap: 10px; }
.blk-edit-form textarea,
.blk-edit-form input[type="text"],
.blk-edit-form select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 11px 13px;
  font-family: var(--mono);
  font-size: 0.86rem;
  color: var(--text);
  background: #fff;
  line-height: 1.7;
}
.blk-edit-form textarea { resize: vertical; min-height: 120px; }
.blk-edit-form select { font-family: var(--sans); }
.blk-edit-form .row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: var(--text-dim);
}
.blk-edit-form .row label { display: inline-flex; align-items: center; gap: 6px; }
.blk-edit-form .actions { display: flex; gap: 10px; }
.blk-edit-form .actions button {
  font-size: 0.84rem;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text-dim);
  cursor: pointer;
}
.blk-edit-form .actions button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.blk-edit-form .hint { font-size: 0.78rem; color: var(--text-faint); }

/* 新板块占位（空页面时） */
.editor-add-first {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 34px 20px;
  text-align: center;
  color: var(--text-faint);
  background: var(--bg-soft);
}

/* 排序时的视觉反馈 */
.sortable-ghost { opacity: 0.4; }
.sortable-drag { box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18); }
