/* =========================================
   SafeW 全站共享样式
   设计变量 · 排版 · 组件 · SVG 动效
   ========================================= */

/* --- 设计 Token & 变量 --- */
:root {
  /* 色板 */
  --color-dark: #231334;
  --color-paper: #F5F3F7;
  --color-text: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;

  /* 表面上下文变量 */
  --bg: var(--color-paper);
  --fg: var(--color-text);
  --accent-fg: var(--color-brand);
  --border: rgba(0, 0, 0, 0.08);
  --card-bg: rgba(255, 255, 255, 0.5);

  /* 结构 */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;

  /* 字体与行距 */
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --lh-base: 1.75;
}

/* 表面变体 */
.surface-dark {
  --bg: var(--color-dark);
  --fg: var(--color-paper);
  --accent-fg: var(--color-accent);
  --border: rgba(255, 255, 255, 0.12);
  --card-bg: rgba(255, 255, 255, 0.06);
}

.surface-card {
  --bg: rgba(255, 255, 255, 0.65);
  --fg: var(--color-text);
  --accent-fg: var(--color-brand);
  --border: rgba(0, 0, 0, 0.06);
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: var(--lh-base);
  color: var(--fg);
  background-color: var(--bg);
  -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; }
button, input, select, textarea { font: inherit; color: inherit; }

/* --- 布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  background-color: var(--bg);
  color: var(--fg);
  position: relative;
}
.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }

/* --- 排版层级 --- */
.marker {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-fg);
  margin-bottom: 0.6em;
  border-left: 3px solid var(--accent-fg);
  padding-left: 0.6em;
}
h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
  margin-bottom: 0.8em;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.9em;
}
h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.6em;
}
p { margin-bottom: 1em; max-width: 38em; }
.text-hl { color: var(--accent-fg); font-weight: 600; }

/* --- 组件：按钮 --- */
.btn-group { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.5em; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  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;
  text-decoration: none;
  gap: 10px;
}
.btn:focus-visible { outline: 3px solid var(--accent-fg); outline-offset: 2px; }
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: 2px solid transparent;
}
.btn-primary:hover { background-color: #e5c95a; }

.btn-secondary {
  background-color: transparent;
  color: var(--fg);
  border: 2px solid var(--fg);
}
.btn-secondary:hover { background-color: rgba(0,0,0,0.05); }
.surface-dark .btn-secondary { background-color: transparent; color: var(--color-paper); border-color: var(--color-paper); }
.surface-dark .btn-secondary:hover { background-color: rgba(255,255,255,0.1); }

/* --- 组件：卡片 --- */
.card {
  background: var(--card-bg);
  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(-3px); }

/* --- 组件：表格 --- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th { font-weight: 600; white-space: nowrap; }
td { vertical-align: top; }
tr:last-child td { border-bottom: none; }

/* --- 组件：FAQ (Details/Summary) --- */
.faq-list { display: flex; flex-direction: column; gap: 12px; }
details {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  border: var(--card-border);
  transition: background-color 0.2s ease;
}
details[open] { background: rgba(0,0,0,0.03); }
.surface-dark details[open] { background: rgba(255,255,255,0.08); }
summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 400;
  transition: transform 0.2s ease;
}
details[open] summary::after { transform: rotate(45deg); }
.summary-content { margin-top: 12px; line-height: 1.7; color: var(--fg); opacity: 0.9; }

/* --- 组件：页头页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 243, 247, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.surface-dark .site-header { background: rgba(35, 19, 52, 0.9); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.logo img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--accent-fg); }
.nav-links a[aria-current="page"] { font-weight: 700; }

.site-footer {
  padding: 48px 0 32px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  opacity: 0.85;
}
.footer-inner { display: flex; flex-direction: column; gap: 24px; align-items: center; text-align: center; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }
.footer-links a:hover { color: var(--accent-fg); }

/* --- SVG 响应式工具类 --- */
.svg-responsive {
  width: 100%;
  height: auto;
  max-width: 100%;
}

/* --- SVG 动效关键帧 --- */
@keyframes flowDash {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes flowDashLoop {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
@keyframes floatSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes pulseOpacity {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes slideInLeft {
  from { transform: translateX(-12px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* 动效类应用 */
.anim-flow {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: flowDashLoop 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.anim-flow-fast {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: flowDashLoop 3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.anim-float {
  animation: floatSoft 5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.anim-pulse {
  animation: pulseOpacity 3s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.anim-slide {
  animation: slideInLeft 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* --- 响应式适配 --- */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 8px 0; }
  .nav-links { gap: 16px; }
  .btn-group { flex-direction: column; }
  .btn { width: 100%; }
}

@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-flow, .anim-flow-fast, .anim-float, .anim-pulse, .anim-slide {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
