/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 配色 */
  --color-dark-bg: #141838;
  --color-paper: #F7F5F3;
  --color-body-text: #151723;
  --color-brand: #142CEB;
  --color-accent: #6EAFED;

  /* 圆角 */
  --radius-card: 8px;
  --radius-btn: 6px;

  /* 卡片边界与阴影 */
  --card-border: 2px solid var(--color-body-text);
  --card-shadow: 4px 4px 0 var(--color-body-text);

  /* 节奏与密度 */
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 960px;
  --line-height-body: 1.65;

  /* 字体 */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--line-height-body);
  color: var(--color-body-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* 容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gap);
  padding-right: var(--gap);
}

/* 区块通用 */
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  position: relative;
}
.section + .section { border-top: 1px solid rgba(21, 23, 35, 0.12); }

/* 眉标 */
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: 0.75rem;
}
.theme-dark .eyebrow { color: var(--color-accent); }

/* 标题 */
h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
  color: var(--color-body-text);
}
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); line-height: 1.1; margin-bottom: 1rem; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.5rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }
.theme-dark h1, .theme-dark h2, .theme-dark h3, .theme-dark h4 { color: var(--color-paper); }

/* 高亮词 */
.hl { color: var(--color-brand); }
.theme-dark .hl { color: var(--color-accent); }

/* 正文 */
p { margin-bottom: 1rem; max-width: 38em; }
.text-muted { color: rgba(21, 23, 35, 0.7); }
.theme-dark p, .theme-dark .text-muted { color: rgba(247, 245, 243, 0.85); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  border: 2px solid transparent;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
}
.btn-primary:hover { background-color: #5aa3e8; }

.btn-secondary {
  background: transparent;
  border-color: var(--color-body-text);
  color: var(--color-body-text);
}
.theme-dark .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}
.btn-secondary:hover { opacity: 0.85; }

/* 图标占位 */
.icon { width: 20px; height: 20px; flex-shrink: 0; stroke: currentColor; stroke-width: 1.8; fill: none; }

/* 卡片 */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-2px); }
.theme-dark .card {
  background: var(--color-paper);
  color: var(--color-body-text);
}

/* 网格布局 */
.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-row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; }

/* 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(21, 23, 35, 0.15);
  text-align: left;
}
th { font-weight: 600; background: rgba(21, 23, 35, 0.04); }
td { vertical-align: top; }
.theme-dark table th { background: rgba(247, 245, 243, 0.08); }

/* FAQ */
.faq-item { margin-bottom: 1rem; border: var(--card-border); border-radius: var(--radius-card); background: var(--color-paper); }
.faq-item summary {
  padding: 1rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 4px;
  background: rgba(21, 23, 35, 0.06);
  flex-shrink: 0;
}
.faq-item[open] summary::before { content: "-"; }
.faq-item .answer { padding: 0 1rem 1rem; color: var(--color-body-text); line-height: 1.7; }
.theme-dark .faq-item { background: var(--color-paper); color: var(--color-body-text); }
.theme-dark .faq-item summary::before { background: rgba(21, 23, 35, 0.08); }

/* 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 245, 243, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(21, 23, 35, 0.1);
}
.theme-dark .site-header { background: rgba(20, 24, 56, 0.9); border-bottom-color: rgba(247, 245, 243, 0.1); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-size: 0.95rem; font-weight: 500; padding: 0.25rem 0; border-bottom: 2px solid transparent; transition: border-color 0.2s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { border-bottom-color: var(--color-brand); }
.theme-dark .nav-links a:hover, .theme-dark .nav-links a[aria-current="page"] { border-bottom-color: var(--color-accent); }

.site-footer {
  padding: 3rem 0;
  border-top: 1px solid rgba(21, 23, 35, 0.1);
  font-size: 0.9rem;
  color: var(--text-muted);
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 2rem; }
.footer-col h4 { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.05em; margin-bottom: 0.75rem; }
.footer-col ul li { margin-bottom: 0.5rem; }
.footer-col a:hover { text-decoration: underline; }
.footer-bottom { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid rgba(21, 23, 35, 0.1); text-align: center; }

/* 响应式导航折叠 */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: block; }
}
.mobile-menu-btn { display: none; background: none; border: none; cursor: pointer; }

/* =========================================
   SVG 动效系统
   ========================================= */
.svg-anim { width: 100%; height: auto; }
.svg-anim svg { width: 100%; height: 100%; }

/* 线条绘制 */
.draw-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes drawLine {
  0%, 100% { stroke-dashoffset: 0; }
  50% { stroke-dashoffset: 1; }
}

/* 气泡浮动 */
.float-bubble {
  animation: floatBubble 5s ease-in-out infinite;
}
@keyframes floatBubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* 呼吸点 */
.breathe-dot {
  animation: breathe 3s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* 几何旋转拼合 */
.rotate-shape {
  animation: rotateShape 12s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes rotateShape {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.assemble-shape {
  animation: assemble 8s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes assemble {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(0.95) rotate(180deg); }
}

/* 通知滑入 */
.slide-in-card {
  animation: slideIn 7s ease-in-out infinite;
}
@keyframes slideIn {
  0%, 10% { transform: translateX(0); opacity: 1; }
  15%, 85% { transform: translateX(0); opacity: 1; }
  90%, 100% { transform: translateX(12px); opacity: 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;
  }
  .draw-path, .float-bubble, .breathe-dot, .rotate-shape, .assemble-shape, .slide-in-card {
    animation: none !important;
  }
}
