/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 设计变量 (Design Tokens) --- */
:root {
  /* 颜色系统 */
  --color-dark-bg: #21163C;
  --color-paper: #E9E8EA;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED926E;
  
  /* 组件衍生色 (不用于正文，仅用于边框、次级背景) */
  --border-color: rgba(25, 21, 35, 0.12);
  --card-shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.3);
  --focus-ring: 0 0 0 3px rgba(82, 20, 235, 0.4);

  /* 圆角 */
  --radius-card: 20px;
  --radius-btn: 12px;
  --radius-badge: 8px;

  /* 间距与节奏 */
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;
  
  /* 字体 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --line-height-base: 1.65;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-family: var(--font-sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { background-color: var(--color-paper); color: var(--color-text); line-height: var(--line-height-base); font-size: 16px; overflow-x: hidden; }

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--color-brand); text-decoration: none; transition: color 0.2s ease; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 4px; }

h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; color: inherit; }
p { margin-bottom: 1.5em; max-width: 38em; }
ul, ol { padding-left: 1.5em; margin-bottom: 1.5em; }
li { margin-bottom: 0.5em; }

/* 容器 */
.container { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }

/* 眉标 (Supertitle) */
.supertitle {
  display: inline-flex; align-items: center; gap: 0.5em;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  margin-bottom: 0.75em;
}
.paper-mode .supertitle { color: var(--color-brand); }
.dark-mode .supertitle { color: var(--color-accent); }

/* 高亮词 */
.hl { color: var(--color-brand); }
.dark-mode .hl { color: var(--color-accent); }

/* --- 按钮 --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6em;
  height: 48px; min-width: 120px; padding: 0 1.5em;
  font-size: 1rem; font-weight: 700; border-radius: var(--radius-btn);
  cursor: pointer; transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-primary {
  background-color: var(--color-accent); color: var(--color-dark-bg);
  border: none;
}
.btn-primary:hover { background-color: #d67b58; }
.btn-secondary {
  background-color: transparent;
  border: 2px solid var(--color-text); color: var(--color-text);
}
.paper-mode .btn-secondary { border-color: var(--color-text); color: var(--color-text); }
.dark-mode .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.dark-mode .btn-primary { color: var(--color-dark-bg); }

/* --- 布局辅助 --- */
.section { padding-block: var(--section-y); position: relative; }
.paper-mode { background-color: var(--color-paper); color: var(--color-text); }
.dark-mode { background-color: var(--color-dark-bg); color: var(--color-paper); }
.dark-mode p, .dark-mode li { color: var(--color-paper); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: var(--gap); align-items: center; }
.text-col { padding: var(--gap); }
.visual-col { display: flex; justify-content: center; align-items: center; }

/* --- 页头 --- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background-color: rgba(233, 232, 234, 0.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}
.dark-mode.site-header { background-color: rgba(33, 22, 60, 0.9); border-bottom-color: rgba(233, 232, 234, 0.1); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 0.75em; font-weight: 800; font-size: 1.2rem; color: inherit; text-decoration: none; }
.brand img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 1.5em; list-style: none; }
.nav-links a { font-weight: 600; font-size: 0.95rem; color: inherit; text-decoration: none; padding: 0.25em 0; position: relative; }
.nav-links a:hover { color: var(--color-brand); }
.dark-mode .nav-links a:hover { color: var(--color-accent); }
.nav-links a[aria-current="page"] { color: var(--color-brand); }
.dark-mode .nav-links a[aria-current="page"] { color: var(--color-accent); }
.nav-links a[aria-current="page"]::after { content: ''; position: absolute; bottom: -4px; left: 0; right: 0; height: 2px; background: currentColor; }

/* --- 页脚 --- */
.site-footer { padding: 3em 0; border-top: 1px solid var(--border-color); background-color: var(--color-paper); color: var(--color-text); }
.dark-mode.site-footer { background-color: var(--color-dark-bg); border-top-color: rgba(233, 232, 234, 0.15); color: var(--color-paper); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2em; }
.footer-col h4 { margin-bottom: 1em; font-size: 1rem; }
.footer-col ul { list-style: none; padding: 0; }
.footer-col li { margin-bottom: 0.5em; }
.footer-col a { opacity: 0.8; }
.footer-col a:hover { opacity: 1; }
.copyright { margin-top: 2em; font-size: 0.85rem; opacity: 0.6; text-align: center; }

/* --- 卡片 --- */
.card {
  background: #fff; border-radius: var(--radius-card); padding: 1.5em;
  box-shadow: var(--card-shadow); border: 1px solid var(--border-color);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 32px -12px rgba(25, 21, 35, 0.35); }
.dark-mode .card { background: #2A1D4F; border-color: rgba(233, 232, 234, 0.1); }

/* --- 表格 --- */
.spec-table { width: 100%; border-collapse: collapse; margin-bottom: 2em; }
.spec-table th, .spec-table td { text-align: left; padding: 0.75em 1em; border-bottom: 1px solid var(--border-color); }
.spec-table th { font-weight: 700; width: 40%; }
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: none; }

/* --- FAQ (Details/Summary) --- */
.faq-list { display: flex; flex-direction: column; gap: 1em; }
.faq-item details {
  background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius-card);
  padding: 1.25em; transition: box-shadow 0.2s ease;
}
.dark-mode .faq-item details { background: #2A1D4F; border-color: rgba(233, 232, 234, 0.1); }
.faq-item summary {
  font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center;
  font-size: 1.05rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 1.2em; font-weight: 400; transition: transform 0.2s; }
.faq-item details[open] summary::after { transform: rotate(45deg); }
.faq-item .answer { margin-top: 1em; line-height: 1.7; color: var(--color-text); }
.dark-mode .faq-item .answer { color: var(--color-paper); }

/* --- 时间轴 --- */
.timeline { position: relative; padding-left: 2em; border-left: 2px solid var(--border-color); }
.timeline-item { position: relative; margin-bottom: 2.5em; }
.timeline-item::before {
  content: ''; position: absolute; left: -2.55em; top: 0.3em; width: 12px; height: 12px;
  border-radius: 50%; background: var(--color-brand); border: 2px solid var(--color-paper);
}
.dark-mode .timeline-item::before { background: var(--color-accent); border-color: var(--color-dark-bg); }
.timeline-time { font-size: 0.85rem; font-weight: 700; color: var(--color-brand); margin-bottom: 0.25em; }
.dark-mode .timeline-time { color: var(--color-accent); }

/* --- 编号徽标 (Steps) --- */
.step-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--gap); }
.step-card { background: #fff; padding: 1.5em; border-radius: var(--radius-card); border: 1px solid var(--border-color); position: relative; overflow: hidden; }
.dark-mode .step-card { background: #2A1D4F; border-color: rgba(233, 232, 234, 0.1); }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px; background: var(--color-accent); color: var(--color-dark-bg);
  font-weight: 800; font-size: 0.9rem; margin-bottom: 1em;
}

/* --- SVG 动效基础 --- */
.svg-panel { width: 100%; height: auto; overflow: visible; }
.svg-panel path, .svg-panel circle, .svg-panel rect { transition: all 0.3s ease; }
.svg-panel .draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
.svg-panel .float { animation: floatY 4s ease-in-out infinite; }
.svg-panel .pulse { animation: breathe 3s ease-in-out infinite; }
.svg-panel .slideIn { animation: slideInRight 5s ease-in-out infinite; }
.svg-panel .flowLine { animation: dashFlow 2s linear infinite; }

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes slideInRight {
  0%, 20% { transform: translateX(0); opacity: 0; }
  30%, 70% { transform: translateX(0); opacity: 1; }
  80%, 100% { transform: translateX(20px); opacity: 0; }
}
@keyframes dashFlow {
  to { stroke-dashoffset: -1; }
}

/* 节点点亮动画 */
@keyframes nodeGlow {
  0%, 100% { fill: var(--color-brand); opacity: 0.3; }
  50% { fill: var(--color-accent); opacity: 1; }
}
.node-glow-1 { animation: nodeGlow 4s ease-in-out infinite 0s; }
.node-glow-2 { animation: nodeGlow 4s ease-in-out infinite 0.5s; }
.node-glow-3 { animation: nodeGlow 4s ease-in-out infinite 1s; }
.node-glow-4 { animation: nodeGlow 4s ease-in-out infinite 1.5s; }
.node-glow-5 { animation: nodeGlow 4s ease-in-out infinite 2s; }

/* 减少动态效果 */
@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;
  }
  .svg-panel .draw, .svg-panel .float, .svg-panel .pulse, .svg-panel .slideIn, .svg-panel .flowLine,
  .node-glow-1, .node-glow-2, .node-glow-3, .node-glow-4, .node-glow-5 {
    animation: none !important;
    opacity: 1 !important;
    stroke-dashoffset: 0 !important;
  }
}

/* --- 响应式微调 --- */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; height: auto; padding: 1em 0; gap: 1em; }
  .nav-links { gap: 1em; flex-wrap: wrap; justify-content: center; }
  .grid-2 { grid-template-columns: 1fr; }
  .visual-col { order: -1; } /* 移动端视觉在前 */
  .text-col { padding: 0; }
  
  /* 防止 SVG 溢出 */
  svg { max-width: 100%; }
}

/* 全局防横向溢出修复 */
html, body { overflow-x: hidden; max-width: 100vw; }
.container { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); box-sizing: border-box; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: var(--gap); align-items: center; overflow: hidden; }
