/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计 Token & 变量 --- */
:root {
  /* 色彩系统 */
  --bg-dark: #121531;
  --bg-paper: #E8E9EA;
  --text-body: #151723;
  --brand: #142CEB;
  --accent: #ED7D6E;
  
  /* 圆角与边界 */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: none;
  
  /* 间距与节奏 */
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;
  
  /* 排版基础 */
  --font-main: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --lh-base: 1.65;
}

/* 面层变量覆盖规则 */
.section-paper {
  --text-primary: var(--text-body);
  --text-secondary: var(--text-body);
  --link-color: var(--brand);
  --highlight-color: var(--brand);
  --btn-text: var(--bg-dark);
  background-color: var(--bg-paper);
}

.section-dark {
  --text-primary: var(--bg-paper);
  --text-secondary: rgba(232, 233, 234, 0.85);
  --link-color: var(--accent);
  --highlight-color: var(--accent);
  --btn-text: var(--bg-dark);
  background-color: var(--bg-dark);
}

.card-light-on-dark {
  --text-primary: var(--text-body);
  --text-secondary: var(--text-body);
  --link-color: var(--brand);
  --highlight-color: var(--brand);
  --btn-text: var(--bg-dark);
  background-color: var(--bg-paper);
  border-radius: var(--radius-card);
  padding: var(--gap);
}

/* --- 基础重置与排版 --- */
*, *::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: var(--lh-base);
  color: var(--text-primary);
  background-color: var(--bg-paper);
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--link-color); text-decoration: none; transition: opacity 0.2s ease; }
a:hover { opacity: 0.8; }
a:focus-visible { outline: 2px solid var(--highlight-color); outline-offset: 3px; border-radius: 4px; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* 容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

/* 段落限制 */
p, li { max-width: 38em; }
.text-center { text-align: center; }
.mb-gap { margin-bottom: var(--gap); }
.mt-gap { margin-top: var(--gap); }

/* --- 标题系统 --- */
h1, h2, h3, h4 { font-weight: 600; line-height: 1.25; letter-spacing: 0; text-wrap: balance; color: var(--text-primary); }
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); margin-bottom: calc(var(--gap) * 0.8); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: calc(var(--gap) * 0.6); }
.subtitle { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--highlight-color); margin-bottom: calc(var(--gap) * 0.4); display: block; }
.hl { color: var(--highlight-color); }

/* --- 布局框架 (侧边栏+主内容) --- */
.layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}
@media (min-width: 1024px) {
  .layout-grid {
    grid-template-columns: 260px 1fr;
    grid-template-rows: 1fr;
  }
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid rgba(128,128,128,0.15);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .main-content { overflow-y: auto; }
}

/* --- 导航与页头 --- */
.nav-brand { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 2rem; }
.nav-brand img { height: 32px; width: auto; }
.nav-brand span { font-weight: 700; font-size: 1.1rem; color: var(--text-primary); }
.nav-list { display: flex; flex-direction: column; gap: 1rem; }
.nav-link { font-size: 0.95rem; font-weight: 500; color: var(--text-secondary); transition: color 0.2s; }
.nav-link:hover, .nav-link[aria-current="page"] { color: var(--highlight-color); }
.mobile-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem var(--gap); background: var(--bg-paper); border-bottom: 1px solid rgba(128,128,128,0.1);
  position: sticky; top: 0; z-index: 10;
}
@media (min-width: 1024px) { .mobile-header { display: none; } }

/* --- 按钮 --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  height: 52px; padding: 0 1.5rem;
  border-radius: var(--radius-btn);
  font-weight: 600; font-size: 1rem;
  cursor: pointer; border: none;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.btn-primary {
  background-color: var(--accent);
  color: var(--btn-text);
}
.btn-primary:hover { transform: translateY(-1px); background-color: #d96b5c; }
.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--text-primary);
  color: var(--text-primary);
}
.btn-secondary:hover { background: rgba(128,128,128,0.08); transform: translateY(-1px); }
.btn-group { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.5rem; }

/* --- 卡片与面板 --- */
.panel {
  background-color: var(--bg-paper);
  border-radius: var(--radius-card);
  padding: var(--gap);
  box-shadow: var(--card-shadow);
  border: var(--card-border);
}
.dark-panel { background-color: var(--bg-dark); }
.feature-row { display: grid; grid-template-columns: 1fr; gap: var(--gap); align-items: center; }
@media (min-width: 768px) {
  .feature-row.alt { direction: rtl; }
  .feature-row.alt > * { direction: ltr; }
  .feature-row { grid-template-columns: 1fr 1fr; }
}

/* --- 表格 --- */
.platform-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.platform-table th, .platform-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid rgba(128,128,128,0.2); }
.platform-table th { font-weight: 600; color: var(--text-primary); }
.platform-table td { color: var(--text-secondary); }
.platform-table a { color: var(--link-color); font-weight: 500; }

/* --- FAQ --- */
.faq-item { border-bottom: 1px solid rgba(128,128,128,0.2); margin-bottom: 0.5rem; }
.faq-item summary {
  padding: 1rem 0; cursor: pointer; font-weight: 600; color: var(--text-primary);
  list-style: none; position: relative; padding-right: 2rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  font-size: 1.2rem; color: var(--highlight-color); transition: transform 0.2s;
}
.faq-item[open] summary::after { content: "−"; }
.faq-item p { padding-bottom: 1rem; color: var(--text-secondary); line-height: 1.7; }

/* --- 新闻卡片 --- */
.news-grid { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
@media (min-width: 768px) { .news-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .news-grid { grid-template-columns: repeat(3, 1fr); } }
.news-card { background: rgba(255,255,255,0.06); border-radius: var(--radius-card); padding: var(--gap); display: flex; flex-direction: column; justify-content: space-between; }
.news-card h4 { font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--text-primary); }
.news-card p { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; }
.news-date { font-size: 0.8rem; color: var(--highlight-color); margin-top: 1rem; display: block; }

/* --- SVG 动效关键帧 --- */
@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes float-bubble {
  0%, 100% { transform: translateY(0); opacity: 0.85; }
  50% { transform: translateY(-10px); opacity: 1; }
}
@keyframes slide-in {
  0% { transform: translateX(-16px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}
@keyframes flow-path {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

.anim-draw { animation: draw-line 4s ease-in-out infinite alternate; }
.anim-float { animation: float-bubble 6s ease-in-out infinite; }
.anim-slide { animation: slide-in 5s ease-out forwards; }
.anim-pulse { animation: pulse-dot 3s ease-in-out infinite; }
.anim-flow { animation: flow-path 7s linear infinite; }

svg path, svg circle, svg rect, svg line { transform-box: fill-box; transform-origin: center; }

/* 减少动态效果适配 */
@media (prefers-reduced-motion: reduce) {
  .anim-draw, .anim-float, .anim-slide, .anim-pulse, .anim-flow {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  html { scroll-behavior: auto; }
}
