/* =========================================================
   John Denve的个人笔记 · 全站样式表
   零构建、零依赖，直接通过 file:// 打开即可
   目录：1 变量 / 2 基础 / 3 布局 / 4 头部导航 / 5 组件
         6 首页 / 7 列表 / 8 文章正文 / 9 关于 / 10 页脚
         11 回到顶部 / 12 响应式 / 13 动效与打印
   ========================================================= */

/* ---------- 1. 设计变量 ---------- */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-soft: #f5f3ec;
  --text: #1f2328;
  --text-soft: #414a52;
  --muted: #68737d;
  --border: #e6e3da;
  --border-strong: #d6d2c6;
  --accent: #2f6f5e;
  --accent-strong: #245a4c;
  --accent-soft: #e7f0ed;
  --code-bg: #f4f2ec;
  --code-text: #2b3440;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(20, 26, 32, 0.05);
  --shadow: 0 1px 2px rgba(20, 26, 32, 0.04), 0 14px 30px -22px rgba(20, 26, 32, 0.35);

  --maxw: 760px;
  --gutter: clamp(1.15rem, 5vw, 2rem);
  --header-h: 64px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

/* ---------- 2. 基础 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.nav-open {
  overflow: hidden;
}

img,
svg {
  max-width: 100%;
  display: block;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--accent);
  text-decoration-color: var(--accent);
  text-underline-offset: 0.22em;
}

@supports (color: color-mix(in srgb, black, white)) {
  a {
    text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  }
}

a:hover {
  color: var(--accent-strong);
  text-decoration-color: currentColor;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.55em;
  line-height: 1.28;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

p {
  margin: 0 0 1em;
}

ul,
ol {
  padding-left: 1.35em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 1rem;
  color: #fff;
}

/* ---------- 3. 布局 ---------- */
.container {
  width: 100%;
  max-width: calc(var(--maxw) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-main {
  display: block;
  padding-block: clamp(2rem, 6vw, 3.5rem) clamp(2.5rem, 8vw, 4.5rem);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 4. 头部与导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(251, 250, 247, 0.92);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}

@supports (color: color-mix(in srgb, black, white)) {
  .site-header {
    background: color-mix(in srgb, var(--bg) 88%, transparent);
  }
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.02em;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
}

.brand-name {
  font-size: 1rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.site-nav a {
  display: inline-block;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--surface);
}

.site-nav a[aria-current="page"] {
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-weight: 600;
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  position: relative;
}

.nav-toggle span {
  position: absolute;
  left: 50%;
  width: 16px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transform: translateX(-50%);
  transition: transform 0.2s ease, opacity 0.2s ease, top 0.2s ease;
}

.nav-toggle span:nth-child(1) {
  top: 14px;
}
.nav-toggle span:nth-child(2) {
  top: 19px;
}
.nav-toggle span:nth-child(3) {
  top: 24px;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  top: 19px;
  transform: translateX(-50%) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  top: 19px;
  transform: translateX(-50%) rotate(-45deg);
}

/* ---------- 5. 通用组件 ---------- */
.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.page-head {
  margin-bottom: 2rem;
}

.page-head h1 {
  font-size: clamp(1.7rem, 4.5vw, 2.2rem);
}

.page-head p {
  margin: 0;
  color: var(--muted);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 3rem 0 1.15rem;
}

.section-head h2 {
  margin: 0;
  font-size: 1.12rem;
  letter-spacing: 0.02em;
}

.section-head a {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.58rem 1.15rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  background: var(--accent-strong);
  color: #fff;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
}

.btn-ghost:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tag {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none;
}

/* ---------- 6. 首页 ---------- */
.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(1.1rem, 4vw, 1.8rem);
  align-items: start;
  padding: clamp(1.5rem, 4vw, 2.2rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.avatar {
  display: grid;
  place-items: center;
  width: clamp(58px, 12vw, 78px);
  height: clamp(58px, 12vw, 78px);
  border-radius: 50%;
  background: linear-gradient(150deg, var(--accent) 0%, #4f8f7c 100%);
  color: #fff;
  font-size: clamp(1.3rem, 3.2vw, 1.7rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.hero h1 {
  font-size: clamp(1.45rem, 4.6vw, 1.95rem);
  margin-bottom: 0.5rem;
}

.hero-text {
  color: var(--text-soft);
  margin-bottom: 1.15rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* 文章卡片 */
.post-list {
  display: grid;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-card {
  display: block;
  padding: 1.25rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.post-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  color: inherit;
}

.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.post-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.12rem;
  line-height: 1.45;
}

.post-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.7;
}

.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

/* ---------- 7. 文章列表页 ---------- */
.blog-list {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- 8. 文章正文 ---------- */
.article {
  max-width: 100%;
}

.article-head {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

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

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

.article-title {
  font-size: clamp(1.6rem, 5vw, 2.15rem);
  margin-bottom: 0.7rem;
}

.article-head .tag {
  margin-bottom: 0.7rem;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.prose {
  font-size: 1.02rem;
  color: var(--text-soft);
}

.prose > :first-child {
  margin-top: 0;
}

.prose h2 {
  margin: 2.4rem 0 0.8rem;
  padding-top: 0.2rem;
  font-size: 1.32rem;
}

.prose h3 {
  margin: 1.9rem 0 0.6rem;
  font-size: 1.1rem;
}

.prose p,
.prose li {
  line-height: 1.85;
}

.prose ul,
.prose ol {
  margin: 0 0 1.15em;
}

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

.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.14em 0.4em;
  border-radius: 5px;
  background: var(--code-bg);
  color: var(--code-text);
  word-break: break-word;
}

.prose pre {
  margin: 1.5rem 0;
  padding: 1.05rem 1.15rem;
  overflow-x: auto;
  background: #232a31;
  border-radius: var(--radius);
  font-size: 0.86rem;
  line-height: 1.7;
}

.prose pre code {
  padding: 0;
  background: none;
  color: #e6edf3;
  font-size: inherit;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
}

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

.prose table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.prose th,
.prose td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.prose th {
  background: var(--surface-soft);
  font-weight: 600;
  color: var(--text);
}

/* 上一篇 / 下一篇 */
.post-nav {
  display: grid;
  gap: 0.9rem;
  margin-top: 3rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
}

.post-nav-link {
  display: block;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.16s ease;
}

.post-nav-link:hover {
  border-color: var(--border-strong);
  color: inherit;
}

.post-nav-label {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.post-nav-title {
  font-weight: 600;
  color: var(--text);
}

.post-nav-link.is-empty {
  opacity: 0.85;
}

/* ---------- 9. 关于页 ---------- */
.about-card {
  padding: clamp(1.5rem, 4vw, 2.2rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.about-card h2 {
  font-size: 1.1rem;
  margin-top: 2rem;
}

.about-card h2:first-child {
  margin-top: 0;
}

.about-lead {
  font-size: 1.06rem;
  color: var(--text-soft);
}

.contact-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.7rem;
}

.contact-label {
  min-width: 5.2em;
  color: var(--muted);
  font-size: 0.86rem;
}

.about-note {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ---------- 10. 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.footer-inner p {
  margin: 0;
}

.footer-links {
  display: flex;
  gap: 1rem;
}

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

.footer-links a:hover {
  color: var(--accent);
}

/* ---------- 11. 回到顶部 ---------- */
.to-top {
  position: fixed;
  right: clamp(1rem, 3vw, 1.8rem);
  bottom: clamp(1rem, 3vw, 1.8rem);
  z-index: 30;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.to-top:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.to-top svg {
  width: 18px;
  height: 18px;
}

/* ---------- 12. 响应式 ---------- */
@media (max-width: 640px) {
  .nav-toggle {
    display: block;
  }

  .site-nav {
    position: absolute;
    inset: var(--header-h) var(--gutter) auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    padding: 0.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: none;
  }

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

  .site-nav a {
    padding: 0.65rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
  }

  .hero {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .avatar {
    width: 60px;
    height: 60px;
  }

  .section-head {
    margin-top: 2.4rem;
  }

  .post-card {
    padding: 1.1rem 1.15rem;
  }

  .article-meta {
    font-size: 0.8rem;
  }
}

@media (max-width: 360px) {
  :root {
    --gutter: 1rem;
  }

  .brand-name {
    display: none;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- 13. 动效与打印 ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

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

@media print {
  .site-header,
  .site-footer,
  .to-top,
  .post-nav,
  .back-link {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .article {
    max-width: none;
  }

  .prose pre {
    background: #f3f3f3;
    color: #111;
    border: 1px solid #ddd;
  }

  .prose pre code {
    color: #111;
  }
}

/* ---------- 14. 转载文章：来源框与版权声明（新增，不影响既有规则） ---------- */
.tag-repost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--muted);
}

.source-box {
  margin: 0 0 2rem;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}

.source-box-title {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.source-list {
  margin: 0;
  display: grid;
  gap: 0.45rem;
  font-size: 0.86rem;
}

.source-list > div {
  display: grid;
  grid-template-columns: 5.8em 1fr;
  gap: 0.6rem;
}

.source-list dt {
  color: var(--muted);
}

.source-list dd {
  margin: 0;
  color: var(--text-soft);
  word-break: break-word;
}

.license-note {
  margin-top: 2.2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.75;
}

@media (max-width: 480px) {
  .source-list > div {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
}

/* ---------- 15. 搜索页 / 法律页 / 404（新增） ---------- */
.footer-links {
  flex-wrap: wrap;
}

.search-panel {
  padding: clamp(1.2rem, 4vw, 1.7rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.6rem;
}

.search-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-hint {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.search-status {
  min-height: 1.6em;
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.search-empty {
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.search-empty strong {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.legal-meta {
  margin: 0 0 1.6rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 2rem;
}

.legal-nav a {
  display: inline-block;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
}

.legal-nav a:hover,
.legal-nav a[aria-current="page"] {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.error-code {
  margin: 0 0 0.5rem;
  font-size: clamp(3.5rem, 14vw, 6rem);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.6rem;
}

/* ---------- 16. 联系方式与备案信息（新增） ---------- */
.wechat-card {
  margin: 1.6rem 0 0;
  padding: 0;
  max-width: 560px;
}

.wechat-card img {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.wechat-card figcaption {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.footer-beian {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  padding-top: 0.9rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.footer-beian span {
  white-space: nowrap;
}

.footer-beian a {
  color: var(--muted);
}


