/* ===== SafeW 全站共享样式 ===== */

/* --- 设计变量 --- */
:root {
  /* 色板 */
  --bg-dark: #121531;
  --bg-paper: #E8E9EA;
  --text: #151723;
  --brand: #142CEB;
  --accent: #ED7D6E;

  /* 结构 token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 2px solid var(--text);
  --card-shadow: 4px 4px 0 var(--text);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;

  /* 组件衍生 */
  --border-radius: 16px;
  --font-sans: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --line-height-body: 1.75;
  --line-height-title: 1.25;
  --focus-ring: 3px solid var(--brand);
}

/* --- 深色面取色覆盖 --- */
.surface-dark {
  --_surface-bg: var(--bg-dark);
  --_surface-text: var(--bg-paper);
  --_surface-accent: var(--accent);
  --_surface-brand: var(--accent);
  --_surface-link: var(--accent);
}

/* --- 纸面卡片取色覆盖（用于深色面内的浅色卡片） --- */
.card-light-on-dark {
  --_surface-bg: var(--bg-paper);
  --_surface-text: var(--text);
  --_surface-accent: var(--accent);
  --_surface-brand: var(--brand);
  --_surface-link: var(--brand);
  --card-border: 2px solid var(--text);
  --card-shadow: 4px 4px 0 var(--text);
  color: var(--text);
}

/* --- 重置与基础 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--line-height-body);
  color: var(--text);
  background-color: var(--bg-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; height: auto; }

a { color: var(--brand); text-decoration: none; transition: color 0.2s; }
a:hover { color: color-mix(in srgb, var(--brand) 80%, black); }

ul, ol { list-style: none; }

/* --- 容器 --- */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* --- 眉标 --- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
  color: var(--brand);
}
.surface-dark .eyebrow {
  color: var(--accent);
}

/* --- 标题 --- */
h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: 0;
  line-height: var(--line-height-title);
  color: var(--text);
}
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); }
h3 { font-size: clamp(1.15rem, 2vw, 1.5rem); margin-bottom: 12px; }

.hl {
  color: var(--brand);
}
.surface-dark .hl {
  color: var(--accent);
}

p {
  max-width: 38em;
  margin-bottom: 1em;
}

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 28px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-btn);
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background-color: var(--accent);
  color: var(--bg-dark);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(237, 125, 110, 0.35);
  color: var(--bg-dark);
}
.btn-secondary {
  background: transparent;
  border: 2px solid var(--text);
  color: var(--text);
}
.surface-dark .btn-secondary {
  border-color: var(--bg-paper);
  color: var(--bg-paper);
}
.btn-secondary:hover {
  transform: translateY(-2px);
  background-color: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
}
.surface-dark .btn-secondary:hover {
  background-color: color-mix(in srgb, var(--bg-paper) 10%, transparent);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* --- 卡片 --- */
.card {
  background: var(--bg-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  transition: transform 0.25s ease;
}
.card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--text);
}

/* --- 表格 --- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--text) 15%);
}
th {
  font-weight: 700;
  background: color-mix(in srgb, var(--text) 5%, transparent);
}
td:first-child { font-weight: 600; white-space: nowrap; }

/* --- FAQ --- */
.faq details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 12px;
  background: var(--bg-paper);
  overflow: hidden;
}
.faq summary {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.2s;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--brand);
  border-bottom: 2px solid var(--brand);
  transform: rotate(-45deg);
  flex-shrink: 0;
  transition: transform 0.25s;
}
.faq details[open] summary::before {
  transform: rotate(45deg);
}
.faq summary:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.faq .faq-answer {
  padding: 0 20px 16px 38px;
  font-size: 0.95rem;
  line-height: var(--line-height-body);
  color: var(--text);
}

/* --- 页头 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(232, 233, 234, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid color-mix(in srgb, var(--text) 10%);
}
.surface-dark.header-dark {
  background: rgba(18, 21, 49, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom-color: rgba(232, 233, 234, 0.1);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}
.surface-dark .logo { color: var(--bg-paper); }
.logo img {
  width: 32px;
  height: 32px;
}
.nav { display: flex; align-items: center; gap: 24px; }
.nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  position: relative;
}
.surface-dark .nav a { color: var(--bg-paper); }
.nav a:hover { color: var(--brand); }
.surface-dark .nav a:hover { color: var(--accent); }
.nav a[aria-current="page"] {
  color: var(--brand);
  font-weight: 700;
}
.surface-dark .nav a[aria-current="page"] {
  color: var(--accent);
}
.nav .btn { height: 40px; padding: 0 20px; font-size: 0.9rem; }

/* 移动端菜单 */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.menu-toggle svg { width: 24px; height: 24px; stroke: var(--text); }
.surface-dark .menu-toggle svg { stroke: var(--bg-paper); }

@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-paper);
    padding: 16px var(--gap);
    border-bottom: 1px solid color-mix(in srgb, var(--text) 10%);
    gap: 12px;
  }
  .surface-dark .nav { background: var(--bg-dark); }
  .nav.open { display: flex; }
  .nav .btn { width: 100%; justify-content: center; }
}

/* --- 页脚 --- */
.site-footer {
  padding: 48px var(--gap);
  border-top: 1px solid color-mix(in srgb, var(--text) 10%);
  font-size: 0.85rem;
  color: color-mix(in srgb, var(--text) 60%);
}
.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-links a { color: var(--text); }
.footer-links a:hover { color: var(--brand); }
.surface-dark .site-footer {
  border-top-color: rgba(232, 233, 234, 0.1);
  color: rgba(232, 233, 234, 0.6);
}
.surface-dark .footer-links a { color: var(--bg-paper); }
.surface-dark .footer-links a:hover { color: var(--accent); }

/* --- 区块通用 --- */
.section {
  padding: var(--section-y) 0;
}

/* --- 网格 --- */
.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);
}

/* --- 特性胶囊 --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-btn);
  border: 1px solid color-mix(in srgb, var(--text) 20%);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  background: rgba(255,255,255,0.5);
}
.chip svg { width: 16px; height: 16px; stroke: var(--brand); }

/* --- 编号徽标 --- */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--bg-dark);
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
}

/* --- 提示框 --- */
.callout {
  border-left: 4px solid var(--brand);
  background: color-mix(in srgb, var(--brand) 6%, transparent);
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
  padding: 16px 20px;
  margin: 16px 0;
  font-size: 0.95rem;
}
.surface-dark .callout {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

/* --- 新闻卡片 --- */
.news-card {
  background: var(--bg-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.25s ease;
}
.news-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--text);
}
.news-card time {
  font-size: 0.8rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--text) 50%);
}

/* --- 时间线 --- */
.timeline {
  position: relative;
  padding-left: 48px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: color-mix(in srgb, var(--text) 20%);
}
.timeline-item {
  position: relative;
  margin-bottom: 32px;
}
.timeline-item:last-child { margin-bottom: 0; }
.timeline-item .step-badge {
  position: absolute;
  left: -48px;
  top: 0;
}

/* --- SVG 动效：同心轨道呼吸 --- */
.orbit-ring {
  transform-box: fill-box;
  transform-origin: center;
  animation: orbit-breathe 8s ease-in-out infinite;
}
.orbit-ring:nth-child(2) { animation-delay: -2s; animation-duration: 10s; }
.orbit-ring:nth-child(3) { animation-delay: -4s; animation-duration: 12s; }
.orbit-ring:nth-child(4) { animation-delay: -6s; animation-duration: 14s; }

@keyframes orbit-breathe {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.08); opacity: 0.7; }
}

/* 气泡浮现 */
.bubble-enter {
  animation: bubble-in 6s ease-in-out infinite;
}
.bubble-enter:nth-child(2) { animation-delay: -1.5s; }
.bubble-enter:nth-child(3) { animation-delay: -3s; }

@keyframes bubble-in {
  0%, 100% { opacity: 0.6; transform: translateY(0); }
  10%, 30% { opacity: 1; transform: translateY(-4px); }
  40% { opacity: 0.6; transform: translateY(0); }
}

/* 输入三点呼吸 */
.typing-dot {
  animation: typing-blink 2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.3s; }
.typing-dot:nth-child(3) { animation-delay: 0.6s; }

@keyframes typing-blink {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* 通知滑入 */
.notify-slide {
  animation: notify-in 8s ease-in-out infinite;
}

@keyframes notify-in {
  0%, 10% { opacity: 0; transform: translateX(20px); }
  15%, 40% { opacity: 1; transform: translateX(0); }
  45%, 55% { opacity: 0; transform: translateX(20px); }
  60%, 100% { opacity: 0; transform: translateX(20px); }
}

/* 连接线流动 */
.flow-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: flow-draw 6s linear infinite;
}

@keyframes flow-draw {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

/* --- 减少动态效果 --- */
@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;
  }
  .orbit-ring, .bubble-enter, .typing-dot, .notify-slide, .flow-line {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* --- 响应式辅助 --- */
@media (max-width: 640px) {
  h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); }
  h2 { font-size: clamp(1.3rem, 5vw, 1.8rem); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .hero-layout { flex-direction: column !important; }
  .hero-text { text-align: left !important; }
  .hero-visual { width: 100% !important; max-width: 480px; margin: 0 auto; }
}
