/* ===== 简约主题 ===== */

:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --fg-muted: #6b6b6b;
  --accent: #2f6fed;
  --border: #e6e6e6;
  --code-bg: #f6f7f9;
  --code-fg: #24292f;
  --max-width: 46rem;
}

:root[data-theme="dark"] {
  --bg: #121417;
  --fg: #e8e8e8;
  --fg-muted: #9a9a9a;
  --accent: #6ea0ff;
  --border: #2a2d31;
  --code-bg: #1c2026;
  --code-fg: #d6dde5;
}

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

html {
  font-size: 17px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.75;
  transition: background 0.25s ease, color 0.25s ease;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ===== 头部 ===== */

header.site-header {
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
}

.site-header .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--fg);
}

nav a {
  color: var(--fg-muted);
  text-decoration: none;
  margin-left: 1.25rem;
  font-size: 0.95rem;
}

nav a:hover,
nav a.active {
  color: var(--accent);
}

#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem 0.55rem;
  margin-left: 1.25rem;
  color: var(--fg);
  line-height: 1.4;
}

#theme-toggle:hover {
  border-color: var(--accent);
}

/* ===== 首页 Hero ===== */

.hero {
  padding: 3.5rem 0 2.5rem;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.hero p {
  color: var(--fg-muted);
  max-width: 36rem;
}

.hero .clock {
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

/* ===== 文章列表 ===== */

.post-list {
  padding: 1rem 0 4rem;
}

.post-list h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.5rem;
}

.post-item {
  display: block;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}

.post-item:hover .post-item-title {
  color: var(--accent);
}

.post-item-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  transition: color 0.15s ease;
}

.post-item-meta {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-bottom: 0.4rem;
}

.post-item-excerpt {
  font-size: 0.95rem;
  color: var(--fg-muted);
}

/* ===== 文章页 ===== */

article.post {
  padding: 3rem 0 4rem;
}

article.post h1 {
  font-size: 1.8rem;
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.post-meta {
  color: var(--fg-muted);
  font-size: 0.88rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

article.post h2 {
  font-size: 1.35rem;
  margin: 2.5rem 0 1rem;
}

article.post h3 {
  font-size: 1.1rem;
  margin: 2rem 0 0.75rem;
}

article.post p {
  margin-bottom: 1.1rem;
}

article.post ul,
article.post ol {
  margin: 0 0 1.1rem 1.5rem;
}

article.post li {
  margin-bottom: 0.4rem;
}

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

article.post a {
  color: var(--accent);
}

/* ===== 代码块 ===== */

code {
  font-family: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: 4px;
  padding: 0.15em 0.4em;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  margin: 0 0 1.5rem;
  line-height: 1.6;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
}

.lang-label {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 0.25rem 0.9rem;
  margin-top: 1.5rem;
}

.lang-label + pre {
  border-top-left-radius: 0;
  margin-top: 0;
}

/* ===== 实时时钟演示卡片 ===== */

.demo-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin: 1.5rem 0 2rem;
  text-align: center;
}

.demo-card .demo-label {
  font-size: 0.8rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.demo-card .demo-time {
  font-size: 1.6rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ===== 页脚 ===== */

footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 0 2.5rem;
  color: var(--fg-muted);
  font-size: 0.85rem;
  text-align: center;
}

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

.footer-line {
  margin-bottom: 0.5rem;
}

/* 备案号:居中放置,ICP 链接至工信部备案系统,公安备案链接至公安部备案查询 */
.footer-beian {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
}

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

.beian-gongan {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.beian-gongan img {
  display: block;
}

.footer-beian a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ===== 返回链接 ===== */

.back-link {
  display: inline-block;
  margin-top: 2.5rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.95rem;
}

.back-link:hover {
  text-decoration: underline;
}

/* ===== 移动端适配 ===== */

@media (max-width: 600px) {
  html {
    font-size: 16px;
  }

  .container {
    padding: 0 1rem;
  }

  header.site-header {
    padding: 1.25rem 0 1rem;
  }

  /* 导航项之间保持足够的触控间距 */
  nav a {
    margin-left: 0.9rem;
    padding: 0.35rem 0.2rem;
    display: inline-block;
  }

  #theme-toggle {
    margin-left: 0.9rem;
    padding: 0.3rem 0.6rem;
  }

  .hero {
    padding: 2.25rem 0 1.5rem;
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  article.post {
    padding: 2rem 0 3rem;
  }

  article.post h1 {
    font-size: 1.45rem;
  }

  article.post h2 {
    font-size: 1.2rem;
  }

  .post-meta {
    margin-bottom: 1.75rem;
    padding-bottom: 1rem;
  }

  pre {
    padding: 0.8rem 0.9rem;
    border-radius: 6px;
  }

  pre code {
    font-size: 0.8rem;
  }

  .demo-card {
    padding: 1.1rem;
  }

  .demo-card .demo-time {
    font-size: 1.3rem;
  }
}

/* 超窄屏幕(小折叠屏 / 老机型) */
@media (max-width: 360px) {
  .site-header .row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  nav a:first-child {
    margin-left: 0;
  }
}
