/* =========================================
   SafeW 全站共享样式
   ========================================= */

:root {
  /* 色板 */
  --color-dark: #10112D;
  --color-paper: #F5F0E5;
  --color-text: #151523;
  --color-brand: #1416EB;
  --color-accent: #89ED6E;

  /* 结构 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(21,21,35,0.3);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;

  /* 排版 */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --fs-h1: clamp(2rem, 4.6vw, 3.4rem);
  --fs-h2: clamp(1.6rem, 3vw, 2.4rem);
  --fs-body: 17px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  font-size: var(--fs-body);
  line-height: 1.75;
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* 容器与布局 */
.container {
  width: min(100% - 32px, var(--content-max));
  margin-inline: auto;
}

section {
  padding-block: var(--section-y);
  position: relative;
}

.bg-paper { background-color: var(--color-paper); }
.bg-paper-alt { background-color: #EBE6DB; }
.bg-dark { background-color: var(--color-dark); color: var(--color-paper); }

/* 背景上下文取色重置 */
.bg-dark .text-body, .bg-dark h1, .bg-dark h2, .bg-dark h3, .bg-dark p, .bg-dark li { color: var(--color-paper); }
.bg-dark .text-brand { color: var(--color-accent); }
.bg-dark .hl { color: var(--color-accent); }

.paper-card {
  background-color: var(--color-paper);
  color: var(--color-text);
  padding: var(--gap);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
}
.paper-card .hl { color: var(--color-brand); }
.paper-card .text-brand { color: var(--color-brand); }

/* 标题系统 */
h1, h2, h3, h4 { line-height: 1.25; font-weight: 600; letter-spacing: 0; }
h1 { font-size: var(--fs-h1); margin-bottom: 1.5rem; text-wrap: balance; }
h2 { font-size: var(--fs-h2); margin-bottom: 1.25rem; text-wrap: balance; }
h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; max-width: 38em; }
.text-brand { color: var(--color-brand); }
.hl { color: var(--color-brand); font-weight: 700; }
.bg-dark .hl { color: var(--color-accent); }

/* 眉标 */
.breadcrumb-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  color: var(--color-brand);
}
.bg-dark .breadcrumb-label { color: var(--color-accent); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  height: 52px;
  padding-inline: 1.5rem;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  border: none;
}
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(137,237,110,0.25); }
.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 1.5px solid var(--color-text);
}
.bg-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.btn-secondary:hover { opacity: 0.85; transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }

/* 卡片网格 */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: var(--gap); }

.card {
  background: var(--color-paper);
  border-radius: var(--radius-card);
  padding: 1.75rem;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-4px); }
.card-icon { width: 40px; height: 40px; margin-bottom: 1rem; color: var(--color-brand); }
.bg-dark .card { background: #1A1B3A; color: var(--color-paper); }
.bg-dark .card .card-icon { color: var(--color-accent); }
.bg-dark .card h3 { color: var(--color-paper); }
.bg-dark .card p { color: rgba(245,240,229,0.85); }

/* 表格 */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-card); box-shadow: var(--card-shadow); }
table { width: 100%; border-collapse: collapse; background: var(--color-paper); }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid rgba(21,21,35,0.1); }
th { font-weight: 700; background: rgba(20,22,235,0.05); }
td:first-child { font-weight: 600; }
.bg-dark .table-wrapper { box-shadow: none; background: #1A1B3A; }
.bg-dark table { background: #1A1B3A; color: var(--color-paper); }
.bg-dark th { background: rgba(137,237,110,0.08); }
.bg-dark td, .bg-dark th { border-color: rgba(245,240,229,0.1); }

/* FAQ */
.faq-list details {
  background: var(--color-paper);
  border-radius: 12px;
  margin-bottom: 1rem;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}
.bg-dark .faq-list details { background: #1A1B3A; }
.faq-list summary {
  padding: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; font-size: 1.5rem; font-weight: 300; transition: transform 0.2s; }
.faq-list details[open] summary::after { transform: rotate(45deg); }
.faq-list .answer { padding: 0 1.25rem 1.25rem; line-height: 1.7; }

/* 页头页脚 */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(245,240,229,0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(21,21,35,0.08);
  padding: 0.75rem 0;
}
.bg-dark .site-header { background: rgba(16,17,45,0.9); border-color: rgba(245,240,229,0.1); }
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.logo img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; transition: color 0.2s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--color-brand); }
.bg-dark .nav-links a { color: var(--color-paper); }
.bg-dark .nav-links a:hover, .bg-dark .nav-links a[aria-current="page"] { color: var(--color-accent); }

.site-footer {
  background: var(--color-dark);
  color: var(--color-paper);
  padding: 3rem 0;
  font-size: 0.9rem;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); }
.footer-col h4 { margin-bottom: 1rem; color: var(--color-accent); }
.footer-col ul li { margin-bottom: 0.5rem; }
.footer-col a:hover { text-decoration: underline; }
.footer-bottom { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid rgba(245,240,229,0.1); text-align: center; opacity: 0.7; }

/* 时间线 */
.timeline { position: relative; padding-left: 2rem; border-left: 2px solid var(--color-brand); }
.timeline-step { position: relative; margin-bottom: 2rem; padding-left: 1rem; }
.timeline-step::before {
  content: attr(data-step);
  position: absolute; left: -2.6rem; top: 0;
  width: 2rem; height: 2rem;
  background: var(--color-accent); color: var(--color-dark);
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem;
}

/* 新闻卡片 */
.news-card {
  background: var(--color-paper);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  display: flex; flex-direction: column; gap: 0.75rem;
}
.news-card time { font-size: 0.8rem; color: rgba(21,21,35,0.6); font-weight: 500; }
.news-card h3 { font-size: 1.1rem; margin: 0; }
.news-card p { font-size: 0.95rem; margin: 0; }

/* =========================================
   SVG 动效系统
   ========================================= */
.svg-visual { width: 100%; height: auto; max-width: 100%; }
svg { overflow: visible; }

/* 描边绘制 */
.anim-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLoop 6s ease-in-out infinite;
}
@keyframes drawLoop {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}

/* 呼吸缩放 */
.anim-breathe {
  transform-box: fill-box;
  transform-origin: center;
  animation: breathe 5s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.05); opacity: 1; }
}

/* 轨道旋转 */
.anim-orbit {
  transform-box: fill-box;
  transform-origin: center;
  animation: orbitSpin 12s linear infinite;
}
@keyframes orbitSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 浮动 */
.anim-float {
  animation: floatUp 4.5s ease-in-out infinite;
}
@keyframes floatUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* 滑入循环 */
.anim-slide {
  animation: slideCycle 7s ease-in-out infinite;
}
@keyframes slideCycle {
  0%, 100% { transform: translateX(0); opacity: 0.4; }
  20%, 80% { transform: translateX(10px); opacity: 1; }
}

/* 输入点呼吸 */
.anim-dot { animation: dotPulse 2s ease-in-out infinite; }
.anim-dot:nth-child(2) { animation-delay: 0.4s; }
.anim-dot:nth-child(3) { animation-delay: 0.8s; }
@keyframes dotPubble {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .anim-draw, .anim-breathe, .anim-orbit, .anim-float, .anim-slide, .anim-dot {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
    stroke-dashoffset: 0 !important;
  }
}

/* 响应式适配 */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .nav-links span { display: none; }
  .hero-layout { flex-direction: column !important; }
  .split-layout { flex-direction: column-reverse !important; }
  .split-layout .visual-panel { order: 2; }
  .split-layout .text-panel { order: 1; }
}
