/* =========================================
   Design Tokens & Variables
   ========================================= */
:root {
  --color-bg: #F8FAF9;
  --color-surface: #FFFFFF;
  --color-text-primary: #0F172A;
  --color-text-secondary: #475569;
  --color-text-muted: #64748B;
  --color-brand-deep: #064E3B;
  --color-brand-mid: #059669;
  --color-brand-light: #34D399;
  --color-accent: #10B981;
  --color-border: #E2E8F0;
  --color-hover: #F1FDF9;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 8px 20px rgba(0, 0, 0, 0.08);
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --container-max: 1120px;
}

/* =========================================
   Reset & Base
   ========================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  line-height: 1.65;
  font-size: clamp(0.95rem, 0.9rem + 0.25vw, 1.05rem);
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: color var(--transition-fast); }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* =========================================
   Typography & Layout
   ========================================= */
.container { width: 100%; max-width: var(--container-max); margin: 0 auto; padding: 0 var(--space-lg); }
.section { padding: var(--space-2xl) 0; position: relative; }
.section-alt { background-color: var(--color-surface); }
.heading-xl { font-size: clamp(2.2rem, 4vw, 3.5rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; text-wrap: balance; }
.heading-lg { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; margin-bottom: var(--space-md); text-wrap: balance; }
.heading-md { font-size: clamp(1.2rem, 2vw, 1.5rem); font-weight: 600; line-height: 1.3; margin-bottom: var(--space-sm); }
.text-body { color: var(--color-text-secondary); margin-bottom: var(--space-md); }
.text-small { font-size: 0.85rem; color: var(--color-text-muted); }
.mono-tag { font-family: var(--font-mono); font-size: 0.8rem; background: rgba(5, 150, 105, 0.08); color: var(--color-brand-deep); padding: 0.2rem 0.6rem; border-radius: var(--radius-sm); display: inline-block; margin-bottom: var(--space-sm); }

.grid-auto { display: grid; gap: var(--space-lg); grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.flex-center { display: flex; align-items: center; justify-content: center; }
.divider { height: 1px; background: var(--color-border); margin: var(--space-xl) 0; }

/* =========================================
   Header & Footer
   ========================================= */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(248, 250, 249, 0.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}
.header-inner { height: 64px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: var(--space-sm); font-weight: 700; font-size: 1.1rem; color: var(--color-brand-deep); }
.brand img { width: 28px; height: 28px; object-fit: contain; }
.nav-desktop ul { display: flex; gap: var(--space-lg); }
.nav-desktop a { font-size: 0.95rem; font-weight: 500; padding: 0.4rem 0; position: relative; }
.nav-desktop a:hover, .nav-desktop a[aria-current="page"] { color: var(--color-brand-mid); }
.nav-desktop a[aria-current="page"]::after { content: ""; position: absolute; bottom: -4px; left: 0; width: 100%; height: 2px; background: var(--color-brand-mid); border-radius: 2px; }
.mobile-toggle { display: none; background: none; border: none; cursor: pointer; padding: var(--space-sm); }
.mobile-nav { display: none; position: fixed; inset: 64px 0 auto 0; background: var(--color-surface); padding: var(--space-lg); border-bottom: 1px solid var(--color-border); z-index: 99; }
.mobile-nav.open { display: block; }
.mobile-nav a { display: block; padding: var(--space-md) 0; font-weight: 500; border-bottom: 1px solid var(--color-border); }
.site-footer { background: var(--color-brand-deep); color: #E2E8F0; padding: var(--space-xl) 0 var(--space-lg); font-size: 0.9rem; }
.footer-grid { display: grid; gap: var(--space-lg); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: var(--space-lg); }
.footer-col h4 { color: var(--color-brand-light); margin-bottom: var(--space-md); font-weight: 600; }
.footer-col ul li { margin-bottom: var(--space-sm); }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: var(--space-md); text-align: center; color: #94A3B8; font-size: 0.8rem; }

/* =========================================
   Components: Buttons & Cards
   ========================================= */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm); padding: 0.75rem 1.5rem; border-radius: var(--radius-full); font-weight: 600; transition: all var(--transition-base); cursor: pointer; border: 1px solid transparent; }
.btn-primary { background: linear-gradient(135deg, var(--color-brand-deep) 0%, var(--color-brand-mid) 100%); color: #fff; box-shadow: 0 4px 10px rgba(5, 150, 105, 0.25); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(5, 150, 105, 0.35); filter: brightness(1.05); }
.btn-outline { background: transparent; border-color: var(--color-brand-mid); color: var(--color-brand-deep); }
.btn-outline:hover { background: var(--color-hover); border-color: var(--color-brand-deep); }
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-lg); transition: transform var(--transition-base), box-shadow var(--transition-base); }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.card-meta { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.card-tag { font-family: var(--font-mono); font-size: 0.75rem; color: var(--color-brand-mid); background: rgba(52, 211, 153, 0.1); padding: 0.15rem 0.5rem; border-radius: var(--radius-sm); }

/* =========================================
   Components: Table & Details (FAQ)
   ========================================= */
.table-wrapper { overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { padding: 0.9rem 1rem; text-align: left; border-bottom: 1px solid var(--color-border); }
th { background: #F1F5F9; font-weight: 600; color: var(--color-brand-deep); }
tr:last-child td { border-bottom: none; }
details { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); margin-bottom: var(--space-md); overflow: hidden; transition: box-shadow var(--transition-fast); }
details[open] { box-shadow: var(--shadow-card); }
summary { padding: 1rem; cursor: pointer; font-weight: 600; position: relative; list-style: none; display: flex; align-items: center; gap: var(--space-sm); }
summary::-webkit-details-marker { display: none; }
summary::before { content: "+"; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: #F1F5F9; color: var(--color-brand-deep); font-size: 0.9rem; transition: transform var(--transition-fast); }
details[open] summary::before { content: "-"; transform: rotate(180deg); }
details p { padding: 0 1rem 1rem; color: var(--color-text-secondary); line-height: 1.6; }

/* =========================================
   SVG Motion & Decorations
   ========================================= */
.svg-container { position: relative; width: 100%; aspect-ratio: 16/9; max-width: 800px; margin: var(--space-lg) auto; }
.flow-line { fill: none; stroke: var(--color-brand-light); stroke-width: 1.5; pathLength: 1; stroke-dasharray: 0.12 0.88; stroke-dashoffset: 0; animation: dataFlow 6s linear infinite; }
.pulse-node { fill: var(--color-brand-mid); opacity: 0.8; }
.pulse-ring { fill: none; stroke: var(--color-brand-mid); stroke-width: 1.5; opacity: 0; animation: ringPulse 4s ease-out infinite; }
.data-stream { fill: none; stroke: url(#grad-green); stroke-width: 2; pathLength: 1; stroke-dasharray: 0.1 0.9; stroke-dashoffset: 0; animation: streamMove 8s linear infinite; }
.node-group { transform-box: fill-box; transform-origin: center; }
@keyframes dataFlow { from { stroke-dashoffset: 1; } to { stroke-dashoffset: -1; } }
@keyframes streamMove { from { stroke-dashoffset: 1; } to { stroke-dashoffset: -1; } }
@keyframes ringPulse { 0% { transform: scale(0.8); opacity: 0.8; } 100% { transform: scale(1.8); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 768px) {
  .nav-desktop { display: none; }
  .mobile-toggle { display: block; }
  .heading-xl { font-size: 2rem; }
  .grid-auto { grid-template-columns: 1fr; }
  .section { padding: var(--space-xl) 0; }
}
