/* SafeW 全局样式与动效 */
:root {
  /* 色板 */
  --color-dark: #271334;
  --color-paper: #E9E8EA;
  --color-text: #1D1523;
  --color-brand: #8A13DD;
  --color-accent: #9EED6E;
  --color-surface-light: #F3F2F4;

  /* 结构 Token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --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: 1120px;

  /* 排版 */
  --font-main: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img, svg { display: block; max-width: 100%; }

/* 容器与区块 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section {
  padding-block: var(--section-y);
  position: relative;
}

.surface-dark {
  background: var(--color-dark);
  color: var(--color-paper);
}
.surface-dark a { color: var(--color-accent); }
.surface-dark .hl { color: var(--color-accent); }
.surface-dark .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}
.surface-dark .btn-secondary:hover { background: rgba(233, 232, 234, 0.1); }

.surface-paper {
  background: var(--color-paper);
  color: var(--color-text);
}
.surface-paper a { color: var(--color-brand); }
.surface-paper .hl { color: var(--color-brand); }

.surface-light {
  background: var(--color-surface-light);
  color: var(--color-text);
}
.surface-light a { color: var(--color-brand); }
.surface-light .hl { color: var(--color-brand); }

/* 标题系统 */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}
.surface-dark .badge { color: var(--color-accent); }
.surface-paper .badge, .surface-light .badge { color: var(--color-brand); }

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 1.5rem;
}

h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

p { margin-bottom: 1rem; max-width: 38em; }
.text-center { text-align: center; }
.w-full { width: 100%; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  border: 2px solid transparent;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border-color: var(--color-accent);
}
.btn-primary:hover { background: #8dd95f; border-color: #8dd95f; }

.btn-secondary {
  background: transparent;
  border-color: var(--color-text);
  color: var(--color-text);
}
.btn-secondary:hover { background: rgba(29, 21, 35, 0.06); }

/* 卡片与面板 */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 24px;
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-2px); }
.surface-dark .card { background: var(--color-paper); color: var(--color-text); }

.panel {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: 32px;
  position: relative;
  overflow: hidden;
}
.surface-paper .panel { background: var(--color-dark); color: var(--color-paper); }

/* 网格布局 */
.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); }
.grid-alt { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: center; }
@media (max-width: 768px) {
  .grid-alt { grid-template-columns: 1fr; }
  .grid-alt.reverse { direction: rtl; }
  .grid-alt.reverse > * { direction: ltr; }
}

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  table-layout: fixed;
}
.data-table th, .data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(29, 21, 35, 0.1);
  text-align: left;
  overflow-wrap: break-word;
}
.data-table th { font-weight: 600; }
.surface-dark .data-table th, .surface-dark .data-table td { border-color: rgba(233, 232, 234, 0.15); }

/* 步骤条 */
.steps { display: flex; flex-wrap: wrap; gap: var(--gap); counter-reset: step; }
.step-item {
  flex: 1 1 200px;
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 20px;
  position: relative;
  counter-increment: step;
}
.step-item::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  top: -12px; left: 16px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 8px;
}
.surface-dark .step-item { background: var(--color-paper); color: var(--color-text); }

/* FAQ */
.faq details {
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  margin-bottom: 12px;
  background: var(--color-paper);
  color: var(--color-text);
}
.surface-dark .faq details { background: rgba(233, 232, 234, 0.05); border-color: rgba(233, 232, 234, 0.2); box-shadow: none; }
.faq summary {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  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.2rem; transition: transform 0.2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq div { padding: 0 20px 16px; line-height: 1.7; }

/* 新闻卡片 */
.news-card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.surface-dark .news-card { background: rgba(233, 232, 234, 0.08); border-color: rgba(233, 232, 234, 0.15); box-shadow: none; }
.news-meta { font-size: 0.85rem; opacity: 0.8; }

/* 页头页脚 */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(233, 232, 234, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(29, 21, 35, 0.08);
}
.surface-dark .header { background: rgba(39, 19, 52, 0.95); border-color: rgba(233, 232, 234, 0.1); }
.nav-bar {
  display: flex; justify-content: space-between; align-items: center;
  height: 64px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.logo img { height: 28px; width: auto; }
.nav-links { display: flex; gap: 24px; }
.nav-links a { font-weight: 500; font-size: 0.95rem; transition: opacity 0.2s; color: var(--color-text); }
.nav-links a:hover, .nav-links a[aria-current="page"] { opacity: 0.85; }
.surface-dark .nav-links a { color: var(--color-paper); }
.footer {
  padding: 48px 0;
  border-top: 1px solid rgba(29, 21, 35, 0.1);
  margin-top: auto;
}
.surface-dark .footer { border-color: rgba(233, 232, 234, 0.1); }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px; }
.footer-col h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 12px; opacity: 0.8; }
.footer-col a { display: block; padding: 4px 0; font-size: 0.9rem; opacity: 0.85; }
.footer-col a:hover { opacity: 1; }

/* SVG 基础 */
.svg-icon { width: 24px; height: 24px; stroke: currentColor; stroke-width: 1.8; fill: none; }
.svg-panel { width: 100%; height: auto; max-width: 480px; }

/* SVG 动效关键帧 */
@keyframes float-layer-1 {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes float-layer-2 {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes draw-path {
  0% { stroke-dashoffset: 1; }
  40%, 60% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
@keyframes breathe-dots {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}
@keyframes slide-up {
  0% { transform: translateY(16px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes flow-line {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}

/* 动效类 */
.anim-float-1 { animation: float-layer-1 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-float-2 { animation: float-layer-2 7s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-draw { animation: draw-path 4s ease-in-out infinite; }
.anim-breathe { animation: breathe-dots 2.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-breathe-delay { animation: breathe-dots 2.5s ease-in-out infinite 0.8s; transform-box: fill-box; transform-origin: center; }
.anim-slide { animation: slide-up 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.anim-flow { animation: flow-line 3s linear infinite; }

/* 减少动态效果 */
@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;
  }
}
