/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计变量 */
:root {
  --color-dark: #19102D;
  --color-paper: #FCFCFD;
  --color-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #D66EED;
  
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 2px solid var(--color-body);
  --card-shadow: 4px 4px 0 var(--color-body);
  
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;
  
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --line-height-base: 1.75;
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-main);
  font-size: 16px;
  line-height: var(--line-height-base);
  color: var(--color-body);
  background-color: var(--color-paper);
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* 容器与区块 */
.container {
  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);
}
.dark-surface .hl { color: var(--color-accent); }
.dark-surface .badge { color: var(--color-accent); }
.dark-surface .text-muted { color: rgba(252, 252, 253, 0.7); }
.paper-surface {
  background-color: var(--color-paper);
  color: var(--color-body);
}
.paper-surface .hl { color: var(--color-brand); }
.paper-surface .badge { color: var(--color-brand); }
.paper-surface .text-muted { color: rgba(25, 21, 35, 0.65); }

/* 卡片与面板 */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  position: relative;
}
.dark-surface .card {
  background: var(--color-paper);
  color: var(--color-body);
}
.visual-panel {
  background: var(--color-dark);
  border: 1px solid rgba(252, 252, 253, 0.15);
  padding: var(--gap);
  position: relative;
  overflow: hidden;
}
.dark-surface .visual-panel {
  background: rgba(252, 252, 253, 0.05);
  border-color: rgba(252, 252, 253, 0.1);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 52px;
  padding-inline: 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  text-align: center;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border: 2px solid var(--color-accent);
}
.btn-primary:hover { background: #c95ce0; border-color: #c95ce0; }
.btn-secondary {
  background: transparent;
  color: var(--color-body);
  border: 2px solid var(--color-body);
}
.dark-surface .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}
.btn-secondary:hover { background: rgba(25, 21, 35, 0.05); }
.dark-surface .btn-secondary:hover { background: rgba(252, 252, 253, 0.08); }

/* 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.8rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(25, 21, 35, 0.15);
}
th { font-weight: 700; letter-spacing: 0.02em; }
td { color: var(--color-body); }
.dark-surface th, .dark-surface td { border-color: rgba(252, 252, 253, 0.15); }
.dark-surface td { color: var(--color-paper); }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 1rem; }
.faq-item {
  border: var(--card-border);
  background: var(--color-paper);
}
.faq-item summary {
  padding: 1rem;
  cursor: pointer;
  font-weight: 600;
  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-size: 1.2rem;
  font-weight: 400;
}
.faq-item[open] summary::after { content: "-"; }
.faq-item p {
  padding: 0 1rem 1rem;
  margin: 0;
  color: var(--color-body);
  line-height: 1.7;
}
.dark-surface .faq-item { background: rgba(252, 252, 253, 0.06); border-color: rgba(252, 252, 253, 0.2); }
.dark-surface .faq-item p { color: var(--color-paper); }

/* 眉标 */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

/* 高亮词 */
.hl { font-weight: 800; }

/* 网格布局 */
.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); }
.flex-center { display: flex; align-items: center; justify-content: center; }
.text-center { text-align: center; }

/* 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252, 252, 253, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
}
.dark-surface .site-header { background: rgba(25, 16, 45, 0.92); border-color: rgba(252, 252, 253, 0.08); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 0.8rem; font-weight: 800; font-size: 1.1rem; }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; transition: color 0.2s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--color-brand); }
.dark-surface .nav-links a { color: var(--color-paper); }
.dark-surface .nav-links a:hover, .dark-surface .nav-links a[aria-current="page"] { color: var(--color-accent); }
.footer {
  background: var(--color-dark);
  color: var(--color-paper);
  padding-block: 3rem;
  border-top: 1px solid rgba(252, 252, 253, 0.1);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
}
.footer h4 { margin: 0 0 1rem; font-size: 1rem; letter-spacing: 0.02em; }
.footer ul li { margin-bottom: 0.6rem; }
.footer a { color: rgba(252, 252, 253, 0.7); transition: color 0.2s; }
.footer a:hover { color: var(--color-accent); }
.copyright {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(252, 252, 253, 0.1);
  text-align: center;
  font-size: 0.85rem;
  color: rgba(252, 252, 253, 0.5);
}

/* =========================================
   SVG 动效系统
   ========================================= */
.svg-panel {
  width: 100%;
  height: auto;
  display: block;
}
.svg-element {
  transform-box: fill-box;
  transform-origin: center;
}

/* 线条自绘 */
@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.draw-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 6s ease-in-out infinite alternate;
}

/* 气泡浮动 */
@keyframes float-bubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.float-anim { animation: float-bubble 4.5s ease-in-out infinite; }

/* 输入呼吸点 */
@keyframes breathe-dot {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
.breathe-1 { animation: breathe-dot 2.4s ease-in-out infinite 0s; }
.breathe-2 { animation: breathe-dot 2.4s ease-in-out infinite 0.4s; }
.breathe-3 { animation: breathe-dot 2.4s ease-in-out infinite 0.8s; }

/* 通知滑入 */
@keyframes slide-in {
  0% { transform: translateX(20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
.slide-anim { animation: slide-in 5s ease-in-out infinite alternate; }

/* 连接线流动 */
@keyframes flow-dash {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.flow-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: flow-dash 8s linear infinite;
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 1rem 0; }
  .nav-links { order: 3; width: 100%; justify-content: center; margin-top: 0.5rem; }
  .btn { width: 100%; }
}
