/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计变量 */
:root {
  /* 色板 */
  --color-surface-dark: #17203F;
  --color-paper: #FCFCFD;
  --color-text: #151823;
  --color-brand: #1441EB;
  --color-accent: #6EEDBD;
  --color-bg-alt: #F3F4F6;

  /* 结构 Token */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(21,24,35,0.3);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;
  --body-line-height: 1.75;
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;

  /* 上下文取色变量（默认浅色纸面） */
  --text-primary: var(--color-text);
  --text-secondary: var(--color-text);
  --link-color: var(--color-brand);
  --accent-color: var(--color-brand);
  --bg-section: var(--color-paper);
  --bg-alt-section: var(--color-bg-alt);
}

/* 深色面覆盖 */
.surface-dark {
  --text-primary: var(--color-paper);
  --text-secondary: rgba(252,252,253,0.85);
  --link-color: var(--color-accent);
  --accent-color: var(--color-accent);
  --bg-section: var(--color-surface-dark);
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: var(--body-line-height);
  color: var(--text-primary);
  background-color: var(--bg-section);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--link-color); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.85; }
ul, ol { list-style: none; }

/* 容器与区块 */
.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);
  background-color: var(--bg-section);
}
.section-alt { background-color: var(--bg-alt-section); }
.section-dark { background-color: var(--color-surface-dark); }

/* 标题系统 */
.meter {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-color);
  margin-bottom: 0.75rem;
  position: relative;
  padding-left: 1.2em;
}
.meter::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 0.6em;
  height: 2px;
  background-color: var(--accent-color);
}
h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}
h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}
.hl { color: var(--accent-color); }

/* 按钮系统 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 52px;
  padding: 0 1.5em;
  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, background-color 0.2s ease;
}
.btn:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
}
.btn-primary {
  background-color: var(--accent-color);
  color: var(--color-surface-dark);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(110,237,189,0.25);
}
.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--text-primary);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: rgba(110,237,189,0.05);
}
.surface-dark .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}

/* 卡片与网格 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}
.card {
  background: var(--color-paper);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  border: var(--card-border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.surface-dark .card {
  background: var(--color-paper);
  color: var(--color-text);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px -12px rgba(21,24,35,0.35);
}
.card-header {
  display: flex;
  align-items: center;
  gap: 0.75em;
  margin-bottom: 0.75rem;
}
.card-icon {
  width: 28px;
  height: 28px;
  stroke: var(--accent-color);
  fill: none;
  stroke-width: 1.5;
  flex-shrink: 0;
}

/* 表格 */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.spec-table th, .spec-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(21,24,35,0.08);
  text-align: left;
}
.spec-table th {
  font-weight: 600;
  width: 40%;
}
.surface-dark .spec-table th,
.surface-dark .spec-table td {
  border-color: rgba(252,252,253,0.1);
  color: var(--color-paper);
}

/* FAQ */
.faq-item {
  border-bottom: 1px solid rgba(21,24,35,0.1);
  margin-bottom: 0.5rem;
}
.surface-dark .faq-item { border-color: rgba(252,252,253,0.1); }
details summary {
  padding: 1rem 0;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
details summary::-webkit-details-marker { display: none; }
details summary::after {
  content: '+';
  font-weight: 400;
  font-size: 1.2rem;
  transition: transform 0.2s;
}
details[open] summary::after { transform: rotate(45deg); }
details p {
  padding-bottom: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
.surface-dark details p { color: rgba(252,252,253,0.85); }

/* 流程条 */
.flow-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.flow-node {
  flex: 1;
  min-width: 0;
  background: var(--color-paper);
  padding: 1rem;
  border-radius: var(--radius-card);
  text-align: center;
  font-weight: 500;
  box-shadow: var(--card-shadow);
}
.surface-dark .flow-node { background: rgba(252,252,253,0.05); color: var(--color-paper); }
.flow-arrow {
  width: 24px;
  height: 24px;
  stroke: var(--accent-color);
  flex-shrink: 0;
}

/* 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252,252,253,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(21,24,35,0.06);
}
.surface-dark .site-header { background: rgba(23,32,63,0.95); border-color: rgba(252,252,253,0.08); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}
.brand img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.nav-link:hover { color: var(--accent-color); }
.nav-link[aria-current="page"] { color: var(--accent-color); }

/* 修复深色页头导航链接对比度 */
.surface-dark .brand span,
.surface-dark .nav-link {
  color: #FCFCFD !important;
}

/* 修复中文版页面横向溢出：限制 SVG 面板和场景网格在窄屏下的宽度 */
.svg-panel {
  max-width: 100%;
  overflow: hidden;
}
.scene-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.site-footer {
  padding: 2rem 0;
  border-top: 1px solid rgba(21,24,35,0.06);
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.surface-dark .site-footer { border-color: rgba(252,252,253,0.08); }
.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* =========================================
   SVG 动效系统
   ========================================= */
.svg-panel {
  width: 100%;
  height: auto;
  max-width: 640px;
  margin: 0 auto;
}
.anim-flow-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: flowDash 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.anim-dot-move {
  animation: dotFloat 6s ease-in-out infinite alternate;
}
.anim-breathe {
  animation: breathe 3s ease-in-out infinite;
}
.anim-slide-up {
  animation: slideUp 5s ease-in-out infinite;
}
.anim-pulse-ring {
  animation: pulseRing 4s ease-out infinite;
}

@keyframes flowDash {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
@keyframes dotFloat {
  0% { transform: translateX(0) translateY(0); }
  100% { transform: translateX(12px) translateY(-6px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes slideUp {
  0%, 100% { transform: translateY(0); opacity: 1; }
  10% { transform: translateY(-4px); opacity: 0.8; }
}
@keyframes pulseRing {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.05); opacity: 0.4; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

/* 响应式与无障碍 */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .flow-bar { flex-direction: column; }
  .flow-arrow { transform: rotate(90deg); margin: 0.5rem 0; }
  h1 { font-size: clamp(2rem, 8vw, 3.5rem); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
