/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量与色板 --- */
:root {
  --color-deep: #231334;
  --color-paper: #F5F3F7;
  --color-text: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;
  
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: none;
  
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;
  
  --font-main: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* 默认取色（纸面模式） */
  --bg-surface: var(--color-paper);
  --text-primary: var(--color-text);
  --text-secondary: rgba(28, 21, 35, 0.7);
  --brand-color: var(--color-brand);
  --accent-color: var(--color-accent);
  --surface-hover: rgba(28, 21, 35, 0.04);
}

/* 深色面覆盖 */
.theme-dark {
  --bg-surface: var(--color-deep);
  --text-primary: var(--color-paper);
  --text-secondary: rgba(245, 243, 247, 0.8);
  --brand-color: var(--color-accent);
  --accent-color: var(--color-accent);
  --surface-hover: rgba(245, 243, 247, 0.08);
}

/* 浅色纸面变体（用于交替节奏） */
.theme-paper-alt {
  --bg-surface: #ECEAF0;
  --text-primary: var(--color-text);
  --text-secondary: rgba(28, 21, 35, 0.65);
  --brand-color: var(--color-brand);
  --accent-color: var(--color-accent);
  --surface-hover: rgba(28, 21, 35, 0.03);
}

/* 卡片内层容器（在深色面上使用时恢复纸面取色） */
.card-light {
  --bg-surface: var(--color-paper);
  --text-primary: var(--color-text);
  --text-secondary: rgba(28, 21, 35, 0.7);
  --brand-color: var(--color-brand);
  --accent-color: var(--color-accent);
  --surface-hover: transparent;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-primary);
  background-color: var(--bg-surface);
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--brand-color); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }
ul, ol { list-style: none; }

/* 区块容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
section {
  padding: var(--section-y) 0;
  background-color: var(--bg-surface);
  position: relative;
}

/* 标题系统 */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--brand-color);
  margin-bottom: 12px;
  text-transform: uppercase;
}
.section-label::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 2px;
  background-color: currentColor;
  border-radius: 2px;
}
h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 32px;
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 12px;
}
p { margin-bottom: 16px; max-width: 38em; }
.hl { color: var(--brand-color); font-weight: 600; }
.theme-dark .hl { color: var(--accent-color); }

/* --- 组件：按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 28px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s, border-color 0.2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 3px solid var(--brand-color);
  outline-offset: 2px;
}
.btn-primary {
  background-color: var(--accent-color);
  color: var(--color-deep);
  border: 2px solid transparent;
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(0.95); }
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--text-primary);
}
.btn-secondary:hover { background-color: var(--surface-hover); }
.theme-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }

/* --- 组件：卡片与面板 --- */
.panel {
  background-color: var(--bg-surface);
  border-radius: var(--radius-card);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  transition: background-color 0.3s;
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }

/* --- 组件：表格 --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--surface-hover);
}
.data-table th { font-weight: 600; color: var(--text-primary); }
.data-table td { color: var(--text-secondary); }
.theme-dark .data-table th, .theme-dark .data-table td { border-bottom-color: rgba(245,243,247,0.1); }

/* --- 组件：FAQ --- */
.faq-item {
  border-bottom: 1px solid var(--surface-hover);
  margin-bottom: 8px;
}
.faq-item summary {
  padding: 16px 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 32px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  transition: transform 0.2s;
}
.faq-item[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq-item p { margin-top: 8px; font-size: 0.95rem; color: var(--text-secondary); }

/* --- 组件：步骤条 --- */
.step-list { display: flex; flex-wrap: wrap; gap: 24px; counter-reset: step; }
.step-item {
  flex: 1 1 200px;
  position: relative;
  padding-left: 48px;
}
.step-item::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  background-color: var(--accent-color);
  color: var(--color-deep);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

/* --- 组件：场景标签 --- */
.tag {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 6px;
  background-color: var(--surface-hover);
  color: var(--brand-color);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--surface-hover);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo img { height: 32px; width: auto; }
.nav-list { display: flex; gap: 24px; align-items: center; }
.nav-link { font-weight: 500; font-size: 0.95rem; }
.nav-link[aria-current="page"] { color: var(--brand-color); }
.site-footer {
  padding: 48px 0;
  border-top: 1px solid var(--surface-hover);
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 16px; }

/* --- SVG 动效核心规则 --- */
.svg-visual { width: 100%; height: auto; overflow: visible; }
.anim-star { animation: twinkle 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-line { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawPath 8s ease-in-out infinite; }
.anim-bubble { animation: float 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-input { animation: breathe 3s ease-in-out infinite; }

@keyframes twinkle {
  0%, 100% { opacity: 0.4; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.05); }
}
@keyframes drawPath {
  0% { stroke-dashoffset: 1; }
  40% { stroke-dashoffset: 0; }
  60% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* --- 响应式与无障碍 --- */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; height: auto; padding: 12px 0; gap: 12px; }
  .nav-list { gap: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .step-list { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .anim-star, .anim-line, .anim-bubble, .anim-input { animation: none; opacity: 1; transform: none; }
}
