:root {
  --bg: #f7f8fc;
  --bg-elevated: #ffffff;
  --surface: rgba(255, 255, 255, 0.82);
  --border: rgba(99, 102, 241, 0.1);
  --border-strong: rgba(99, 102, 241, 0.18);
  --text: #0f172a;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-dim: rgba(99, 102, 241, 0.12);
  --gradient-brand: linear-gradient(135deg, #6366f1 0%, #8b5cf6 45%, #06b6d4 100%);
  --shadow-glow: 0 8px 32px rgba(99, 102, 241, 0.22);
  --radius: 12px;
  --radius-full: 9999px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --max: 1100px;
  --header-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
}

.site-header__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.logo:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.nav a {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.nav a:hover {
  color: var(--text);
  text-decoration: none;
}

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

.hero {
  padding: 4.5rem 0 3.5rem;
  border-bottom: 1px solid var(--border);
}

.hero__eyebrow {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero__role {
  margin: 0 0 1.25rem;
  font-size: 1.125rem;
  color: var(--text-muted);
}

.hero__summary {
  margin: 0;
  max-width: 42rem;
  color: var(--text-muted);
  font-size: 1rem;
}

.hero__actions {
  margin-top: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease,
    color 0.18s ease;
}

.btn:hover {
  border-color: var(--border-strong);
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.06);
  text-decoration: none;
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--gradient-brand);
  border-color: transparent;
  color: #ffffff;
  box-shadow: var(--shadow-glow);
}

.btn--primary:hover {
  background: var(--gradient-brand);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.38);
  transform: translateY(-2px);
  filter: none;
}

.section {
  padding: 3.5rem 0;
  border-bottom: 1px solid var(--border);
}

.section:last-of-type {
  border-bottom: none;
}

.section__head {
  margin-bottom: 1.75rem;
}

.section__head h2 {
  margin: 0 0 0.35rem;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.section__head p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.grid-2 {
  display: grid;
  gap: 1rem;
}

@media (min-width: 720px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.pill-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill-list li {
  padding: 0.4rem 0.75rem;
  font-size: 0.8125rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.timeline__item {
  position: relative;
  padding-left: 1.25rem;
  border-left: 2px solid var(--border);
  margin-left: 0.35rem;
}

.timeline__item::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 0.35rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.timeline__meta {
  font-size: 0.8125rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.timeline h3 {
  margin: 0 0 0.5rem;
  font-size: 1.0625rem;
  font-weight: 600;
}

.timeline p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.timeline ul {
  margin: 0.75rem 0 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.timeline ul li {
  margin-bottom: 0.35rem;
}

.cards {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .cards--projects {
    grid-template-columns: repeat(3, 1fr);
  }
}

.cards__loading,
.cards__error,
.cards__noscript {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted, #64748b);
  font-size: 0.95rem;
}

.cards__error {
  color: #b91c1c;
}

.cards__noscript code {
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 0.9em;
}

.card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.card:has(.card__hit) {
  cursor: pointer;
}

.card:has(.card__hit):hover {
  border-color: rgba(37, 99, 235, 0.2);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.card__hit {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
}

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

.card__media {
  aspect-ratio: 16 / 9;
  position: relative;
  z-index: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: #0f172a;
}

.cards--projects .card__media {
  padding: 0;
  /* 比 16:9 更扁，头图占位高度约降三成 */
  aspect-ratio: 5 / 2;
}

.card__media-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.02);
  transition: transform 0.35s ease;
}

.card:has(.card__hit):hover .card__media-art {
  transform: scale(1.06);
}

@media (prefers-reduced-motion: reduce) {
  .card__media-art,
  .card:has(.card__hit):hover .card__media-art {
    transform: none;
    transition: none;
  }
}

.card__media-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1rem 1.15rem 1.1rem;
  pointer-events: none;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.78) 0%,
    rgba(0, 0, 0, 0.45) 38%,
    rgba(0, 0, 0, 0.12) 62%,
    transparent 100%
  );
}

.card__media-eyebrow {
  margin: 0 0 0.3rem;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.card__media-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.35;
  color: #fff;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__body {
  padding: 1.1rem 1.15rem 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card__tag {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.card h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.card p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  flex: 1;
}

.card__links {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card__links a {
  position: relative;
  z-index: 2;
  font-size: 0.8125rem;
}

.media-block {
  margin-top: 2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.media-block__label {
  padding: 0.65rem 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.media-block + .media-block {
  margin-top: 1.25rem;
}

.media-block video {
  width: 100%;
  background: #000;
}

.tech-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 560px) {
  .tech-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .tech-grid--wide {
    grid-template-columns: repeat(3, 1fr);
  }
}

.tech-block {
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tech-block h3 {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.tech-block p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.article-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.article-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1.1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}

.article-row:hover {
  border-color: rgba(37, 99, 235, 0.22);
}

.article-row a {
  font-weight: 500;
  color: var(--text);
}

.article-row a:hover {
  color: var(--accent);
  text-decoration: none;
}

.article-row time {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.site-footer {
  padding: 2rem 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Article detail pages */
.article-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

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

.article-page h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

.article-page .meta {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.article-page .prose {
  font-size: 1rem;
  color: var(--text-muted);
}

.article-page .prose h2 {
  color: var(--text);
  font-size: 1.125rem;
  margin: 2rem 0 0.75rem;
}

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

.article-page .prose h3 {
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
}

.article-page .prose p {
  margin: 0 0 1rem;
}

.article-page .prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 1rem 0 1.25rem;
}

.article-page .prose th,
.article-page .prose td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.article-page .prose th {
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 600;
}

.article-page .prose pre.article-code {
  margin: 0.5rem 0 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.article-page .prose pre.article-code code {
  font-family: var(--mono);
  white-space: pre;
  color: var(--text);
}

.article-page .diagram-block {
  margin: 1.5rem 0;
  padding: 1rem 1rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.article-page .diagram-block .mermaid {
  display: flex;
  justify-content: center;
}

.article-page .diagram-block .mermaid svg {
  max-width: 100%;
  height: auto;
}

.article-page .diagram-block figcaption {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.resource-video-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  margin-top: 1.25rem;
}

.resource-video-grid figure {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.resource-video-grid video {
  width: 100%;
  display: block;
  background: #000;
  aspect-ratio: 16 / 9;
}

.resource-video-grid figcaption {
  padding: 0.4rem 0.6rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.poster-showcase {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin-top: 1.25rem;
}

.poster-showcase figure {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.poster-showcase img {
  width: 100%;
  max-height: min(88vh, 1400px);
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
  object-position: top center;
  vertical-align: middle;
  background: var(--bg);
}

.poster-showcase figcaption {
  padding: 0.5rem 0.65rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.45;
  border-top: 1px solid var(--border);
}

.poster-showcase figcaption code {
  font-size: 0.75rem;
}

/* Pro7-style: demo cards — 2 per row on wide screens */
.demo-cards-grid {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 2rem;
  grid-template-columns: 1fr;
  align-items: stretch;
}

@media (min-width: 640px) {
  .demo-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.demo-block {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.demo-block:hover {
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.demo-block__figure {
  margin: 0;
  border-bottom: 1px solid var(--border);
  background: #0f172a;
  flex-shrink: 0;
}

.demo-block__figure img {
  width: 100%;
  max-height: min(38vh, 420px);
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
  object-position: top center;
}

.demo-block__body {
  padding: 1rem 1.15rem 1.15rem;
  flex: 1 1 auto;
}

.demo-block__body ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.demo-block__body li {
  margin: 0.3rem 0;
}

.demo-block__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

/* GitHub-hosted demo assets (e.g. pro7) */
.resource-notice {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  line-height: 1.55;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent;
}

.resource-notice--github {
  color: #7c2d12;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border-color: rgba(234, 88, 12, 0.35);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
}

.resource-notice--github code {
  font-size: 0.8em;
  color: #9a3412;
  background: rgba(255, 255, 255, 0.65);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.article-page .prose p.resource-notice--github {
  color: #7c2d12;
}

.doc-actions {
  margin: 1rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.subnav {
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.875rem;
}

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

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

.stack {
  margin-top: 1.5rem;
}

/* Articles hub: 技术文章 / 行业笔记 */
.articles-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0 0 2rem;
  padding: 0 0 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

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

.articles-toc a:hover {
  color: var(--accent);
}

.articles-section {
  margin-top: 2rem;
}

.articles-section > h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.section-lead {
  margin: 0 0 1.5rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.article-entry {
  margin-bottom: 1.5rem;
  padding: 1.15rem 1.2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}

.article-entry:hover {
  border-color: rgba(37, 99, 235, 0.2);
}

.article-entry__title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.article-entry__summary {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.article-entry__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.article-entry__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: var(--radius);
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.article-entry__action:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

/* Markdown body (md-view.html rendered output) */
.article-page .md-body {
  color: var(--text);
}

.article-page .md-body h2 {
  color: var(--text);
  font-size: 1.2rem;
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.article-page .md-body h3,
.article-page .md-body h4 {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.35rem 0 0.5rem;
}

.article-page .md-body ul,
.article-page .md-body ol {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
}

.article-page .md-body li {
  margin: 0.35rem 0;
}

.article-page .md-body li > p {
  margin: 0.35rem 0;
}

.article-page .md-body blockquote {
  margin: 0 0 1rem;
  padding: 0.5rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-dim);
  color: var(--text-muted);
}

.article-page .md-body pre {
  margin: 0 0 1rem;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.55;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
}

.article-page .md-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--surface);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}

.article-page .md-body pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

.article-page .md-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.article-page .md-body th,
.article-page .md-body td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.6rem;
  text-align: left;
  vertical-align: top;
}

.article-page .md-body th {
  background: var(--bg-elevated);
  font-weight: 600;
}

.article-page .md-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.article-page .md-body a {
  word-break: break-word;
}

.article-page .md-body img {
  margin: 0.75rem 0;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid var(--border);
}
