/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 配色 */
  --color-dark: #140E25;
  --color-paper: #F5F0E5;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;
  
  /* 圆角 */
  --radius-card: 8px;
  --radius-btn: 6px;
  
  /* 卡片边界 */
  --card-border: 1px solid rgba(25, 21, 35, 0.16);
  --card-shadow: none;
  
  /* 节奏与密度 */
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  
  /* 内容最大宽度 */
  --content-max: 1120px;
  
  /* 字体栈 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  background-color: var(--color-paper);
  color: var(--color-text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  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; }
button, input, select, textarea { font: inherit; color: inherit; }

/* 容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gap);
  padding-right: var(--gap);
}

/* 区块间距 */
.section { padding-top: var(--section-y); padding-bottom: var(--section-y); }
.section.dark { background-color: var(--color-dark); color: var(--color-paper); }
.section.dark .hl { color: var(--color-accent); }
.section.paper { background-color: var(--color-paper); color: var(--color-text); }
.section.paper .hl { color: var(--color-brand); }

/* 眉标 */
.breadcrumb-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.paper .breadcrumb-label { color: var(--color-brand); }
.dark .breadcrumb-label { color: var(--color-accent); }
.breadcrumb-label::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 2px;
  background-color: currentColor;
}

/* 标题 */
h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
  margin-bottom: 1rem;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 1.5rem;
}
h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.75rem;
}
p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }
.text-intro { font-size: 1.125rem; line-height: 1.6; max-width: 65ch; margin-bottom: 2rem; }

/* 关键词高亮 */
.hl { font-weight: 700; }

/* 按钮 */
.btn-group { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.5rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.btn:focus-visible { outline: 3px solid var(--color-brand); outline-offset: 3px; }
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border-color: var(--color-accent);
}
.btn-primary:hover { background-color: #d4f580; border-color: #d4f580; }
.btn-secondary {
  background-color: transparent;
  color: var(--color-text);
  border-color: var(--color-text);
}
.paper .btn-secondary { color: var(--color-text); border-color: var(--color-text); }
.dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.btn-secondary:hover { opacity: 0.85; }
.btn-icon { width: 20px; height: 20px; stroke-width: 1.8; }

/* 卡片与网格 */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.card {
  background: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--card-shadow);
}
.dark .card { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12); }

/* 表格 */
.spec-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.spec-table th, .spec-table td { padding: 12px 16px; border-bottom: 1px solid rgba(25,21,35,0.1); text-align: left; }
.spec-table th { font-weight: 600; width: 40%; }
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: none; }
.dark .spec-table th, .dark .spec-table td { border-bottom-color: rgba(255,255,255,0.1); }

/* FAQ Details */
.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq-item { border: var(--card-border); border-radius: var(--radius-card); overflow: hidden; }
.faq-item summary {
  padding: 16px 20px;
  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.25rem;
  transition: transform 0.2s ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-answer { padding: 0 20px 16px; color: var(--color-text); line-height: 1.7; }
.dark .faq-item .faq-answer { color: var(--color-paper); }

/* 页头页脚 */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(245, 240, 229, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25,21,35,0.08);
}
.dark .site-header { background: rgba(20, 14, 37, 0.95); border-bottom-color: rgba(255,255,255,0.08); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; 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-weight: 500; font-size: 0.95rem; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--color-brand); }
.dark .nav-links a:hover, .dark .nav-links a[aria-current="page"] { color: var(--color-accent); }
.mobile-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.mobile-toggle svg { width: 24px; height: 24px; stroke: currentColor; }

.site-footer {
  padding: 48px 0;
  border-top: 1px solid rgba(25,21,35,0.08);
  text-align: center;
  font-size: 0.9rem;
  color: rgba(25,21,35,0.6);
}
.dark .site-footer { border-top-color: rgba(255,255,255,0.08); color: rgba(255,255,255,0.5); }
.footer-nav { display: flex; justify-content: center; gap: 24px; margin-bottom: 16px; flex-wrap: wrap; }
.footer-nav a:hover { text-decoration: underline; }

/* SVG 面板容器 */
.svg-panel {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--color-dark);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.svg-panel svg { width: 100%; height: 100%; }

/* 流程条 */
.flow-steps { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: center; margin: 2rem 0; }
.flow-node {
  background: var(--color-paper);
  border: var(--card-border);
  padding: 12px 20px;
  border-radius: var(--radius-card);
  font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.flow-arrow { width: 32px; height: 32px; stroke: var(--color-brand); }
.dark .flow-arrow { stroke: var(--color-accent); }

/* 时间线 */
.timeline { position: relative; padding-left: 32px; margin: 2rem 0; }
.timeline::before {
  content: ""; position: absolute; left: 11px; top: 8px; bottom: 8px;
  width: 2px; background: rgba(25,21,35,0.15);
}
.dark .timeline::before { background: rgba(255,255,255,0.15); }
.timeline-item { position: relative; margin-bottom: 2rem; }
.timeline-item::before {
  content: attr(data-step);
  position: absolute; left: -32px; top: 0;
  width: 24px; height: 24px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
}
.dark .timeline-item::before { background: var(--color-accent); color: var(--color-dark); }

/* 新闻卡片 */
.news-card { display: flex; flex-direction: column; height: 100%; }
.news-meta { font-size: 0.85rem; color: rgba(25,21,35,0.6); margin-bottom: 8px; }
.dark .news-meta { color: rgba(255,255,255,0.6); }
.news-card h4 { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.news-card p { font-size: 0.95rem; line-height: 1.6; flex-grow: 1; }

/* 响应式适配 */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-toggle { display: block; color: inherit; }
  .header-inner { padding: 0; }
  .hero-layout { grid-template-columns: 1fr !important; }
  .feature-row { flex-direction: column !important; }
  .feature-text, .feature-visual { width: 100% !important; }
  .flow-steps { flex-direction: column; }
  .flow-arrow { transform: rotate(90deg); }
}

/* =========================================
   SVG 动效关键帧
   ========================================= */
@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.anim-star { animation: twinkle 4s ease-in-out infinite; }
.anim-star:nth-child(odd) { animation-delay: 1.2s; }
.anim-line { animation: drawLine 6s ease-in-out infinite alternate; }
.anim-bubble { animation: float 5s ease-in-out infinite; }
.anim-bubble:nth-child(even) { animation-delay: 1.5s; }
.anim-dot { animation: breathe 3s ease-in-out infinite; }

/* 旋转缩放修正 */
.anim-spin { transform-box: fill-box; transform-origin: center; animation: spin 12s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* 减少动态效果 */
@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;
  }
}
