/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 色彩体系 */
  --color-dark: #10112D;
  --color-paper: #F5F0E5;
  --color-text: #151523;
  --color-brand: #1416EB;
  --color-accent: #89ED6E;
  
  /* 取色上下文变量 */
  --bg-primary: var(--color-paper);
  --text-primary: var(--color-text);
  --text-highlight: var(--color-brand);
  --link-color: var(--color-brand);
  --badge-color: var(--color-brand);
  --icon-color: var(--color-brand);
  
  /* 组件尺寸与圆角 */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 1px solid rgba(21, 21, 35, 0.16);
  --card-shadow: none;
  
  /* 节奏与间距 */
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;
  
  /* 排版基准 */
  --font-base: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --line-height-body: 1.65;
}

/* --- 基础重置 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-base);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: var(--line-height-body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--link-color); text-decoration: none; transition: color 0.2s ease; }
a:hover { opacity: 0.85; }
ul, ol { list-style: none; }

/* --- 布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.section {
  padding-block: var(--section-y);
}
.grid-auto {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}

/* --- 页头与导航 --- */
.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);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}
.brand-logo img { width: 32px; height: 32px; object-fit: contain; }
.nav-list { display: flex; gap: 24px; align-items: center; }
.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  padding: 6px 0;
  position: relative;
}
.nav-link[aria-current="page"], .nav-link:hover { color: var(--text-highlight); }
.nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--text-highlight);
  border-radius: 2px;
}
.header-cta { display: none; }
@media (min-width: 768px) {
  .header-cta { display: inline-flex; }
}

/* --- 页脚 --- */
.site-footer {
  background: var(--color-dark);
  color: var(--color-paper);
  padding-block: 48px;
  margin-top: auto;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}
.footer-links { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; }
.footer-links a { color: rgba(245, 240, 229, 0.8); font-size: 0.9rem; }
.footer-links a:hover { color: var(--color-accent); }
.copyright { font-size: 0.85rem; opacity: 0.7; }

/* --- 按钮系统 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding-inline: 28px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(137, 237, 110, 0.35); }
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--text-primary);
}
.btn-secondary:hover { background: rgba(21, 21, 35, 0.05); }
/* 深色面上的次按钮变体 */
.dark-surface .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}
.dark-surface .btn-secondary:hover { background: rgba(245, 240, 229, 0.1); }

/* --- 卡片与面板 --- */
.card {
  background: var(--bg-primary);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 24px;
}
.panel {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: 32px;
  position: relative;
  overflow: hidden;
}
/* 深色块内的浅色卡片恢复纸面取色 */
.panel .card {
  --bg-primary: var(--color-paper);
  --text-primary: var(--color-text);
  --text-highlight: var(--color-brand);
  --link-color: var(--color-brand);
  --badge-color: var(--color-brand);
  --icon-color: var(--color-brand);
  border-color: rgba(21, 21, 35, 0.16);
}

/* --- 排版组件 --- */
.breadcrumb-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 12px;
  color: var(--badge-color);
}
.highlight { color: var(--text-highlight); }
h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
  margin-bottom: 24px;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
  margin-bottom: 32px;
  text-wrap: balance;
}
h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 12px;
}
p { margin-bottom: 16px; max-width: 38em; }
.text-muted { opacity: 0.75; font-size: 0.9rem; }

/* --- 列表与定义 --- */
.feature-list dt {
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-highlight);
}
.feature-list dd {
  margin-bottom: 24px;
  padding-left: 16px;
  border-left: 3px solid var(--card-border);
}
.step-list { counter-reset: step; }
.step-item {
  position: relative;
  padding-left: 48px;
  margin-bottom: 32px;
}
.step-item::before {
  counter-increment: step;
  content: "0" counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 36px;
  height: 36px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- 表格 --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
}
.data-table th { font-weight: 600; color: var(--text-highlight); }
.data-table tr:last-child td { border-bottom: none; }

/* --- FAQ --- */
.faq-item { margin-bottom: 16px; border: var(--card-border); border-radius: 12px; overflow: hidden; }
.faq-summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.faq-summary::-webkit-details-marker { display: none; }
.faq-summary::after {
  content: "+";
  font-weight: 400;
  transition: transform 0.2s ease;
}
.faq-item[open] .faq-summary::after { transform: rotate(45deg); }
.faq-answer { padding: 0 20px 20px; color: var(--text-primary); line-height: 1.7; }

/* --- 新闻卡片 --- */
.news-card { display: flex; flex-direction: column; height: 100%; }
.news-date { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; display: block; }
.news-card h3 { margin-bottom: 8px; }
.news-card p { flex-grow: 1; margin-bottom: 0; }

/* --- SVG 动效关键帧 --- */
@keyframes starTwinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.9; }
}
@keyframes lineDraw {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes pulseOpacity {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* 动效类绑定 */
.star { animation: starTwinkle 4s ease-in-out infinite; }
.star:nth-child(odd) { animation-delay: 1.2s; }
.star:nth-child(even) { animation-delay: 2.5s; }
.line-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: lineDraw 6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.bubble { animation: bubbleFloat 5s ease-in-out infinite; }
.bubble:nth-child(2) { animation-delay: 1.5s; }
.bubble:nth-child(3) { animation-delay: 3s; }
.float-panel { animation: bubbleFloat 7s ease-in-out infinite; }

/* 旋转/缩放子元素中心修正 */
svg .anim-center {
  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: none !important;
  }
}

/* --- 响应式适配 --- */
@media (max-width: 768px) {
  .nav-list { display: none; } /* 简化移动端导航，实际项目可加汉堡菜单，此处保持静态结构 */
  .hero-layout { flex-direction: column-reverse; }
  .feature-grid { grid-template-columns: 1fr; }
  .case-layout { flex-direction: column; }
  .platform-table-wrapper { overflow-x: auto; }
}
@media (min-width: 769px) {
  .hero-layout { display: flex; align-items: center; gap: 48px; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .case-layout { display: flex; gap: 48px; align-items: stretch; }
  .news-grid { grid-template-columns: repeat(2, 1fr); }
  @media (min-width: 1024px) {
    .news-grid { grid-template-columns: repeat(4, 1fr); }
  }
}
/* 强制宽度不溢出 */
.overflow-safe { overflow-wrap: anywhere; white-space: normal; }
.min-zero { min-width: 0; }
