/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 配色 */
  --color-dark: #19102D;
  --color-paper: #FCFCFD;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #D66EED;
  
  /* 结构 Token */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;
  
  /* 排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --line-height-body: 1.75;
  --heading-weight: 600;
  --heading-ls: 0;
  --heading-lh: 1.25;
  
  /* 间距辅助 */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
}

/* --- 基础重置 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background-color: var(--color-paper);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
ul, ol { list-style: none; }

/* --- 容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--space-md);
}

/* --- 排版 --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-ls);
  line-height: var(--heading-lh);
  color: var(--color-text);
}
.dark-section h1, .dark-section h2, .dark-section h3,
.dark-section .paper-text { color: var(--color-paper); }
.dark-section .brand-text, .dark-section .accent-text { color: var(--color-accent); }

h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); margin-bottom: var(--space-md); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--space-lg); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: var(--space-sm); }
p { margin-bottom: var(--space-sm); max-width: 38em; }
.hl { color: var(--color-brand); font-weight: 700; }
.dark-section .hl { color: var(--color-accent); }

/* --- 眉标 --- */
.kicker {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--space-xs);
  color: var(--color-brand);
}
.dark-section .kicker { color: var(--color-accent); }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-2px); background-color: #c45de0; }
.btn-secondary {
  background: transparent;
  border: 2px solid var(--color-text);
  color: var(--color-text);
}
.dark-section .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}
.btn-secondary:hover { background-color: rgba(0,0,0,0.05); }
.dark-section .btn-secondary:hover { background-color: rgba(255,255,255,0.1); }

/* --- 卡片 --- */
.card {
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  background-color: var(--color-paper);
  padding: var(--space-lg);
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-4px); }
.dark-section .card { background-color: var(--color-paper); }

/* --- 网格布局 --- */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
.flex-col { display: flex; flex-direction: column; gap: var(--gap); }
.flex-row { display: flex; flex-direction: column; gap: var(--gap); }
@media (min-width: 768px) {
  .flex-row { flex-direction: row; align-items: center; }
}

/* --- 表格 --- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-text);
  text-align: left;
}
th { font-weight: 700; background-color: rgba(82, 20, 235, 0.05); }
td { vertical-align: top; }

/* --- FAQ (Details/Summary) --- */
details {
  border: var(--card-border);
  background: var(--color-paper);
  margin-bottom: var(--space-sm);
}
summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-left: 32px;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-brand);
  border-bottom: 2px solid var(--color-brand);
  transform: translateY(-60%) rotate(45deg);
  transition: transform 0.2s ease;
}
details[open] summary::before { transform: translateY(-40%) rotate(-135deg); }
details > div { padding: 0 20px 16px 20px; line-height: 1.7; }

/* --- 导航与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  backdrop-filter: blur(8px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.1rem; }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.nav-links { display: flex; gap: 24px; }
.nav-links a { font-weight: 500; font-size: 0.95rem; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--color-brand); }
.dark-section .nav-links a { color: var(--color-paper); }
.dark-section .nav-links a:hover, .dark-section .nav-links a[aria-current="page"] { color: var(--color-accent); }

.site-footer {
  background-color: var(--color-dark);
  color: var(--color-paper);
  padding: var(--space-xl) 0;
  margin-top: var(--section-y);
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  text-align: center;
}
.footer-links { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; }
.footer-links a { color: rgba(252, 252, 253, 0.7); }
.footer-links a:hover { color: var(--color-accent); }
.footer-copy { font-size: 0.85rem; opacity: 0.6; }

/* --- SVG 动效类 --- */
.svg-panel { width: 100%; height: auto; }
.draw-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawStroke 6s ease-in-out infinite alternate;
}
.breathe {
  animation: breatheOpacity 4s ease-in-out infinite alternate;
}
.float-up {
  animation: floatY 5s ease-in-out infinite alternate;
}
.slide-in {
  animation: slideInX 5s cubic-bezier(0.2, 0.8, 0.2, 1) infinite alternate;
}
.dot-pulse {
  animation: dotPulse 2s ease-in-out infinite alternate;
}

@keyframes drawStroke {
  0% { stroke-dashoffset: 1; }
  20% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 0; }
}
@keyframes breatheOpacity {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}
@keyframes floatY {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}
@keyframes slideInX {
  0% { transform: translateX(-12px); opacity: 0.6; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes dotPulse {
  0% { opacity: 0.3; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1.2); }
}

/* 旋转中心修正 */
.anim-rotate { 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;
    scroll-behavior: auto !important;
  }
  .draw-line, .breathe, .float-up, .slide-in, .dot-pulse {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
