/* =========================================
   SafeW 全局样式与动效系统
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 色彩层 */
  --color-bg-dark: #10112D;
  --color-bg-paper: #F5F0E5;
  --color-text-body: #151523;
  --color-brand: #1416EB;
  --color-accent: #89ED6E;
  
  /* 文本与图标取色规则 */
  --text-primary: var(--color-text-body);
  --text-secondary: color-mix(in srgb, var(--color-text-body) 75%, transparent);
  --icon-color: var(--color-brand);
  --link-color: var(--color-brand);
  
  /* 几何与间距 */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(21,21,35,0.3);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;
  
  /* 排版 */
  --font-title: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-body: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --line-height-base: 1.75;
  --line-height-tight: 1.25;
}

/* --- 重置与基础 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: var(--line-height-base);
  color: var(--text-primary);
  background-color: var(--color-bg-paper);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--link-color); text-decoration: none; transition: color 0.2s; }
a:hover { opacity: 0.85; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* --- 布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  position: relative;
}
.section + .section { border-top: 1px solid rgba(21,21,35,0.08); }

/* --- 表面主题覆盖 --- */
.surface-dark {
  background-color: var(--color-bg-dark);
  color: var(--color-bg-paper);
  --text-primary: var(--color-bg-paper);
  --text-secondary: rgba(245,240,229,0.7);
  --icon-color: var(--color-accent);
  --link-color: var(--color-accent);
}
.surface-dark .section + .section { border-top-color: rgba(245,240,229,0.1); }
.card-paper {
  background-color: var(--color-bg-paper);
  color: var(--color-text-body);
  --text-primary: var(--color-text-body);
  --text-secondary: rgba(21,21,35,0.7);
  --icon-color: var(--color-brand);
  --link-color: var(--color-brand);
}

/* --- 排版组件 --- */
.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--icon-color);
  margin-bottom: 0.6em;
}
h1, h2, h3, h4 {
  font-family: var(--font-title);
  font-weight: 600;
  line-height: var(--line-height-tight);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); margin-bottom: 1em; text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 0.8em; text-wrap: balance; }
h3 { font-size: 1.25rem; margin-bottom: 0.6em; margin-top: 1.5em; }
p { margin-bottom: 1em; max-width: 38em; }
.hl { color: var(--icon-color); font-weight: 600; }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s;
}
.btn:focus-visible { outline: 3px solid var(--icon-color); outline-offset: 2px; }
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-bg-dark);
}
.btn-secondary {
  background: transparent;
  border: 1.5px solid currentColor;
  color: var(--text-primary);
}
.btn-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* --- 卡片与面板 --- */
.card {
  background: var(--color-bg-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 24px;
  transition: box-shadow 0.3s ease;
}
.card:hover { box-shadow: 0 14px 32px -12px rgba(21,21,35,0.35); }
.panel {
  background: var(--color-bg-dark);
  border-radius: var(--radius-card);
  padding: 32px;
  overflow: hidden;
  position: relative;
}

/* --- 表格 --- */
.table-wrapper { overflow-x: auto; margin: 1.5em 0; border-radius: 12px; border: 1px solid rgba(21,21,35,0.1); }
table { width: 100%; border-collapse: collapse; min-width: 480px; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid rgba(21,21,35,0.08); }
th { font-weight: 600; background: rgba(21,21,35,0.03); }
td:first-child { font-weight: 500; color: var(--text-secondary); width: 35%; }

/* --- FAQ (Details) --- */
.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq-item summary {
  padding: 18px 20px;
  background: rgba(21,21,35,0.03);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  color: var(--icon-color);
  transition: transform 0.2s;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding: 16px 20px 20px; margin: 0; font-size: 0.95rem; color: var(--text-secondary); }

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245,240,229,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(21,21,35,0.06);
  transition: background 0.3s;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--text-primary); }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.nav-links { display: flex; gap: 24px; }
.nav-links a { font-weight: 500; font-size: 0.95rem; }
.nav-links a[aria-current="page"] { color: var(--icon-color); }
.site-footer {
  padding: 48px 0;
  border-top: 1px solid rgba(21,21,35,0.08);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.footer-links { display: flex; justify-content: center; gap: 20px; margin-bottom: 16px; }

/* --- SVG 动效系统 --- */
.svg-visual { width: 100%; height: auto; display: block; }
.path-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.3s ease;
}
@keyframes grid-pulse {
  0%, 100% { stroke-dashoffset: 1; opacity: 0.35; }
  50% { stroke-dashoffset: 0; opacity: 1; }
}
.node-glow {
  animation: grid-pulse 6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.delay-1 { animation-delay: 0.4s; }
.delay-2 { animation-delay: 0.8s; }
.delay-3 { animation-delay: 1.2s; }
.delay-4 { animation-delay: 1.6s; }
.delay-5 { animation-delay: 2.0s; }

@keyframes float-bubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.bubble-float {
  animation: float-bubble 5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.bubble-float.d1 { animation-delay: 0.5s; }
.bubble-float.d2 { animation-delay: 1.2s; }

@keyframes breathe-dot {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}
.input-dot {
  animation: breathe-dot 2.5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.input-dot.d1 { animation-delay: 0s; }
.input-dot.d2 { animation-delay: 0.2s; }
.input-dot.d3 { animation-delay: 0.4s; }

@keyframes slide-in-panel {
  0%, 100% { transform: translateX(0); opacity: 0.9; }
  50% { transform: translateX(4px); opacity: 1; }
}
.slide-panel {
  animation: slide-in-panel 7s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: left center;
}

/* --- 响应式 --- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); }
  .section { padding-top: calc(var(--section-y) * 0.7); padding-bottom: calc(var(--section-y) * 0.7); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* --- 减少动态效果 --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .node-glow, .bubble-float, .input-dot, .slide-panel {
    animation: none !important;
    opacity: 1 !important;
    stroke-dashoffset: 0 !important;
    transform: none !important;
  }
}
