/* ====================
   SafeW 全局样式与动效
   ==================== */

/* --- 设计变量 --- */
:root {
  /* 色板 */
  --color-dark: #13102D;
  --color-paper: #F7F5F3;
  --color-text: #171523;
  --color-brand: #2714EB;
  --color-accent: #89ED6E;

  /* 组件结构 */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 1px solid rgba(23, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 960px;

  /* 字体排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
  --line-height-base: 1.55;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--color-brand); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }
ul, ol { padding-left: 1.2em; margin: 0; }

/* --- 容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* --- 区块节奏 --- */
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}
.section-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.section-paper {
  background-color: var(--color-paper);
  color: var(--color-text);
}

/* --- 眉标 --- */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.5em;
  text-transform: uppercase;
}
.paper .badge { color: var(--color-brand); }
.dark .badge { color: var(--color-accent); }

/* --- 标题 --- */
h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
}
h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  letter-spacing: -0.02em;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 0.8em;
}
h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  margin-bottom: 0.6em;
}
.hl { font-weight: 800; }
.paper .hl { color: var(--color-brand); }
.dark .hl { color: var(--color-accent); }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0 1.5em;
  height: 48px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  text-align: center;
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: none;
}
.btn-primary:hover { transform: translateY(-1px); opacity: 0.9; }

.btn-secondary {
  background: transparent;
  border: 1px solid currentColor;
}
.paper .btn-secondary { color: var(--color-text); border-color: var(--color-text); }
.dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.btn-secondary:hover { opacity: 0.85; }

/* --- 卡片 --- */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: clamp(1.25rem, 2vw, 2rem);
}
.dark .card {
  background-color: var(--color-paper);
  color: var(--color-text);
}

/* --- 布局网格 --- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}
.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}
@media (min-width: 768px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* --- 图文交错行 --- */
.split-row {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
@media (min-width: 768px) {
  .split-row { flex-direction: row; align-items: center; }
  .split-row.reverse { flex-direction: row-reverse; }
  .split-row .text-col { flex: 1; min-width: 0; }
  .split-row .visual-col { flex: 1; min-width: 0; }
}

/* --- 表格 --- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  text-align: left;
  padding: 0.75em 1em;
  border-bottom: 1px solid rgba(23, 21, 35, 0.12);
}
th { font-weight: 600; }

/* --- FAQ Details --- */
details {
  border: var(--card-border);
  border-radius: 12px;
  margin-bottom: var(--gap);
  background: var(--color-paper);
}
.summary {
  list-style: none;
  padding: 1em 1.25em;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.summary::-webkit-details-marker { display: none; }
.summary::after {
  content: "+";
  font-size: 1.25em;
  font-weight: 400;
}
details[open] .summary::after { content: "−"; }
.details-content { padding: 0 1.25em 1.25em; }

/* --- 页头页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(247, 245, 243, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(23, 21, 35, 0.08);
}
.dark-bg .site-header { background-color: rgba(19, 16, 45, 0.9); border-color: rgba(247, 245, 243, 0.1); }
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}
.nav-links { display: none; gap: 1.5em; }
.nav-links a { font-weight: 500; font-size: 0.95rem; }
@media (min-width: 768px) { .nav-links { display: flex; align-items: center; } }
.nav-links a.active { color: var(--color-brand); font-weight: 700; }
.dark-bg .nav-links a.active { color: var(--color-accent); }

.site-footer {
  padding: 3rem 0;
  border-top: 1px solid rgba(23, 21, 35, 0.08);
  font-size: 0.9rem;
}
.dark-bg .site-footer { border-color: rgba(247, 245, 243, 0.08); }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
}
.footer-links { display: flex; gap: 1.5em; }
.footer-links a { opacity: 0.7; }
.footer-links a:hover { opacity: 1; }

/* --- SVG 动效 Keyframes --- */
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.06); opacity: 0.7; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes pulseDot {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* --- 动效类 --- */
.anim-breathe { animation: breathe 6s ease-in-out infinite; }
.anim-float { animation: float 5s ease-in-out infinite; }
.anim-slide-in { animation: slideIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.anim-pulse { animation: pulseDot 2s ease-in-out infinite; }
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }

/* --- 减少动态效果 --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
