/* =========================================
   SafeW 全站共享样式
   Design Tokens & Base System
   ========================================= */
:root {
  /* 配色 */
  --color-dark: #271231;
  --color-paper: #F6F3F7;
  --color-text: #1F1523;
  --color-brand: #9E13DD;
  --color-accent: #ED6EC0;
  --color-bg-alt: #EDEAF0;
  
  /* 尺寸与节奏 */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(31, 21, 35, 0.3);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;
  
  /* 排版 */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.75;
  color: var(--color-text);
  background-color: var(--color-paper);
  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: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

/* 主题切换变量覆写 */
.theme-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.theme-dark .hl { color: var(--color-accent); }
.theme-dark .meta-label { color: var(--color-accent); }
.theme-dark a:not(.btn) { color: var(--color-accent); }
.theme-dark .card { background: var(--color-paper); color: var(--color-text); }
.theme-dark .table-row:nth-child(even) { background: rgba(255,255,255,0.05); }

.theme-paper {
  background-color: var(--color-paper);
  color: var(--color-text);
}
.theme-paper .hl { color: var(--color-brand); }
.theme-paper .meta-label { color: var(--color-brand); }
.theme-paper a:not(.btn) { color: var(--color-brand); }

/* 排版组件 */
.meta-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}
.section-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
  margin-bottom: var(--gap);
}
.section-body {
  max-width: 38em;
  margin-bottom: var(--gap);
}
.hl { font-weight: 600; }

/* 按钮 */
.btn-group { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 24px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-secondary {
  background: transparent;
  border: 1px solid var(--color-text);
  color: var(--color-text);
}
.theme-dark .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* 卡片网格 */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  position: relative;
}
.theme-dark .card { background: var(--color-paper); color: var(--color-text); }
.card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
  line-height: 1.3;
}
.card p { font-size: 0.95rem; line-height: 1.7; margin-bottom: 0.6rem; }
.card ul { padding-left: 1.2rem; }
.card li { position: relative; margin-bottom: 0.4rem; font-size: 0.95rem; }
.card li::before {
  content: "";
  position: absolute;
  left: -1.2rem;
  top: 0.55em;
  width: 6px;
  height: 6px;
  background: currentColor;
  opacity: 0.6;
}

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin-top: var(--gap);
}
.data-table th, .data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(128,128,128,0.2);
}
.data-table th { font-weight: 600; }
.table-row:nth-child(even) { background: rgba(0,0,0,0.03); }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq-item details {
  background: var(--color-paper);
  border: 1px solid rgba(128,128,128,0.15);
  padding: 16px;
}
.theme-dark .faq-item details { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.1); }
.faq-item summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-weight: 400;
  font-size: 1.2rem;
  transition: transform 0.2s;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { margin-top: 12px; line-height: 1.7; }

/* 时间线 */
.timeline { position: relative; padding-left: 24px; border-left: 2px solid currentColor; opacity: 0.8; }
.timeline-step { position: relative; margin-bottom: 32px; }
.timeline-step::before {
  content: attr(data-num);
  position: absolute;
  left: -40px;
  top: 0;
  width: 28px;
  height: 28px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-dark .timeline-step::before { background: var(--color-accent); color: var(--color-dark); }
.theme-paper .timeline-step::before { background: var(--color-accent); color: var(--color-dark); }
.timeline-step h4 { font-size: 1.1rem; font-weight: 600; margin-bottom: 6px; }
.timeline-step p { font-size: 0.95rem; opacity: 0.9; }

/* 新闻卡片 */
.news-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--gap); }
.news-card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  display: flex;
  flex-direction: column;
}
.news-card time { font-size: 0.8rem; font-weight: 600; opacity: 0.7; margin-bottom: 8px; }
.news-card h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.news-card p { font-size: 0.95rem; line-height: 1.65; flex-grow: 1; }

/* 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-paper);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  backdrop-filter: blur(8px);
}
.theme-dark .site-header { background: var(--color-dark); border-bottom-color: rgba(255,255,255,0.1); }
.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 { height: 32px; width: auto; }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { font-size: 0.95rem; font-weight: 500; opacity: 0.8; }
.nav-links a:hover, .nav-links a[aria-current="page"] { opacity: 1; }
.footer { padding: 48px 0; border-top: 1px solid rgba(128,128,128,0.2); margin-top: var(--section-y); }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 32px; }
.footer-col h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 12px; }
.footer-col ul li { margin-bottom: 8px; font-size: 0.9rem; }

/* SVG 动效基础 */
.hero-svg { width: 100%; height: auto; max-width: 800px; margin: 0 auto; }
.svg-element { transition: transform 0.3s ease; }
.flow-path { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }

@keyframes float-slow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes float-med {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes float-fast {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}
@keyframes dash-flow {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes bubble-in {
  0%, 100% { opacity: 0.85; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

.anim-float-1 { animation: float-slow 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-float-2 { animation: float-med 7.5s ease-in-out infinite 0.5s; transform-box: fill-box; transform-origin: center; }
.anim-float-3 { animation: float-fast 5s ease-in-out infinite 1.2s; transform-box: fill-box; transform-origin: center; }
.anim-draw { animation: dash-flow 2.5s linear infinite; }
.anim-bubble { animation: bubble-in 4s ease-in-out infinite; 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;
    animation-delay: 0ms !important;
  }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .header-inner { height: 56px; }
  .nav-links { gap: 16px; }
  .grid-cards { grid-template-columns: 1fr; }
  .news-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; }
  
  /* 修复横向溢出：确保表格和网格在移动端不超出容器 */
  .data-table, .step-grid, .checklist-grid {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .spec-table { width: 100%; min-width: 600px; }
  .step-grid { display: block; }
  .step-grid > div:first-child { margin-bottom: 32px; }
  .hero-svg { max-width: 100%; margin-top: 32px; }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
