/* =========================================
   SafeW 全局样式与 SVG 动效
   ========================================= */

/* 设计变量 */
:root {
  --color-dark: #1B1231;
  --color-paper: #DBD4ED;
  --color-paper-light: #E8E2F5;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;
  --color-white: #FFFFFF;

  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;

  --font-main: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --transition-base: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 基础重置与排版 */
*, *::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);
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-paper);
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: color var(--transition-base); }
ul, ol { list-style: none; }

/* 容器与网格 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.grid {
  display: grid;
  gap: var(--gap);
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }

/* 区块与背景 */
.section {
  padding-block: var(--section-y);
}
.bg-dark { background: var(--color-dark); color: var(--color-paper); }
.bg-paper { background: var(--color-paper); color: var(--color-text); }
.bg-paper-light { background: var(--color-paper-light); color: var(--color-text); }

/* 眉标与标题 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.bg-dark .tag { color: var(--color-accent); }
.bg-paper .tag { color: var(--color-brand); }
.tag::before {
  content: "";
  display: inline-block;
  width: 1.2em;
  height: 2px;
  background: currentColor;
}

h1, h2, h3 {
  font-weight: 500;
  line-height: 1.15;
  text-wrap: balance;
}
h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  margin-bottom: 0.8em;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 0.6em;
}
h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  margin-bottom: 0.5em;
}
.hl { color: var(--color-brand); }
.bg-dark .hl { color: var(--color-accent); }

/* 文本排版 */
.lead {
  font-size: clamp(1.05rem, 1.2vw, 1.2rem);
  line-height: 1.65;
  max-width: 38em;
  margin-bottom: 1.5rem;
}
.text-body {
  max-width: 38em;
  line-height: 1.7;
}
.text-small {
  font-size: 0.875rem;
  opacity: 0.85;
}

/* 按钮组件 */
.btn-group { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 52px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform var(--transition-base), background var(--transition-base), box-shadow var(--transition-base);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }

.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border: none;
  box-shadow: 0 4px 12px rgba(153, 119, 238, 0.3);
}
.btn-primary:hover { background: #8A66DF; }

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 2px solid var(--color-text);
}
.bg-dark .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}
.bg-dark .btn-secondary:hover { background: rgba(219, 212, 237, 0.1); }

/* 卡片组件 */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  transition: transform var(--transition-base);
}
.bg-dark .card {
  background: var(--color-dark);
  border-color: var(--color-paper);
  color: var(--color-paper);
  box-shadow: 4px 4px 0 var(--color-paper);
}
.card:hover { transform: translateY(-4px); }

/* 列表与定义 */
dl { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1rem; }
dt { font-weight: 600; position: relative; padding-left: 1.2em; }
dt::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 0.5em;
  height: 0.5em;
  background: var(--color-brand);
  border-radius: 2px;
}
.bg-dark dt::before { background: var(--color-accent); }
dd { margin-bottom: 1rem; line-height: 1.6; }

/* 表格组件 */
.table-wrap {
  overflow-x: auto;
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
}
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-paper);
}
th, td {
  padding: 1rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}
th { font-weight: 600; background: rgba(82, 20, 235, 0.05); }
tr:last-child td { border-bottom: none; }
td a { color: var(--color-brand); text-decoration: underline; text-underline-offset: 3px; }
.bg-dark .table-wrap { background: var(--color-dark); border-color: var(--color-paper); }
.bg-dark th { background: rgba(153, 119, 238, 0.1); color: var(--color-paper); }
.bg-dark td, .bg-dark td a { color: var(--color-paper); }

/* FAQ 组件 */
.faq-list { display: flex; flex-direction: column; gap: 0.75rem; }
.faq-item {
  border: var(--card-border);
  border-radius: var(--radius-card);
  background: var(--color-dark);
  overflow: hidden;
}
.faq-item summary {
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  font-weight: 600;
  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-size: 1.25rem;
  font-weight: 400;
  transition: transform var(--transition-base);
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .answer {
  padding: 0 1.5rem 1.25rem;
  line-height: 1.65;
  color: var(--color-paper);
  border-top: 1px solid rgba(219, 212, 237, 0.15);
  padding-top: 1rem;
}

/* 页头与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(27, 18, 49, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(219, 212, 237, 0.1);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.brand-name { font-weight: 700; font-size: 1.1rem; color: var(--color-paper); }
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a {
  color: var(--color-paper);
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0.8;
  transition: opacity var(--transition-base);
}
.nav-links a:hover, .nav-links a[aria-current="page"] { opacity: 1; color: var(--color-accent); }
@media (max-width: 768px) {
  .nav-links { display: none; }
}

.site-footer {
  background: var(--color-dark);
  color: var(--color-paper);
  padding: 3rem 0;
  border-top: 1px solid rgba(219, 212, 237, 0.1);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}
.footer-col h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 1rem; color: var(--color-accent); }
.footer-col ul li { margin-bottom: 0.6rem; }
.footer-col a { opacity: 0.8; font-size: 0.9rem; }
.footer-col a:hover { opacity: 1; color: var(--color-accent); }
.copyright {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(219, 212, 237, 0.1);
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* SVG 响应式基类 */
.svg-responsive { width: 100%; height: auto; }

/* SVG 动效关键帧 */
@keyframes float-slow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes float-medium {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-16px); }
}
@keyframes float-fast {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-22px); }
}
@keyframes draw-path {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes slide-in-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* 动效类绑定 */
.anim-float-slow { animation: float-slow 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-float-medium { animation: float-medium 5s ease-in-out infinite 0.5s; transform-box: fill-box; transform-origin: center; }
.anim-float-fast { animation: float-fast 4s ease-in-out infinite 1s; transform-box: fill-box; transform-origin: center; }
.anim-draw { stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw-path 3s ease-out forwards; }
.anim-breathe { animation: breathe 4s ease-in-out infinite; }
.anim-slide-up { animation: slide-in-up 1.5s ease-out forwards; }

/* 减少动态效果偏好 */
@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-float-slow, .anim-float-medium, .anim-float-fast,
  .anim-draw, .anim-breathe, .anim-slide-up {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}
