/* =========================================
   SafeW 共享样式 (style.css)
   ========================================= */

/* --- 设计 Token --- */
:root {
  /* 色板 */
  --color-dark: #251943;
  --color-paper: #DBD4ED;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED6E89;

  /* 圆角 */
  --radius-card: 0;
  --radius-btn: 0;

  /* 卡片边界与阴影 */
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.3);

  /* 节奏与密度 */
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --line-height: 1.55;

  /* 内容最大宽度 */
  --content-max: 960px;

  /* 标题处理 */
  --heading-weight: 800;
  --heading-tracking: -0.02em;
  --heading-lh: 1.1;
  --h1-size: clamp(2.4rem, 6vw, 4.5rem);
  --h2-size: clamp(1.6rem, 3vw, 2.4rem);
  --body-size: clamp(1rem, 1.1vw, 1.125rem);

  /* 组件尺寸 */
  --btn-h: 52px;
  --btn-icon-size: 20px;
}

/* --- 基础重置与排版 --- */
*, *::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, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: var(--body-size);
  line-height: var(--line-height);
  color: var(--color-text);
  background-color: var(--color-paper);
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* --- 容器与布局 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.section {
  padding-block: var(--section-y);
}

/* 面色控制 */
.dark-surface {
  background-color: var(--color-dark);
  color: var(--color-paper);
}

.light-surface .dark-surface {
  /* 深色区块内的浅色卡片恢复纸面取色 */
  background-color: var(--color-paper);
  color: var(--color-text);
}

/* --- 标题系统 --- */
.heading-xl {
  font-size: var(--h1-size);
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-tracking);
  line-height: var(--heading-lh);
  text-wrap: balance;
}

.heading-lg {
  font-size: var(--h2-size);
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-tracking);
  line-height: var(--heading-lh);
  margin-bottom: var(--gap);
  text-wrap: balance;
}

.heading-md {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-tracking);
  line-height: var(--heading-lh);
  margin-bottom: calc(var(--gap) * 0.75);
}

.text-hl {
  color: var(--color-brand);
}

.dark-surface .text-hl {
  color: var(--color-accent);
}

.breadcrumb {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: calc(var(--gap) * 0.5);
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.dark-surface .breadcrumb {
  color: var(--color-accent);
}

.breadcrumb::before {
  content: "";
  display: inline-block;
  width: 1em;
  height: 2px;
  background-color: currentColor;
}

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75em;
  height: var(--btn-h);
  padding-inline: 1.5em;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.dark-surface .btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text);
  border: 2px solid var(--color-text);
}

.dark-surface .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(0.95);
}

.btn-icon {
  width: var(--btn-icon-size);
  height: var(--btn-icon-size);
  flex-shrink: 0;
}

/* --- 卡片 --- */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: calc(var(--gap) * 1.5);
  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.4);
}

.dark-surface .card {
  background-color: var(--color-paper);
  color: var(--color-text);
}

/* --- 表格 --- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  text-align: left;
  padding: 0.75em 1em;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

.dark-surface th, .dark-surface td {
  border-bottom-color: rgba(219, 212, 237, 0.15);
}

th {
  font-weight: 700;
  background-color: rgba(25, 21, 35, 0.03);
}

.dark-surface th {
  background-color: rgba(219, 212, 237, 0.05);
}

tr:last-child th, tr:last-child td {
  border-bottom: none;
}

/* --- FAQ --- */
details {
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  padding: 1em 0;
}

.dark-surface details {
  border-bottom-color: rgba(219, 212, 237, 0.15);
}

summary {
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.75em;
  position: relative;
  padding-right: 2em;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  position: absolute;
  right: 0;
  font-weight: 400;
  font-size: 1.25em;
  transition: transform 0.2s ease;
}

details[open] summary::after {
  transform: rotate(45deg);
}

details p {
  margin-top: 0.75em;
  color: inherit;
}

/* --- 页头页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.dark-surface .site-header {
  background-color: var(--color-dark);
  border-bottom-color: rgba(219, 212, 237, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75em;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.nav-list {
  display: flex;
  gap: var(--gap);
}

.nav-link {
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5em 0;
  position: relative;
}

.nav-link[aria-current="page"], .nav-link:hover {
  color: var(--color-brand);
}

.dark-surface .nav-link[aria-current="page"], .dark-surface .nav-link:hover {
  color: var(--color-accent);
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: currentColor;
  transition: width 0.2s ease;
}

.nav-link:hover::after {
  width: 100%;
}

.site-footer {
  background-color: var(--color-dark);
  color: var(--color-paper);
  padding-block: var(--section-y);
  border-top: 1px solid rgba(219, 212, 237, 0.1);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
}

.footer-col h4 {
  font-weight: 700;
  margin-bottom: 0.75em;
  color: var(--color-accent);
}

.footer-col a {
  display: block;
  padding: 0.3em 0;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.footer-col a:hover {
  opacity: 1;
}

.copyright {
  margin-top: calc(var(--section-y) * 0.75);
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.6;
}

/* --- SVG 动效系统 --- */
.svg-graphic {
  width: 100%;
  height: auto;
  overflow: visible;
}

.flow-dot {
  fill: var(--color-accent);
  animation: flowPath 4s linear infinite;
}

.flow-dot:nth-child(2) { animation-delay: 1.33s; }
.flow-dot:nth-child(3) { animation-delay: 2.66s; }

.bubble-rise {
  animation: bubbleRise 5s ease-in-out infinite;
}

.bubble-rise:nth-child(2) { animation-delay: 1.5s; }
.bubble-rise:nth-child(3) { animation-delay: 3s; }

.input-breathe {
  animation: breathe 3s ease-in-out infinite;
}

.line-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 3s ease-in-out infinite;
}

@keyframes flowPath {
  0% { offset-distance: 0%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}

@keyframes bubbleRise {
  0%, 100% { transform: translateY(0); opacity: 0.8; }
  50% { transform: translateY(-6px); opacity: 1; }
}

@keyframes breathe {
  0%, 100% { opacity: 0.4; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1); }
}

@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}

/* --- 响应式调整 --- */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    height: auto;
    padding-block: 0.75em;
  }
  
  .nav-list {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5em 1em;
  }
  
  .hero-layout {
    flex-direction: column-reverse !important;
  }
  
  .step-flow {
    flex-direction: column !important;
  }
  
  .step-flow .step-item {
    margin-bottom: var(--gap);
  }
}

/* --- 减少动态效果 --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .flow-dot, .bubble-rise, .input-breathe, .line-draw {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
