/* =========================================
   SafeW 全局共享样式
   ========================================= */

/* 设计变量 */
:root {
  --color-dark: #1B1231;
  --color-paper: #F4F3F7;
  --color-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;
  --color-text-light: #F4F3F7;
  --color-border-subtle: rgba(25, 21, 35, 0.12);

  --radius-card: 24px;
  --radius-btn: 999px;
  --radius-sm: 12px;
  --card-border: 2px solid var(--color-body);
  --card-shadow: 4px 4px 0 var(--color-body);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;

  --font-main: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --line-height-base: 1.65;
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: var(--line-height-base);
  color: var(--color-body);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  max-width: 100vw;
  overflow-wrap: break-word;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
h1, h2, h3, h4, h5, h6 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.25; }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); line-height: 1.3; }
p { margin-bottom: 1rem; max-width: 38em; }

/* 容器与分节 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

/* 面色覆盖规则 */
.dark-surface {
  background-color: var(--color-dark);
  color: var(--color-text-light);
}
.dark-surface .hl { color: var(--color-accent); }
.dark-surface .label-tag { color: var(--color-accent); }
.dark-surface a:not(.btn-primary):not(.btn-secondary) { color: var(--color-accent); text-decoration: underline; text-underline-offset: 3px; }
.dark-surface h1, .dark-surface h2, .dark-surface h3, .dark-surface p, .dark-surface li { color: var(--color-text-light); }

.paper-surface {
  background-color: var(--color-paper);
  color: var(--color-body);
}
.paper-surface .hl { color: var(--color-brand); }
.paper-surface .label-tag { color: var(--color-brand); }
.paper-surface a:not(.btn-primary):not(.btn-secondary) { color: var(--color-brand); text-decoration: underline; text-underline-offset: 3px; }

/* 深色面内的浅色卡片（恢复纸面取色） */
.dark-surface .card-inner {
  background-color: var(--color-paper);
  color: var(--color-body);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
}
.dark-surface .card-inner .hl { color: var(--color-brand); }
.dark-surface .card-inner .label-tag { color: var(--color-brand); }
.dark-surface .card-inner a { color: var(--color-brand); }

/* 眉标 */
.label-tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

/* 按钮 */
.btn-group { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.5rem; }
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: none;
}
.btn-primary:hover { transform: translateY(-2px); background-color: #8A66E5; }
.btn-primary:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }

.btn-secondary {
  border: 2px solid var(--color-body);
  color: var(--color-body);
  background: transparent;
}
.btn-secondary:hover { transform: translateY(-2px); background-color: rgba(25, 21, 35, 0.05); }
.btn-secondary:focus-visible { outline: 3px solid var(--color-body); outline-offset: 2px; }
.dark-surface .btn-secondary { border-color: var(--color-text-light); color: var(--color-text-light); }
.dark-surface .btn-secondary:hover { background-color: rgba(244, 243, 247, 0.08); }

/* 卡片网格 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
  margin-top: var(--gap);
}
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.card-icon {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

/* 平台分发箭头图标 */
.platform-arrow {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-border-subtle);
}
.data-table th { font-weight: 700; color: var(--color-body); }
.dark-surface .data-table th { color: var(--color-text-light); }
.data-table tr:last-child td { border-bottom: none; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 12px; margin-top: 1.5rem; }
.faq-item {
  border: var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--color-paper);
}
.faq-item summary {
  padding: 16px 20px;
  font-weight: 700;
  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-size: 1.2rem; font-weight: 400; }
.faq-item[open] summary::after { content: "−"; }
.faq-item .faq-content {
  padding: 0 20px 16px;
  line-height: 1.7;
  color: var(--color-body);
}
.dark-surface .faq-item { background: rgba(244, 243, 247, 0.05); border-color: rgba(244, 243, 247, 0.2); }
.dark-surface .faq-item summary { color: var(--color-text-light); }
.dark-surface .faq-item .faq-content { color: var(--color-text-light); }

/* 头部与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-paper);
  border-bottom: 1px solid var(--color-border-subtle);
  padding: 12px 0;
}
.dark-surface .site-header { background: var(--color-dark); border-bottom-color: rgba(244, 243, 247, 0.15); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; }
.brand img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { font-weight: 600; font-size: 0.95rem; }
.nav-links a:hover { opacity: 0.8; }
.nav-links a[aria-current="page"] { color: var(--color-brand); }
.dark-surface .nav-links a[aria-current="page"] { color: var(--color-accent); }

.site-footer {
  padding: 48px 0;
  border-top: 1px solid var(--color-border-subtle);
  font-size: 0.9rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px;
}
.footer-nav { display: flex; gap: 16px; }
.footer-copy { margin-top: 24px; opacity: 0.7; }

/* SVG 动效类 */
.svg-panel {
  width: 100%;
  height: auto;
  max-width: 100%;
}
.flow-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: flowDash 4s linear infinite;
}
.float-bubble {
  animation: floatUp 6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.breathe-dot {
  animation: breathe 3s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes flowDash {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}
@keyframes floatUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes breathe {
  0% { opacity: 0.6; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1.05); }
}

/* 响应式 */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .btn-group { flex-direction: column; }
  .btn-primary, .btn-secondary { width: 100%; }
  .hero-layout { grid-template-columns: 1fr !important; }
  .hero-visual { order: -1; margin-bottom: var(--gap); }
}

/* 减少动态效果偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
