/* =========================================
   SafeW 全站共享样式 & 设计 Token
   ========================================= */

/* 基础变量 */
:root {
  --bg-dark: #231334;
  --bg-paper: #E9E8EA;
  --text-main: #1C1523;
  --brand: #7D14EB;
  --accent: #EDD26E;
  
  --card-border: 2px solid var(--text-main);
  --card-shadow: 4px 4px 0 var(--text-main);
  --radius-card: 20px;
  --radius-btn: 12px;
  
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;
  
  --font-body: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --line-height: 1.75;
  
  --header-h: 64px;
  --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 重置与基础排版 */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg-paper);
  color: var(--text-main);
  line-height: var(--line-height);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* 容器与网格 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
  width: 100%;
}
.grid-auto {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}
.flex-center { display: flex; align-items: center; justify-content: center; }

/* 颜色覆盖机制（面与卡片的取色隔离） */
.dark-surface {
  --bg-surface: var(--bg-dark);
  --text-surface: var(--bg-paper);
  --brand-surface: var(--accent);
  --border-surface: rgba(233, 210, 110, 0.25);
  background: var(--bg-surface);
  color: var(--text-surface);
}
.light-card {
  --bg-surface: var(--bg-paper);
  --text-surface: var(--text-main);
  --brand-surface: var(--brand);
  --border-surface: var(--text-main);
  background: var(--bg-surface);
  color: var(--text-surface);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}

/* 排版系统 */
.kicker {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 0.75rem;
}
.dark-surface .kicker { color: var(--brand-surface); }
.hl { color: var(--brand); font-weight: 700; }
.dark-surface .hl { color: var(--brand-surface); }

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
  margin: 0 0 1rem;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 1.5rem;
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 0.75rem;
}
p { margin: 0 0 1rem; max-width: 38em; }
strong { font-weight: 600; }

/* 区块结构 */
.section {
  padding: var(--section-y) 0;
  position: relative;
}
.section + .section {
  border-top: 1px solid var(--border-surface);
}
.dark-surface + .section { border-top-color: rgba(233, 210, 110, 0.3); }

/* 导航与页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(233, 232, 234, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-base), background var(--transition-base);
}
.site-header.scrolled {
  border-bottom-color: var(--border-surface);
  background: rgba(233, 232, 234, 0.95);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.1rem;
}
.brand img { height: 32px; width: auto; }
nav ul { display: flex; gap: 1.5rem; align-items: center; }
nav a {
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 0;
  position: relative;
  transition: color var(--transition-base);
}
nav a:hover, nav a:focus-visible { color: var(--brand); }
nav a[aria-current="page"] { color: var(--brand); font-weight: 600; }

/* 按钮系统 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: 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 var(--transition-base), background var(--transition-base), box-shadow var(--transition-base);
  border: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: var(--bg-dark);
}
.btn-primary:hover, .btn-primary:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(237, 210, 110, 0.4);
}
.btn-secondary {
  background: transparent;
  color: var(--text-main);
  border: 2px solid var(--text-main);
}
.dark-surface .btn-secondary {
  color: var(--bg-paper);
  border-color: var(--bg-paper);
}
.btn-secondary:hover, .btn-secondary:focus-visible {
  background: rgba(28, 21, 35, 0.05);
  transform: translateY(-1px);
}
.btn:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}
.btn svg { width: 20px; height: 20px; }

/* 卡片与面板 */
.card-panel {
  border-radius: var(--radius-card);
  padding: var(--gap);
  position: relative;
}
.feature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: center;
}
.feature-row.reverse .text-col { order: 2; }
.feature-row.reverse .visual-col { order: 1; }

/* 表格与列表 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-surface);
}
.data-table th { font-weight: 600; color: var(--brand); }
.dark-surface .data-table th { color: var(--brand-surface); }
.list-disc { list-style: disc; padding-left: 1.25rem; }
.list-disc li { margin-bottom: 0.5rem; position: relative; }
.list-disc li::marker { color: var(--brand); }
.dark-surface .list-disc li::marker { color: var(--brand-surface); }

/* 步骤条 */
.steps-bar {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  counter-reset: step;
}
.step-item {
  flex: 1 1 0;
  min-width: 200px;
  padding: 1.25rem;
  border-radius: var(--radius-card);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  position: relative;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: var(--bg-dark);
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}
.dark-surface .step-num { background: var(--accent); color: var(--bg-dark); }

/* 资讯卡片 */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}
.news-card {
  padding: 1.5rem;
  border-radius: var(--radius-card);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.news-date {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand);
  letter-spacing: 0.05em;
}
.dark-surface .news-date { color: var(--brand-surface); }

/* FAQ 折叠面板 */
.faq-list { display: flex; flex-direction: column; gap: 1rem; }
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 1.25rem;
  transition: background var(--transition-base);
}
summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "";
  width: 12px;
  height: 12px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--transition-base);
  flex-shrink: 0;
}
details[open] summary::after { transform: rotate(45deg); }
details p { margin-top: 1rem; font-size: 0.95rem; color: var(--text-main); opacity: 0.9; }
.dark-surface details { border-color: var(--border-surface); box-shadow: none; }
.dark-surface details p { color: var(--text-surface); }

/* 页脚 */
.site-footer {
  padding: 3rem 0 2rem;
  border-top: 1px solid var(--border-surface);
  font-size: 0.9rem;
  color: var(--text-main);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
}
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.footer-links a:hover { color: var(--brand); }

/* SVG 动效基座 */
.svg-panel {
  width: 100%;
  height: auto;
  max-width: 100%;
  overflow: visible;
}
.svg-panel path, .svg-panel rect, .svg-panel circle, .svg-panel line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.anim-draw { animation: breathe-dash 6s ease-in-out infinite; }
.anim-float { animation: float-y 5s ease-in-out infinite; }
.anim-pulse { animation: pulse-opacity 4s ease-in-out infinite; }
.anim-slide { animation: slide-in 8s ease-in-out infinite; }

@keyframes breathe-dash {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}
@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes pulse-opacity {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
@keyframes slide-in {
  0%, 100% { transform: translateX(0); opacity: 0.7; }
  50% { transform: translateX(12px); opacity: 1; }
}

/* 响应式调整 */
@media (max-width: 768px) {
  .feature-row { grid-template-columns: 1fr; }
  .feature-row.reverse .text-col { order: 1; }
  .feature-row.reverse .visual-col { order: 2; }
  .steps-bar { flex-direction: column; }
  .step-item { min-width: auto; }
  nav ul { gap: 1rem; }
}

/* 无障碍：减少动态效果 */
@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;
  }
  .anim-draw, .anim-float, .anim-pulse, .anim-slide {
    animation: none !important;
    stroke-dashoffset: 0 !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* 焦点可见性增强 */
:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}
.dark-surface :focus-visible {
  outline-color: var(--accent);
}
