/* =========================================
   Design Tokens & Global Reset
   ========================================= */
:root {
  --color-bg: #080E1F;
  --color-surface: #111A36;
  --color-surface-light: #1A2547;
  --color-text-primary: #F4F6FA;
  --color-text-secondary: #A8B2D1;
  --color-text-muted: #6B7799;
  --color-accent: #F2A63A;
  --color-accent-hover: #FFB84D;
  --color-border: #2A3558;
  --color-success: #34C759;

  --font-display: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1.25rem;
  --space-lg: 2rem;
  --space-xl: 3.5rem;
  --space-xxl: 5rem;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-card: 0 8px 24px rgba(2, 6, 18, 0.6);
  --shadow-elevated: 0 12px 32px rgba(2, 6, 18, 0.75);

  --container-max: 1200px;
  --header-height: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-display);
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; cursor: pointer; border: none; background: transparent; color: inherit; }

/* =========================================
   Layout & Typography
   ========================================= */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

section { padding: var(--space-xxl) 0; }
.section-header { margin-bottom: var(--space-xl); }
.section-header h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  line-height: 1.15;
  text-wrap: balance;
  margin: 0 0 var(--space-sm) 0;
  color: var(--color-text-primary);
}
.section-header p {
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  color: var(--color-text-secondary);
  max-width: 65ch;
  line-height: 1.6;
}

/* Staggered asymmetry helper */
.stagger-left { margin-right: calc(var(--space-lg) * -1); }
.stagger-right { margin-left: calc(var(--space-lg) * -1); }

/* =========================================
   Header & Navigation
   ========================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 14, 31, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
.brand { display: flex; align-items: center; gap: var(--space-sm); }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.brand-name { font-weight: 600; font-size: 1.1rem; letter-spacing: 0.02em; }
nav ul { display: flex; gap: var(--space-lg); }
nav a { font-size: 0.95rem; font-weight: 500; opacity: 0.85; position: relative; }
nav a:hover, nav a[aria-current="page"] { opacity: 1; color: var(--color-accent); }
nav a[aria-current="page"]::after {
  content: ""; position: absolute; bottom: -4px; left: 0; width: 100%; height: 2px;
  background: var(--color-accent); border-radius: 2px;
}
.mobile-toggle { display: none; }

@media (max-width: 768px) {
  nav { display: none; }
  .mobile-toggle { display: block; }
}

/* =========================================
   Footer
   ========================================= */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-xl) 0 var(--space-lg) 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-lg); margin-bottom: var(--space-xl); }
.footer-col h3 { font-size: 1rem; color: var(--color-text-primary); margin: 0 0 var(--space-md) 0; }
.footer-col ul li { margin-bottom: var(--space-xs); }
.footer-col a:hover { color: var(--color-accent); }
.footer-bottom { text-align: center; padding-top: var(--space-lg); border-top: 1px solid var(--color-border); }

/* =========================================
   Components: Buttons
   ========================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs);
  padding: 0.75rem 1.5rem; border-radius: var(--radius-md);
  font-weight: 600; font-size: 1rem; transition: all 0.2s ease;
  border: 1px solid transparent; text-wrap: balance;
}
.btn-primary { background: var(--color-accent); color: #080E1F; }
.btn-primary:hover { background: var(--color-accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(242, 166, 58, 0.3); }
.btn-outline { border-color: var(--color-border); background: transparent; color: var(--color-text-primary); }
.btn-outline:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* =========================================
   Components: Cards & Lists
   ========================================= */
.card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-lg);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-lg); }
.feature-item { display: flex; flex-direction: column; gap: var(--space-sm); }
.feature-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--color-surface-light); display: flex; align-items: center; justify-content: center; margin-bottom: var(--space-xs); }
.feature-icon svg { width: 24px; height: 24px; stroke: var(--color-accent); }

.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-lg); }
.news-card { display: flex; flex-direction: column; height: 100%; }
.news-meta { font-size: 0.85rem; color: var(--color-text-muted); margin-bottom: var(--space-xs); display: flex; align-items: center; gap: var(--space-xs); }
.news-title { font-size: 1.1rem; font-weight: 600; margin: 0 0 var(--space-xs) 0; line-height: 1.35; }
.news-excerpt { font-size: 0.95rem; color: var(--color-text-secondary); flex-grow: 1; margin-bottom: var(--space-md); line-height: 1.6; }
.related-list li { margin-bottom: var(--space-sm); padding-left: 1.2em; position: relative; }
.related-list li::before { content: "·"; position: absolute; left: 0; color: var(--color-accent); font-weight: bold; }
.related-link { display: block; font-weight: 500; margin-bottom: 2px; }
.related-link:hover { color: var(--color-accent); }
.related-desc { font-size: 0.9rem; color: var(--color-text-muted); }

/* =========================================
   Components: Table & FAQ
   ========================================= */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-md); border: 1px solid var(--color-border); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.data-table th, .data-table td { padding: var(--space-md); text-align: left; border-bottom: 1px solid var(--color-border); }
.data-table th { background: var(--color-surface-light); font-weight: 600; color: var(--color-text-primary); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(26, 37, 71, 0.4); }

details { margin-bottom: var(--space-md); border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; }
summary {
  padding: var(--space-md); cursor: pointer; font-weight: 500; background: var(--color-surface);
  list-style: none; position: relative; padding-right: var(--space-xl);
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+"; position: absolute; right: var(--space-md); top: 50%; transform: translateY(-50%);
  font-size: 1.2rem; color: var(--color-accent); transition: transform 0.2s;
}
details[open] summary::after { content: "-"; }
details p { padding: var(--space-md); color: var(--color-text-secondary); line-height: 1.6; margin: 0; background: var(--color-bg); }

/* =========================================
   SVG Animations & Utilities
   ========================================= */
.svg-container { position: relative; width: 100%; max-width: 600px; aspect-ratio: 4/3; }
.wave-group path { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
@keyframes wave-undulate {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes wave-phase-shift {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(6px); }
}
@keyframes draw-path {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -1; }
}
.wave-animated { animation: wave-undulate 4s ease-in-out infinite; }
.wave-animated.phase-1 { animation-delay: 0s; }
.wave-animated.phase-2 { animation-delay: 0.8s; }
.wave-animated.phase-3 { animation-delay: 1.6s; }
.draw-animated { animation: draw-path 3s linear infinite; }
.rotate-center { transform-box: fill-box; transform-origin: center; }
@keyframes slow-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin-slow { animation: slow-spin 24s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Page Specific Overrides */
.hero-layout { display: grid; grid-template-columns: 1.2fr 1fr; gap: var(--space-xl); align-items: center; }
.hero-content h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); line-height: 1.1; margin: 0 0 var(--space-md) 0; text-wrap: balance; }
.hero-sub { font-size: clamp(1.05rem, 2vw, 1.2rem); color: var(--color-text-secondary); margin-bottom: var(--space-lg); line-height: 1.6; max-width: 55ch; }
.hero-actions { display: flex; gap: var(--space-md); flex-wrap: wrap; }
.mockup-frame { background: var(--color-surface-light); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-md); box-shadow: var(--shadow-elevated); }
.mockup-header { display: flex; gap: 6px; margin-bottom: var(--space-md); }
.mockup-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--color-border); }
.mockup-dot:first-child { background: #FF5F57; }
.mockup-dot:nth-child(2) { background: #FEBC2E; }
.mockup-dot:nth-child(3) { background: #28C840; }
.mockup-chat { display: flex; flex-direction: column; gap: var(--space-sm); }
.chat-bubble { padding: 10px 14px; border-radius: 12px; font-size: 0.9rem; max-width: 80%; }
.chat-bubble.received { background: var(--color-surface); align-self: flex-start; border-bottom-left-radius: 2px; }
.chat-bubble.sent { background: #005C4B; align-self: flex-end; border-bottom-right-radius: 2px; }
.encryption-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--color-success); margin-top: var(--space-sm); }
.steps-list { counter-reset: step; list-style: none; padding-left: 0; }
.steps-list li { position: relative; padding-left: 2.5rem; margin-bottom: var(--space-md); }
.steps-list li::before {
  content: counter(step); counter-increment: step; position: absolute; left: 0; top: 0;
  width: 1.8rem; height: 1.8rem; background: var(--color-surface-light); border: 1px solid var(--color-border);
  border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.9rem;
}
.scenario-block { background: var(--color-surface); padding: var(--space-lg); border-radius: var(--radius-md); border-left: 3px solid var(--color-accent); margin-bottom: var(--space-md); }
.scenario-title { font-weight: 600; margin-bottom: var(--space-xs); display: block; }
.focus-ring { outline: none; }
.focus-ring:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: var(--radius-sm); }
