/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  --color-dark: #271231;
  --color-paper: #F6F3F7;
  --color-text: #1F1523;
  --color-brand: #9E13DD;
  --color-accent: #ED6EC0;
  
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(31, 21, 35, 0.3);
  
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;
  
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --line-height-body: 1.75;
}

/* --- 基础重置 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-paper);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: opacity 0.2s ease; }
ul, ol { list-style: none; }

/* --- 容器与布局 --- */
.container { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
.section { padding: var(--section-y) 0; position: relative; }
.section--dark { background: var(--color-dark); color: var(--color-paper); }
.section--paper { background: var(--color-paper); color: var(--color-text); }

.split-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--gap);
  align-items: start;
}
.sidebar-index {
  position: sticky;
  top: 80px;
  padding-right: var(--gap);
  border-right: 1px solid rgba(128, 128, 128, 0.2);
}
.sidebar-index ul li { margin-bottom: 12px; }
.sidebar-index a {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 8px 12px;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
}
.sidebar-index a:hover, .sidebar-index a:focus-visible {
  border-left-color: var(--color-brand);
  background: rgba(158, 19, 221, 0.05);
}
.main-content { min-width: 0; }

@media (max-width: 900px) {
  .split-layout { grid-template-columns: 1fr; }
  .sidebar-index {
    position: static;
    border-right: none;
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
    padding-bottom: var(--gap);
    margin-bottom: var(--gap);
  }
}

/* --- 排版 --- */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  text-transform: uppercase;
}
.section--paper .badge { color: var(--color-brand); }
.section--dark .badge { color: var(--color-accent); }

h1, h2, h3 { font-weight: 500; line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); margin-bottom: 24px; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 32px; }
h3 { font-size: 1.35rem; margin-bottom: 16px; }
p { margin-bottom: 16px; max-width: 38em; }
.hl { font-weight: 700; }
.section--paper .hl { color: var(--color-brand); }
.section--dark .hl { color: var(--color-accent); }

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246, 243, 247, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(31, 21, 35, 0.1);
}
.section--dark ~ .site-header,
.header--dark {
  background: rgba(39, 18, 49, 0.95);
  border-bottom-color: rgba(246, 243, 247, 0.15);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo-group { display: flex; align-items: center; gap: 10px; }
.logo-img { width: 32px; height: 32px; object-fit: contain; }
.brand-name { font-weight: 700; font-size: 1.1rem; }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { font-size: 0.95rem; font-weight: 500; }
.nav-links a[aria-current="page"], .nav-links a:hover { color: var(--color-brand); }
.section--dark .nav-links a[aria-current="page"],
.section--dark .nav-links a:hover { color: var(--color-accent); }

.site-footer {
  padding: 48px 0;
  border-top: 1px solid rgba(128, 128, 128, 0.2);
  font-size: 0.9rem;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-links { display: flex; gap: 20px; }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 28px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(237, 110, 192, 0.4); }
.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-text);
}
.section--dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.btn-secondary:hover { background: rgba(128, 128, 128, 0.1); }
.btn:focus-visible { outline: 3px solid var(--color-brand); outline-offset: 2px; }
.icon-svg { width: 20px; height: 20px; stroke-width: 1.8; }

/* --- 卡片与面板 --- */
.card-grid { display: grid; gap: var(--gap); }
.card-grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card-grid--3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover { box-shadow: 0 14px 32px -12px rgba(31, 21, 35, 0.4); transform: translateY(-2px); }
.section--dark .card { background: rgba(246, 243, 247, 0.08); border: 1px solid rgba(246, 243, 247, 0.15); }
.panel {
  background: var(--color-dark);
  padding: var(--gap);
  box-shadow: var(--card-shadow);
}
.section--dark .panel { background: rgba(246, 243, 247, 0.05); border: 1px solid rgba(246, 243, 247, 0.1); }

/* --- 表格 --- */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}
.data-table th { font-weight: 600; }
.section--dark .data-table th { color: var(--color-accent); }
.data-table tr:last-child td { border-bottom: none; }

/* --- FAQ --- */
.faq-list details {
  margin-bottom: 16px;
  border: 1px solid rgba(128, 128, 128, 0.2);
  padding: 16px;
}
.faq-list summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 24px;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 400;
}
.faq-list details[open] summary::after { content: "−"; }
.faq-list p { margin-top: 12px; font-size: 0.95rem; }

/* --- 步骤条 --- */
.steps-row { display: flex; gap: var(--gap); flex-wrap: wrap; }
.step-item { flex: 1 1 280px; position: relative; }
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  margin-bottom: 12px;
}
.section--dark .step-num { background: var(--color-accent); color: var(--color-dark); }

/* --- 资讯卡片 --- */
.news-card {
  background: var(--color-paper);
  padding: var(--gap);
  border: 1px solid rgba(128, 128, 128, 0.15);
}
.news-meta { font-size: 0.85rem; opacity: 0.8; margin-bottom: 8px; }
.section--dark .news-card { background: rgba(246, 243, 247, 0.06); border-color: rgba(246, 243, 247, 0.1); }

/* --- SVG 动效关键帧 --- */
@keyframes drawPath {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}
@keyframes flowDash {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes floatBubble {
  0%, 100% { transform: translateY(0); opacity: 0.85; }
  50% { transform: translateY(-6px); opacity: 1; }
}
@keyframes breatheDots {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}
@keyframes slideInPanel {
  0%, 100% { transform: translateX(0); opacity: 0.9; }
  50% { transform: translateX(4px); opacity: 1; }
}
@keyframes pulseRing {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.2); opacity: 0; }
}

/* 动效类绑定 */
.anim-draw { animation: drawPath 4s ease-in-out infinite; }
.anim-flow { animation: flowDash 6s linear infinite; }
.anim-float { animation: floatBubble 5s ease-in-out infinite; }
.anim-breathe { animation: breatheDots 3s ease-in-out infinite; }
.anim-slide { animation: slideInPanel 7s ease-in-out infinite; }
.anim-pulse { animation: pulseRing 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }

/* 减少动态效果支持 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .anim-draw, .anim-flow, .anim-float, .anim-breathe, .anim-slide, .anim-pulse {
    animation: none !important;
  }
}
