/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 1. 设计变量（色板） */
:root {
  --c-dark: #121531;
  --c-paper: #E8E9EA;
  --c-body: #151723;
  --c-brand: #142CEB;
  --c-accent: #ED7D6E;

  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 2px solid;
  --card-shadow: 4px 4px 0;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;
}

/* 2. 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  line-height: 1.75;
  color: var(--c-body);
  background: var(--c-paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: opacity 0.2s; }
ul, ol { list-style: none; }

/* 3. 主题层（纸面 / 深色面） */
.theme-paper {
  --bg: var(--c-paper);
  --text-main: var(--c-body);
  --text-sub: #4a4c54;
  --accent: var(--c-brand);
  --border: rgba(21, 23, 35, 0.12);
  --btn-text: var(--c-body);
}
.theme-dark {
  --bg: var(--c-dark);
  --text-main: var(--c-paper);
  --text-sub: rgba(232, 233, 234, 0.8);
  --accent: var(--c-accent);
  --border: rgba(232, 233, 234, 0.15);
  --btn-text: var(--c-dark);
}
/* 深色面内的浅色卡片恢复纸面取色 */
.theme-dark .card-light {
  --bg: var(--c-paper);
  --text-main: var(--c-body);
  --text-sub: #4a4c54;
  --accent: var(--c-brand);
  --border: var(--c-body);
  --btn-text: var(--c-body);
  background: var(--c-paper);
  border: var(--card-border) var(--c-body);
  box-shadow: var(--card-shadow) var(--c-body);
}

/* 4. 布局容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  background: var(--bg);
}
.section + .section { border-top: 1px solid var(--border); }

/* 5. 排版组件 */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.5em;
  text-transform: uppercase;
}
h1, h2, h3 {
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-main);
  letter-spacing: 0;
}
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); margin-bottom: 1em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 0.8em; }
h3 { font-size: 1.25rem; margin-bottom: 0.5em; }
p { color: var(--text-sub); margin-bottom: 1em; max-width: 38em; }
strong { font-weight: 600; color: var(--text-main); }
.highlight { color: var(--accent); font-weight: 600; }

/* 6. 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.8em 1.6em;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary {
  background: var(--accent);
  color: var(--btn-text);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.btn-secondary {
  background: transparent;
  border-color: var(--text-main);
  color: var(--text-main);
}
.btn-secondary:hover { background: rgba(128,128,128,0.1); }

/* 7. 卡片与网格 */
.card {
  background: var(--bg);
  border: var(--card-border) var(--border);
  box-shadow: var(--card-shadow) var(--border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  height: 100%;
}
.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); }

/* 8. 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  color: var(--text-main);
}
th, td {
  padding: 0.8em 1em;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th { font-weight: 600; color: var(--accent); }
td:first-child { font-weight: 600; color: var(--text-main); }

/* 9. FAQ (Details) */
details {
  border: var(--card-border) var(--border);
  border-radius: var(--radius-card);
  margin-bottom: 0.8em;
  background: var(--bg);
}
summary {
  padding: 1em 1.2em;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-main);
  list-style: none;
  position: relative;
  padding-left: 2em;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "+";
  position: absolute;
  left: 1.2em;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-weight: 700;
}
details[open] summary::before { content: "-"; }
details > div { padding: 0 1.2em 1em 2.2em; color: var(--text-sub); }

/* 10. 步骤条 */
.steps { display: flex; gap: var(--gap); flex-wrap: wrap; }
.step { flex: 1 1 200px; counter-increment: step; }
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: var(--accent);
  color: var(--btn-text);
  font-weight: 700;
  border-radius: 8px;
  margin-bottom: 0.6em;
}

/* 11. 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(232, 233, 234, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.theme-dark .site-header { background: rgba(18, 21, 49, 0.9); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 0.6em; font-weight: 700; color: var(--text-main); }
.brand img { width: 28px; height: 28px; object-fit: contain; }
nav { display: flex; gap: 1.5em; align-items: center; }
nav a { font-weight: 500; color: var(--text-sub); }
nav a:hover, nav a[aria-current="page"] { color: var(--accent); }
.footer {
  padding: 2em 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-sub);
}
.footer-links { display: flex; justify-content: center; gap: 1.5em; margin-bottom: 1em; }

/* 12. SVG 动效基础与 Keyframes */
.svg-anim { width: 100%; height: auto; overflow: visible; }
.anim-fade-up { opacity: 0; transform: translateY(12px); animation: fadeUp 1.2s ease-out forwards; }
.anim-breathe { animation: breathe 3s ease-in-out infinite alternate; }
.anim-flow { stroke-dasharray: 1; stroke-dashoffset: 0; animation: flowDash 2.5s linear infinite; }
.anim-twinkle { animation: twinkle 4s ease-in-out infinite alternate; }
.anim-float { animation: float 6s ease-in-out infinite alternate; }
.transform-box-fill { transform-box: fill-box; transform-origin: center; }

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes breathe {
  from { opacity: 0.4; }
  to { opacity: 1; }
}
@keyframes flowDash {
  to { stroke-dashoffset: 1; }
}
@keyframes twinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}
@keyframes float {
  from { transform: translateY(0); }
  to { transform: translateY(-6px); }
}

/* 减少动态效果适配 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation-delay: 0ms !important;
  }
  .anim-fade-up { opacity: 1; transform: none; }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .steps { flex-direction: column; }
  .header-inner { padding: 0; }
  nav { display: none; } /* 移动端简化：实际项目可加汉堡菜单，此处保持静态导航结构 */
}
