/* SafeW 全站共享样式 */
:root {
  /* 色板 */
  --color-dark: #271231;
  --color-paper: #F5F0E5;
  --color-text: #1F1523;
  --color-brand: #9B12D8;
  --color-accent: #ED6EC0;

  /* 结构变量 */
  --radius-card: 0;
  --radius-btn: 0;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 960px;

  /* 组件变量 */
  --card-border-color: rgba(31, 21, 35, 0.16);
  --card-shadow: none;
  --header-height: 64px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--color-brand);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: color-mix(in srgb, var(--color-brand) 80%, black);
}

a:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

/* 容器与布局 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.section {
  padding-block: var(--section-y);
  position: relative;
}

.section + .section {
  border-top: 1px solid var(--card-border-color);
}

.dark-surface {
  background-color: var(--color-dark);
  color: var(--color-paper);
}

.dark-surface a {
  color: var(--color-accent);
}

.dark-surface a:hover {
  color: #f48ecf;
}

.paper-surface {
  background-color: var(--color-paper);
  color: var(--color-text);
}

/* 排版 */
h1, h2, h3, h4 {
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  margin-bottom: var(--gap);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: calc(var(--gap) * 1.5);
}

h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  margin-bottom: var(--gap);
}

p {
  margin-bottom: var(--gap);
  max-width: 38em;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  color: var(--color-brand);
}

.dark-surface .eyebrow {
  color: var(--color-accent);
}

.hl {
  color: var(--color-brand);
}

.dark-surface .hl {
  color: var(--color-accent);
}

/* 页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid transparent;
  height: var(--header-height);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.dark-surface ~ .site-header {
  background-color: var(--color-paper);
}

.site-header.scrolled {
  border-bottom-color: var(--card-border-color);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--color-text);
}

.logo img {
  height: 32px;
  width: auto;
}

.nav {
  display: flex;
  align-items: center;
  gap: calc(var(--gap) * 1.5);
}

.nav a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
  padding: 8px 12px;
  border-radius: var(--radius-btn);
  transition: background 0.2s ease, color 0.2s ease;
}

.nav a:hover, .nav a[aria-current="page"] {
  color: var(--color-brand);
  background: rgba(155, 18, 216, 0.06);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background-color: var(--color-accent);
  color: var(--color-dark);
  font-weight: 600;
  font-size: 1rem;
  padding: 12px 24px;
  border-radius: var(--radius-btn);
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
  text-decoration: none;
  height: 48px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  background-color: #f082c7;
}

.btn-primary:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-text);
  font-weight: 600;
  font-size: 1rem;
  padding: 12px 24px;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  text-decoration: none;
  height: 48px;
}

.dark-surface .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.btn-secondary:hover {
  transform: translateY(-1px);
  background: rgba(31, 21, 35, 0.05);
}

.dark-surface .btn-secondary:hover {
  background: rgba(245, 240, 229, 0.08);
}

/* 按钮组 */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: var(--gap);
}

/* 卡片 */
.card {
  background: var(--color-paper);
  border: 1px solid var(--card-border-color);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  border-radius: var(--radius-card);
}

.dark-surface .card {
  background: color-mix(in srgb, var(--color-dark) 90%, white);
  border-color: rgba(245, 240, 229, 0.15);
}

.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-collapse: collapse;
  margin-bottom: var(--gap);
}

.data-table th, .data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--card-border-color);
  text-align: left;
}

.data-table th {
  font-weight: 600;
  color: var(--color-text);
}

.dark-surface .data-table th, .dark-surface .data-table td {
  color: var(--color-paper);
  border-bottom-color: rgba(245, 240, 229, 0.15);
}

/* 步骤条 */
.steps {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  counter-reset: step;
}

.step-item {
  flex: 1 1 200px;
  position: relative;
  padding-left: 48px;
}

.step-num {
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  display: grid;
  place-items: center;
  border-radius: var(--radius-btn);
}

/* FAQ */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.security-list {
  list-style: none;
  padding: 0;
}

.security-list li {
  position: relative;
  padding-left: 32px;
  margin-bottom: 16px;
}

.security-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 20px;
  height: 20px;
  background-color: var(--color-brand);
  mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg>') no-repeat center / contain;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg>') no-repeat center / contain;
}

.faq-item details {
  border: 1px solid var(--card-border-color);
  padding: 16px;
  border-radius: var(--radius-card);
  background: var(--color-paper);
}

.dark-surface .faq-item details {
  background: color-mix(in srgb, var(--color-dark) 95%, white);
  border-color: rgba(245, 240, 229, 0.15);
}

.faq-item summary {
  font-weight: 600;
  cursor: pointer;
  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-weight: 400;
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

.faq-item details[open] summary::after {
  transform: rotate(45deg);
}

.faq-item p {
  margin-top: 12px;
  margin-bottom: 0;
  font-size: 0.95rem;
}

/* SVG 基础 */
.svg-panel {
  width: 100%;
  height: auto;
  max-width: 100%;
  overflow: hidden;
}

.svg-panel svg {
  width: 100%;
  height: auto;
  display: block;
}

/* SVG 动效 Keyframes */
@keyframes drawLine {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes breatheOpacity {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulseDot {
  0%, 100% { r: 3; opacity: 0.6; }
  50% { r: 4.5; opacity: 1; }
}

/* 动效类绑定 */
.draw-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 3s ease forwards, breatheOpacity 6s ease-in-out infinite 3s;
}

.float-element {
  animation: floatY 5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.slide-element {
  animation: slideInRight 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.breath-circle {
  animation: pulseDot 4s ease-in-out infinite alternate;
}

.line-flow {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 4s linear infinite alternate;
}

/* 响应式适配 */
@media (max-width: 768px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
  
  .steps {
    flex-direction: column;
  }
  
  .step-item {
    flex: 1 1 100%;
  }
  
  h1 {
    line-height: 1.1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation-delay: 0ms !important;
  }
  
  .draw-path, .float-element, .slide-element, .breath-circle, .line-flow {
    animation: none;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
