/* ==========================================================================
   迎洽官网 · WordPress 适配与文章正文排版
   --------------------------------------------------------------------------
   本文件是区块主题相对源站原型新增的样式，分两部分：

   一、WordPress 结构适配（仅前端生效）
      模板部件的包装层、登录后的管理条偏移。
      这部分规则都以 .wp-site-blocks / body.admin-bar 限定，只在前台页面
      匹配；经 add_editor_style 加载进编辑器后被自动加上
      .editor-styles-wrapper 前缀，不会命中编辑器界面，天然失效，安全。

   二、WordPress 正文排版
      site.css 只覆盖 .yq-* 类名，不覆盖文章正文里的裸标签与 .wp-block-*。
      这里给文章正文（前端 .wp-block-post-content、编辑器 .is-root-container）
      写一套与整站一致的排版，编辑器经 add_editor_style 加载，所见即所得。
   ========================================================================== */


/* --------------------------------------------------------------------------
   一、WordPress 结构适配（仅前端生效）
   -------------------------------------------------------------------------- */

/* 模板部件 block 会在页头 / 页脚外再包一层 div.wp-block-template-part。
   让它不产生盒模型：子元素（.yq-header / .yq-footer）直接以 .wp-site-blocks
   为包含块，.yq-header 的 position: sticky 才能跨全页生效。 */
.wp-site-blocks > .wp-block-template-part {
  display: contents;
}

/* 登录状态下 WordPress 管理条固定在视口顶部（桌面 32px / 手机 46px），
   sticky 页头与手机抽屉需要相应下移。 */
@media (min-width: 783px) {
  body.admin-bar .yq-header {
    top: 32px;
  }
}

@media (max-width: 782px) {
  body.admin-bar .yq-header {
    top: 46px;
  }
}

/* 手机抽屉（导航 < 1024px 时 position: fixed，top 为页头高度）。 */
@media (max-width: 1023px) {
  body.admin-bar .yq-header__nav {
    top: calc(var(--yq-header-h) + 46px);
  }
  body.admin-bar .yq-header.is-scrolled .yq-header__nav {
    top: calc(var(--yq-header-h-compact) + 46px);
  }
}

@media (min-width: 783px) and (max-width: 1023px) {
  body.admin-bar .yq-header__nav {
    top: calc(var(--yq-header-h) + 32px);
  }
  body.admin-bar .yq-header.is-scrolled .yq-header__nav {
    top: calc(var(--yq-header-h-compact) + 32px);
  }
}


/* --------------------------------------------------------------------------
   二、WordPress 正文排版
   选择器同时覆盖前端 .wp-block-post-content 与编辑器 .is-root-container。
   用 :where() 保持零优先级，方便在编辑器里被区块自身设置覆盖。
   -------------------------------------------------------------------------- */

/* 段落之间留白由区块间距（blockGap）负责；这里兜底经典内容里的裸标签。 */
:where(.wp-block-post-content, .is-root-container) :where(p, ul, ol, blockquote, table, pre) {
  margin-block: 0 1.25em;
}

:where(.wp-block-post-content, .is-root-container) h2 {
  font-size: var(--yq-text-2xl);
  line-height: var(--yq-leading-snug);
  margin-block: 1.6em 0.6em;
}

:where(.wp-block-post-content, .is-root-container) h3 {
  font-size: var(--yq-text-xl);
  line-height: var(--yq-leading-snug);
  margin-block: 1.4em 0.5em;
}

:where(.wp-block-post-content, .is-root-container) h4 {
  font-size: var(--yq-text-lg);
  line-height: var(--yq-leading-snug);
  margin-block: 1.2em 0.4em;
}

/* 列表：site.css 全局重置了 list-style，正文里恢复。 */
:where(.wp-block-post-content, .is-root-container) ul:not([class]) {
  list-style: disc;
  padding-left: 1.5em;
}

:where(.wp-block-post-content, .is-root-container) ol:not([class]) {
  list-style: decimal;
  padding-left: 1.5em;
}

:where(.wp-block-post-content, .is-root-container) :where(ul, ol) :where(ul, ol) {
  margin-block: 0.25em;
}

:where(.wp-block-post-content, .is-root-container) li + li {
  margin-top: 0.35em;
}

/* 链接：整站默认下划线关闭，正文里为可读性恢复下划线。 */
:where(.wp-block-post-content, .is-root-container) a:not(.yq-btn):not(.wp-block-button__link) {
  color: var(--yq-navy-800);
  text-decoration: underline;
  text-decoration-color: var(--yq-line-strong);
  text-underline-offset: 0.18em;
  transition: color var(--yq-dur) var(--yq-ease), text-decoration-color var(--yq-dur) var(--yq-ease);
}

:where(.wp-block-post-content, .is-root-container) a:not(.yq-btn):not(.wp-block-button__link):hover {
  color: var(--yq-gold-700);
  text-decoration-color: var(--yq-gold-500);
}

/* 引用块。 */
:where(.wp-block-post-content, .is-root-container) blockquote {
  padding: 1em 1.5em;
  background: var(--yq-paper);
  border-left: 3px solid var(--yq-gold-500);
  border-radius: 0 var(--yq-radius) var(--yq-radius) 0;
  color: var(--yq-ink-2);
}

:where(.wp-block-post-content, .is-root-container) blockquote cite,
:where(.wp-block-post-content, .is-root-container) .wp-block-quote__citation {
  display: block;
  margin-top: 0.5em;
  font-size: var(--yq-text-sm);
  font-style: normal;
  color: var(--yq-ink-3);
}

/* 图片与图注。 */
:where(.wp-block-post-content, .is-root-container) img {
  border-radius: var(--yq-radius-lg);
}

:where(.wp-block-post-content, .is-root-container) figcaption {
  margin-top: 0.5em;
  font-size: var(--yq-text-sm);
  color: var(--yq-ink-3);
  text-align: center;
}

/* 表格。 */
:where(.wp-block-post-content, .is-root-container) table,
:where(.wp-block-post-content, .is-root-container) .wp-block-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--yq-text-sm);
}

:where(.wp-block-post-content, .is-root-container) th,
:where(.wp-block-post-content, .is-root-container) td {
  padding: 0.6em 0.9em;
  border: 1px solid var(--yq-line);
  text-align: left;
}

:where(.wp-block-post-content, .is-root-container) thead th,
:where(.wp-block-post-content, .is-root-container) th {
  color: var(--yq-navy-800);
  background: var(--yq-paper);
  font-weight: 600;
}

/* 行内代码与代码块。 */
:where(.wp-block-post-content, .is-root-container) code {
  font-family: var(--yq-font-mono);
  font-size: 0.875em;
  padding: 0.15em 0.4em;
  background: var(--yq-paper-2);
  border-radius: var(--yq-radius-sm);
}

:where(.wp-block-post-content, .is-root-container) pre {
  padding: 1.25em 1.5em;
  background: var(--yq-navy-900);
  color: var(--yq-on-dark-2);
  border-radius: var(--yq-radius-lg);
  overflow-x: auto;
  font-size: var(--yq-text-sm);
  line-height: 1.7;
}

:where(.wp-block-post-content, .is-root-container) pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: inherit;
}

/* 分隔线。 */
:where(.wp-block-post-content, .is-root-container) hr,
:where(.wp-block-post-content, .is-root-container) .wp-block-separator {
  border: 0;
  border-top: 1px solid var(--yq-line);
  margin-block: 2em;
  color: inherit;
  opacity: 1;
}

/* 文章列表（index / archive / search 的查询循环）里的标题与摘要间距。 */
.wp-block-post-template .wp-block-post-title {
  font-size: var(--yq-text-2xl);
}

.wp-block-post-excerpt__excerpt {
  color: var(--yq-ink-2);
}

.wp-block-post-excerpt__more-link {
  color: var(--yq-navy-800);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--yq-line-strong);
  text-underline-offset: 0.18em;
}

/* 查询分页。 */
.wp-block-query-pagination a {
  text-decoration: underline;
  text-decoration-color: var(--yq-line-strong);
  text-underline-offset: 0.18em;
}
