/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量与基础重置 --- */
:root {
  /* 色板 */
  --color-dark: #140E25;
  --color-paper: #F5F0E5;
  --color-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;

  /* 组件取值（纸面默认） */
  --text-main: var(--color-body);
  --text-link: var(--color-brand);
  --text-button: var(--color-dark);
  --highlight: var(--color-brand);
  --bg-page: var(--color-paper);
  --bg-card: var(--color-paper);

  /* 结构参数 */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 1px solid rgba(25, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;
  --header-h: 64px;
}

/* 深色面覆盖 */
.dark-bg {
  --text-main: var(--color-paper);
  --text-link: var(--color-accent);
  --text-button: var(--color-dark);
  --highlight: var(--color-accent);
  --bg-page: var(--color-dark);
  --bg-card: var(--color-paper);
}

/* 浅色卡片在深色面内恢复纸面取色 */
.card-light {
  --text-main: var(--color-body);
  --text-link: var(--color-brand);
  --highlight: var(--color-brand);
  --bg-card: var(--color-paper);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: var(--font-sans), system-ui, -apple-system, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.75;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  min-width: 320px;
  width: 100%;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--text-link); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }
a:focus-visible { outline: 2px solid var(--highlight); outline-offset: 2px; border-radius: 2px; }

ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; table-layout: fixed; }

/* --- 布局容器 --- */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

section {
  padding-block: var(--section-y);
}

.section-header {
  margin-bottom: calc(var(--gap) * 1.5);
}

.breadcrumb {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--highlight);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

h1, h2, h3 {
  font-weight: 500;
  line-height: 1.15;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  margin-bottom: 1.5rem;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 1rem;
}

h3 {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  margin-bottom: 0.75rem;
}

p {
  max-width: 38em;
  margin-bottom: 1rem;
}

.hl {
  color: var(--highlight);
  font-weight: 500;
}

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-page);
  border-bottom: 1px solid var(--card-border);
  height: var(--header-h);
  display: flex;
  align-items: center;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-main);
}
.logo img { height: 28px; width: auto; }

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-main);
}
.nav-links a[aria-current="page"] {
  color: var(--highlight);
  border-bottom: 2px solid var(--highlight);
}

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 1.25rem;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--highlight); outline-offset: 2px; }

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-secondary {
  background: transparent;
  border: 1px solid var(--text-main);
  color: var(--text-main);
}

/* --- 卡片与网格 --- */
.card {
  background: var(--bg-card);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-2px); }

.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: var(--card-border);
  border-radius: var(--radius-card);
  overflow: hidden;
  margin-top: 1rem;
}
.data-table th, .data-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
  vertical-align: top;
}
.data-table th {
  font-weight: 600;
  background: rgba(0,0,0,0.03);
  width: 35%;
}
.data-table tr:last-child td { border-bottom: none; }

/* --- 步骤徽标 --- */
.step-list { counter-reset: step-counter; }
.step-item {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.step-badge {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

/* --- FAQ --- */
.faq-list details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 0.75rem;
  background: var(--bg-card);
}
.faq-list summary {
  padding: 1rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--text-main);
  border-bottom: 1.5px solid var(--text-main);
  transform: rotate(-45deg);
  flex-shrink: 0;
}
.faq-list details[open] summary::before { transform: rotate(45deg); }
.faq-list .answer {
  padding: 0 1rem 1rem;
  color: var(--text-main);
  opacity: 0.9;
}

/* --- 定义列表 --- */
.def-list dt {
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.25rem;
  color: var(--text-main);
}
.def-list dd {
  margin-left: 0;
  padding-left: 1rem;
  border-left: 2px solid var(--highlight);
  color: var(--text-main);
  opacity: 0.9;
}

/* --- 流程条 --- */
.flow-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-top: 1.5rem;
}
.flow-node {
  flex: 1;
  min-width: 140px;
  padding: 0.75rem;
  background: rgba(82, 20, 235, 0.08);
  border-radius: var(--radius-card);
  text-align: center;
  font-weight: 500;
  color: var(--text-main);
}
.flow-arrow {
  color: var(--highlight);
  font-size: 1.2rem;
  opacity: 0.6;
}

/* --- SVG 动效 --- */
.svg-panel {
  width: 100%;
  height: auto;
  max-width: 100%;
  overflow: visible;
}

.anim-float { animation: floatUp 6s ease-in-out infinite; }
.anim-float-delay { animation: floatUp 6s ease-in-out 2s infinite; }
.anim-float-slow { animation: floatUp 8s ease-in-out 1s infinite; }

.anim-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 4s ease forwards;
}
.anim-draw-delay { animation-delay: 0.5s; }
.anim-draw-delay2 { animation-delay: 1s; }

.anim-pulse { animation: breathe 3s ease-in-out infinite; }

@keyframes floatUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { 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: none !important;
  }
  .svg-panel { transform: none !important; }
}

/* --- 响应式微调 --- */
@media (max-width: 768px) {
  .nav-links { gap: 1rem; }
  .flow-bar { flex-direction: column; }
  .flow-arrow { transform: rotate(90deg); margin: 0.5rem 0; }
  h1 { font-size: clamp(2rem, 8vw, 3.5rem); }
}
