/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 色板 */
  --color-dark: #231334;
  --color-paper: #E9E8EA;
  --color-body: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;
  
  /* 衍生背景（用于卡片区分，不改变取色规则） */
  --bg-card-paper: #F3F2F4;
  --bg-card-dark: #2A1A40;
  --border-subtle: rgba(28, 21, 35, 0.08);

  /* 结构 Token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;
  --header-h: 64px;

  /* 排版 */
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --lh-base: 1.65;
  --lh-tight: 1.15;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: var(--lh-base);
  color: var(--color-body);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
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);
  position: relative;
}
.section--dark {
  background: var(--color-dark);
  color: var(--color-paper);
}
.section--paper {
  background: var(--color-paper);
  color: var(--color-body);
}
.section--surface-light {
  background: var(--bg-card-paper);
  color: var(--color-body);
}

/* 眉标与标题 */
.label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.paper .label { color: var(--color-brand); }
.dark .label { color: var(--color-accent); }

h1, h2, h3, h4 {
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.6rem, 5.5vw, 4rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 24px; }
h3 { font-size: 1.25rem; margin-bottom: 12px; }

.highlight {
  font-weight: 600;
}
.paper .highlight { color: var(--color-brand); }
.dark .highlight { color: var(--color-accent); }

p {
  max-width: 38em;
  margin-bottom: 16px;
}

/* --- 组件：按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}
.btn:hover { transform: translateY(-2px); }

.btn--primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border: none;
}
.btn--primary:hover { background: #E5C85A; }

.btn--secondary {
  background: transparent;
  border: 1.5px solid currentColor;
}
.paper .btn--secondary { color: var(--color-body); border-color: var(--color-body); }
.dark .btn--secondary { color: var(--color-paper); border-color: var(--color-paper); }
.btn--secondary:hover { opacity: 0.85; }

/* --- 组件：卡片与面板 --- */
.card {
  background: var(--bg-card-paper);
  border-radius: var(--radius-card);
  padding: 24px;
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}
.dark .card { background: var(--bg-card-dark); }

.panel {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: 32px;
  overflow: hidden;
  position: relative;
}
.dark .panel { background: var(--color-dark); }

/* --- 组件：表格 --- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 16px;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}
th, td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
th { font-weight: 600; }
.dark th, td { border-color: rgba(255,255,255,0.1); }

/* --- 组件：FAQ --- */
.faq-item {
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 0;
}
.faq-item summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: "+";
  font-weight: 400;
  color: var(--color-brand);
}
.faq-item[open] summary::before { content: "−"; }
.faq-item p { margin-top: 12px; font-size: 0.95rem; color: inherit; opacity: 0.85; }

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(233, 232, 234, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
}
.logo img { height: 32px; width: auto; }

.nav { display: flex; gap: 24px; align-items: center; }
.nav a { font-weight: 500; font-size: 0.95rem; opacity: 0.8; }
.nav a:hover, .nav a[aria-current="page"] { opacity: 1; color: var(--color-brand); }
.dark-nav a:hover, .dark-nav a[aria-current="page"] { color: var(--color-accent); }

.site-footer {
  background: var(--color-dark);
  color: var(--color-paper);
  padding-block: 48px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
}
.footer-col h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 12px; color: var(--color-accent); }
.footer-col a { display: block; padding-block: 6px; opacity: 0.7; font-size: 0.9rem; }
.footer-col a:hover { opacity: 1; }
.copyright { margin-top: 32px; font-size: 0.8rem; opacity: 0.6; text-align: center; }

/* --- 响应式网格辅助 --- */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-2-alternate .grid-2-row:nth-child(even) { direction: rtl; }
  .grid-2-alternate .grid-2-row > * { direction: ltr; }
}

/* =========================================
   SVG 动效系统
   ========================================= */
.svg-anim {
  width: 100%;
  height: auto;
}
/* 同心轨道呼吸 */
@keyframes orbit-breathe {
  0%, 100% { transform: scale(0.96); opacity: 0.4; }
  50% { transform: scale(1.04); opacity: 0.7; }
}
.orbit { animation: orbit-breathe 6s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.orbit:nth-child(2) { animation-delay: -2s; }
.orbit:nth-child(3) { animation-delay: -4s; }

/* 气泡浮动 */
@keyframes bubble-float {
  0%, 100% { transform: translateY(0); opacity: 0.8; }
  50% { transform: translateY(-8px); opacity: 1; }
}
.bubble { animation: bubble-float 5s ease-in-out infinite; }
.bubble:nth-child(odd) { animation-duration: 6.5s; }

/* 输入三点呼吸 */
@keyframes dot-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
.dot-pulse { animation: dot-pulse 1.8s ease-in-out infinite; }
.dot-pulse:nth-child(2) { animation-delay: 0.3s; }
.dot-pulse:nth-child(3) { animation-delay: 0.6s; }

/* 连线流动 */
@keyframes flow-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.flow-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: flow-line 3s linear infinite;
}

/* 通知卡片滑入循环 */
@keyframes slide-in {
  0% { transform: translateX(20px); opacity: 0; }
  15% { transform: translateX(0); opacity: 1; }
  85% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(20px); opacity: 0; }
}
.slide-in { animation: slide-in 8s ease-in-out infinite; }

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 焦点可见性 */
button:focus-visible, a:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}
/* factory-contrast-width */
@media (min-width: 1440px) {
  [data-fc-1440="paper"] {
    color: #e9e8ea !important;
    -webkit-text-fill-color: #e9e8ea !important;
  }
}
