/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量与色板 --- */
:root {
  --color-bg-dark: #1B1231;
  --color-bg-paper: #F4F3F7;
  --color-text-main: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;
  --color-bg-card: #EAE8F0;
  --color-bg-card-dark: #2A2045;
  
  --radius-card: 24px;
  --radius-btn: 999px;
  --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-sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

.dark-surface {
  --surface-bg: var(--color-bg-dark);
  --surface-text: var(--color-bg-paper);
  --surface-accent: var(--color-accent);
  --surface-card-bg: var(--color-bg-card-dark);
}
.paper-surface {
  --surface-bg: var(--color-bg-paper);
  --surface-text: var(--color-text-main);
  --surface-accent: var(--color-brand);
  --surface-card-bg: var(--color-bg-card);
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--surface-text);
  background-color: var(--surface-bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: opacity 0.2s ease; }
ul, ol { list-style: none; }

/* --- 布局容器 --- */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding: var(--section-y) 0;
  position: relative;
}
.grid-auto {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* --- 标题与眉标 --- */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
  color: var(--surface-accent);
}
h1, h2, h3, h4 { font-weight: 500; line-height: 1.15; color: var(--surface-text); }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); letter-spacing: -0.02em; margin-bottom: 1rem; text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.2rem; }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: 0.8rem; }
p { margin-bottom: 1rem; max-width: 38em; }
.hl { color: var(--surface-accent); }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
  border: none;
}
.btn:focus-visible { outline: 3px solid var(--surface-accent); outline-offset: 2px; }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-bg-dark);
}
.btn-primary:hover { transform: translateY(-1px); opacity: 0.95; }
.btn-secondary {
  background: transparent;
  color: var(--surface-text);
  border: 1px solid currentColor;
}
.btn-secondary:hover { opacity: 0.8; }
.btn svg { width: 20px; height: 20px; stroke-width: 1.8; }

/* --- 卡片与面板 --- */
.card {
  background: var(--surface-card-bg);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-2px); }
.panel {
  background: var(--surface-card-bg);
  border-radius: var(--radius-card);
  padding: 2rem;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.panel svg { width: 100%; height: auto; }

/* --- 表格 --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.data-table td { padding: 0.8rem 0; border-bottom: 1px solid rgba(128,128,128,0.2); }
.data-table td:first-child { font-weight: 600; width: 40%; }
.data-table tr:last-child td { border-bottom: none; }

/* --- FAQ (Details) --- */
.faq-item {
  background: var(--surface-card-bg);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  overflow: hidden;
}
.faq-item summary {
  padding: 1.2rem 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.2rem;
  font-weight: 400;
  color: var(--surface-accent);
  transition: transform 0.2s ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-answer { padding: 0 1.5rem 1.2rem; line-height: 1.6; color: var(--surface-text); }

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(244, 243, 247, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.dark-surface .site-header { background: rgba(27, 18, 49, 0.85); border-color: rgba(255,255,255,0.05); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; opacity: 0.8; }
.nav-links a:hover, .nav-links a[aria-current="page"] { opacity: 1; color: var(--surface-accent); }
.site-footer {
  padding: 3rem 0;
  border-top: 1px solid rgba(128,128,128,0.15);
  margin-top: var(--section-y);
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; }
.footer-col h4 { margin-bottom: 0.8rem; font-size: 0.9rem; opacity: 0.7; }
.footer-col a { display: block; padding: 0.3rem 0; opacity: 0.8; }
.footer-col a:hover { opacity: 1; color: var(--surface-accent); }

/* =========================================
   SVG 动效系统
   ========================================= */
.svg-container { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.star-point { fill: var(--surface-accent); opacity: 0.4; }
.star-line { stroke: var(--surface-accent); stroke-width: 1.5; fill: none; pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
.chat-bubble { fill: var(--surface-card-bg); stroke: var(--surface-accent); stroke-width: 1; }
.input-bar { fill: var(--surface-bg); stroke: var(--surface-accent); stroke-width: 1; rx: 4; }
.notif-card { fill: var(--surface-card-bg); stroke: var(--surface-accent); stroke-width: 1; rx: 8; }

@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.9); }
  50% { opacity: 0.8; transform: scale(1.1); }
}
@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  50%, 100% { stroke-dashoffset: 0; }
}
@keyframes float-up {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(-6px); opacity: 1; }
}
@keyframes slide-in {
  0% { transform: translateX(20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes breathe-dots {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.anim-star { animation: twinkle 4s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.anim-line { animation: draw-line 6s ease-in-out infinite; }
.anim-bubble { animation: float-up 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-slide { animation: slide-in 4s ease-out forwards; }
.anim-dot { animation: breathe-dots 2s ease-in-out infinite; }

/* 错开动画起始时间，避免同步闪烁 */
.delay-1 { animation-delay: 0.5s; }
.delay-2 { animation-delay: 1.2s; }
.delay-3 { animation-delay: 2.0s; }
.delay-4 { animation-delay: 3.1s; }

/* 减少动态效果适配 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation-name: none !important;
  }
}
