/* =========================================
   SafeW 全站共享样式
   ========================================= */

:root {
  /* 色板 */
  --color-dark: #231334;
  --color-paper: #E9E8EA;
  --color-body: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;

  /* 上下文覆盖变量 */
  --txt: var(--color-body);
  --lnk: var(--color-brand);
  --acc: var(--color-accent);

  /* 设计 Token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 2px solid var(--color-body);
  --card-shadow: 4px 4px 0 var(--color-body);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --lh: 1.75;
}

/* 深色面上下文 */
.bg-dark {
  background-color: var(--color-dark);
  --txt: var(--color-paper);
  --lnk: var(--color-accent);
  --acc: var(--color-accent);
  --card-border: 2px solid rgba(233, 210, 110, 0.4);
  --card-shadow: 4px 4px 0 rgba(233, 210, 110, 0.15);
}

/* 浅色纸面上下文 */
.bg-paper {
  background-color: var(--color-paper);
  --txt: var(--color-body);
  --lnk: var(--color-brand);
  --acc: var(--color-accent);
  --card-border: 2px solid var(--color-body);
  --card-shadow: 4px 4px 0 var(--color-body);
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-main);
  color: var(--txt);
  background-color: var(--color-paper);
  line-height: var(--lh);
  font-size: 17px;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--lnk); text-decoration: none; transition: color 0.2s ease; }
a:hover { opacity: 0.85; }
ul, ol { list-style: none; }

/* 布局容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.section {
  padding-block: var(--section-y);
}

/* 页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-paper);
  border-bottom: 1px solid rgba(28, 21, 35, 0.1);
  backdrop-filter: blur(8px);
  transition: background 0.3s, border-color 0.3s;
}
.bg-dark .site-header { background: var(--color-dark); border-color: rgba(233, 210, 110, 0.2); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; color: var(--txt); }
.brand img { width: 32px; height: 32px; object-fit: contain; }
nav { display: flex; gap: 24px; align-items: center; }
nav a { font-weight: 600; font-size: 0.95rem; color: var(--txt); }
nav a[aria-current="page"] { color: var(--lnk); text-decoration: underline underline-offset-4; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding-inline: 24px;
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s;
  border: none;
  text-decoration: none;
}
.btn:focus-visible { outline: 3px solid var(--lnk); outline-offset: 2px; }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 0 rgba(0,0,0,0.15); }
.btn-secondary {
  background: transparent;
  color: var(--txt);
  border: 2px solid var(--txt);
  box-shadow: none;
}
.btn-secondary:hover { background: rgba(0,0,0,0.05); transform: translateY(-2px); }
.bg-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.bg-dark .btn-secondary:hover { background: rgba(233, 210, 110, 0.1); }

/* 卡片 */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 24px;
  transition: transform 0.2s ease;
}
.bg-dark .card { background: var(--color-dark); }
.card:hover { transform: translateY(-4px); }

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  text-align: left;
}
.bg-dark .data-table th, .bg-dark .data-table td { border-color: rgba(233, 210, 110, 0.2); }
.data-table th { font-weight: 700; color: var(--txt); }
.data-table tr:last-child td { border-bottom: none; }

/* FAQ */
.faq-item {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 12px;
  background: var(--color-paper);
  overflow: hidden;
}
.bg-dark .faq-item { background: var(--color-dark); }
.faq-item summary {
  padding: 16px 20px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-weight: 400;
  font-size: 1.2rem;
  transition: transform 0.2s;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding: 0 20px 16px; line-height: var(--lh); color: var(--txt); }

/* 眉标 */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lnk);
  margin-bottom: 12px;
}

/* 关键词高亮 */
.hl { color: var(--lnk); font-weight: 800; }
.bg-dark .hl { color: var(--acc); }

/* 网格系统 */
.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); }

/* 响应式调整 */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .header-inner nav { display: none; } /* 移动端简化处理，实际项目可加汉堡菜单，此处为保证静态结构完整 */
  .hero-layout { flex-direction: column-reverse; }
}

/* =========================================
   SVG 动效关键帧 (仅动画 transform, opacity, stroke-dashoffset)
   ========================================= */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes slideIn {
  0%, 100% { transform: translateX(0); opacity: 1; }
  50% { transform: translateX(4px); opacity: 0.85; }
}
@keyframes drawLine {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}
@keyframes rotateMesh {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes pulseNode {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 1; }
}

/* 动效类绑定 */
.anim-float { animation: float 4s ease-in-out infinite; }
.anim-breathe { animation: breathe 3s ease-in-out infinite; }
.anim-slide-in { animation: slideIn 5s ease-in-out infinite; }
.anim-line { animation: drawLine 6s ease-in-out infinite; }
.anim-rotate { animation: rotateMesh 12s linear infinite; }
.anim-pulse { animation: pulseNode 4s ease-in-out infinite; }

/* 变换中心控制 */
.rot-center { transform-box: fill-box; transform-origin: center; }

/* 减少动态效果支持 */
@media (prefers-reduced-motion: reduce) {
  [class*="anim-"], .rot-center { animation: none !important; transform: none !important; }
}
