/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计变量 */
:root {
  --c-dark: #19102D;
  --c-paper: #FCFCFD;
  --c-text: #191523;
  --c-brand: #5214EB;
  --c-accent: #D66EED;
  --r-card: 0;
  --r-btn: 0;
  --cb: 0;
  --cs: none;
  --sy: clamp(3.5rem, 7vw, 6rem);
  --g: clamp(1rem, 2vw, 1.75rem);
  --max-w: 960px;
  --lh-body: 1.65;
  --fw-title: 500;
  --lh-title: 1.15;
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: var(--lh-body);
  color: var(--c-text);
  background: var(--c-paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
ul, ol { list-style: none; }

/* 布局容器 */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--g);
}
.section-wrapper {
  padding-block: var(--sy);
}
.divider-bottom {
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

/* 上下文取色 */
.ctx-paper { background: var(--c-paper); color: var(--c-text); }
.ctx-dark { background: var(--c-dark); color: var(--c-paper); }
.ctx-paper .hl { color: var(--c-brand); }
.ctx-dark .hl { color: var(--c-accent); }
.ctx-paper .mb { color: var(--c-brand); }
.ctx-dark .mb { color: var(--c-accent); }

/* 标题系统 */
.mbadge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
  text-transform: uppercase;
}
h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: var(--fw-title);
  line-height: var(--lh-title);
  letter-spacing: -0.02em;
  margin-bottom: 1.2rem;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: var(--fw-title);
  line-height: var(--lh-title);
  margin-bottom: 1.5rem;
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: var(--fw-title);
  line-height: 1.3;
  margin-bottom: 0.8rem;
}
p { margin-bottom: 1rem; max-width: 38em; }
strong { font-weight: 600; }

/* 组件：按钮 */
.btn-group { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--c-accent); color: var(--c-dark); }
.btn-primary:hover { background: #C95CE0; }
.btn-secondary { background: transparent; border: 1px solid var(--c-text); color: var(--c-text); }
.ctx-dark .btn-secondary { border-color: var(--c-paper); color: var(--c-paper); }
.ctx-dark .btn-secondary:hover { background: rgba(255,255,255,0.1); }
.btn-icon { width: 20px; height: 20px; stroke-width: 2; }

/* 组件：卡片 */
.card {
  background: rgba(0,0,0,0.03);
  border: var(--cb);
  box-shadow: var(--cs);
  padding: 24px;
  border-radius: var(--r-card);
}
.ctx-dark .card { background: rgba(255,255,255,0.05); }
.card-grid { display: grid; gap: var(--g); }
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }

/* 组件：表格 */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.08); }
.ctx-dark th, .ctx-dark td { border-bottom-color: rgba(255,255,255,0.1); }
th { font-weight: 600; }

/* 组件：FAQ (details/summary) */
details {
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding: 16px 0;
  cursor: pointer;
}
.ctx-dark details { border-bottom-color: rgba(255,255,255,0.1); }
summary {
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-weight: 400; font-size: 1.2rem; transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details p { margin-top: 12px; color: var(--c-text); }
.ctx-dark details p { color: var(--c-paper); }

/* 组件：步骤/编号 */
.step-list { counter-reset: step; }
.step-item { position: relative; padding-left: 3.5rem; margin-bottom: 2rem; }
.step-num {
  position: absolute; left: 0; top: 0;
  width: 40px; height: 40px;
  background: var(--c-accent);
  color: var(--c-dark);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-btn);
}
.tip-list { counter-reset: tip; }
.tip-item { position: relative; padding-left: 2.5rem; margin-bottom: 1.5rem; }
.tip-num {
  position: absolute; left: 0; top: 0;
  width: 24px; height: 24px;
  background: var(--c-brand);
  color: var(--c-paper);
  font-size: 0.8rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-btn);
}

/* 页头 */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(252,252,253,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.ctx-dark .site-header { background: rgba(25,16,45,0.95); border-bottom-color: rgba(255,255,255,0.1); }
.header-inner { display: flex; justify-content: space-between; align-items: center; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.brand img { height: 32px; width: auto; }
nav { display: flex; gap: 24px; align-items: center; }
nav a { font-size: 0.95rem; font-weight: 500; }
nav a:hover { color: var(--c-brand); }
.ctx-dark nav a:hover { color: var(--c-accent); }
nav a[aria-current="page"] { color: var(--c-brand); font-weight: 600; }
.ctx-dark nav a[aria-current="page"] { color: var(--c-accent); }

/* 页脚 */
.site-footer {
  padding: 40px 0;
  border-top: 1px solid rgba(0,0,0,0.08);
  font-size: 0.9rem;
  color: rgba(0,0,0,0.6);
}
.ctx-dark .site-footer { border-top-color: rgba(255,255,255,0.1); color: rgba(255,255,255,0.7); }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px; }
.footer-links { display: flex; gap: 16px; }
.footer-links a:hover { color: var(--c-brand); }
.ctx-dark .footer-links a:hover { color: var(--c-accent); }

/* SVG 基础 */
.svg-panel { width: 100%; height: auto; max-width: 100%; }
.svg-ui { width: 100%; height: auto; }

/* SVG 动效 Keyframes */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
@keyframes dash-in {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes slide-up {
  0% { transform: translateY(12px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes orbit-spin {
  0% { transform: rotate(0deg) scale(1); opacity: 0.4; }
  50% { transform: rotate(180deg) scale(1.05); opacity: 0.8; }
  100% { transform: rotate(360deg) scale(1); opacity: 0.4; }
}
@keyframes pulse-dot {
  0%, 100% { r: 3; opacity: 0.5; }
  50% { r: 5; opacity: 1; }
}

/* 动效类 */
.anim-float { animation: float 4s ease-in-out infinite; }
.anim-float-delay { animation: float 5s ease-in-out infinite 1s; }
.anim-breathe { animation: breathe 3.5s ease-in-out infinite; }
.anim-draw { animation: dash-in 2s ease forwards; }
.anim-slide-up { animation: slide-up 0.8s ease forwards; }
.anim-orbit { animation: orbit-spin 12s linear infinite; transform-box: fill-box; transform-origin: center; }
.anim-pulse { animation: pulse-dot 2s ease-in-out 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: 640px) {
  .header-inner { height: 56px; }
  nav { gap: 12px; }
  nav a { font-size: 0.85rem; }
  .btn-group { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
}
