/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 1. 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* 2. 设计 Token 与变量 */
:root {
  /* 配色 */
  --color-dark: #140E25;
  --color-paper: #F7F5F3;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;

  /* 圆角与阴影 */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.3);

  /* 节奏与间距 */
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --container-padding: 1.5rem;

  /* 内容宽度 */
  --content-max: 1120px;

  /* 字体比例 */
  --text-h1: clamp(2.4rem, 6vw, 4.5rem);
  --text-h2: clamp(1.6rem, 3vw, 2.4rem);
  --text-body: 16px;
}

/* 3. 主题上下文覆盖 */
.theme-dark {
  --_text: var(--color-paper);
  --_highlight: var(--color-accent);
  --_link: var(--color-accent);
  --_icon: var(--color-accent);
  background-color: var(--color-dark);
  color: var(--_text);
}
.theme-dark .hl { color: var(--_highlight); }
.theme-dark a:not(.btn) { color: var(--_link); }
.theme-dark .overline, .theme-dark .tag { color: var(--_highlight); }

.light-card {
  background-color: var(--color-paper);
  color: var(--color-text);
  border-radius: var(--radius-card);
  padding: var(--gap);
}
.light-card .hl { color: var(--color-brand); }
.light-card a:not(.btn) { color: var(--color-brand); }
.light-card .overline, .light-card .tag { color: var(--color-brand); }

/* 4. 布局容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  position: relative;
}
.section + .section::before {
  content: "";
  display: block;
  height: 1px;
  background-color: currentColor;
  opacity: 0.12;
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
}
.grid-auto {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}

/* 5. 排版组件 */
.overline {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
h1, h2, h3 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-wrap: balance;
}
h1 { font-size: var(--text-h1); margin-bottom: 1rem; }
h2 { font-size: var(--text-h2); margin-bottom: 0.8rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.5rem; font-weight: 700; }
p { margin-bottom: 1rem; max-width: 38em; }
.hl { color: var(--color-brand); }
.theme-dark .hl { color: var(--color-accent); }

/* 6. 按钮系统 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 52px;
  padding: 0 1.25rem;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(200, 237, 110, 0.4); }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--color-text);
  color: var(--color-text);
}
.theme-dark .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}
.btn-secondary:hover { background-color: rgba(0,0,0,0.04); }
.theme-dark .btn-secondary:hover { background-color: rgba(255,255,255,0.08); }
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }

/* 7. 卡片与面板 */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 32px -12px rgba(25, 21, 35, 0.35); }
.dark-panel {
  background-color: var(--color-dark);
  border-radius: var(--radius-card);
  padding: var(--gap);
  color: var(--color-paper);
}
.dark-panel .hl { color: var(--color-accent); }

/* 8. 表格与列表 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin: 1rem 0;
}
.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}
.theme-dark .data-table th, .theme-dark .data-table td { border-bottom-color: rgba(255,255,255,0.1); }
.data-table th { font-weight: 600; color: var(--color-brand); }
.theme-dark .data-table th { color: var(--color-accent); }
.step-list { counter-reset: step; padding-left: 0; }
.step-list li {
  counter-increment: step;
  position: relative;
  padding-left: 2.5rem;
  margin-bottom: 1rem;
}
.step-list li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0; top: 0;
  width: 2rem; height: 2rem;
  background-color: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-dark .step-list li::before { background-color: var(--color-accent); }

/* 9. FAQ */
.faq-item { margin-bottom: 1rem; border-bottom: 1px solid rgba(0,0,0,0.08); padding-bottom: 1rem; }
.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.5rem 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem; height: 1.25rem;
  border-radius: 50%;
  background: rgba(0,0,0,0.05);
  font-size: 0.9rem;
  flex-shrink: 0;
}
.faq-item[open] summary::before { content: "−"; }
.faq-item p { margin-top: 0.5rem; font-size: 0.95rem; }

/* 10. 导航与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(247, 245, 243, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.theme-dark .site-header { background-color: rgba(20, 14, 37, 0.92); border-bottom-color: rgba(255,255,255,0.08); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.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); }
.theme-dark .nav-links a { color: var(--color-paper); }
.theme-dark .nav-links a:hover, .theme-dark .nav-links a[aria-current="page"] { color: var(--color-accent); }
.site-footer {
  padding: 2rem 0;
  border-top: 1px solid rgba(0,0,0,0.08);
  font-size: 0.9rem;
  opacity: 0.8;
}
.theme-dark .site-footer { border-top-color: rgba(255,255,255,0.08); }

/* 11. SVG 基础与动效 */
.svg-illust {
  width: 100%;
  height: auto;
  display: block;
}
.svg-illust path, .svg-illust circle, .svg-illust rect, .svg-illust line {
  transition: d 0.3s ease;
}
.anim-flow {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: flowDash 4s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}
.anim-breathe {
  animation: breathe 3s ease-in-out infinite;
}
.anim-float {
  animation: floatY 5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.anim-slideIn {
  animation: slideIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes flowDash {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes breathe {
  0%, 100% { opacity: 0.6; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1.02); }
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

/* 12. 响应式适配 */
@media (max-width: 768px) {
  .hero-layout { flex-direction: column !important; }
  .hero-visual { margin-top: 2rem; width: 100%; }
  .nav-links { gap: 1rem; }
  .nav-links .hide-mobile { display: none; }
}
@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;
  }
  html { scroll-behavior: auto; }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
