/* ============================================================
   faio 首页 · 品牌视觉
   深蓝黑顶栏 / 冷白画布 / 靛蓝紫主色 / 协程轨道网格背景
   ============================================================ */
:root {
  color-scheme: light;

  --paper: #f7f8fc;
  --paper-alt: #ffffff;
  --paper-line: #e3e6f0;
  --ink: #141830;
  --body: #4a5068;
  --muted: #6f7690;

  --nav: #12162b;
  --nav-fg: #ffffff;
  --nav-fg-dim: #aeb5cf;

  --accent: #5061cf;
  --accent-hover: #4251b8;
  --accent-2: #8190f2;

  --navy: #181f38;
  --navy-line: rgba(255, 255, 255, 0.1);

  --c-easy: #5061cf;
  --c-perf: #f5a623;
  --c-flexible: #95ca51;
  --c-safe: #a674e5;
  --c-task: #5396d1;
  --c-runtime: #c83895;
  --c-net: #e7544c;
  --c-fs: #f5a623;
  --c-sync: #95ca51;
  --c-tls: #a674e5;
  --c-process: #e2b619;
  --c-experimental: #e7544c;

  --sans:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono:
    ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;
}

* {
  box-sizing: border-box;
}
::selection {
  background: rgba(83, 150, 209, 0.22);
  color: var(--ink);
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  background-color: var(--paper);
}
body {
  margin: 0;
  /* 不能给 body 铺底色：body 背景会盖住 z-index:-1 的 .page-canvas 环境背景层。
     视口底色由 html 的 background 兜底。 */
  color: var(--body);
  font-family: var(--sans);
  font-size: 1.02rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  cursor: pointer;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}
code {
  font-family: var(--mono);
  font-size: 0.9em;
}
p code,
.hero-subtitle code,
.feature-card code,
.stack-card code {
  color: var(--accent);
  background: transparent;
  padding: 0;
}
h1,
h2,
h3 {
  color: var(--ink);
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
}

.shell {
  width: min(1150px, calc(100% - 48px));
  margin-inline: auto;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  z-index: 100;
  top: -80px;
  left: 20px;
  padding: 12px 20px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 4px;
}
.skip-link:focus {
  top: 12px;
}

/* ---------- 顶栏：黑色 navbar ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav);
  color: var(--nav-fg);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 72px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--nav-fg);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.brand img {
  display: block;
}
.desktop-nav {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-left: auto;
}
.desktop-nav a {
  color: var(--nav-fg-dim);
  font-size: 0.95rem;
  transition: color 0.15s ease;
}
.desktop-nav a:hover {
  color: var(--nav-fg);
}
.github-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  color: var(--nav-fg-dim);
  transition: color 0.15s ease;
}
.github-link:hover {
  color: var(--nav-fg);
}
.github-link svg {
  width: 22px;
  height: 22px;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  margin-left: auto;
  padding: 8px;
  border: 0;
  background: transparent;
}
.menu-toggle span {
  display: block;
  height: 2px;
  background: var(--nav-fg);
  border-radius: 2px;
}
.mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 24px 16px;
  background: var(--nav);
}
.mobile-nav[hidden] {
  display: none;
}
.mobile-nav a {
  color: var(--nav-fg-dim);
  padding: 10px 0;
  font-size: 1rem;
}
.mobile-nav a:hover {
  color: var(--nav-fg);
}

/* ---------- 全页环境背景：网格 + 光晕，贯穿 Hero 以下所有区块 ---------- */
.page-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: var(--paper);
}
.page-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(80, 97, 207, 0.042) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(80, 97, 207, 0.042) 1px, transparent 1px);
  background-size: 46px 46px;
}
.page-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.42;
}
.page-glow-a {
  top: -160px;
  right: -120px;
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, rgba(129, 144, 242, 0.45), transparent 68%);
  animation: glow-drift 16s ease-in-out infinite alternate;
}
.page-glow-b {
  bottom: -200px;
  left: -140px;
  width: 620px;
  height: 620px;
  background: radial-gradient(circle, rgba(160, 107, 214, 0.3), transparent 68%);
  animation: glow-drift 20s ease-in-out infinite alternate-reverse;
}
/* 协程轨道：与网格、光晕一起铺满全页 */
.page-track {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 108px 0 96px;
}
@keyframes glow-drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, 30px) scale(1.12); }
}
.track-line {
  fill: none;
  stroke: url(#trackGrad);
  stroke-width: 1.6;
  stroke-dasharray: 9 13;
  animation: track-flow 26s linear infinite;
}
.track-line.t2 { animation-duration: 34s; animation-direction: reverse; }
.track-line.t3 { animation-duration: 30s; }
@keyframes track-flow {
  to { stroke-dashoffset: -440; }
}
.track-nodes circle {
  fill: var(--paper-alt);
  stroke: var(--accent);
  stroke-width: 2;
  animation: node-pulse 3.2s ease-in-out infinite;
}
.track-nodes circle:nth-child(2) { animation-delay: 0.6s; }
.track-nodes circle:nth-child(3) { animation-delay: 1.2s; }
.track-nodes circle:nth-child(4) { animation-delay: 1.8s; }
@keyframes node-pulse {
  0%, 100% { r: 5; opacity: 0.6; }
  50% { r: 7; opacity: 1; }
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin-inline: auto;
  text-align: center;
}
.hero h1 {
  font-size: clamp(2.2rem, 4.4vw, 3.3rem);
  letter-spacing: -0.03em;
  line-height: 1.22;
}
.hero h1 .hero-title-lead {
  font-size: 1.14em;
  background: linear-gradient(100deg, var(--accent) 0%, #a06bd6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent);
}
.hero h1 .hero-title-sub {
  font-size: 0.62em;
  color: var(--ink);
}
.hero-subtitle {
  max-width: 660px;
  margin: 26px auto 0;
  font-size: 1.12rem;
  line-height: 1.7;
  color: var(--body);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 34px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 26px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-primary span {
  transition: transform 0.15s ease;
}
.btn-primary:hover span {
  transform: translateX(3px);
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--paper-line);
}
.btn-ghost:hover {
  border-color: var(--ink);
}

/* ---------- 特性卡片 ---------- */
.features {
  padding-bottom: 84px;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.feature-card {
  position: relative;
  background: var(--paper-alt);
  border: 1px solid var(--paper-line);
  border-top: 3px solid var(--card-color);
  border-radius: 6px;
  padding: 26px 28px 28px;
  box-shadow: 0 1px 2px rgba(10, 10, 10, 0.03);
  overflow: hidden;
  transition:
    transform 0.24s ease,
    box-shadow 0.24s ease,
    border-color 0.24s ease;
}
/* 悬停时顶边主色延展为整圈描边微光，卡片上浮 */
.feature-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--card-color);
  opacity: 0;
  transition: opacity 0.24s ease;
  pointer-events: none;
}
.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 38px -22px rgba(24, 31, 56, 0.35);
}
.feature-card:hover::after {
  opacity: 0.55;
}
.feature-card h2 {
  font-size: 1.15rem;
  margin-bottom: 12px;
  transition: letter-spacing 0.24s ease;
}
.feature-card:hover h2 {
  letter-spacing: 0.02em;
}
.feature-card p {
  margin: 0;
  color: var(--body);
  line-height: 1.7;
}
.fc-easy { --card-color: var(--c-easy); }
.fc-easy h2 { color: var(--c-easy); }
.fc-perf { --card-color: var(--c-perf); }
.fc-perf h2 { color: var(--c-perf); }
.fc-flexible { --card-color: var(--c-flexible); }
.fc-flexible h2 { color: var(--c-flexible); }
.fc-safe { --card-color: var(--c-safe); }
.fc-safe h2 { color: var(--c-safe); }

/* ---------- 设计支柱：与全页背景一体的胶囊词条 ---------- */
.users {
  padding: 66px 0;
}
.users-inner {
  text-align: center;
}
.users h2 {
  font-size: 1.5rem;
  margin-bottom: 36px;
}
.user-logos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: center;
  max-width: 880px;
  margin: 0 auto;
}
.user-logo {
  display: block;
  padding: 13px 10px;
  background: var(--paper-alt);
  border: 1px solid var(--paper-line);
  border-radius: 999px;
  color: var(--body);
  font: 600 0.98rem var(--sans);
  letter-spacing: 0.01em;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    color 0.2s ease;
}
.user-logo:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  color: var(--ink);
  box-shadow: 0 12px 24px -16px rgba(80, 97, 207, 0.45);
}

/* ---------- 代码展示窗口 ---------- */
.code-section {
  padding: 80px 0 24px;
}
.code-window {
  background: var(--navy);
  border: 1px solid var(--navy-line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 20px 45px rgba(10, 12, 28, 0.18);
}
.code-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--navy-line);
  background: rgba(4, 8, 20, 0.25);
}
.code-tabs {
  display: flex;
}
.code-tabs button {
  position: relative;
  border: 0;
  background: transparent;
  color: #8f9bb6;
  padding: 14px 18px;
  font-size: 0.9rem;
  font-weight: 600;
}
.code-tabs button span {
  margin-left: 6px;
  color: #656f88;
  font-weight: 400;
  font-size: 0.8rem;
}
.code-tabs button:hover {
  color: #c3cbdd;
}
.code-tabs button[aria-selected="true"] {
  color: #fff;
}
.code-tabs button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}
.code-topbar > a {
  color: #aab6ff;
  font-size: 0.82rem;
}
.code-topbar > a:hover {
  color: #d0d8ef;
}
.code-source {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 316px;
  padding: 26px 28px;
}
.code-source [role="tabpanel"] {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(170, 182, 255, 0.35) transparent;
}
.code-source [role="tabpanel"]::-webkit-scrollbar {
  height: 8px;
}
.code-source [role="tabpanel"]::-webkit-scrollbar-thumb {
  background: rgba(170, 182, 255, 0.3);
  border-radius: 4px;
}
.code-source [role="tabpanel"]::-webkit-scrollbar-track {
  background: transparent;
}
.code-source pre {
  margin: 0;
  color: #d7dcea;
  font: 12.3px/1.8 var(--mono);
  font-variant-ligatures: none;
  tab-size: 2;
}
.keyword { color: #aab6ff; }
.number { color: #edbd91; }
.string { color: #91d5b3; }
.comment { color: #7f8ba7; font-style: italic; }
/* ---------- The Stack：左侧锚点菜单 + 右侧卡片 ---------- */
.stack {
  padding: 72px 0 84px;
}
.stack-layout {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 40px;
  align-items: start;
}
.stack-menu-inner {
  position: sticky;
  top: 96px;
}
.menu-label {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 12px;
}
.menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--paper-line);
}
.menu-list li a {
  display: block;
  padding: 7px 0 7px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 0.9rem;
}
.menu-list li a:hover {
  color: var(--ink);
  border-left-color: var(--ink);
}
.sm-task a:hover { border-left-color: var(--c-task); }
.sm-runtime a:hover { border-left-color: var(--c-runtime); }
.sm-net a:hover { border-left-color: var(--c-net); }
.sm-fs a:hover { border-left-color: var(--c-fs); }
.sm-sync a:hover { border-left-color: var(--c-sync); }
.sm-tls a:hover { border-left-color: var(--c-tls); }
.sm-process a:hover { border-left-color: var(--c-process); }
.sm-experimental a:hover { border-left-color: var(--c-experimental); }

.stack-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.stack-card {
  background: var(--paper-alt);
  border: 1px solid var(--paper-line);
  border-radius: 6px;
  padding: 22px 26px;
  scroll-margin-top: 96px;
  transition:
    transform 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}
.stack-card:hover {
  transform: translateY(-3px);
  border-color: var(--card-color);
  box-shadow: 0 14px 30px -22px rgba(24, 31, 56, 0.35);
}
.stack-card h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.08rem;
  color: var(--card-color);
  margin-bottom: 10px;
}
.stack-icon {
  display: block;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
}
.stack-card p {
  margin: 0;
  color: var(--body);
}
.stack-card .learn-more {
  margin-top: 12px;
  text-align: right;
}
.stack-card .learn-more a {
  color: var(--card-color);
  font-size: 0.88rem;
  font-weight: 600;
}
.stack-card .learn-more a:hover {
  text-decoration: underline;
}
.sc-task { --card-color: var(--c-task); }
.sc-runtime { --card-color: var(--c-runtime); }
.sc-net { --card-color: var(--c-net); }
.sc-fs { --card-color: var(--c-fs); }
.sc-sync { --card-color: var(--c-sync); }
.sc-tls { --card-color: var(--c-tls); }
.sc-process { --card-color: var(--c-process); }
.sc-experimental { --card-color: var(--c-experimental); }

/* ---------- 收尾区 ---------- */
.closing {
  padding: 78px 0 86px;
  text-align: center;
}
.section-kicker {
  display: inline-block;
  color: var(--accent);
  font: 700 0.78rem var(--mono);
  letter-spacing: 0.12em;
}
.closing h2 {
  font-size: clamp(1.9rem, 3.6vw, 2.5rem);
  letter-spacing: -0.03em;
  margin: 14px 0 0;
}
.closing p {
  max-width: 560px;
  margin: 16px auto 26px;
  color: var(--body);
}
.install-command {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  max-width: 100%;
  margin-top: 30px;
  padding: 10px 12px 10px 18px;
  background: var(--navy);
  border: 1px solid var(--navy-line);
  border-radius: 6px;
}
.install-command code {
  color: #d7dcea;
  font-size: 0.86rem;
  /* 窄屏允许长 URL 折行，避免撑宽页面 */
  overflow-wrap: anywhere;
}
.install-command button {
  border: 0;
  padding: 6px 14px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: #d7dcea;
  font-size: 0.8rem;
}
.install-command button:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--nav);
  color: var(--nav-fg-dim);
  padding: 30px 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.footer-inner .brand {
  font-size: 1.15rem;
}
.footer-inner p {
  margin: 0;
  font-size: 0.85rem;
}
.footer-inner nav {
  display: flex;
  gap: 20px;
  margin-left: auto;
}
.footer-inner nav a {
  font-size: 0.85rem;
}
.footer-inner nav a:hover {
  color: var(--nav-fg);
}

/* ---------- 入场动画：进入视口时淡入上移，同组元素按 JS 写入的 --reveal-delay 错峰 ---------- */
/* 用 translate 属性而非 transform，避免与卡片悬停的 transform 冲突 */
.reveal-js [data-reveal] {
  opacity: 0;
  translate: 0 16px;
  transition:
    opacity 0.35s ease-out,
    translate 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
  transition-delay: var(--reveal-delay, 0s);
}
.reveal-js [data-reveal].in-view {
  opacity: 1;
  translate: 0 0;
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .stack-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .stack-menu-inner {
    position: static;
  }
  .menu-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    border-left: 0;
  }
  .menu-list li a {
    padding: 4px 0;
    margin-left: 0;
    border-left: 0;
  }
}
@media (max-width: 760px) {
  .desktop-nav,
  .github-link {
    display: none;
  }
  .menu-toggle {
    display: flex;
  }
  .features-grid {
    grid-template-columns: 1fr;
  }
  .user-logos {
    grid-template-columns: repeat(2, 1fr);
  }
  .hero {
    padding: 72px 0 64px;
  }
  /* 窄屏缩小标题字号，避免长行溢出产生横向滚动 */
  .hero h1 {
    font-size: 1.8rem;
  }
  .footer-inner nav {
    margin-left: 0;
    flex-wrap: wrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .page-glow,
  .track-line,
  .track-nodes circle { animation: none; }
  .feature-card,
  .user-logo,
  .stack-card { transition: none; }
  /* 运行途中切换减少动态时，已隐藏的元素也要直接显示 */
  .reveal-js [data-reveal] {
    transition: none;
    opacity: 1;
    translate: 0 0;
  }
}
