/** siyuan */
body {
  background-color: var(--b3-theme-background);
  color: var(--b3-theme-on-background);
}
.b3-typography,
.protyle-wysiwyg,
.protyle-title {
  font-size: 16px !important;
}
.b3-typography code:not(.hljs),
.protyle-wysiwyg span[data-type~='code'] {
  font-variant-ligatures: normal;
}
.li > .protyle-action {
  height: 34px;
  line-height: 34px;
}
.protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h1,
.protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h2,
.protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h3,
.protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h4,
.protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h5,
.protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h6 {
  line-height: 34px;
}
.protyle-wysiwyg [data-node-id].li > .protyle-action:after {
  height: 16px;
  width: 16px;
  margin: -8px 0 0 -8px;
}
.protyle-wysiwyg [data-node-id].li > .protyle-action svg {
  height: 14px;
}
.protyle-wysiwyg [data-node-id].li:before {
  height: calc(100% - 34px);
  top: 34px;
}
.protyle-wysiwyg [data-node-id] [spellcheck] {
  min-height: 26px;
}
.protyle-wysiwyg .li {
  min-height: 34px;
}
.protyle-gutters button svg {
  height: 26px;
}
.protyle-wysiwyg img.emoji,
.b3-typography img.emoji {
  width: 18px;
}
.protyle-wysiwyg .h1 img.emoji,
.b3-typography h1 img.emoji {
  width: 35px;
}
.protyle-wysiwyg .h2 img.emoji,
.b3-typography h2 img.emoji {
  width: 31px;
}
.protyle-wysiwyg .h3 img.emoji,
.b3-typography h3 img.emoji {
  width: 27px;
}
.protyle-wysiwyg .h4 img.emoji,
.b3-typography h4 img.emoji {
  width: 25px;
}
.protyle-wysiwyg .h5 img.emoji,
.b3-typography h5 img.emoji {
  width: 22px;
}
.protyle-wysiwyg .h6 img.emoji,
.b3-typography h6 img.emoji {
  width: 20px;
}
/** ocenapress */
body {
  margin: 0;
}
#preview {
  padding: 24px 20px 48px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 24px;
  box-sizing: border-box;
  max-width: 1280px;
  margin: 0 auto;
}
/** 中文阅读最佳行宽约 720~800px（35~45 字/行） */
#preview > [data-type='NodeDocument'] {
  padding: 0 5px;
  max-width: 760px;
  flex: 1;
  min-height: 850px;
  overflow-x: hidden;
  word-wrap: break-word;
}

/** 文档标题下的更新时间 meta */
.oceanpress-doc-meta {
  margin: -14px 0 28px;
  font-size: 13px;
  color: var(--b3-theme-on-surface-light, #9099a6);
  letter-spacing: 0.2px;
  user-select: none;
}
#preview > [data-type='NodeDocument'] > .h1 {
  margin-bottom: 4px;
}

#preview > [data-type='NodeDocument'] > .protyle-background__img {
  max-width: 100%;
  width: 100vw;
  background-position: center;
  background-size: cover;
}
#oceanpress-sidebar {
  width: 50px;
}
/* 临时修复代码块错乱的问题 */
.protyle-wysiwyg div.hljs {
  display: block !important;
}

/* 主题切换按钮：使用思源 b3 变量。
   优先挂在 .header-container 内随导航排版；无导航时回退为 fixed 悬浮 */
#oceanpress-theme-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: transparent;
  border: 1px solid var(--b3-border-color);
  border-radius: var(--b3-border-radius-round, 999px);
  padding: 4px 12px;
  cursor: pointer;
  font-size: 13px;
  line-height: 20px;
  color: var(--b3-theme-on-surface);
  user-select: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

#oceanpress-theme-toggle:hover {
  background-color: var(--b3-list-hover);
}

#oceanpress-theme-toggle .theme-icon {
  font-size: 15px;
}

/** 回退形态：未挂在 header 时悬浮在右上角 */
body > #oceanpress-theme-toggle {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 1000;
  background-color: var(--b3-theme-surface);
  box-shadow: var(--b3-point-shadow, 0 0 0.1rem rgba(0, 0, 0, 0.15));
}

/* 右侧边栏窄屏隐藏 */
@media (max-width: 1100px) {
  #oceanpress-right-sidebar {
    display: none;
  }
}

/* 中等屏幕时调整布局 */
@media (max-width: 1024px) {
  #preview {
    gap: 12px;
    padding: 12px;
  }

  #preview > [data-type='NodeDocument'] {
    max-width: none;
    flex: 1;
  }
}

/* 小屏幕时侧边栏变为抽屉，具体交互由 docTree.css / docTree.js 负责 */
@media (max-width: 768px) {
  #preview {
    flex-direction: column;
    align-items: stretch;
    padding: 8px;
  }

  #preview > [data-type='NodeDocument'] {
    max-width: none;
    width: 100%;
    padding: 0;
    box-sizing: border-box;
  }

  body > #oceanpress-theme-toggle {
    top: 8px;
    right: 10px;
    padding: 3px 10px;
    font-size: 12px;
  }
}

/* 平滑过渡效果 */
* {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
