/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计 Token & 变量 --- */
:root {
  --color-dark: #140E25;
  --color-paper: #F7F5F3;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;
  
  --radius-card: 8px;
  --radius-btn: 6px;
  
  --card-border: 1px solid rgba(25, 21, 35, 0.16);
  --card-shadow: none;
  
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;
  
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", sans-serif;
  
  /* 取色映射（纸面默认） */
  --bg-surface: var(--color-paper);
  --text-primary: var(--color-text);
  --text-secondary: rgba(25, 21, 35, 0.7);
  --highlight: var(--color-brand);
  --link-color: var(--color-brand);
}

/* 深色面覆盖 */
.dark-surface {
  --bg-surface: var(--color-dark);
  --text-primary: var(--color-paper);
  --text-secondary: rgba(247, 245, 243, 0.8);
  --highlight: var(--color-accent);
  --link-color: var(--color-accent);
  --card-border: 1px solid rgba(247, 245, 243, 0.12);
}

/* 浅色卡片在深色面上恢复纸面取色 */
.surface-card {
  --bg-surface: var(--color-paper);
  --text-primary: var(--color-text);
  --text-secondary: rgba(25, 21, 35, 0.7);
  --highlight: var(--color-brand);
  --link-color: var(--color-brand);
  --card-border: 1px solid rgba(25, 21, 35, 0.16);
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-main);
  background: var(--bg-surface);
  color: var(--text-primary);
  line-height: 1.55;
  -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); overflow-x: hidden; }

/* 标题系统 */
.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--highlight);
  margin-bottom: 0.5em;
  position: relative;
  padding-left: 1.2em;
}
.section-label::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 0.6em; height: 2px;
  background: currentColor;
  transform: translateY(-50%);
}
h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: var(--gap);
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}
p { margin-bottom: 1em; color: var(--text-secondary); }
.hl { color: var(--highlight); font-weight: 700; }

/* 区块节奏 */
section { padding: var(--section-y) 0; border-bottom: 1px solid var(--card-border); }
section:last-of-type { border-bottom: none; }

/* 按钮系统 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  padding: 0.8em 1.6em;
  font-size: 1rem; font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s, border-color 0.2s;
  text-decoration: none;
}
.btn:focus-visible { outline: 3px solid var(--highlight); outline-offset: 2px; }
.btn-primary {
  background: var(--color-accent); color: var(--color-dark); border: 2px solid var(--color-accent);
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(0.95); }
.btn-secondary {
  background: transparent; color: var(--text-primary); border: 1px solid var(--text-primary);
}
.btn-secondary:hover { background: rgba(128,128,128,0.1); transform: translateY(-1px); }

/* 导航与页脚 */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(247, 245, 243, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--card-border);
}
.dark-surface .site-header { background: rgba(20, 14, 37, 0.92); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.nav-list { display: flex; gap: var(--gap); }
.nav-link { color: var(--text-primary); font-weight: 500; padding: 0.4em 0; border-bottom: 2px solid transparent; }
.nav-link[aria-current="page"], .nav-link:hover { color: var(--highlight); border-bottom-color: var(--highlight); }
.footer {
  background: var(--bg-surface);
  padding: var(--section-y) 0;
  border-top: 1px solid var(--card-border);
  margin-top: var(--section-y);
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); }
.footer-col h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.8em; color: var(--highlight); }
.footer-col a { display: block; margin-bottom: 0.5em; color: var(--text-secondary); font-size: 0.9rem; }
.footer-col a:hover { color: var(--highlight); }
.copyright { text-align: center; margin-top: 2rem; font-size: 0.85rem; color: var(--text-secondary); }

/* 卡片与面板 */
.card {
  background: var(--bg-surface);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  box-shadow: var(--card-shadow);
}
.panel {
  background: var(--color-dark);
  border-radius: 16px;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  position: relative;
  overflow: hidden;
}
.surface-card.panel { background: var(--color-paper); border: var(--card-border); }

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; margin: var(--gap) 0; }
.data-table th, .data-table td { padding: 0.8em 1em; text-align: left; border-bottom: 1px solid var(--card-border); }
.data-table th { font-weight: 700; color: var(--text-primary); background: rgba(128,128,128,0.05); }
.data-table td { color: var(--text-secondary); }

/* FAQ */
.faq-item { margin-bottom: var(--gap); border: var(--card-border); border-radius: var(--radius-card); overflow: hidden; }
.faq-item summary {
  padding: 1em 1.2em; cursor: pointer; font-weight: 600; color: var(--text-primary);
  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.2em; transition: transform 0.2s; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-answer { padding: 0 1.2em 1em; color: var(--text-secondary); line-height: 1.6; }

/* 新闻卡片 */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--gap); }
.news-card { display: flex; flex-direction: column; height: 100%; }
.news-card time { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.5em; display: block; }
.news-card h3 { font-size: 1.1rem; margin-bottom: 0.5em; }
.news-card p { font-size: 0.95rem; flex-grow: 1; }

/* 流程条 */
.flow-bar { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; margin: var(--gap) 0; }
.flow-node { flex: 1 1 180px; padding: 1em; background: rgba(128,128,128,0.08); border-radius: var(--radius-card); text-align: center; font-weight: 600; }
.flow-arrow { font-size: 1.5em; color: var(--highlight); }

/* 特性列表 */
.feature-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--gap); }
.feature-item { padding: 1.2em; background: rgba(128,128,128,0.05); border-radius: var(--radius-card); }
.feature-item dt { font-weight: 700; color: var(--text-primary); margin-bottom: 0.4em; display: flex; align-items: center; gap: 0.5em; }
.feature-item dd { color: var(--text-secondary); margin: 0; }

/* SVG 动效基础类 */
svg.svga { width: 100%; height: auto; display: block; }
.anim-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawStroke 1.8s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.anim-breathe { animation: breathe 4s ease-in-out infinite; }
.anim-float { animation: floatY 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-slide { animation: slideInX 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.anim-flow { stroke-dasharray: 6 6; animation: flowDash 2s linear infinite; }

@keyframes drawStroke { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes breathe { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes slideInX { from { transform: translateX(40px); opacity: 0.8; } to { transform: translateX(0); opacity: 1; } }
@keyframes flowDash { to { stroke-dashoffset: -24; } }

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
  .anim-draw, .anim-breathe, .anim-float, .anim-slide, .anim-flow { animation: none !important; }
  .anim-draw { stroke-dashoffset: 0 !important; }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; height: auto; padding: 1rem 0; gap: 1rem; }
  .hero-layout { flex-direction: column; }
  .hero-text { margin-bottom: 2rem; }
  .feature-list, .news-grid { grid-template-columns: 1fr; }
}
