/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 设计变量与 Token --- */
:root {
  --color-dark: #17203F;
  --color-paper: #FCFCFD;
  --color-body: #151823;
  --color-brand: #1441EB;
  --color-accent: #6EEDBD;
  
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(21, 24, 35, 0.3);
  
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;
  
  --line-height: 1.75;
  --title-weight: 500;
  --title-line-height: 1.15;
  --h1-size: clamp(2.6rem, 6.4vw, 5rem);
  --h2-size: clamp(1.6rem, 3vw, 2.4rem);
  --h3-size: clamp(1.2rem, 2vw, 1.5rem);
  
  --focus-ring: 0 0 0 3px rgba(20, 65, 235, 0.4);
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: var(--line-height);
  color: var(--color-body);
  background-color: var(--color-paper);
  -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; }
a:hover { opacity: 0.85; }
ul, ol { list-style: none; }

/* --- 容器与布局 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gap);
  padding-right: var(--gap);
}
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }

/* --- 颜色面系统 --- */
.bg-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.bg-dark .hl { color: var(--color-accent); }
.bg-dark .label { color: var(--color-accent); }
.bg-dark a:not(.btn) { color: var(--color-accent); }
.bg-dark .btn-primary { background: var(--color-accent); color: var(--color-dark); }
.bg-dark .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.bg-dark .card-light {
  background: var(--color-paper);
  color: var(--color-body);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}
.bg-dark .card-light .hl { color: var(--color-brand); }
.bg-dark .card-light .label { color: var(--color-brand); }
.bg-dark .card-light a { color: var(--color-brand); }

/* --- 标题与眉标 --- */
.label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  color: var(--color-brand);
}
.bg-dark .label { color: var(--color-accent); }
h1, h2, h3, h4 {
  font-weight: var(--title-weight);
  line-height: var(--title-line-height);
  letter-spacing: -0.01em;
}
h1 { font-size: var(--h1-size); margin-bottom: 1rem; text-wrap: balance; }
h2 { font-size: var(--h2-size); margin-bottom: 1.5rem; text-wrap: balance; }
h3 { font-size: var(--h3-size); margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; max-width: 38em; }
.hl { color: var(--color-brand); font-weight: 600; }
.bg-dark .hl { color: var(--color-accent); }

/* --- 按钮 --- */
.btn-group { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.5rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--color-brand); color: var(--color-paper); border: var(--card-border); }
.btn-secondary { background: transparent; color: var(--color-body); border: 1px solid var(--color-body); }
.bg-dark .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }

/* --- 卡片 --- */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover { box-shadow: 0 14px 32px -12px rgba(21, 24, 35, 0.35); transform: translateY(-2px); }
.card-icon { width: 28px; height: 28px; margin-bottom: 1rem; color: var(--color-brand); }
.bg-dark .card-icon { color: var(--color-accent); }

/* --- 表格 --- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid rgba(21, 24, 35, 0.1); }
td:first-child { font-weight: 600; white-space: nowrap; }
.bg-dark th, .bg-dark td { border-bottom-color: rgba(252, 252, 253, 0.15); }

/* --- FAQ --- */
.faq-item { margin-bottom: 1rem; border-bottom: 1px solid rgba(21, 24, 35, 0.1); }
.bg-dark .faq-item { border-bottom-color: rgba(252, 252, 253, 0.15); }
details summary {
  cursor: pointer;
  font-weight: 600;
  padding: 1rem 0;
  list-style: none;
  position: relative;
  padding-right: 2rem;
}
details summary::-webkit-details-marker { display: none; }
details summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 400;
  color: var(--color-brand);
}
.bg-dark details summary::after { color: var(--color-accent); }
details[open] summary::after { content: "−"; }
details p { padding-bottom: 1rem; color: var(--color-body); line-height: 1.7; }
.bg-dark details p { color: var(--color-paper); }

/* --- 步骤与编号 --- */
.step-list { counter-reset: step; }
.step-list li {
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1.5rem;
}
.step-list li::before {
  counter-increment: step;
  content: "" counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  background: var(--color-brand);
  color: var(--color-paper);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}
.bg-dark .step-list li::before { background: var(--color-accent); color: var(--color-dark); }

/* --- 页头页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252, 252, 253, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(21, 24, 35, 0.08);
  padding: 0.75rem 0;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 0.75rem; font-weight: 700; font-size: 1.1rem; }
.brand img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-size: 0.95rem; font-weight: 500; }
.nav-links a[aria-current="page"] { color: var(--color-brand); }
.bg-dark .nav-links a { color: var(--color-paper); }
.bg-dark .nav-links a[aria-current="page"] { color: var(--color-accent); }

.site-footer {
  background: var(--color-dark);
  color: var(--color-paper);
  padding: 3rem 0;
  margin-top: auto;
}
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2rem; }
.footer-col h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 1rem; color: var(--color-accent); }
.footer-col a { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; opacity: 0.8; }
.footer-col a:hover { opacity: 1; }
.copyright { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid rgba(252, 252, 253, 0.1); font-size: 0.85rem; opacity: 0.7; text-align: center; }

/* --- SVG 动效关键帧 --- */
@keyframes draw-stroke {
  0% { stroke-dashoffset: 1; }
  50%, 100% { stroke-dashoffset: 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes slide-up {
  0% { transform: translateY(12px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes dash-flow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

/* --- SVG 动效类 --- */
.svg-anim-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-stroke 4s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}
.svg-anim-float {
  animation: float 6s ease-in-out infinite;
}
.svg-anim-breathe {
  animation: breathe 3s ease-in-out infinite;
}
.svg-anim-slide {
  animation: slide-up 5s ease-out forwards;
}
.svg-anim-dash {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: dash-flow 5s linear infinite;
}
svg { width: 100%; height: auto; }
svg[max-width] { max-width: 100%; }

/* --- 响应式与无障碍 --- */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; gap: 1rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .btn-group { flex-direction: column; width: 100%; }
  .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .svg-anim-path, .svg-anim-float, .svg-anim-breathe, .svg-anim-slide, .svg-anim-dash {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    stroke-dashoffset: 0 !important;
  }
}
