/* =========================================
   SafeW 全站共享样式
   设计系统 / 排版 / 组件 / SVG动效
   ========================================= */

:root {
  /* 色板 */
  --color-deep: #271334;
  --color-paper: #E9E8EA;
  --color-body: #1D1523;
  --color-brand: #8A13DD;
  --color-accent: #9EED6E;
  
  /* 卡片微差底色（不另发明灰色，仅在同色系内微调） */
  --bg-card-paper: #DEDCDF;
  --bg-card-dark: rgba(255, 255, 255, 0.06);

  /* 尺寸 Token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 960px;

  /* 字体与行高 */
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --line-height-body: 1.55;
  --line-height-title: 1.15;
  --h1-size: clamp(2.6rem, 6.4vw, 5rem);
  --h2-size: clamp(1.8rem, 3.5vw, 2.8rem);
  --h3-size: clamp(1.1rem, 1.8vw, 1.25rem);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-main);
  color: var(--color-body);
  background-color: var(--color-paper);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { padding-left: 0; list-style: none; }

/* 布局容器 */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

section {
  padding-block: var(--section-y);
}

/* 表面层配色规则 */
.surface-paper {
  background-color: var(--color-paper);
  color: var(--color-body);
}
.surface-dark {
  background-color: var(--color-deep);
  color: var(--color-paper);
}
.light-card-on-dark {
  background-color: var(--bg-card-dark);
  color: inherit;
}
.surface-paper .light-card-on-dark {
  background-color: var(--bg-card-paper);
}

/* 卡片基础 */
.card {
  border-radius: var(--radius-card);
  padding: var(--gap);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}

/* 排版 */
.label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.5em;
}
.surface-paper .label { color: var(--color-brand); }
.surface-dark .label { color: var(--color-accent); }

h1 {
  font-size: var(--h1-size);
  font-weight: 500;
  line-height: var(--line-height-title);
  letter-spacing: -0.02em;
  margin: 0.5em 0 0.25em;
  text-wrap: balance;
}
h2 {
  font-size: var(--h2-size);
  font-weight: 500;
  line-height: var(--line-height-title);
  margin: 1.5em 0 0.5em;
  text-wrap: balance;
}
h3 {
  font-size: var(--h3-size);
  font-weight: 600;
  line-height: 1.3;
  margin: 1em 0 0.5em;
}
p { margin: 0.75em 0; max-width: 38em; }
.hl { color: var(--color-brand); }
.surface-dark .hl { color: var(--color-accent); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease, background-color 0.2s ease;
  white-space: nowrap;
}
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-deep);
}
.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}
.btn-secondary {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
}
.btn-secondary:hover {
  transform: translateY(-2px);
  background-color: rgba(128,128,128,0.08);
}
.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* 网格与弹性布局 */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
}
.flex-row {
  display: flex;
  align-items: center;
  gap: var(--gap);
}
@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .flex-row { flex-direction: column; align-items: flex-start; }
}

/* 表格 */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(128, 128, 128, 0.25);
}
th { font-weight: 600; }
td:first-child { font-weight: 600; }
.surface-dark th, .surface-dark td { border-bottom-color: rgba(255,255,255,0.15); }

/* 列表与定义 */
.dl-grid {
  display: grid;
  gap: var(--gap);
}
.dl-item {
  padding: var(--gap);
  border-radius: var(--radius-card);
}
.dl-item dt {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.dl-item dd {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.9;
}

/* FAQ Details */
details {
  margin-bottom: 0.75rem;
  border-radius: var(--radius-card);
  overflow: hidden;
}
summary {
  cursor: pointer;
  font-weight: 600;
  padding: 1rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
summary::-webkit-details-marker { display: none; }
summary::marker { display: none; content: ""; }
details[open] summary { border-bottom: 1px solid rgba(128,128,128,0.2); }
details p { padding: 1rem; margin: 0; font-size: 0.95rem; }

/* 时间线 */
.timeline {
  position: relative;
  padding-left: 2rem;
  counter-reset: step;
}
.timeline li {
  position: relative;
  margin-bottom: 1.5rem;
  padding-left: 1rem;
}
.timeline li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: -2.5rem;
  top: 0;
  width: 2rem;
  height: 2rem;
  background: var(--color-accent);
  color: var(--color-deep);
  font-weight: 700;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}
.timeline li p { margin: 0.25rem 0 0; }

/* 页头页脚 */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-paper);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.1rem;
}
.logo-group img { width: 32px; height: 32px; }
.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.nav-links a:hover, .nav-links a[aria-current="page"] {
  opacity: 1;
  color: var(--color-brand);
}
footer {
  background: var(--color-deep);
  color: var(--color-paper);
  padding: 3rem 0;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.9;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}
.footer-links a { opacity: 0.8; }
.footer-links a:hover { opacity: 1; color: var(--color-accent); }

/* SVG 动效系统 */
.svg-panel {
  width: 100%;
  height: auto;
  max-width: 520px;
  margin: 0 auto;
}
.svg-panel svg {
  overflow: visible;
}
.anim-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 3.5s ease-in-out infinite alternate;
}
@keyframes draw-line {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
.anim-float {
  animation: float-shape 4.5s ease-in-out infinite alternate;
}
@keyframes float-shape {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}
.anim-breathe {
  animation: breathe-opacity 3s ease-in-out infinite alternate;
}
@keyframes breathe-opacity {
  from { opacity: 0.5; }
  to { opacity: 1; }
}
.anim-slide-in {
  animation: slide-path 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes slide-path {
  from { transform: translateX(18px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
/* 旋转/缩放子元素修正 */
.anim-float, .anim-breathe, .anim-draw {
  transform-box: fill-box;
  transform-origin: center;
}

/* 减少动态效果偏好 */
@media (prefers-reduced-motion: reduce) {
  .anim-draw, .anim-float, .anim-breathe, .anim-slide-in {
    animation: none !important;
  }
}
