/* SafeW 全站共享样式 */
:root {
  /* 色板 */
  --bg-dark: #271334;
  --bg-paper: #E9E8EA;
  --bg-paper-alt: #F8F7F9;
  --text-body: #1D1523;
  --text-paper: #E9E8EA;
  --brand: #8A13DD;
  --accent: #9EED6E;

  /* 设计 Token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;

  /* 排版 */
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --line-height-base: 1.55;
  --line-height-heading: 1.1;
  --tracking-tight: -0.02em;
}

/* 基础重置与排版 */
*, *::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(--line-height-base);
  color: var(--text-body);
  background: var(--bg-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* 容器与布局 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  position: relative;
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); overflow-x: hidden; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); overflow-x: hidden; }
.flex-row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; }
.text-center { text-align: center; }
.mt-lg { margin-top: calc(var(--gap) * 2); }

/* 面与取色变量 */
.dark-face {
  background: var(--bg-dark);
  color: var(--text-paper);
}
.dark-face .hl { color: var(--accent); }
.dark-face .link { color: var(--accent); }
.dark-face .btn-primary { background: var(--accent); color: var(--bg-dark); }
.dark-face .btn-secondary { border-color: var(--text-paper); color: var(--text-paper); }
.dark-face .card { background: rgba(233, 232, 234, 0.08); }
.paper-face {
  background: var(--bg-paper);
  color: var(--text-body);
}
.paper-face .hl { color: var(--brand); }
.paper-face .link { color: var(--brand); }
.paper-face .btn-primary { background: var(--accent); color: var(--bg-dark); }
.paper-face .btn-secondary { border-color: var(--text-body); color: var(--text-body); }
.paper-face .card { background: var(--bg-paper-alt); }

/* 标题系统 */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.5em;
  padding: 4px 10px;
  border-radius: 6px;
  background: currentColor;
  color: var(--bg-dark);
}
.dark-face .badge { background: var(--accent); color: var(--bg-dark); }
.paper-face .badge { background: var(--brand); color: var(--bg-paper); }
h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  line-height: var(--line-height-heading);
  margin-bottom: 0.8em;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  line-height: var(--line-height-heading);
  margin: 1.5em 0 0.8em;
  text-wrap: balance;
}
h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 700;
  margin: 1.2em 0 0.6em;
  text-wrap: balance;
}
p { margin-bottom: 1em; max-width: 38em; }
strong { font-weight: 700; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn svg { width: 20px; height: 20px; stroke-width: 2; }
.btn-secondary { background: transparent; border: 2px solid currentColor; }

/* 卡片与面板 */
.card {
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: calc(var(--gap) * 1.5);
  transition: background-color 0.2s ease;
}
.panel {
  border-radius: var(--radius-card);
  padding: 24px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.svg-panel {
  overflow: hidden;
}

/* 表格 */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid currentColor;
  opacity: 0.9;
}
th { font-weight: 700; opacity: 1; }
tr:last-child td { border-bottom: none; }

/* FAQ */
.faq-item {
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  overflow: hidden;
}
.faq-item summary {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: "+";
  font-weight: 700;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: currentColor;
  color: var(--bg-dark);
  flex-shrink: 0;
}
.faq-item[open] summary::before { content: "-"; }
.faq-item p { padding: 0 20px 16px; margin: 0; }

/* 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background: rgba(233, 232, 234, 0.85);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.dark-face .site-header { background: rgba(39, 19, 52, 0.85); border-bottom-color: rgba(255,255,255,0.1); }
.header-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 12px var(--gap);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; 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; opacity: 0.85; transition: opacity 0.2s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { opacity: 1; }
.site-footer {
  padding: 48px 0;
  border-top: 1px solid currentColor;
  opacity: 0.9;
  font-size: 0.9rem;
}
.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px;
}
.footer-col h4 { font-weight: 700; margin-bottom: 12px; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { opacity: 0.8; transition: opacity 0.2s; }
.footer-col a:hover { opacity: 1; }
.copyright { margin-top: 32px; text-align: center; opacity: 0.6; font-size: 0.85rem; }

/* SVG 响应式控制 */
.svg-responsive { width: 100%; height: auto; }

/* SVG 动效关键帧 */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes float-delay {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.03); }
}
@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes slide-in {
  0% { opacity: 0; transform: translateX(-12px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* 动效类 */
.anim-float { animation: float 4s ease-in-out infinite; }
.anim-float-delay { animation: float-delay 5s ease-in-out infinite 0.5s; }
.anim-breathe { animation: breathe 6s ease-in-out infinite; }
.anim-draw { stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw-line 3s ease forwards; }
.anim-pulse-1 { animation: pulse-dot 2s ease-in-out infinite; }
.anim-pulse-2 { animation: pulse-dot 2s ease-in-out infinite 0.4s; }
.anim-pulse-3 { animation: pulse-dot 2s ease-in-out infinite 0.8s; }
.anim-slide { animation: slide-in 0.8s ease-out both; }

/* 子元素变换中心 */
.anim-transform-box {
  transform-box: fill-box;
  transform-origin: center;
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
