:root {
  --navy: #003278;
  --navy-deep: #001a4d;
  --blue: #0050be;
  --text: #1a2332;
  --text-secondary: #5a6b82;
  --muted: #8a97ab;
  --border: #e5eaf0;
  --bg: #ffffff;
  --bg-soft: #f7f9fc;
  --code-bg: #f4f6f9;
  --max: 720px;
  --max-wide: 880px;
  --header-h: 64px;
  --ease: 0.15s ease;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans SC", sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Consolas", "Liberation Mono",
    monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition: color var(--ease);
}

a:hover {
  color: var(--navy);
}

.wrap {
  width: min(100% - 40px, var(--max));
  margin: 0 auto;
}

.wrap-wide {
  width: min(100% - 40px, var(--max-wide));
  margin: 0 auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--navy-deep);
  flex-shrink: 0;
}

.brand:hover {
  color: var(--navy);
  text-decoration: none;
}

.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.brand-name {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.nav-desktop {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-desktop a {
  color: var(--text-secondary);
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
}

.nav-desktop a:hover,
.nav-desktop a.is-active {
  color: var(--navy);
  background: var(--bg-soft);
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  color: var(--navy);
  align-items: center;
  justify-content: center;
}

.menu-toggle-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 16px;
}

.menu-toggle-bars span {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.nav-mobile {
  display: none;
  flex-direction: column;
  padding: 8px 0 16px;
  border-top: 1px solid var(--border);
}

.nav-mobile a {
  color: var(--text);
  text-decoration: none;
  padding: 12px 0;
  font-size: 1rem;
  border-bottom: 1px solid var(--border);
}

.site-header.is-open .nav-mobile {
  display: flex;
}

/* Main */
.site-main {
  flex: 1;
  padding: 40px 0 64px;
}

/* Home */
.home-intro {
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.home-brand {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.04em;
  margin-bottom: 14px;
}

.home-intro h1 {
  font-size: clamp(1.45rem, 4vw, 1.8rem);
  font-weight: 650;
  color: var(--navy-deep);
  line-height: 1.4;
  margin-bottom: 16px;
  letter-spacing: 0.01em;
}

.home-lead-text {
  font-size: 1.02rem;
  color: var(--text);
  line-height: 1.8;
  margin-bottom: 12px;
}

.home-vision {
  font-size: 1rem;
  color: var(--text-secondary);
}

.home-block {
  margin-bottom: 40px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--border);
}

.home-block > h2 {
  font-size: 1.08rem;
  font-weight: 650;
  color: var(--navy-deep);
  margin-bottom: 20px;
}

.home-focus-item + .home-focus-item {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.home-focus-item h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy-deep);
  margin-bottom: 8px;
}

.home-focus-item p,
.home-method p {
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.85;
}

.home-method p + p {
  margin-top: 1em;
}

.home-posts {
  border-bottom: 0;
  padding-bottom: 0;
  margin-bottom: 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-head h2 {
  font-size: 1.08rem;
  font-weight: 650;
  color: var(--navy-deep);
}

.section-head a {
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--text-secondary);
  white-space: nowrap;
}

.section-head a:hover {
  color: var(--blue);
}

/* Post list */
.post-list {
  list-style: none;
}

.post-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.post-item:first-child {
  padding-top: 4px;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.post-meta time {
  font-variant-numeric: tabular-nums;
}

.post-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.post-cats a {
  color: var(--text-secondary);
  text-decoration: none;
  background: var(--bg-soft);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.post-cats a:hover {
  color: var(--navy);
}

.post-title {
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 6px;
}

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

.post-title a:hover {
  color: var(--blue);
}

.post-summary {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.empty-state {
  padding: 28px 0;
  color: var(--text-secondary);
  font-size: 0.98rem;
}

.empty-state p + p {
  margin-top: 0.6em;
}

/* Page titles */
.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: clamp(1.45rem, 3.5vw, 1.75rem);
  color: var(--navy-deep);
  font-weight: 650;
  line-height: 1.35;
  margin-bottom: 10px;
}

.page-header .lede {
  color: var(--text-secondary);
}

/* Article */
.article-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.article-header h1 {
  font-size: clamp(1.4rem, 3.5vw, 1.7rem);
  font-weight: 650;
  color: var(--navy-deep);
  line-height: 1.35;
  margin: 8px 0 12px;
}

.article-summary {
  color: var(--text-secondary);
  font-size: 1rem;
}

.prose {
  font-size: 1.02rem;
  line-height: 1.8;
  color: var(--text);
  overflow-wrap: break-word;
}

.prose > * + * {
  margin-top: 1.15em;
}

.prose h2 {
  font-size: 1.25rem;
  color: var(--navy-deep);
  margin-top: 2em;
  margin-bottom: 0.6em;
  font-weight: 650;
  line-height: 1.35;
}

.prose h3 {
  font-size: 1.08rem;
  color: var(--navy-deep);
  margin-top: 1.6em;
  margin-bottom: 0.5em;
  font-weight: 600;
}

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

.prose li + li {
  margin-top: 0.35em;
}

.prose blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1em;
  color: var(--text-secondary);
}

.prose img {
  margin: 1.4em auto;
  border-radius: 4px;
}

.prose figure {
  margin: 1.4em 0;
}

.prose figcaption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.5em;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--bg-soft);
  font-weight: 600;
  color: var(--navy-deep);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.12em 0.4em;
  border-radius: 4px;
}

.prose pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 0.88rem;
  line-height: 1.55;
}

.prose pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  border-radius: 0;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

.prose a {
  word-break: break-word;
}

.article-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.article-footer a {
  text-decoration: none;
}

/* About */
.about-block + .about-block {
  margin-top: 36px;
}

.about-block h2 {
  font-size: 1.1rem;
  color: var(--navy-deep);
  margin-bottom: 12px;
  font-weight: 650;
}

.about-block p + p {
  margin-top: 0.75em;
}

.about-block ul {
  margin-top: 0.75em;
  padding-left: 1.25em;
  color: var(--text-secondary);
}

.about-block li + li {
  margin-top: 0.4em;
}

.contact-line {
  margin-top: 12px;
}

.contact-line a {
  text-decoration: none;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 36px;
  background: var(--bg);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.footer-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.footer-text .cn {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--navy-deep);
}

.footer-text .en {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.footer-meta {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: right;
  line-height: 1.65;
  max-width: 100%;
}

.footer-meta a {
  color: var(--muted);
  text-decoration: none;
}

.footer-meta a:hover {
  color: var(--blue);
}

.footer-beian {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 14px;
  margin-top: 4px;
  max-width: 100%;
}

.footer-beian a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.beian-gongan-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
  object-fit: contain;
}

/* Pagination */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 32px;
  list-style: none;
}

.pagination a {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.pagination .active a,
.pagination a:hover {
  color: var(--navy);
  border-color: var(--navy);
}

/* Highlight (chroma) */
.highlight {
  margin: 1.15em 0;
}

/* Mobile */
@media (max-width: 768px) {
  .nav-desktop {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .site-main {
    padding: 28px 0 48px;
  }

  .footer-inner {
    flex-direction: column;
  }

  .footer-meta {
    text-align: left;
  }

  .footer-beian {
    justify-content: flex-start;
  }

  .wrap,
  .wrap-wide {
    width: min(100% - 32px, var(--max-wide));
  }
}

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

  * {
    transition: none !important;
  }
}
