/* =========================================
   SafeW 共享样式系统
   ========================================= */

/* 1. 设计变量 */
:root {
  /* 色板 */
  --color-dark: #21163C;
  --color-paper: #E9E8EA;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED926E;
  --color-text-on-dark: #E9E8EA;
  --color-accent-on-dark: #ED926E;

  /* 边界与阴影 */
  --radius-card: 20px;
  --radius-btn: 12px;
  --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);
  --content-max: 1280px;
  --header-h: 64px;
}

/* 2. 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
ul, ol { list-style: none; }

/* 3. 布局容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.section {
  padding-block: var(--section-y);
}

/* 4. 表面层变量覆盖规则 */
.surface-paper { color: var(--color-text); background: var(--color-paper); }
.surface-dark { color: var(--color-text-on-dark); background: var(--color-dark); }

.surface-paper .hl, .surface-paper .badge, .surface-paper .link-accent, .surface-paper .icon { color: var(--color-brand); }
.surface-dark .hl, .surface-dark .badge, .surface-dark .link-accent, .surface-dark .icon { color: var(--color-accent-on-dark); }

/* 5. 标题与文本组件 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.badge::before {
  content: "";
  display: block;
  width: 12px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}
.hl { font-weight: 800; }
h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}
p { margin-bottom: 1rem; max-width: 38em; }
.text-muted { opacity: 0.8; font-size: 0.9rem; }

/* 6. 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  border: none;
}
.btn:focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(237, 146, 110, 0.35); }
.btn-secondary {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
}
.btn-secondary:hover { background: rgba(128,128,128,0.1); }

/* 7. 卡片与面板 */
.card {
  background: 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(-4px); box-shadow: 0 14px 32px -12px rgba(25, 21, 35, 0.35); }
.panel {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: var(--gap);
  position: relative;
  overflow: hidden;
}
.panel-light {
  background: var(--color-paper);
  color: var(--color-text);
}

/* 8. 网格与交错布局 */
.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); }
.alt-layout { display: grid; gap: var(--gap); align-items: center; }
.alt-layout:nth-child(even) .alt-layout__visual { order: -1; }
@media (min-width: 768px) {
  .alt-layout { grid-template-columns: 1fr 1fr; }
}

/* 9. 表格 */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}
.spec-table th, .spec-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(128,128,128,0.2);
}
.spec-table th { font-weight: 700; width: 40%; }
@media (max-width: 600px) {
  .spec-table th, .spec-table td { display: block; width: 100%; }
  .spec-table tr { display: block; margin-bottom: 12px; }
}

/* 10. FAQ */
.faq-item { margin-bottom: 12px; border: 1px solid rgba(128,128,128,0.15); border-radius: var(--radius-btn); overflow: hidden; }
.faq-item summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.2rem; transition: transform 0.2s; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding: 0 20px 16px; margin: 0; font-size: 0.95rem; line-height: 1.6; }

/* 11. 时间轴与步骤条 */
.timeline { position: relative; padding-left: 24px; border-left: 2px solid rgba(128,128,128,0.2); margin: 1.5rem 0; }
.timeline-item { position: relative; margin-bottom: 2rem; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -30px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid var(--color-paper);
}
.steps-bar { display: flex; gap: var(--gap); overflow-x: auto; padding-bottom: 8px; }
.step-card { flex: 1 1 200px; min-width: 0; }
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 800;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

/* 12. SVG 动效系统 */
.ui-svg { width: 100%; height: auto; max-width: 100%; display: block; }
.svg-orbit { animation: orbit-breathe 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.svg-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw-line 4s ease-in-out infinite alternate; }
.svg-float { animation: float-up 5s ease-in-out infinite; }
.svg-dot { animation: pulse-dot 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.svg-dot:nth-child(2) { animation-delay: 0.4s; }
.svg-dot:nth-child(3) { animation-delay: 0.8s; }

@keyframes orbit-breathe {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.04); opacity: 1; }
}
@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes float-up {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(0.8); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .svg-orbit, .svg-draw, .svg-float, .svg-dot { animation: none !important; }
}

/* 13. 响应式微调 */
@media (max-width: 768px) {
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
  h2 { font-size: clamp(1.4rem, 5vw, 1.8rem); }
  .steps-bar { flex-direction: column; }
  .step-card { flex: unset; }
}
