/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计变量与主题上下文 */
:root {
  /* 色板 */
  --color-dark: #1B1231;
  --color-paper: #DBD4ED;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;

  /* 结构性 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;

  /* 默认纸面上下文 */
  --bg-color: var(--color-paper);
  --text-color: var(--color-text);
  --heading-color: var(--color-text);
  --link-color: var(--color-brand);
}

/* 深色面上下文覆盖 */
.bg-dark {
  --bg-color: var(--color-dark);
  --text-color: var(--color-paper);
  --heading-color: var(--color-paper);
  --link-color: var(--color-accent);
  --card-border: 2px solid var(--color-paper);
  --card-shadow: 4px 4px 0 var(--color-paper);
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text-color);
  background-color: var(--bg-color);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
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-color);
  transition: background-color 0.3s;
}

/* 标题系统 */
.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--link-color);
  margin-bottom: 0.75rem;
}
h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--heading-color);
  margin-bottom: 1.25rem;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--heading-color);
  margin-bottom: 1.5rem;
}
h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--heading-color);
  margin-bottom: 0.75rem;
  line-height: 1.3;
}
p {
  font-size: 1rem;
  line-height: 1.55;
  margin-bottom: 1rem;
  max-width: 38em;
}
.hl { color: var(--link-color); }

/* 页头与导航 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-color);
  border-bottom: 1px solid rgba(128,128,128,0.15);
  padding: 1rem 0;
  transition: background-color 0.3s;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.logo-wrap img { height: 32px; width: auto; }
.nav-list { display: flex; gap: 1.5rem; align-items: center; }
.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-color);
}
.nav-link[aria-current="page"] {
  font-weight: 700;
  color: var(--link-color);
}

/* 按钮系统 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 48px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s, opacity 0.2s;
}
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: none;
}
.btn-primary:hover { transform: translateY(-1px); opacity: 0.95; }
.btn-secondary {
  background: transparent;
  color: var(--text-color);
  border: 2px solid var(--text-color);
}
.btn-secondary:hover { background-color: rgba(128,128,128,0.1); }
.btn:focus-visible { outline: 3px solid var(--link-color); outline-offset: 2px; }

/* 卡片与网格 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}
.card {
  background-color: var(--bg-color);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  transition: transform 0.2s;
}
.card:hover { transform: translateY(-2px); }
.card-icon {
  width: 28px;
  height: 28px;
  stroke: var(--link-color);
  margin-bottom: 1rem;
}

/* 表格 */
.table-wrap {
  overflow-x: auto;
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 1rem;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px;
}
th, td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(128,128,128,0.2);
}
th { font-weight: 700; }
td:first-child { font-weight: 600; width: 35%; }

/* FAQ */
.faq-item {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  background-color: var(--bg-color);
}
.faq-summary {
  padding: 1.25rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-summary::-webkit-details-marker { display: none; }
.faq-summary::after {
  content: "+";
  font-size: 1.25rem;
  font-weight: 400;
  transition: transform 0.2s;
}
.faq-item[open] .faq-summary::after { transform: rotate(45deg); }
.faq-answer {
  padding: 0 1.25rem 1.25rem;
  line-height: 1.6;
}

/* SVG 基础与响应式 */
.svg-container {
  width: 100%;
  height: auto;
  max-width: 100%;
}
svg { width: 100%; height: auto; overflow: visible; }

/* SVG 动效方向：数据点沿路径流动 / 线条绘制 / 呼吸 */
.anim-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 4s ease-in-out infinite alternate;
}
.anim-dot-flow {
  animation: flowDot 6s linear infinite;
}
.anim-bubble-float {
  animation: floatBubble 5s ease-in-out infinite alternate;
}
.anim-input-dots {
  animation: breatheDots 2s ease-in-out infinite;
}

@keyframes drawLine {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes flowDot {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: 1; }
  50% { transform: translate(120px, -40px); }
  90% { opacity: 1; }
  100% { transform: translate(240px, 0); opacity: 0; }
}
@keyframes floatBubble {
  from { transform: translateY(0); }
  to { transform: translateY(-6px); }
}
@keyframes breatheDots {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* 减少动态效果支持 */
@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;
  }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .nav-list { gap: 1rem; }
  h1 { font-size: clamp(2rem, 8vw, 3.2rem); }
  .grid-alt { grid-template-columns: 1fr !important; }
}

/* 页脚 */
.site-footer {
  padding: 3rem 0;
  border-top: 1px solid rgba(128,128,128,0.2);
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-color);
  opacity: 0.85;
}
.footer-links { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 1rem; }
