/*
Theme Name: 文明残片 Minimal
Theme URI: https://blog.qingyuxy.com/
Author: Chen & Codex
Description: 为中文技术博客设计的轻量主题，重点优化文章阅读、代码块与旧 Markdown 内容。
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 8.0
Text Domain: wenming-fragments
*/

:root {
  --wm-bg: #f7f8fa;
  --wm-surface: #ffffff;
  --wm-text: #17202a;
  --wm-muted: #667085;
  --wm-border: #e7eaf0;
  --wm-accent: #176b5b;
  --wm-accent-soft: #e7f3ef;
  --wm-code: #111827;
  --wm-code-text: #e5edf8;
  --wm-shadow: 0 18px 50px rgba(20, 32, 45, 0.07);
  --wm-radius: 18px;
  --wm-content: 780px;
  --wm-wide: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--wm-text);
  background: var(--wm-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.8;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--wm-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: #0d5145;
}

img {
  max-width: 100%;
  height: auto;
}

button,
input,
textarea {
  font: inherit;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.screen-reader-text:focus {
  position: fixed;
  z-index: 100000;
  top: 12px;
  left: 12px;
  width: auto;
  height: auto;
  padding: 10px 14px;
  clip: auto;
  color: var(--wm-text);
  background: var(--wm-surface);
  border-radius: 8px;
  box-shadow: var(--wm-shadow);
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgba(231, 234, 240, 0.88);
  background: rgba(247, 248, 250, 0.9);
  backdrop-filter: blur(18px);
}

.header-inner,
.site-main,
.footer-inner {
  width: min(calc(100% - 40px), var(--wm-wide));
  margin-inline: auto;
}

.header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.site-branding {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.custom-logo {
  display: block;
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 10px;
}

.site-title {
  margin: 0;
  font-family: ui-serif, "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  font-size: 1.12rem;
  font-weight: 760;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.site-title a {
  color: var(--wm-text);
  text-decoration: none;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  color: var(--wm-muted);
  font-size: 0.92rem;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav .current-menu-item > a {
  color: var(--wm-text);
}

.site-main {
  min-height: calc(100vh - 180px);
  padding-block: 72px 96px;
}

.home-intro {
  max-width: 760px;
  margin-bottom: 58px;
}

.eyebrow,
.archive-kicker,
.post-card-meta,
.entry-meta {
  color: var(--wm-muted);
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-intro h1,
.archive-header h1 {
  margin: 10px 0 16px;
  font-family: ui-serif, "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  font-size: clamp(2.3rem, 6vw, 4.8rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.home-description,
.archive-description {
  max-width: 620px;
  margin: 0;
  color: var(--wm-muted);
  font-size: 1.08rem;
}

.archive-header {
  margin-bottom: 40px;
}

.archive-header h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.post-card {
  min-width: 0;
  padding: clamp(24px, 4vw, 36px);
  background: var(--wm-surface);
  border: 1px solid var(--wm-border);
  border-radius: var(--wm-radius);
  box-shadow: 0 1px 0 rgba(20, 32, 45, 0.02);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.post-card:hover {
  transform: translateY(-3px);
  border-color: #d8dedf;
  box-shadow: var(--wm-shadow);
}

.post-card h2 {
  margin: 14px 0 12px;
  font-family: ui-serif, "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.post-card h2 a {
  color: var(--wm-text);
  text-decoration: none;
}

.post-card-excerpt {
  margin: 0 0 22px;
  color: var(--wm-muted);
  font-size: 0.96rem;
  line-height: 1.75;
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.read-more::after {
  content: "→";
  transition: transform 160ms ease;
}

.read-more:hover::after {
  transform: translateX(4px);
}

.single-shell {
  width: min(100%, var(--wm-content));
  margin-inline: auto;
}

.back-link {
  display: inline-block;
  margin-bottom: 42px;
  color: var(--wm-muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.back-link:hover {
  color: var(--wm-text);
}

.entry-header {
  margin-bottom: 42px;
}

.entry-title {
  margin: 12px 0 18px;
  font-family: ui-serif, "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  font-size: clamp(2.15rem, 6vw, 4.15rem);
  line-height: 1.16;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  text-transform: none;
  letter-spacing: 0.03em;
}

.entry-content {
  font-family: ui-serif, "Noto Serif CJK SC", "Songti SC", Georgia, serif;
  font-size: 1.06rem;
  line-height: 1.95;
  overflow-wrap: anywhere;
}

.entry-content > *:first-child {
  margin-top: 0;
}

.entry-content p,
.entry-content ul,
.entry-content ol,
.entry-content blockquote,
.entry-content pre,
.entry-content table,
.entry-content figure {
  margin-block: 1.45em;
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
  scroll-margin-top: 96px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.entry-content h2 {
  margin: 2.8em 0 0.8em;
  padding-bottom: 0.45em;
  font-size: 1.65rem;
  border-bottom: 1px solid var(--wm-border);
}

.entry-content h3 {
  margin: 2.2em 0 0.7em;
  font-size: 1.3rem;
}

.entry-content h4 {
  margin: 2em 0 0.6em;
  font-size: 1.08rem;
}

.entry-content a {
  word-break: break-word;
}

.entry-content strong {
  font-weight: 760;
}

.entry-content ul,
.entry-content ol {
  padding-left: 1.4em;
}

.entry-content li {
  margin-block: 0.4em;
}

.entry-content li::marker {
  color: var(--wm-accent);
}

.entry-content blockquote {
  margin-inline: 0;
  padding: 0.8em 1.2em;
  color: #4b5563;
  background: var(--wm-accent-soft);
  border-left: 4px solid var(--wm-accent);
  border-radius: 0 12px 12px 0;
}

.entry-content blockquote > *:first-child {
  margin-top: 0;
}

.entry-content blockquote > *:last-child {
  margin-bottom: 0;
}

.entry-content code,
.entry-content kbd {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.88em;
}

.entry-content :not(pre) > code {
  padding: 0.18em 0.42em;
  color: #9f3a38;
  background: #f4efed;
  border-radius: 6px;
}

.entry-content pre {
  max-width: 100%;
  padding: 22px 24px;
  overflow: auto;
  color: var(--wm-code-text);
  background: var(--wm-code);
  border: 1px solid #273449;
  border-radius: 14px;
  box-shadow: 0 16px 36px rgba(10, 18, 30, 0.16);
  tab-size: 4;
  line-height: 1.65;
  white-space: pre;
}

.entry-content pre code {
  padding: 0;
  color: inherit;
  background: transparent;
}

.entry-content img {
  display: block;
  margin: 2em auto;
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(20, 32, 45, 0.12);
}

.entry-content figure {
  max-width: 100%;
}

.entry-content figcaption {
  margin-top: -1em;
  color: var(--wm-muted);
  font-size: 0.82rem;
  text-align: center;
}

.entry-content table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.92rem;
}

.entry-content th,
.entry-content td {
  padding: 10px 14px;
  text-align: left;
  border: 1px solid var(--wm-border);
}

.entry-content th {
  background: #f0f2f5;
}

.entry-footer {
  margin-top: 54px;
  padding-top: 24px;
  border-top: 1px solid var(--wm-border);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-list a {
  padding: 5px 10px;
  color: var(--wm-muted);
  background: var(--wm-surface);
  border: 1px solid var(--wm-border);
  border-radius: 999px;
  font-size: 0.8rem;
  text-decoration: none;
}

.post-navigation {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 44px;
}

.post-navigation a {
  display: block;
  min-height: 100%;
  padding: 18px;
  color: var(--wm-text);
  background: var(--wm-surface);
  border: 1px solid var(--wm-border);
  border-radius: 12px;
  text-decoration: none;
}

.post-navigation .nav-next {
  text-align: right;
}

.nav-label {
  display: block;
  margin-bottom: 4px;
  color: var(--wm-muted);
  font-size: 0.75rem;
}

.pagination {
  margin-top: 42px;
}

.pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pagination a,
.pagination .current {
  min-width: 38px;
  padding: 6px 12px;
  text-align: center;
  background: var(--wm-surface);
  border: 1px solid var(--wm-border);
  border-radius: 8px;
  text-decoration: none;
}

.pagination .current {
  color: #fff;
  background: var(--wm-accent);
  border-color: var(--wm-accent);
}

.comments-area {
  margin-top: 56px;
  padding-top: 30px;
  border-top: 1px solid var(--wm-border);
}

.comment-list {
  padding-left: 1.2em;
}

.comment-body {
  margin-block: 1.5em;
  padding: 18px;
  background: var(--wm-surface);
  border: 1px solid var(--wm-border);
  border-radius: 12px;
}

.comment-form input:not([type="submit"]),
.comment-form textarea,
.search-form input[type="search"] {
  width: 100%;
  padding: 11px 13px;
  color: var(--wm-text);
  background: var(--wm-surface);
  border: 1px solid var(--wm-border);
  border-radius: 9px;
}

.comment-form input[type="submit"],
.search-submit {
  padding: 10px 18px;
  color: #fff;
  background: var(--wm-accent);
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}

.empty-state {
  max-width: 640px;
  padding: 40px;
  background: var(--wm-surface);
  border: 1px solid var(--wm-border);
  border-radius: var(--wm-radius);
}

.site-footer {
  color: var(--wm-muted);
  border-top: 1px solid var(--wm-border);
}

.footer-inner {
  min-height: 106px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  font-size: 0.84rem;
}

.footer-inner p {
  margin: 0;
}

@media (max-width: 760px) {
  body {
    font-size: 16px;
  }

  .header-inner,
  .site-main,
  .footer-inner {
    width: min(calc(100% - 28px), var(--wm-wide));
  }

  .header-inner {
    min-height: 64px;
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding-block: 12px;
  }

  .site-nav {
    max-width: 100%;
    overflow-x: auto;
  }

  .site-nav ul {
    gap: 18px;
  }

  .site-main {
    padding-block: 48px 68px;
  }

  .home-intro {
    margin-bottom: 36px;
  }

  .post-grid,
  .post-navigation {
    grid-template-columns: 1fr;
  }

  .post-card {
    padding: 23px;
  }

  .entry-header {
    margin-bottom: 32px;
  }

  .entry-content {
    font-size: 1rem;
    line-height: 1.88;
  }

  .entry-content pre {
    margin-inline: -8px;
    padding: 18px;
    border-radius: 10px;
  }

  .footer-inner {
    min-height: 92px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
