/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 设计变量 (Design Tokens) --- */
:root {
  /* 核心色板 */
  --color-bg-dark: #13102D;
  --color-bg-paper: #D6D4ED;
  --color-text-body: #171523;
  --color-brand: #2714EB;
  --color-accent: #89ED6E;

  /* 派生与透明度 */
  --color-border-light: rgba(23, 21, 35, 0.16);
  --color-border-dark: rgba(214, 212, 237, 0.25);

  /* 排版 */
  --font-sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Noto Sans SC", var(--font-sans);
  --text-h1: clamp(2.6rem, 6.4vw, 5rem);
  --text-h2: clamp(1.6rem, 3vw, 2.4rem);
  --text-h3: 1.25rem;
  --text-body: 1.0625rem;
  --line-height-tight: 1.15;
  --line-height-body: 1.75;

  /* 间距与节奏 */
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;

  /* 圆角与边界 */
  --radius-card: 24px;
  --radius-btn: 999px;
  --radius-sm: 8px;
  --card-border: 1px solid var(--color-border-light);
  --card-shadow: none;

  /* 动效时长 */
  --duration-slow: 6s;
  --duration-med: 4s;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--line-height-body);
  color: var(--color-text-body);
  background-color: var(--color-bg-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 容器 */
.container {
  width: min(100% - 2rem, var(--content-max));
  margin-inline: auto;
}

/* 标题系统 */
h1, h2, h3, h4 {
  font-weight: 500;
  line-height: var(--line-height-tight);
  letter-spacing: -0.02em;
  margin-top: 0;
  margin-bottom: 0.6em;
}
h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); margin-bottom: 1.5rem; }
h3 { font-size: var(--text-h3); margin-bottom: 0.8em; }

/* 眉标 (Subtitle/Label) */
.label-tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  padding: 0.25em 0.6em;
  border-radius: var(--radius-sm);
}
/* 纸面上用品牌色，深色面上用强调色，由父级容器控制颜色变量 */
.label-tag { color: var(--label-color, currentColor); }

/* 高亮关键词 */
.hl { color: var(--hl-color, inherit); }

/* 链接与正文 */
a { color: var(--link-color, var(--brand)); text-decoration: underline; text-underline-offset: 2px; transition: opacity 0.2s; }
a:hover { opacity: 0.85; }
p { margin-top: 0; margin-bottom: 1.5em; max-width: 38em; }

/* 按钮组件 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 52px;
  padding: 0 1.5em;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.btn:focus-visible { outline: 2px solid var(--focus-color, var(--accent)); outline-offset: 4px; }

/* 主按钮：强调色底，深色文字 */
.btn-primary {
  background-color: var(--accent);
  color: var(--color-bg-dark);
  border: none;
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); }

/* 次按钮：描边风格 */
.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--btn-border-color, var(--text-body));
  color: var(--btn-text-color, var(--text-body));
}
.btn-secondary:hover { transform: translateY(-1px); background: rgba(0,0,0,0.03); }

/* 卡片与面板 */
.card {
  background: var(--card-bg, transparent);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  box-shadow: var(--card-shadow);
}

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5em;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 0.75em 1em;
  border-bottom: 1px solid var(--table-border, var(--color-border-light));
  text-align: left;
}
.data-table th { font-weight: 600; color: var(--table-header-color, var(--text-body)); }
.data-table td { color: var(--table-text-color, var(--text-body)); }
.data-table tr:last-child td { border-bottom: none; }

/* FAQ (Details/Summary) */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 1rem;
  background: var(--faq-bg, transparent);
}
summary {
  padding: 1.25em 1.5em;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "";
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23171523'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  transition: transform 0.2s;
}
details[open] summary::after { transform: rotate(180deg); }
details > div { padding: 0 1.5em 1.5em; }

/* 页头导航 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--header-border, transparent);
  background: var(--header-bg, transparent);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--header-text, var(--text-body));
}
.brand-logo img { width: 28px; height: 28px; object-fit: contain; }
.nav-links { display: flex; gap: 1.5em; align-items: center; }
.nav-links a {
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--header-text, var(--text-body));
}
.nav-links a:hover { opacity: 0.7; }
.nav-links [aria-current="page"] { color: var(--nav-active, var(--brand)); }

/* 页脚 */
.site-footer {
  padding: 3em 0;
  border-top: 1px solid var(--footer-border, var(--color-border-light));
  text-align: center;
  font-size: 0.9rem;
  color: var(--footer-text, var(--text-body));
}
.footer-links { display: flex; justify-content: center; gap: 1.5em; margin-bottom: 1em; flex-wrap: wrap; }
.footer-links a { color: var(--footer-link, var(--brand)); text-decoration: none; }

/* 响应式适配 */
@media (max-width: 768px) {
  .header-inner { height: 56px; }
  .nav-links { gap: 1em; }
  .btn { height: 48px; font-size: 0.95rem; }
}

/* =========================================
   SVG 动效系统 (CSS Keyframes & Classes)
   ========================================= */

/* 浮动动画 (层叠漂浮) */
@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes float-y-reverse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}
.anim-float-slow { animation: float-y 6s ease-in-out infinite; }
.anim-float-fast { animation: float-y 4s ease-in-out infinite; }
.anim-float-rev { animation: float-y-reverse 5s ease-in-out infinite; }

/* 呼吸动画 (输入点/状态灯) */
@keyframes breathe {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}
.anim-breathe { animation: breathe 3s ease-in-out infinite; }

/* 描边绘制动画 (仅用于装饰性线条，非必须) */
@keyframes draw-stroke {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
.anim-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  animation: draw-stroke 2s ease forwards;
}

/* 旋转动画 (带 transform-box) */
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.anim-spin {
  transform-box: fill-box;
  transform-origin: center;
  animation: spin-slow 12s linear infinite;
}

/* 减少动态效果支持 */
@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;
  }
}

/* =========================================
   页面特定变体 (通过类名覆盖变量)
   ========================================= */

/* 深色面容器 */
.bg-dark {
  background-color: var(--color-bg-dark);
  color: var(--color-bg-paper);
}
.bg-dark .label-tag { color: var(--color-accent); }
.bg-dark a:not(.btn) { color: var(--color-accent); }
.bg-dark .btn-secondary { border-color: var(--color-bg-paper); color: var(--color-bg-paper); }
.bg-dark .card { background: var(--color-bg-paper); border-color: rgba(23,21,35,0.1); color: var(--color-text-body); }
.bg-dark .card .label-tag { color: var(--color-brand); }
.bg-dark .card a { color: var(--color-brand); }
.bg-dark .data-table { --table-border: rgba(23,21,35,0.1); --table-header-color: var(--color-text-body); --table-text-color: var(--color-text-body); }
.bg-dark details { --faq-bg: var(--color-bg-paper); border-color: rgba(23,21,35,0.1); }
.bg-dark details summary { color: var(--color-text-body); }
.bg-dark details summary::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23171523'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E"); }

/* 浅色面容器 (默认) */
.bg-paper {
  background-color: var(--color-bg-paper);
  color: var(--color-text-body);
}
.bg-paper .label-tag { color: var(--color-brand); }
.bg-paper a:not(.btn) { color: var(--color-brand); }
.bg-paper .btn-secondary { border-color: var(--color-text-body); color: var(--color-text-body); }
.bg-paper details { border-color: var(--color-border-light); background: transparent; }
.bg-paper details summary { color: var(--color-text-body); }
.bg-paper details summary::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23171523'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E"); }

/* 页头变体 */
.header-dark {
  --header-bg: rgba(19, 16, 45, 0.85);
  --header-border: rgba(214, 212, 237, 0.15);
  --header-text: var(--color-bg-paper);
  --nav-active: var(--color-accent);
}
.header-paper {
  --header-bg: rgba(214, 212, 237, 0.85);
  --header-border: rgba(23, 21, 35, 0.08);
  --header-text: var(--color-text-body);
  --nav-active: var(--color-brand);
}

/* 新闻卡片网格 */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}
.news-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.news-card time {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 0.5em;
  display: block;
}
.news-card h3 { font-size: 1.1rem; margin-bottom: 0.5em; }
.news-card p { font-size: 0.95rem; margin-bottom: 0; opacity: 0.85; }

/* 步骤条 */
.steps-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
}
.step-item { counter-reset: step-counter; }
.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background-color: var(--step-num-bg, var(--accent));
  color: var(--step-num-text, var(--color-bg-dark));
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.75em;
}
.bg-paper .step-number { background-color: var(--color-brand); color: #fff; }

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
