/**
 * PoeticTheme 3.0.11视觉与阅读增强层。
 *
 * 每条属性独立成行。本文件最后加载，用明确选择器收束历史版本的冲突规则。
 */

:root {
  --pt-reading-width: 920px;
  --pt-toc-width: 204px;
  --pt-reading-gap: 32px;
}

/* 桌面主标题统一为26px，保持首页、栏目和内容页层级一致。 */
@media (min-width: 783px) {
  .pt-hero-slide-custom h1,
  .pt-hero-copy h1,
  .pt-hero-fallback h1,
  .pt-home-heading h2,
  .pt-section-heading h2,
  .pt-archive-hero h1,
  .pt-about-hero h1,
  .pt-standard-page-hero h1,
  .pt-editorial-hero h1,
  .pt-page-head h1,
  .pt-page-title,
  .pt-article-title-row h1,
  .pt-article-hero h1,
  .pt-detail-summary h1,
  .pt-home-about h2,
  .pt-brand-story blockquote {
    font-size: 26px !important;
    line-height: 1.32 !important;
    letter-spacing: -0.018em !important;
  }
}

/* 新模板：标题独占一行，摘要和元信息在左，题头图在右。 */
.pt-article-title-row {
  width: 100%;
  max-width: none !important;
  margin-bottom: 18px;
}

.pt-article-title-row h1 {
  margin: 9px 0 0;
}

.pt-article-hero {
  align-items: stretch !important;
  gap: 28px !important;
}

.pt-article-hero > .wp-block-column:first-child {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pt-article-cover,
.pt-article-cover > button,
.pt-article-cover img {
  width: 100%;
  height: 100%;
}

.pt-article-cover {
  min-height: 230px;
  aspect-ratio: 16 / 10;
}

.pt-article-cover > button {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.pt-article-cover img {
  display: block;
  object-fit: cover;
  transition: transform 220ms ease;
}

.pt-article-cover > button:hover img {
  transform: scale(1.025);
}

/* 兼容数据库中保存的3.0.10旧文章模板，不要求用户进入站点编辑器。 */
body.single-post .pt-article-hero:has(> .wp-block-column:first-child h1) {
  display: grid !important;
  grid-template-columns: minmax(0, 64fr) minmax(260px, 36fr);
}

body.single-post .pt-article-hero:has(> .wp-block-column:first-child h1) > .wp-block-column:first-child {
  display: contents;
}

body.single-post .pt-article-hero:has(> .wp-block-column:first-child h1) .pt-article-category,
body.single-post .pt-article-hero:has(> .wp-block-column:first-child h1) h1 {
  grid-column: 1 / -1;
}

body.single-post .pt-article-hero:has(> .wp-block-column:first-child h1) h1 {
  margin: 0 0 18px;
}

body.single-post .pt-article-hero:has(> .wp-block-column:first-child h1) .pt-article-lead,
body.single-post .pt-article-hero:has(> .wp-block-column:first-child h1) .pt-article-meta {
  grid-column: 1;
}

body.single-post .pt-article-hero:has(> .wp-block-column:first-child h1) > .wp-block-column:last-child {
  grid-column: 2;
  grid-row: 3 / 5;
}

/* 正文排版：以中文技术文档的阅读和打印为基准。 */
.pt-article-content {
  max-width: 780px !important;
  font-size: 17px !important;
  line-height: 1.82 !important;
  overflow-wrap: anywhere;
}

.pt-article-content > p {
  margin-top: 0;
  margin-bottom: 1.05em;
}

.pt-article-content h2,
.pt-article-content h3 {
  scroll-margin-top: 96px;
}

.pt-article-content h2 {
  margin-top: 2em;
  margin-bottom: 0.7em;
  padding: 9px 13px;
  border-left: 4px solid var(--pt-blue);
  border-radius: 0 10px 10px 0;
  background: linear-gradient(90deg, #edf8fd, rgba(237, 248, 253, 0));
  font-size: 22px !important;
  line-height: 1.4;
}

.pt-article-content h3 {
  margin-top: 1.65em;
  margin-bottom: 0.6em;
  color: #22485f;
  font-size: 19px !important;
  line-height: 1.45;
}

.pt-article-content ul,
.pt-article-content ol {
  margin: 1em 0;
  padding-left: 1.5em;
}

.pt-article-content li {
  margin: 0.42em 0;
  padding-left: 0.2em;
}

.pt-article-content li::marker {
  color: var(--pt-blue);
  font-weight: 800;
}

.pt-article-content figure {
  margin-top: 1.5em;
  margin-bottom: 1.5em;
}

.pt-article-content figcaption {
  margin-top: 8px;
  color: var(--pt-muted);
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
}

.pt-article-content img[data-pt-full] {
  border-radius: 14px;
  cursor: zoom-in;
  box-shadow: 0 10px 28px rgba(21, 53, 74, 0.1);
}

.pt-article-content .wp-block-table {
  overflow-x: auto;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(21, 53, 74, 0.07);
}

.pt-article-content table {
  min-width: 620px;
  border: 1px solid #cbdde6 !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: #fff;
}

.pt-article-content th,
.pt-article-content td {
  padding: 11px 14px !important;
  border-right: 1px solid #d7e5eb !important;
  border-bottom: 1px solid #d7e5eb !important;
  text-align: center !important;
  vertical-align: middle !important;
}

.pt-article-content thead th,
.pt-article-content tr:first-child th {
  background: linear-gradient(135deg, #0d89ca, #0092dc) !important;
  color: #fff !important;
  font-weight: 800 !important;
}

.pt-article-content tbody tr:nth-child(even) td {
  background: #f6fafc;
}

.pt-article-content tr > :last-child {
  border-right: 0 !important;
}

.pt-article-content tbody tr:last-child td {
  border-bottom: 0 !important;
}

.pt-article-content pre {
  position: relative;
  padding: 22px !important;
  border: 1px solid #214b62;
  border-radius: 15px !important;
  background: #102f42 !important;
  box-shadow: 0 10px 28px rgba(16, 47, 66, 0.15);
  tab-size: 2;
}

.pt-article-content code:not(pre code) {
  border: 1px solid #cce8f4;
}

.pt-article-content .katex-display,
.pt-article-content .math-display,
.pt-article-content .MathJax_Display {
  overflow-x: auto;
  margin: 1.35em 0;
  padding: 15px 18px;
  border: 1px solid var(--pt-line);
  border-radius: 13px;
  background: #fbfdfe;
}

/* 目录：1200px及以上固定在正文左侧，低于该宽度置于正文前方并折叠。 */
@media (min-width: 1200px) {
  .pt-reading-wrap {
    width: min(1280px, calc(100% - 32px));
    max-width: 1280px !important;
  }

  .pt-article-card,
  .pt-adjacent-posts {
    width: min(var(--pt-reading-width), calc(100% - var(--pt-toc-width) - var(--pt-reading-gap)));
    max-width: var(--pt-reading-width) !important;
    margin-right: 0 !important;
    margin-left: auto !important;
  }

  .pt-reading-toc {
    position: fixed !important;
    top: 108px !important;
    left: max(16px, calc(50vw - 624px)) !important;
    z-index: 40;
    width: var(--pt-toc-width) !important;
    margin: 0 !important;
  }

  .pt-toc-toggle {
    display: none !important;
  }

  .pt-toc-panel {
    display: block !important;
    max-height: calc(100vh - 136px);
  }
}

@media (max-width: 1199px) {
  .pt-reading-toc {
    position: static !important;
    width: 100% !important;
    margin: 24px 0 0 !important;
  }

  .pt-toc-toggle {
    display: inline-flex !important;
    align-items: center;
    min-height: 42px;
    padding: 9px 16px;
    border: 0;
    border-radius: 999px;
    background: var(--pt-deep);
    color: #fff;
    font-weight: 750;
    cursor: pointer;
  }

  .pt-toc-panel {
    display: none !important;
    margin-top: 10px;
  }

  .pt-reading-toc.is-open .pt-toc-panel {
    display: block !important;
  }
}

.pt-toc-panel a {
  font-size: 14px !important;
}

.pt-reading-float button {
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.pt-reading-float button:active {
  transform: translateY(0) scale(0.94);
}

/* 手机仍保持清晰层级，避免26px标题挤压窄屏。 */
@media (max-width: 782px) {
  .pt-hero-slide-custom h1,
  .pt-hero-copy h1,
  .pt-home-heading h2,
  .pt-archive-hero h1,
  .pt-about-hero h1,
  .pt-standard-page-hero h1,
  .pt-editorial-hero h1,
  .pt-article-title-row h1,
  .pt-article-hero h1,
  .pt-detail-summary h1,
  .pt-home-about h2 {
    font-size: 24px !important;
    line-height: 1.35 !important;
  }

  .pt-article-hero,
  body.single-post .pt-article-hero:has(> .wp-block-column:first-child h1) {
    display: flex !important;
    flex-direction: column;
  }

  body.single-post .pt-article-hero:has(> .wp-block-column:first-child h1) > .wp-block-column:first-child {
    display: flex;
  }

  .pt-article-cover {
    min-height: 0;
    max-width: none;
    aspect-ratio: 16 / 9;
  }

  .pt-article-content {
    font-size: 16px !important;
  }

  .pt-article-content h2 {
    font-size: 20px !important;
  }

  .pt-article-content h3 {
    font-size: 18px !important;
  }
}

@media print {
  .pt-article-title-row h1 {
    font-size: 22pt !important;
  }

  .pt-article-content table {
    min-width: 0;
    box-shadow: none;
  }

  .pt-article-content thead th,
  .pt-article-content tr:first-child th {
    background: #eaf6fb !important;
    color: #000 !important;
  }
}
