:root {
  --bg: #0b0f14;
  --bg-soft: #0f151c;
  --surface: #121b25;
  --surface-2: #182331;
  --border: #243244;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #6ee7b7;
  --accent-2: #60a5fa;
  --danger: #f87171;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

html[data-theme="light"] {
  --bg: #f7f9fc;
  --bg-soft: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button, input { font: inherit; }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(110, 231, 183, 0.18), rgba(96, 165, 250, 0.18));
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
}

.brand-text { font-size: 16px; }

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

.nav a {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  transition: 0.18s ease;
}

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

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-left: 4px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: 0.18s ease;
}

.theme-toggle:hover { transform: translateY(-1px); border-color: var(--accent-2); }

.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

main { min-height: 60vh; }

.hero {
  position: relative;
  isolation: isolate;
  padding: 86px 0 48px;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 10px -20px auto -20px;
  height: 360px;
  background:
    radial-gradient(circle at 16% 20%, rgba(110, 231, 183, 0.13), transparent 42%),
    radial-gradient(circle at 84% 8%, rgba(96, 165, 250, 0.13), transparent 42%);
  filter: blur(10px);
  pointer-events: none;
  z-index: -1;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 78%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 78%);
  opacity: 0.32;
  pointer-events: none;
  z-index: -1;
}
html[data-theme="light"] .hero::after { opacity: 0.22; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}
.hero-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 900px;
  margin: 0 0 18px;
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  line-height: 1.04;
  letter-spacing: -0.05em;
}

.gradient {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  max-width: 700px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.12rem);
  line-height: 1.85;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 650;
  transition: 0.18s ease;
}

.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { transform: translateY(-1px); opacity: 0.92; }
.btn-ghost { border-color: var(--border); background: var(--surface); color: var(--text); }
.btn-ghost:hover { transform: translateY(-1px); border-color: var(--accent-2); }

.section { margin-top: 56px; }

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

.section-head h2 { margin: 0; font-size: 1.35rem; letter-spacing: -0.02em; }
.section-head a { color: var(--muted); font-size: 14px; }
.section-head a:hover { color: var(--accent-2); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.post-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 190px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: 0.2s ease;
}

.post-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow);
}

.post-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.post-card h3 { margin: 0; font-size: 1.08rem; line-height: 1.45; }
.post-card p { flex: 1; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
}

.callout {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
}

.callout h2 { margin: 0 0 10px; font-size: 1.25rem; }
.callout p { margin: 0; color: var(--muted); line-height: 1.8; }
.callout p + p { margin-top: 10px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 8px;
}
.stat {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.stat strong {
  display: block;
  font-size: 1.6rem;
  letter-spacing: -0.03em;
}
.stat span { color: var(--muted); font-size: 12px; }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 18px;
}
.chip-row + .chip-row { margin-top: -8px; }
.chip {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: 0.18s ease;
}
.chip:hover { color: var(--text); border-color: var(--accent-2); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.resource-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  transition: 0.18s ease;
}
.resource-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-2);
  box-shadow: var(--shadow);
}
.resource-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.resource-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.resource-name { font-size: 14px; font-weight: 700; }
.resource-desc { color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.resource-tag {
  align-self: flex-start;
  margin-top: 2px;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10.5px;
}
.resource-arrow { color: var(--muted); font-size: 13px; }
.resource-card:hover .resource-arrow { color: var(--accent-2); }
.resource-note { margin-top: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.project-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.project-card h3 { margin: 10px 0 8px; font-size: 1.05rem; }
.project-card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.project-status {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
}
.project-status.is-live {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.section-note { color: var(--muted); font-size: 12.5px; }

.page-head { padding: 64px 0 8px; }
.page-head h1 { margin: 0 0 14px; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -0.04em; }
.page-head .lead { max-width: 680px; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 26px 0 18px;
}

.search {
  width: min(420px, 100%);
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  color: var(--text);
}

.search:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 18%, transparent);
}

.result-count { color: var(--muted); font-size: 13px; }
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-small {
  padding: 8px 12px;
  font-size: 12.5px;
}
.empty {
  padding: 36px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  line-height: 1.8;
}

.note { max-width: 780px; margin: 48px auto 0; }
.back { color: var(--muted); font-size: 14px; }
.back:hover { color: var(--accent-2); }
.note-head { margin: 26px 0 34px; }
.note-head h1 { margin: 12px 0; font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.18; letter-spacing: -0.04em; }
.meta { margin: 0; color: var(--muted); font-size: 13px; }

.note-body { color: var(--text); font-size: 17px; line-height: 1.88; }
.note-body h1, .note-body h2, .note-body h3, .note-body h4 { line-height: 1.3; letter-spacing: -0.02em; }
.note-body > h1:first-child { display: none; }
.note-body h1 { margin: 2.2em 0 0.6em; font-size: 2rem; }
.note-body h2 { margin: 2em 0 0.6em; font-size: 1.5rem; }
.note-body h3 { margin: 1.8em 0 0.5em; font-size: 1.2rem; }
.note-body p { margin: 1em 0; }
.note-body a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }
.note-body ul, .note-body ol { padding-left: 1.4em; }
.note-body li { margin: 0.4em 0; }
.note-body blockquote {
  margin: 1.5em 0;
  padding: 0.2em 1em;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--surface-2);
  color: var(--muted);
}
.note-body code:not(pre code) {
  padding: 0.15em 0.4em;
  border-radius: 6px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.9em;
}
.note-body pre {
  position: relative;
  overflow: auto;
  margin: 1.4em 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0d1117;
}
.note-body pre code {
  display: block;
  padding: 18px;
  background: transparent !important;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.65;
}
.note-body img { max-width: 100%; border-radius: 12px; }
.note-body table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: 15px; }
.note-body th, .note-body td { padding: 9px 12px; border: 1px solid var(--border); text-align: left; }
.note-body th { background: var(--surface-2); }

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 9px;
  border: 1px solid #30363d;
  border-radius: 6px;
  background: #161b22;
  color: #c9d1d9;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: 0.18s ease;
}
.note-body pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }

.about { max-width: 720px; font-size: 17px; line-height: 1.9; }
.about h2 { margin: 2em 0 0.5em; font-size: 1.25rem; }
.about ul { padding-left: 1.3em; }
.about-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.about-head h2 { margin: 0 0 6px; font-size: 1.3rem; }
.about-head p { margin: 0; color: var(--muted); line-height: 1.7; }
.about-head + p { margin-top: 12px; }
.avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(110, 231, 183, 0.22), rgba(96, 165, 250, 0.22));
  color: var(--accent);
  font-size: 26px;
  font-weight: 800;
}
.about-chips { margin: 18px 0 24px; }
.about-chips .chip { cursor: default; }
.muted { color: var(--muted); }

.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 0.18s ease;
}
.to-top.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.to-top:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.site-footer {
  margin-top: 80px;
  padding: 28px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer-inner p { margin: 0; }
.footer-inner a { color: var(--muted); }
.footer-inner a:hover { color: var(--accent-2); }

@media (max-width: 720px) {
  .wrap { width: calc(100% - 28px); }
  .nav {
    display: none;
    position: absolute;
    top: 64px;
    right: 14px;
    left: 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; border-radius: 10px; }
  .nav a:hover { background: var(--surface-2); }
  .nav-toggle { display: inline-grid; place-items: center; }
  .theme-toggle { margin: 6px 0 0; }
  .hero { padding: 64px 0 34px; }
  .page-head { padding-top: 48px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .about-head { align-items: flex-start; }
  .avatar { flex-basis: 54px; width: 54px; height: 54px; border-radius: 16px; font-size: 22px; }
  .to-top { right: 16px; bottom: 16px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
