:root {
  --bg: #f7f8fc;
  --surface: #ffffff;
  --text: #20242e;
  --muted: #5b6472;
  --primary: #4c6ef5;
  --primary-dark: #3b5bdb;
  --accent: #7048e8;
  --border: #e3e7f2;
  --shadow: 0 2px 10px rgba(30, 40, 90, 0.07);
  --radius: 12px;
  --max-width: 46rem;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.85;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.site-header {
  background: linear-gradient(135deg, #4c6ef5, #7048e8);
  color: #fff;
  padding: 3rem 1rem 2.5rem;
}

.site-header .container {
  max-width: var(--max-width);
}

.site-title {
  margin: 0;
  font-size: 2rem;
  line-height: 1.25;
}

.site-subtitle {
  margin: 0.5rem 0 0;
  font-size: 1.1rem;
  opacity: 0.92;
}

.site-intro {
  margin: 0.75rem 0 0;
  max-width: 34rem;
  opacity: 0.95;
}

.site-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0.5rem 0.75rem;
}

.site-nav a {
  display: block;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  color: var(--text);
  font-size: 0.95rem;
}

.site-nav a:hover,
.site-nav a.active {
  background: #eef1ff;
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: 600;
}

main {
  padding: 2rem 0 3rem;
  min-height: 60vh;
}

.card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
}

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

.section-title {
  font-size: 1.5rem;
  margin: 0 0 1rem;
}

.notice {
  background: #eef2ff;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
}

.notice time {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.5rem 0 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0.2rem 0;
}

.footer-links a {
  margin-right: 1rem;
}

/* Announcements */
.announcement {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.announcement.latest {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(112, 72, 232, 0.1);
}

.announcement h2 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
}

.announcement .version {
  color: var(--accent);
}

.announcement .date {
  color: var(--muted);
  font-size: 0.9rem;
}

.announcement p {
  margin: 0.5rem 0 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* Product */
.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.btn:hover {
  background: var(--primary-dark);
  color: #fff;
  text-decoration: none;
}

.btn.secondary {
  background: var(--accent);
}

.btn.ghost {
  background: var(--surface);
  color: var(--primary-dark);
  border: 1px solid var(--border);
}

.feature-list {
  padding-left: 1.2rem;
}

.feature-list li {
  margin-bottom: 0.5rem;
}

/* Writing / Coffee */
.coffee-meta {
  color: var(--muted);
  margin-bottom: 1rem;
}

details.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

details.toc summary {
  cursor: pointer;
  font-weight: 600;
}

details.toc ol {
  columns: 2;
  column-gap: 2rem;
  margin: 0.75rem 0 0.25rem;
  padding-left: 1.2rem;
}

.chapter-title {
  margin: 2.5rem 0 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 1.4rem;
  color: var(--primary-dark);
}

article.coffee p {
  margin: 0 0 1em;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
}

article.coffee p.empty {
  min-height: 0.5em;
  margin: 0;
}

article.coffee .signature {
  margin-top: 2rem;
}

/* Placeholder */
.placeholder {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--muted);
}

.text-muted {
  color: var(--muted);
}

.breadcrumb {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  .site-title {
    font-size: 2.4rem;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .card-grid.single {
    grid-template-columns: 1fr;
  }

  details.toc ol {
    columns: 3;
  }
}

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

  * {
    transition: none !important;
  }
}

/* 文档中的连续空行在网页里折叠为单行间隔，DOM 仍保留原始段落。 */
article.coffee p.empty + p.empty {
  display: none;
}
