/* =========================================
   SafeW 全站共享样式 / Global Styles
   ========================================= */

/* 设计变量 */
:root {
  --color-dark: #140E25;
  --color-paper: #F7F5F3;
  --color-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;
  
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.3);
  
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 960px;
  
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --line-height-base: 1.65;
}

/* 基础重置 */
*, *::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: 18px;
  line-height: var(--line-height-base);
  color: var(--color-body);
  background-color: var(--color-paper);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
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: 0 auto;
  padding: 0 var(--gap);
}

/* 页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 245, 243, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
  padding: 12px 0;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand-logo img {
  height: 32px;
  width: auto;
  margin-right: 10px;
  vertical-align: middle;
}
.brand-name {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}
.main-nav ul {
  display: flex;
  gap: 24px;
  align-items: center;
}
.main-nav a {
  font-weight: 500;
  font-size: 0.95rem;
  padding: 6px 0;
  position: relative;
  transition: color 0.2s;
}
.main-nav a:hover, .main-nav a[aria-current="page"] {
  color: var(--color-brand);
}
.main-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--color-brand);
}

/* 页脚 */
.site-footer {
  background: var(--color-dark);
  color: var(--color-paper);
  padding: 48px 0 32px;
  margin-top: var(--section-y);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}
.footer-col h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 0.05em;
  color: var(--color-accent);
}
.footer-col a {
  display: block;
  padding: 4px 0;
  font-size: 0.95rem;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.footer-col a:hover { opacity: 1; text-decoration: underline; }
.footer-bottom {
  border-top: 1px solid rgba(247, 245, 243, 0.15);
  padding-top: 24px;
  font-size: 0.85rem;
  opacity: 0.7;
  text-align: center;
}

/* 排版系统 */
.section-block {
  padding: var(--section-y) 0;
  position: relative;
}
.section-block.dark-surface {
  background: var(--color-dark);
  color: var(--color-paper);
}
.section-block.paper-surface {
  background: var(--color-paper);
  color: var(--color-body);
}
.section-block.light-paper {
  background: #EFECEA;
  color: var(--color-body);
}

.megabadge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-btn);
}
.paper-surface .megabadge { color: var(--color-brand); background: rgba(82, 20, 235, 0.08); }
.dark-surface .megabadge { color: var(--color-accent); background: rgba(200, 237, 110, 0.12); }

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: 24px;
  text-wrap: balance;
}
h3 {
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 24px 0 12px;
}
p { margin-bottom: 16px; max-width: 38em; }
.hl { font-weight: 700; }
.paper-surface .hl { color: var(--color-brand); }
.dark-surface .hl { color: var(--color-accent); }

/* 章节序号贯穿 */
.sec-header {
  position: relative;
  padding-left: 60px;
  margin-bottom: 32px;
}
.sec-num {
  position: absolute;
  left: 0; top: -10px;
  font-size: clamp(3.5rem, 8vw, 6rem);
  font-weight: 800;
  line-height: 1;
  opacity: 0.12;
  color: currentColor;
  user-select: none;
  pointer-events: none;
}
.paper-surface .sec-num { color: #5B21B6; }
.light-paper .sec-num { color: #374151; }
.dark-surface .sec-num { color: #E9D5FF; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 20px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  border: none;
}
.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(200, 237, 110, 0.3); }
.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--color-body);
  color: var(--color-body);
}
.dark-surface .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}
.btn-secondary:hover { background: rgba(25, 21, 35, 0.05); }
.dark-surface .btn-secondary:hover { background: rgba(247, 245, 243, 0.08); }
.icon-svg { width: 1em; height: 1em; stroke-width: 1.8; vertical-align: middle; }

/* 卡片与面板 */
.card {
  background: #fff;
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 24px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 32px -12px rgba(25, 21, 35, 0.35); }
.panel {
  background: var(--color-dark);
  border-radius: 12px;
  padding: 32px;
  position: relative;
  overflow: hidden;
}
.panel-light {
  background: #fff;
  border: 1px solid rgba(25, 21, 35, 0.08);
}

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin: 24px 0;
}
.data-table th, .data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
  text-align: left;
}
.data-table th { font-weight: 600; background: rgba(25, 21, 35, 0.03); }
.dark-surface .data-table th { background: rgba(247, 245, 243, 0.06); }

/* FAQ */
.faq-item {
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  padding: 16px 0;
}
.faq-item summary {
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: "+";
  font-weight: 700;
  width: 20px;
  text-align: center;
}
.faq-item[open] summary::before { content: "-"; }
.faq-answer {
  padding: 12px 0 8px 30px;
  font-size: 0.95rem;
  line-height: 1.7;
  opacity: 0.9;
}

/* 步骤徽标 */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 6px;
  margin-right: 10px;
  flex-shrink: 0;
}
.step-list li {
  display: flex;
  align-items: flex-start;
  margin-bottom: 16px;
}

/* 流程条 */
.flow-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin: 24px 0;
  padding: 20px;
  background: rgba(25, 21, 35, 0.04);
  border-radius: var(--radius-card);
}
.flow-node {
  padding: 10px 16px;
  background: #fff;
  border: 1px solid rgba(25, 21, 35, 0.1);
  border-radius: var(--radius-btn);
  font-weight: 500;
  font-size: 0.95rem;
  white-space: nowrap;
}
.flow-arrow {
  width: 24px;
  height: 24px;
  stroke: var(--color-brand);
  opacity: 0.6;
}

/* 新闻卡片网格 */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
}
.news-card article {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.news-meta {
  font-size: 0.8rem;
  color: var(--color-brand);
  margin-bottom: 8px;
  font-weight: 600;
}
.dark-surface .news-meta { color: var(--color-accent); }

/* SVG 基础与动效类 */
.svg-panel {
  width: 100%;
  height: auto;
  max-width: 100%;
}
.orbit-ring {
  animation: orbit-breathe 8s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.bubble-pop {
  animation: bubble-float 4.5s ease-in-out infinite;
}
.dash-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: dash-flow 3.5s ease-in-out infinite alternate;
}
.three-dot-blink {
  animation: dot-pulse 2s infinite;
}
.three-dot-blink:nth-child(2) { animation-delay: 0.4s; }
.three-dot-blink:nth-child(3) { animation-delay: 0.8s; }

@keyframes orbit-breathe {
  0%, 100% { transform: scale(1); opacity: 0.35; }
  50% { transform: scale(1.06); opacity: 0.7; }
}
@keyframes bubble-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes dash-flow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes dot-pulse {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; gap: 12px; }
  .main-nav ul { gap: 16px; font-size: 0.9rem; }
  .sec-header { padding-left: 0; }
  .sec-num { position: static; display: block; margin-bottom: 8px; opacity: 0.2; }
  .flow-bar { flex-direction: column; align-items: stretch; }
  .flow-arrow { transform: rotate(90deg); margin: 8px auto; }
  p { max-width: 100%; }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
