:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --surface: #ffffff;
  --text: #202124;
  --muted: #6f7378;
  --line: #deded8;
  --accent: #2364aa;
  --accent-soft: #e7f0fb;
  --code-bg: #f1f3f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.7;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(20px, 5vw, 64px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, white);
  backdrop-filter: blur(16px);
}

.brand {
  display: grid;
  gap: 2px;
  min-width: 180px;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
}

.brand-desc {
  color: var(--muted);
  font-size: 13px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.site-nav a {
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  padding: 6px 10px;
}

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

.site-main {
  width: min(1080px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.hero {
  display: grid;
  gap: 16px;
  margin-bottom: 40px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(32px, 6vw, 56px);
  line-height: 1.1;
}

.hero p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.section {
  margin-top: 40px;
}

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

.section-header h2 {
  margin: 0;
  font-size: 24px;
}

.section-header a {
  color: var(--accent);
  font-size: 14px;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.article-card {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.article-card a {
  display: grid;
  align-content: space-between;
  height: 100%;
  padding: 18px;
}

.article-card h3 {
  margin: 12px 0 24px;
  font-size: 20px;
  line-height: 1.35;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 14px;
}

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

.breadcrumb-sep {
  color: var(--muted);
}

.breadcrumb-current {
  color: var(--text);
}

.subcategory-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.subcategory-tabs a {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  padding: 6px 14px;
}

.subcategory-tabs a.active,
.subcategory-tabs a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.subcategory-section {
  margin-top: 32px;
}

.article-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.article-type {
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
}

.article-sub,
.article-card time {
  color: var(--muted);
  font-size: 13px;
}

.article-desc {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.doc-type {
  color: var(--accent);
  font-weight: 600;
}

.doc-source {
  margin: 12px 0 0;
  font-size: 14px;
}

.doc-source a {
  color: var(--accent);
}

.doc {
  max-width: 800px;
  margin: 0 auto;
}

.doc-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.doc-header h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.18;
}

.doc-meta {
  color: var(--muted);
  font-size: 14px;
}

.doc-content {
  font-size: 17px;
}

.doc-content h2,
.doc-content h3 {
  margin-top: 34px;
  line-height: 1.25;
}

.doc-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.doc-content pre {
  overflow-x: auto;
  border-radius: 8px;
  padding: 16px;
}

.doc-content pre.mermaid {
  display: flex;
  justify-content: center;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 24px;
}

.doc-content pre.mermaid svg {
  max-width: 100%;
  height: auto;
}

.doc-content code {
  border-radius: 5px;
  background: var(--code-bg);
  font-size: 0.92em;
  padding: 2px 5px;
}

.doc-content pre code {
  background: transparent;
  padding: 0;
}

.doc-content blockquote {
  margin: 24px 0;
  border-left: 4px solid var(--accent);
  padding-left: 16px;
  color: var(--muted);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

@media (max-width: 720px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    justify-content: flex-start;
  }
}
