/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计变量 */
:root {
  --color-dark: #1B1231;
  --color-paper: #F4F3F7;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 960px;
  --font-main: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --lh-base: 1.65;
}

/* 主题覆盖层 */
.theme-paper {
  --bg: var(--color-paper);
  --fg: var(--color-text);
  --ui-accent: var(--color-brand);
  --hl: var(--color-brand);
}
.theme-dark {
  --bg: var(--color-dark);
  --fg: var(--color-paper);
  --ui-accent: var(--color-accent);
  --hl: var(--color-accent);
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: var(--lh-base);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* 容器 */
.container {
  width: min(100% - 2rem, var(--content-max));
  margin-inline: auto;
}

/* 区块通用 */
.section {
  padding-block: var(--section-y);
  background: var(--bg);
  color: var(--fg);
}
.section + .section { border-top: 1px solid color-mix(in srgb, var(--fg) 12%, transparent); }
.section-header { margin-bottom: var(--gap); }
.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ui-accent);
  margin-bottom: 0.6rem;
}
.breadcrumb::before { content: ""; width: 14px; height: 2px; background: currentColor; border-radius: 2px; }
h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
  margin-bottom: 0.8rem;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 0.6rem;
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.5rem;
}
p { margin-bottom: 1rem; max-width: 38em; }
.hl { color: var(--hl); font-weight: 600; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  text-align: center;
}
.btn:focus-visible { outline: 3px solid var(--ui-accent); outline-offset: 3px; }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border: 2px solid var(--color-accent);
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-secondary {
  background: transparent;
  color: var(--fg);
  border: 2px solid var(--fg);
}
.btn-secondary:hover { background: color-mix(in srgb, var(--fg) 10%, transparent); transform: translateY(-2px); }
.btn-group { display: flex; flex-wrap: wrap; gap: 12px; margin: 1.5rem 0; }
.fact-line { font-size: 0.85rem; opacity: 0.85; margin-top: 0.5rem; }

/* 卡片与面板 */
.card {
  background: var(--bg);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  transition: transform 0.2s ease;
}
.panel {
  background: var(--bg);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 2rem;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* 网格布局 */
.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); }
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .split-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: center; }
  .split-row.reverse { direction: rtl; }
  .split-row.reverse > * { direction: ltr; }
}

/* 表格 */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; }
table { width: 100%; border-collapse: collapse; min-width: 480px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid color-mix(in srgb, var(--fg) 15%, transparent); }
th { font-weight: 600; }
td:first-child { font-weight: 600; }

/* 步骤徽标 */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 8px;
  margin-right: 8px;
  flex-shrink: 0;
}
ol.steps { counter-reset: step; }
ol.steps li { counter-increment: step; display: flex; align-items: flex-start; gap: 12px; margin-bottom: 1rem; }
ol.steps li::before { content: counter(step); display: none; } /* 使用自定义徽标替代 */

/* FAQ */
details {
  border: var(--card-border);
  border-radius: 12px;
  margin-bottom: 12px;
  background: var(--bg);
  overflow: hidden;
}
summary {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  position: relative;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  font-weight: 400;
  transition: transform 0.2s;
}
details[open] summary::after { transform: rotate(45deg); }
details > div { padding: 0 20px 16px; }

/* 新闻卡片 */
.news-card {
  background: var(--bg);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  height: 100%;
}
.news-card time { font-size: 0.8rem; opacity: 0.7; margin-bottom: 0.5rem; display: block; }
.news-card h3 { font-size: 1.1rem; }
.news-card p { font-size: 0.95rem; opacity: 0.9; margin-bottom: 0; }

/* 页头页脚 */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid color-mix(in srgb, var(--fg) 10%, transparent);
  backdrop-filter: blur(8px);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.nav-list { display: flex; gap: 24px; align-items: center; }
.nav-link { font-weight: 500; padding: 4px 0; position: relative; }
.nav-link[aria-current="page"] { color: var(--ui-accent); font-weight: 600; }
.nav-link[aria-current="page"]::after {
  content: ""; position: absolute; bottom: -4px; left: 0; width: 100%; height: 2px; background: var(--ui-accent); border-radius: 2px;
}
.site-footer {
  padding: 48px 0 32px;
  border-top: 1px solid color-mix(in srgb, var(--fg) 10%, transparent);
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.85;
}
.footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 16px; }
.footer-links a:hover { color: var(--ui-accent); }

/* SVG 动效核心类 */
.svg-canvas { width: 100%; height: auto; max-width: 100%; }
.svg-path { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
.anim-draw { animation: drawLine 6s ease-in-out infinite alternate; }
.anim-float { animation: floatSoft 5s ease-in-out infinite alternate; }
.anim-twinkle { animation: twinkle 4s ease-in-out infinite alternate; }
.anim-breathe { animation: breathe 3.5s ease-in-out infinite alternate; }
.anim-slide-in { animation: slideIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }

@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes floatSoft {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}
@keyframes twinkle {
  0% { opacity: 0.3; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1.1); }
}
@keyframes breathe {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}
@keyframes slideIn {
  0% { transform: translateX(20px); opacity: 0; }
  100% { transform: translateX(0); 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-name: none !important;
  }
  .anim-draw, .anim-float, .anim-twinkle, .anim-breathe, .anim-slide-in {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* 响应式微调 */
@media (max-width: 640px) {
  .btn-group { flex-direction: column; }
  .btn { width: 100%; }
  .nav-list { gap: 16px; }
  .split-row { grid-template-columns: 1fr !important; direction: ltr !important; }
  .panel { aspect-ratio: 16/9; }
}
