/* 
 * SafeW 全站共享样式
 * 包含设计变量、基础排版、组件样式与 SVG 动效
 */

/* === 1. 设计变量 (Design Tokens) === */
:root {
  /* 配色方案 */
  --color-dark-bg: #140E25;       /* 深色面：首屏、重点区 */
  --color-paper-bg: #F5F0E5;      /* 纸面色：内容区底色 */
  --color-text-main: #191523;     /* 正文色：纸面上的文字 */
  --color-brand: #5214EB;         /* 品牌色：纸面上的强调 */
  --color-accent: #C8ED6E;        /* 强调色：按钮、深色面上的强调 */
  
  /* 布局与间距 */
  --content-max: 1120px;          /* 内容最大宽度 */
  --section-y: clamp(5rem, 10vw, 9rem); /* 区块上下间距 */
  --gap: clamp(1.5rem, 3vw, 2.5rem);     /* 同级元素间距 */
  
  /* 圆角与边框 */
  --radius-card: 8px;             /* 卡片微圆角 */
  --radius-btn: 6px;              /* 按钮圆角 */
  --card-border: 1px solid rgba(25, 21, 35, 0.16); /* 细线描边 */
  --card-shadow: none;            /* 无阴影风格 */

  /* 字体 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* === 2. 基础重置与排版 === */
*, *::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);
  background-color: var(--color-paper-bg);
  color: var(--color-text-main);
  line-height: 1.75;
  font-size: 16px;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* === 3. 通用容器 === */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  position: relative;
}

/* 分节线 */
.section-divider {
  height: 1px;
  background-color: rgba(25, 21, 35, 0.1);
  width: 100%;
}

/* === 4. 标题系统 === */
.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 16px;
  padding-left: 24px;
  border-left: 2px solid var(--color-brand);
}

.dark-section .section-label {
  border-left-color: var(--color-accent);
  color: var(--color-accent);
}

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
  margin-bottom: 16px;
}

h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  margin-bottom: 24px;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin-bottom: 32px;
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 12px;
}

/* 高亮词 */
.hl {
  color: var(--color-brand);
}

.dark-section .hl {
  color: var(--color-accent);
}

p {
  margin-bottom: 16px;
  max-width: 38em;
}

/* === 5. 组件：按钮 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  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;
  text-decoration: none;
  gap: 8px;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--color-text-main);
  color: var(--color-text-main);
}

.dark-section .btn-secondary {
  border-color: var(--color-paper-bg);
  color: var(--color-paper-bg);
}

/* === 6. 组件：卡片 === */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--gap);
}

.card {
  background-color: #fff; /* 纸面内的卡片通常用纯白或极浅灰区分 */
  background-color: var(--color-paper-bg);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 24px;
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
}

/* === 7. 组件：表格 === */
.table-wrapper {
  overflow-x: auto;
  width: 100%;
  border: var(--card-border);
  border-radius: var(--radius-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: normal;
}

th, td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
}

th {
  font-weight: 600;
  background-color: rgba(25, 21, 35, 0.03);
}

tr:last-child td {
  border-bottom: none;
}

/* === 8. 组件：FAQ (Details) === */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 16px;
  background-color: #fff;
  background-color: var(--color-paper-bg);
}

summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: '+';
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1;
}

details[open] summary::after {
  content: '−';
}

details p {
  margin-top: 16px;
  margin-bottom: 0;
  font-size: 0.95rem;
  color: #444;
}

/* === 9. 页头与页脚 === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(245, 240, 229, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
  padding: 16px 0;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--color-text-main);
}

.brand-logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
}

.nav-links a {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--color-text-main);
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--color-brand);
}

.site-footer {
  background-color: var(--color-dark-bg);
  color: var(--color-paper-bg);
  padding: 64px 0 32px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.footer-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-links a {
  color: rgba(245, 240, 229, 0.7);
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--color-accent);
}

/* === 10. SVG 动效 (CSS Keyframes) === */

/* 数据点流动 */
@keyframes flow-dots {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

.animate-flow {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: flow-dots 2s linear infinite;
}

/* 浮动呼吸 */
@keyframes float-breathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.animate-float {
  animation: float-breathe 4s ease-in-out infinite;
}

/* 依次浮现 (用于气泡) */
@keyframes pop-in {
  0% { opacity: 0; transform: scale(0.9) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.animate-pop {
  opacity: 0;
  animation: pop-in 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.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;
    scroll-behavior: auto !important;
  }
  .animate-pop { opacity: 1; }
}

/* === 11. 响应式调整 === */
@media (max-width: 768px) {
  .nav-links {
    display: none; /* 简化版：移动端隐藏导航，实际项目需汉堡菜单 */
  }
  
  .header-inner {
    justify-content: center;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2rem;
  }
}
