/* ========================================
   SafeW 全站共享样式
   设计变量 · 基础排版 · 组件 · SVG 动效
   ======================================== */

/* ---------- 设计变量 ---------- */
: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, .3);

  /* 节奏与密度 */
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --line-height: 1.65;

  /* 内容最大宽度 */
  --content-max: 1120px;

  /* 标题 */
  --title-weight: 800;
  --title-letter-spacing: -0.02em;
  --title-line-height: 1.1;

  /* 分割线 */
  --divider: rgba(25, 21, 35, .1);

  /* 聚焦环 */
  --focus-ring: 3px solid var(--color-accent);
}

/* ---------- 重置与基础 ---------- */
*, *::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", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  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 {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section {
  padding: var(--section-y) 0;
}

.section--dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}

.section--paper {
  background-color: var(--color-paper);
  color: var(--color-text);
}

/* 眉标 */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.section--paper .badge {
  color: var(--color-brand);
}

.section--dark .badge {
  color: var(--color-accent);
}

/* 高亮关键词 */
.hl {
  color: var(--color-brand);
}

.section--dark .hl {
  color: var(--color-accent);
}

/* H1/H2/H3 */
h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: var(--title-weight);
  letter-spacing: var(--title-letter-spacing);
  line-height: var(--title-line-height);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: var(--title-weight);
  letter-spacing: var(--title-letter-spacing);
  line-height: 1.25;
  margin-bottom: 0.6rem;
}

h3 {
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  font-weight: var(--title-weight);
  letter-spacing: var(--title-letter-spacing);
  line-height: 1.2;
  margin-bottom: 0.4rem;
}

p {
  margin-bottom: 1rem;
  max-width: 38em;
}

/* ---------- 页头 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}

.section--dark .site-header {
  background-color: var(--color-dark);
}

.site-header.scrolled {
  border-bottom-color: var(--divider);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

.logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  padding: 6px 0;
  position: relative;
  transition: color .2s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--color-brand);
}

.section--dark .nav-links a:hover,
.section--dark .nav-links a[aria-current="page"] {
  color: var(--color-accent);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform .2s, box-shadow .2s, background-color .2s;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(200, 237, 110, .4);
}

.btn--secondary {
  background: transparent;
  border: 2px solid var(--color-text);
  color: var(--color-text);
}

.section--dark .btn--secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}

.btn--secondary:hover {
  transform: translateY(-2px);
  opacity: .85;
}

.btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ---------- 卡片 ---------- */
.card {
  background: #fff;
  border-radius: var(--radius-card);
  border: var(--card-border) solid var(--divider);
  box-shadow: var(--card-shadow);
  padding: 24px;
  transition: box-shadow .25s;
}

.card:hover {
  box-shadow: 0 14px 36px -12px rgba(25, 21, 35, .35);
}

/* ---------- 表格 ---------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--divider);
}

th {
  font-weight: 700;
  background: rgba(25, 21, 35, .04);
}

.section--dark th {
  background: rgba(247, 245, 243, .06);
}

td:first-child {
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- FAQ ---------- */
.faq details {
  border-bottom: 1px solid var(--divider);
  padding: 16px 0;
}

.faq summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1rem;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::marker {
  display: none;
  content: "";
}

.faq summary::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-brand);
  border-bottom: 2px solid var(--color-brand);
  transform: rotate(-45deg);
  flex-shrink: 0;
  transition: transform .25s;
}

details[open] summary::before {
  transform: rotate(45deg);
}

.faq p {
  margin-top: 8px;
  font-size: 0.95rem;
  color: rgba(25, 21, 35, .75);
}

.section--dark .faq p {
  color: rgba(247, 245, 243, .7);
}

/* ---------- 页脚 ---------- */
.site-footer {
  padding: 48px 0;
  border-top: 1px solid var(--divider);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links a {
  transition: color .2s;
}

.footer-links a:hover {
  color: var(--color-brand);
}

.section--dark .footer-links a:hover {
  color: var(--color-accent);
}

/* ---------- 响应式导航切换 ---------- */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--color-paper);
    flex-direction: column;
    padding: 16px 24px;
    border-bottom: 1px solid var(--divider);
    gap: 12px;
  }

  .section--dark .nav-links {
    background: var(--color-dark);
  }

  .nav-links.open {
    display: flex;
  }
}

/* ---------- SVG 动效 ---------- */

/* 呼吸浮动 */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.animate-float {
  animation: float 4s ease-in-out infinite;
}

/* 气泡依次浮现后漂浮 */
@keyframes bubbleIn {
  0%, 10% { opacity: 0; transform: translateY(12px); }
  15%, 85% { opacity: 1; transform: translateY(0); }
  90%, 100% { opacity: 0; transform: translateY(-4px); }
}

.bubble-1 { animation: bubbleIn 6s ease-in-out infinite; }
.bubble-2 { animation: bubbleIn 6s ease-in-out infinite 1.5s; }
.bubble-3 { animation: bubbleIn 6s ease-in-out infinite 3s; }

/* 输入三点呼吸 */
@keyframes dotBreathe {
  0%, 100% { opacity: .3; }
  50% { opacity: 1; }
}

.dot-1 { animation: dotBreathe 1.8s ease-in-out infinite; }
.dot-2 { animation: dotBreathe 1.8s ease-in-out infinite .3s; }
.dot-3 { animation: dotBreathe 1.8s ease-in-out infinite .6s; }

/* 通知卡片滑入 */
@keyframes slideIn {
  0%, 5% { transform: translateX(30px); opacity: 0; }
  10%, 85% { transform: translateX(0); opacity: 1; }
  90%, 100% { transform: translateX(30px); opacity: 0; }
}

.animate-slide-in {
  animation: slideIn 7s ease-in-out infinite;
}

/* 连接线流动 */
@keyframes dashFlow {
  to { stroke-dashoffset: -40; }
}

.flow-line {
  stroke-dasharray: 8 12;
  animation: dashFlow 2s linear infinite;
}

/* 同心轨道呼吸（SVG 动效方向） */
@keyframes orbitPulse {
  0%, 100% { transform: scale(1); opacity: .6; }
  50% { transform: scale(1.08); opacity: 1; }
}

.orbit-1 { animation: orbitPulse 5s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.orbit-2 { animation: orbitPulse 5s ease-in-out infinite 1s; transform-origin: center; transform-box: fill-box; }
.orbit-3 { animation: orbitPulse 5s ease-in-out infinite 2s; transform-origin: center; transform-box: fill-box; }

/* 面板元素轻微摇摆 */
@keyframes gentleSway {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(1deg); }
}

.animate-sway {
  animation: gentleSway 8s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}

/* 进度条填充 */
@keyframes progressFill {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}

.progress-bar {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: progressFill 4s ease-in-out infinite;
}

/* 消息滑动出现 */
@keyframes msgSlide {
  0%, 8% { transform: translateY(10px); opacity: 0; }
  12%, 88% { transform: translateY(0); opacity: 1; }
  92%, 100% { transform: translateY(10px); opacity: 0; }
}

.msg-anim-1 { animation: msgSlide 8s ease-in-out infinite; }
.msg-anim-2 { animation: msgSlide 8s ease-in-out infinite 2s; }
.msg-anim-3 { animation: msgSlide 8s ease-in-out infinite 4s; }

/* 标签切换指示器移动 */
@keyframes tabIndicatorMove {
  0%, 100% { transform: translateX(0); }
  33% { transform: translateX(calc(var(--tab-w, 80px) * 1)); }
  66% { transform: translateX(calc(var(--tab-w, 80px) * 2)); }
}

.tab-indicator {
  animation: tabIndicatorMove 9s ease-in-out infinite;
}

/* 流程箭头流动 */
@keyframes arrowPulse {
  0%, 100% { opacity: .4; }
  50% { opacity: 1; }
}

.arrow-flow {
  animation: arrowPulse 3s ease-in-out infinite;
}

/* 数字徽标弹跳 */
@keyframes badgePop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.badge-pop {
  animation: badgePop 4s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}

/* ---------- 减少动态效果 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 辅助工具类 ---------- */
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.grow { flex-grow: 1; }

.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);
}

.w-full { width: 100%; }

/* SVG 尺寸控制 */
.svg-hero {
  width: 100%;
  height: auto;
  max-width: 600px;
  margin: 0 auto;
}

.svg-panel {
  width: 100%;
  height: auto;
  max-width: 560px;
  margin: 0 auto;
}

.svg-small {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* 提示框 */
.callout {
  border-left: 3px solid var(--color-brand);
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
  font-size: 0.95rem;
  background: rgba(82, 20, 235, .04);
}

.section--dark .callout {
  border-left-color: var(--color-accent);
  background: rgba(200, 237, 110, .06);
}

/* 步骤编号徽标 */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* Tab 切换视觉面板 */
.tab-visual {
  position: relative;
}

.tab-visual__tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--divider);
  padding-bottom: 0;
}

.tab-visual__tab {
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  color: rgba(25, 21, 35, .5);
  position: relative;
  transition: color .2s;
}

.tab-visual__tab[aria-selected="true"] {
  color: var(--color-text);
}

.section--dark .tab-visual__tab[aria-selected="true"] {
  color: var(--color-paper);
}

.tab-visual__panel {
  display: none;
}

.tab-visual__panel.active {
  display: block;
}

/* 横向流程条 */
.flow-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.flow-node {
  padding: 12px 20px;
  border-radius: var(--radius-card);
  background: rgba(25, 21, 35, .05);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
}

.section--dark .flow-node {
  background: rgba(247, 245, 243, .08);
}

.flow-arrow {
  color: var(--color-brand);
  flex-shrink: 0;
}

.section--dark .flow-arrow {
  color: var(--color-accent);
}
