/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 颜色系统 */
  --color-dark: #13102D;
  --color-paper: #F7F5F3;
  --color-body: #171523;
  --color-brand: #2714EB;
  --color-accent: #89ED6E;

  /* 结构 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 1px solid rgba(23, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;

  /* 排版 Token */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lh-tight: 1.25;
  --lh-body: 1.55;
}

/* --- 基础重置 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  line-height: var(--lh-body);
  color: var(--color-body);
  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; }
button, input { font: inherit; color: inherit; }

/* --- 容器与布局 --- */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.grid-2 { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.flex-center { display: flex; align-items: center; justify-content: center; }

/* --- 表面层配色覆盖 --- */
.surface-dark {
  --bg: var(--color-dark);
  --text-main: var(--color-paper);
  --text-sub: rgba(247, 245, 243, 0.85);
  --accent: var(--color-accent);
  --brand: var(--color-accent);
  background-color: var(--bg);
  color: var(--text-main);
}
.surface-dark .hl { color: var(--accent); }
.surface-dark a:not(.btn) { color: var(--accent); }
.surface-dark .overline { color: var(--accent); }
.surface-dark .card { background: var(--color-paper); color: var(--color-body); border-color: rgba(23, 21, 35, 0.16); }

.surface-paper {
  --bg: var(--color-paper);
  --text-main: var(--color-body);
  --text-sub: var(--color-body);
  --accent: var(--color-accent);
  --brand: var(--color-brand);
  background-color: var(--bg);
  color: var(--text-main);
}
.surface-paper .hl { color: var(--brand); }
.surface-paper a:not(.btn) { color: var(--brand); }
.surface-paper .overline { color: var(--brand); }

/* --- 排版组件 --- */
.overline {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--gap);
}
.section-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  line-height: var(--lh-tight);
  margin-bottom: calc(var(--gap) * 2);
  letter-spacing: 0;
}
.section-title .hl { font-weight: 800; }
.text-body {
  font-size: 1rem;
  line-height: var(--lh-body);
  color: var(--text-sub);
  max-width: 38em;
}
.hl { font-weight: 700; }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  border: none;
  white-space: nowrap;
}
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background-color: var(--accent);
  color: var(--color-dark);
}
.btn-primary:hover { background-color: #7ce060; }
.btn-secondary {
  background: transparent;
  border: 2px solid currentColor;
}
.surface-dark .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.surface-paper .btn-secondary { border-color: var(--color-body); color: var(--color-body); }

/* --- 卡片与面板 --- */
.card {
  background: var(--bg);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-2px); }
.panel {
  background: var(--bg);
  border-radius: var(--radius-card);
  padding: calc(var(--gap) * 2);
  position: relative;
  overflow: hidden;
}

/* --- 表格 --- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-card); border: var(--card-border); }
table { width: 100%; border-collapse: collapse; min-width: 320px; }
th, td { padding: 16px; text-align: left; border-bottom: var(--card-border); }
th { font-weight: 600; background: rgba(0,0,0,0.03); }
td:first-child { font-weight: 600; }
tr:last-child th, tr:last-child td { border-bottom: none; }

/* --- FAQ --- */
.faq-item { border-bottom: var(--card-border); padding: 16px 0; }
.faq-item summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  background: var(--brand);
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2"><path d="M12 5v14M5 12h14"/></svg>') center/contain no-repeat;
  flex-shrink: 0;
}
.faq-item[open] summary::before {
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2"><path d="M5 12h14"/></svg>') center/contain no-repeat;
}
.faq-answer { margin-top: 12px; padding-left: 30px; color: var(--text-sub); }

/* --- 页头页脚 --- */
.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(23, 21, 35, 0.08);
}
.surface-dark .site-header { background: rgba(19, 16, 45, 0.95); border-bottom-color: rgba(247, 245, 243, 0.1); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand img { height: 32px; width: auto; }
nav ul { display: flex; gap: 24px; }
nav a { font-weight: 500; font-size: 0.95rem; transition: opacity 0.2s; }
nav a:hover, nav a[aria-current="page"] { opacity: 0.7; }
.site-footer {
  padding: 48px 0;
  border-top: 1px solid rgba(23, 21, 35, 0.1);
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-sub);
}
.surface-dark .site-footer { border-top-color: rgba(247, 245, 243, 0.1); }

/* --- SVG 动效关键帧 --- */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes draw {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
@keyframes blink {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes slideIn {
  0% { transform: translateX(20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes dashFlow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

/* --- 动效类绑定 --- */
.anim-float { animation: float 6s ease-in-out infinite; }
.anim-float-delay { animation: float 6s ease-in-out 1.5s infinite; }
.anim-draw { animation: draw 4s ease-in-out infinite; }
.anim-blink { animation: blink 3s ease-in-out infinite; }
.anim-slide { animation: slideIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.anim-flow { animation: dashFlow 3s linear infinite; }

/* 限制动画区域 */
.hero-svg { width: 100%; height: auto; max-width: 600px; margin: 0 auto; }
.hero-svg path, .hero-svg line, .hero-svg polyline { vector-effect: non-scaling-stroke; }

/* --- 响应式与无障碍 --- */
@media (max-width: 768px) {
  .header-inner nav ul { display: none; }
  .section-title { font-size: 1.8rem; }
}
@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;
  }
  .anim-float, .anim-draw, .anim-blink, .anim-slide, .anim-flow { animation: none !important; }
}
