/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  --color-dark: #17203F;
  --color-paper: #FCFCFD;
  --color-text: #151823;
  --color-brand: #1441EB;
  --color-accent: #6EEDBD;
  
  --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: 1120px;
  
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --line-height-base: 1.75;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background-color: var(--color-paper);
  color: var(--color-text);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
ul, ol { list-style: none; }

/* --- 容器与布局 --- */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding: var(--section-y) 0;
  position: relative;
}
.bg-dark { background-color: var(--color-dark); color: var(--color-paper); }
.bg-paper { background-color: var(--color-paper); color: var(--color-text); }

/* 取色覆盖逻辑 */
.bg-dark .text-main { color: var(--color-paper); }
.bg-dark .text-sub { color: rgba(252, 252, 253, 0.85); }
.bg-dark .brand { color: var(--color-accent); }
.bg-paper .text-main { color: var(--color-text); }
.bg-paper .text-sub { color: var(--color-text); }
.bg-paper .brand { color: var(--color-brand); }

/* --- 标题与眉标 --- */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}
.bg-dark .badge { color: var(--color-accent); }
.bg-paper .badge { color: var(--color-brand); }

h1, h2, h3, h4 { line-height: 1.15; font-weight: 500; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); margin-bottom: 1.2rem; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.5rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.8rem; }
.hl { font-weight: 700; }
.bg-dark .hl { color: var(--color-accent); }
.bg-paper .hl { color: var(--color-brand); }

p { margin-bottom: 1rem; max-width: 38em; }
.text-center { text-align: center; }
.mt-lg { margin-top: 2rem; }
.mb-md { margin-bottom: 1.5rem; }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  height: 52px;
  padding: 0 1.5rem;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  border: none;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary { background-color: var(--color-accent); color: var(--color-dark); }
.btn-primary:hover { background-color: #5ce3aa; box-shadow: 0 6px 16px rgba(110, 237, 189, 0.25); }
.btn-secondary { background: transparent; border: 1px solid currentColor; }
.bg-dark .btn-secondary { color: var(--color-paper); border-color: rgba(252, 252, 253, 0.5); }
.bg-paper .btn-secondary { color: var(--color-text); border-color: rgba(21, 24, 35, 0.3); }
.btn-secondary:hover { background-color: rgba(128, 128, 128, 0.08); }

/* --- 卡片与面板 --- */
.card {
  background: var(--color-paper);
  border-radius: var(--radius-card);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover { box-shadow: 0 14px 32px -12px rgba(21, 24, 35, 0.35); transform: translateY(-2px); }
.bg-dark .card { background: rgba(252, 252, 253, 0.06); backdrop-filter: blur(8px); }

.panel {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: 2rem;
  box-shadow: var(--card-shadow);
}
.bg-paper .panel { background: var(--color-dark); }
.bg-dark .panel { background: rgba(21, 24, 35, 0.6); border: 1px solid rgba(252, 252, 253, 0.1); }

/* --- 表格 --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
th, td { padding: 0.8rem 1rem; text-align: left; border-bottom: 1px solid rgba(128, 128, 128, 0.2); }
th { font-weight: 600; opacity: 0.9; }
td:first-child { font-weight: 500; }

/* --- 定义列表 (功能矩阵) --- */
.dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.dl-item { padding: 1.2rem; border-radius: var(--radius-card); background: rgba(128, 128, 128, 0.05); }
.dl-item dt { font-weight: 600; margin-bottom: 0.4rem; display: flex; align-items: center; gap: 0.5rem; }
.dl-item dd { font-size: 0.95rem; opacity: 0.9; line-height: 1.6; }

/* --- 流程条 --- */
.flow-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: center; margin: 2rem 0; }
.flow-step { flex: 1; min-width: 140px; text-align: center; padding: 1rem; background: rgba(255,255,255,0.05); border-radius: var(--radius-card); position: relative; }
.flow-arrow { font-size: 1.5rem; opacity: 0.6; }

/* --- 步骤徽标 --- */
.step-list { counter-reset: step; display: grid; gap: 1.5rem; }
.step-item { display: flex; gap: 1rem; align-items: flex-start; }
.step-num {
  flex-shrink: 0; width: 36px; height: 36px;
  background: var(--color-accent); color: var(--color-dark);
  border-radius: 6px; display: grid; place-items: center;
  font-weight: 700; font-size: 0.9rem;
}

/* --- FAQ (Details/Summary) --- */
.faq-list { display: grid; gap: 0.8rem; }
details {
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-card);
  padding: 1rem 1.2rem;
  transition: background 0.2s;
}
details[open] { background: rgba(255,255,255,0.08); }
summary {
  cursor: pointer; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-weight: 400; opacity: 0.7; }
details[open] summary::after { content: "−"; }
details p { margin-top: 0.8rem; font-size: 0.95rem; line-height: 1.7; opacity: 0.9; }

/* --- 新闻卡片 --- */
.news-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; }
.news-card { display: flex; flex-direction: column; height: 100%; }
.news-meta { font-size: 0.85rem; opacity: 0.7; margin-bottom: 0.5rem; }
.news-title { font-weight: 600; margin-bottom: 0.6rem; line-height: 1.4; }
.news-excerpt { font-size: 0.9rem; opacity: 0.85; flex-grow: 1; }

/* --- 页头与页脚 --- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(252, 252, 253, 0.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(21, 24, 35, 0.08);
}
.bg-dark .site-header { background: rgba(23, 32, 63, 0.95); border-bottom-color: rgba(252, 252, 253, 0.1); }
.header-inner { display: flex; justify-content: space-between; align-items: center; height: 64px; }
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.1rem; }
.brand img { height: 28px; width: auto; }
nav ul { display: flex; gap: 1.5rem; }
nav a { font-size: 0.95rem; font-weight: 500; padding: 0.4rem 0; }
nav a:hover, nav a[aria-current="page"] { color: var(--color-brand); }
.bg-dark nav a { color: var(--color-paper); }
.bg-dark nav a:hover, .bg-dark nav a[aria-current="page"] { color: var(--color-accent); }

.site-footer { padding: 3rem 0; border-top: 1px solid rgba(128, 128, 128, 0.2); margin-top: 2rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; }
.footer-col h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 1rem; opacity: 0.8; }
.footer-col a { display: block; margin-bottom: 0.6rem; font-size: 0.9rem; opacity: 0.8; }
.footer-col a:hover { opacity: 1; }
.copyright { text-align: center; margin-top: 2rem; font-size: 0.85rem; opacity: 0.6; }

/* --- SVG 响应式控制 --- */
.svg-responsive { width: 100%; height: auto; display: block; }
.svg-panel { width: 100%; max-width: 480px; margin: 0 auto; }

/* --- SVG 动效 (网格节点依次点亮) --- */
.grid-node {
  animation: nodePulse 5s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}
.grid-node:nth-child(odd) { animation-delay: 0.8s; }
.grid-node:nth-child(3n) { animation-delay: 1.6s; }
.grid-node:nth-child(4n+1) { animation-delay: 2.4s; }
.grid-node:nth-child(5n) { animation-delay: 3.2s; }

@keyframes nodePulse {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

.stroke-flow {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: dashMove 4s linear infinite;
}
@keyframes dashMove {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

.bubble-float {
  animation: floatY 6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* --- 减少动态效果支持 --- */
@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;
  }
  .grid-node, .stroke-flow, .bubble-float { animation: none !important; opacity: 0.6; transform: none; }
}

/* --- 响应式适配 --- */
@media (max-width: 768px) {
  .flow-row { flex-direction: column; }
  .flow-arrow { transform: rotate(90deg); margin: 0.5rem 0; }
  nav ul { gap: 1rem; }
  h1 { font-size: clamp(2.2rem, 8vw, 3.2rem); }
  dl-grid { grid-template-columns: 1fr; }
}
