:root {
  --bg: #f4f7f8;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --surface-2: #eaf0f1;
  --text: #10191c;
  --muted: #617075;
  --line: rgba(22, 49, 55, 0.12);
  --accent: #00a884;
  --accent-2: #006a74;
  --accent-soft: rgba(0, 168, 132, 0.12);
  --warning: #d97706;
  --code: #0c171a;
  --code-text: #d7f7ee;
  --shadow: 0 22px 60px rgba(18, 44, 50, 0.10);
  --radius: 24px;
  --radius-sm: 14px;
  --max: 1180px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #071012;
  --surface: rgba(14, 28, 32, 0.78);
  --surface-solid: #0e1c20;
  --surface-2: #13272c;
  --text: #ecf7f4;
  --muted: #91a6a8;
  --line: rgba(212, 241, 236, 0.12);
  --accent: #39d7b0;
  --accent-2: #67dfe9;
  --accent-soft: rgba(57, 215, 176, 0.12);
  --warning: #f4b860;
  --code: #020708;
  --code-text: #d7f7ee;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.34);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 8%, rgba(0, 168, 132, 0.13), transparent 28rem),
    radial-gradient(circle at 94% 18%, rgba(0, 106, 116, 0.13), transparent 32rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
img, svg { display: block; max-width: 100%; }
::selection { background: var(--accent); color: #00120e; }

.skip-link {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  transition: top .2s ease;
}
.skip-link:focus { top: 16px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
}

.nav-wrap {
  width: min(calc(100% - 36px), var(--max));
  margin: 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 48%, var(--line));
  border-radius: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 24px rgba(57, 215, 176, 0.07);
}
.brand-mark svg { width: 21px; height: 21px; }

.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a, .icon-btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border-radius: 12px;
  color: var(--muted);
  transition: color .2s ease, background .2s ease, transform .2s ease;
}
.nav-links a:hover, .nav-links a.active, .icon-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}
.icon-btn {
  width: 42px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}
.icon-btn:hover { transform: translateY(-1px); }
.mobile-toggle { display: none; }

.container { width: min(calc(100% - 36px), var(--max)); margin: 0 auto; }
.section { padding: 88px 0; }
.section-compact { padding: 52px 0; }
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 34px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--accent-2);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.12; letter-spacing: -0.035em; }
h1 { font-size: clamp(3rem, 7.2vw, 6.6rem); margin-bottom: 28px; }
h2 { font-size: clamp(2rem, 4vw, 3.6rem); margin-bottom: 12px; }
h3 { font-size: 1.25rem; }
.lead { max-width: 690px; color: var(--muted); font-size: clamp(1.05rem, 1.8vw, 1.28rem); }
.muted { color: var(--muted); }

.hero {
  position: relative;
  overflow: hidden;
  padding: 90px 0 78px;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.13fr) minmax(330px, .87fr);
  gap: clamp(42px, 8vw, 104px);
  align-items: center;
}
.hero h1 span { color: var(--accent); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 34px 0 32px; }
.btn {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 19px;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-weight: 750;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(18,44,50,.12); }
.btn-primary { background: var(--accent); color: #04110e; border-color: transparent; }
.btn-secondary { background: var(--surface); }

.status-row { display: flex; flex-wrap: wrap; gap: 10px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: .88rem;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }

.hero-console {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--surface-solid) 88%, transparent), color-mix(in srgb, var(--surface-2) 75%, transparent));
  box-shadow: var(--shadow);
  padding: 18px;
  transform: rotate(1.2deg);
}
.hero-console::before {
  content: "";
  position: absolute;
  inset: -22px;
  z-index: -1;
  border-radius: 42px;
  background: radial-gradient(circle at 50% 50%, var(--accent-soft), transparent 68%);
}
.console-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.console-dots { display: flex; gap: 6px; }
.console-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.console-label { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; }
.robot-stage {
  min-height: 340px;
  overflow: hidden;
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    color-mix(in srgb, var(--bg) 60%, var(--surface-solid));
  background-size: 28px 28px;
}
.robot-stage::after {
  content: "LIVE / CAN FD";
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 700 .68rem ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .08em;
}
.robot-svg { width: 80%; filter: drop-shadow(0 20px 30px rgba(0,0,0,.16)); }
.robot-svg .line { fill: none; stroke: var(--text); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.robot-svg .accent { fill: var(--accent); }
.robot-svg .node { fill: var(--surface-solid); stroke: var(--accent); stroke-width: 5; }
.robot-svg .signal { fill: none; stroke: var(--accent-2); stroke-width: 3; stroke-dasharray: 7 8; animation: dash 2.4s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -30; } }
.console-log {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  background: var(--code);
  color: var(--code-text);
  font: .77rem/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.console-log strong { color: var(--accent); font-weight: 700; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metric {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.metric strong { display: block; font-size: 1.65rem; letter-spacing: -.04em; }
.metric span { color: var(--muted); font-size: .87rem; }

.project-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.project-card {
  position: relative;
  overflow: hidden;
  grid-column: span 6;
  min-height: 320px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.project-card:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--accent) 36%, var(--line)); box-shadow: var(--shadow); }
.project-card.featured { grid-column: span 8; }
.project-card.compact { grid-column: span 4; }
.project-card::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -110px;
  bottom: -130px;
  border-radius: 50%;
  background: var(--accent-soft);
  filter: blur(2px);
}
.project-index { color: var(--accent); font: 700 .8rem ui-monospace, monospace; letter-spacing: .1em; }
.project-card h3 { margin: 62px 0 15px; font-size: clamp(1.6rem, 3vw, 2.45rem); }
.project-card.compact h3 { margin-top: 44px; font-size: 1.65rem; }
.project-card p { max-width: 610px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
}
.project-link { position: absolute; top: 24px; right: 24px; z-index: 2; color: var(--muted); }
.project-link:hover { color: var(--accent); }

.about-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 54px; align-items: start; }
.about-card {
  position: sticky;
  top: 100px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.avatar {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04110e;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -.06em;
}
.about-copy > p { font-size: 1.08rem; color: var(--muted); }
.timeline { margin-top: 36px; border-left: 1px solid var(--line); }
.timeline-item { position: relative; padding: 0 0 32px 28px; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 7px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
}
.timeline-item time { color: var(--accent-2); font: 700 .8rem ui-monospace, monospace; }
.timeline-item h3 { margin: 7px 0 7px; }
.timeline-item p { margin: 0; color: var(--muted); }

.blog-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
}
.search-box { position: relative; flex: 1; max-width: 420px; }
.search-box svg { position: absolute; left: 14px; top: 50%; width: 18px; transform: translateY(-50%); color: var(--muted); }
.search-box input {
  width: 100%;
  min-height: 46px;
  padding: 0 16px 0 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  background: var(--surface);
  color: var(--text);
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-btn {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.filter-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.article-list { display: grid; gap: 12px; }
.article-card {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: 24px;
  align-items: center;
  min-height: 132px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  transition: transform .2s ease, border-color .2s ease;
}
.article-card:hover { transform: translateX(4px); border-color: color-mix(in srgb, var(--accent) 42%, var(--line)); }
.article-date { color: var(--muted); font: .78rem/1.6 ui-monospace, monospace; }
.article-card h3 { margin: 0 0 8px; }
.article-card p { margin: 0; color: var(--muted); font-size: .92rem; }
.article-arrow { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); }
.empty-state { display: none; padding: 42px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 18px; }

.stack-cloud { display: flex; flex-wrap: wrap; gap: 12px; }
.stack-item {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  font-weight: 720;
}
.stack-item i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

.cta {
  position: relative;
  overflow: hidden;
  padding: clamp(38px, 7vw, 72px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--text);
  color: var(--bg);
}
.cta::after {
  content: "";
  position: absolute;
  right: -8%;
  top: -40%;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .2;
  filter: blur(4px);
}
.cta h2 { max-width: 800px; }
.cta p { max-width: 640px; color: color-mix(in srgb, var(--bg) 70%, transparent); }
.cta .btn-primary { position: relative; z-index: 2; margin-top: 18px; }

.site-footer { padding: 36px 0 46px; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; padding-top: 26px; border-top: 1px solid var(--line); }
.footer-links { display: flex; gap: 16px; }
.footer-links a:hover { color: var(--text); }

/* Article pages */
.article-hero { padding: 78px 0 48px; }
.breadcrumb { display: flex; gap: 8px; align-items: center; margin-bottom: 28px; color: var(--muted); font-size: .9rem; }
.breadcrumb a:hover { color: var(--accent); }
.article-hero h1 { max-width: 980px; font-size: clamp(2.7rem, 6vw, 5.6rem); }
.article-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); }
.article-meta span { display: inline-flex; align-items: center; gap: 7px; }
.article-layout { display: grid; grid-template-columns: minmax(0, 760px) 260px; gap: 68px; align-items: start; }
.prose { font-size: 1.03rem; }
.prose h2 { margin: 2.4em 0 .65em; font-size: 2rem; }
.prose h3 { margin: 2em 0 .55em; font-size: 1.35rem; }
.prose p, .prose li { color: color-mix(in srgb, var(--text) 84%, var(--muted)); }
.prose a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 4px; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose blockquote {
  margin: 2em 0;
  padding: 18px 22px;
  border-left: 3px solid var(--accent);
  border-radius: 0 14px 14px 0;
  background: var(--accent-soft);
}
.prose blockquote p { margin: 0; color: var(--text); }
.prose pre {
  position: relative;
  overflow-x: auto;
  padding: 22px;
  border-radius: 16px;
  background: var(--code);
  color: var(--code-text);
  font: .86rem/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.prose code:not(pre code) { padding: 2px 6px; border-radius: 6px; background: var(--surface-2); color: var(--accent-2); }
.prose table { width: 100%; border-collapse: collapse; margin: 2em 0; font-size: .92rem; }
.prose th, .prose td { padding: 12px 14px; border: 1px solid var(--line); text-align: left; }
.prose th { background: var(--surface-2); }
.note {
  margin: 2em 0;
  padding: 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 16px;
  background: var(--surface);
}
.note strong { color: var(--accent-2); }
.toc {
  position: sticky;
  top: 104px;
  padding: 20px;
  border-left: 1px solid var(--line);
}
.toc strong { display: block; margin-bottom: 12px; }
.toc a { display: block; padding: 7px 0; color: var(--muted); font-size: .88rem; }
.toc a:hover { color: var(--accent); }
.back-card { margin-top: 44px; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 9px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
  background: rgba(255,255,255,.07);
  color: #c8ded8;
  cursor: pointer;
  font-size: .72rem;
}
.copy-btn:hover { background: rgba(255,255,255,.14); }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity .65s ease, transform .65s ease; }
.reveal.visible { opacity: 1; transform: none; }

@media (max-width: 960px) {
  .hero-grid, .about-grid, .article-layout { grid-template-columns: 1fr; }
  .hero-console { max-width: 610px; transform: none; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .project-card, .project-card.featured, .project-card.compact { grid-column: span 6; }
  .about-card, .toc { position: static; }
  .article-layout { gap: 20px; }
  .toc { border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 720px) {
  .nav-wrap { min-height: 64px; }
  .mobile-toggle { display: inline-flex; }
  .nav-links {
    position: fixed;
    left: 18px;
    right: 18px;
    top: 72px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-solid);
    box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-links a { justify-content: flex-start; }
  .desktop-only { display: none; }
  .hero { padding-top: 62px; }
  .section { padding: 66px 0; }
  .section-heading, .blog-toolbar, .footer-inner { align-items: flex-start; flex-direction: column; }
  .project-card, .project-card.featured, .project-card.compact { grid-column: 1 / -1; min-height: auto; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric { padding: 18px; }
  .article-card { grid-template-columns: 1fr auto; gap: 16px; }
  .article-date { grid-column: 1 / -1; }
  .search-box { max-width: none; width: 100%; }
  .footer-links { flex-wrap: wrap; }
  .robot-stage { min-height: 280px; }
}

@media (max-width: 440px) {
  .container, .nav-wrap { width: min(calc(100% - 24px), var(--max)); }
  h1 { font-size: 2.85rem; }
  .metric-grid { grid-template-columns: 1fr; }
  .hero-actions .btn { width: 100%; }
  .article-card { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
