/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 (Tokens) --- */
:root {
  --color-dark: #13102D;
  --color-paper: #F7F5F3;
  --color-text: #171523;
  --color-brand: #2714EB;
  --color-accent: #89ED6E;
  --color-accent-text: #13102D;
  
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 1px solid rgba(23, 21, 35, 0.16);
  --card-shadow: none;
  
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;
  
  --title-weight: 600;
  --line-height-title: 1.25;
  --h1-size: clamp(2rem, 4.6vw, 3.4rem);
  --line-height-body: 1.55;
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background-color: var(--color-paper);
  color: var(--color-text);
  line-height: var(--line-height-body);
  font-size: 16px;
  -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-inline: auto;
  padding-inline: var(--gap);
}
.grid-auto {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}
.flex-center { display: flex; align-items: center; justify-content: center; }

/* --- 颜色面作用域规则 --- */
.dark-face {
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.dark-face .hl { color: var(--color-accent); }
.dark-face a:not(.btn) { color: var(--color-accent); }
.light-card {
  background-color: var(--color-paper);
  color: var(--color-text);
  border-radius: var(--radius-card);
  padding: var(--gap);
}
.light-card .hl { color: var(--color-brand); }
.light-card a:not(.btn) { color: var(--color-brand); }

/* --- 标题系统 --- */
h1, h2, h3, h4 { font-weight: var(--title-weight); line-height: var(--line-height-title); letter-spacing: 0; }
h1 { font-size: var(--h1-size); text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); text-wrap: balance; margin-bottom: var(--gap); }
h3 { font-size: 1.25rem; margin-bottom: calc(var(--gap) / 2); }
.section-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: calc(var(--gap) / 2);
  text-transform: uppercase;
}
.paper-section .section-badge { color: var(--color-brand); }
.dark-face .section-badge { color: var(--color-accent); }
.hl { font-weight: 700; }
.paper-section .hl { color: var(--color-brand); }
.dark-face .hl { color: var(--color-accent); }

/* --- 按钮组件 --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  border: none;
  text-align: center;
  white-space: nowrap;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-accent-text);
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--color-text);
  color: var(--color-text);
}
.dark-face .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}
.btn-secondary:hover { background-color: rgba(0,0,0,0.05); }
.dark-face .btn-secondary:hover { background-color: rgba(255,255,255,0.08); }
.btn svg { width: 20px; height: 20px; stroke-width: 2; }

/* --- 卡片与面板 --- */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-2px); }
.panel {
  background-color: var(--color-dark);
  border-radius: var(--radius-card);
  padding: calc(var(--gap) * 1.5);
  position: relative;
  overflow: hidden;
}
.panel svg { width: 100%; height: auto; }

/* --- 表格 --- */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--gap);
  font-size: 0.95rem;
}
.spec-table th, .spec-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--card-border-color);
  text-align: left;
}
.spec-table th { font-weight: 600; width: 40%; }
.spec-table tr:last-child td { border-bottom: none; }

/* --- 列表与步骤 --- */
.step-list { counter-reset: step; }
.step-list li {
  position: relative;
  padding-left: 48px;
  margin-bottom: var(--gap);
}
.step-list li::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0; top: 0;
  width: 32px; height: 32px;
  background-color: var(--color-accent);
  color: var(--color-accent-text);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 8px;
  display: grid; place-items: center;
}
.feature-list li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 8px;
}
.feature-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 10px;
  width: 8px; height: 8px;
  border-radius: 2px;
  background-color: var(--color-brand);
}

/* --- FAQ (Details) --- */
.faq-item {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  overflow: hidden;
}
.faq-item summary {
  padding: 20px;
  cursor: pointer;
  font-weight: 600;
  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;
  transition: transform 0.2s ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-content {
  padding: 0 20px 20px;
  color: var(--color-text);
  opacity: 0.9;
}
.dark-face .faq-item { background-color: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); }
.dark-face .faq-item summary { color: var(--color-paper); }
.dark-face .faq-item .faq-content { color: var(--color-paper); }

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(247, 245, 243, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--card-border-color);
  padding: 12px 0;
}
.dark-face .site-header { background-color: rgba(19, 16, 45, 0.85); border-bottom-color: rgba(255,255,255,0.1); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.brand img { height: 28px; width: auto; }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; position: relative; }
.nav-links a:hover { color: var(--color-brand); }
.dark-face .nav-links a:hover { color: var(--color-accent); }
.nav-links a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
.dark-face .nav-links a[aria-current="page"] { color: var(--color-accent); }
@media (max-width: 768px) {
  .nav-links { gap: 16px; }
  .nav-links a span.desktop-only { display: none; }
}
.site-footer {
  padding: 48px 0;
  border-top: 1px solid var(--card-border-color);
  margin-top: var(--section-y);
  font-size: 0.9rem;
  color: rgba(var(--color-text-rgb), 0.7);
}
.dark-face .site-footer { border-top-color: rgba(255,255,255,0.1); color: rgba(255,255,255,0.6); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; }
.footer-col h4 { font-size: 0.95rem; margin-bottom: 12px; font-weight: 600; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col a:hover { text-decoration: underline; }

/* --- SVG 动效核心规则 --- */
.svg-panel { width: 100%; height: auto; }
.svg-panel svg { width: 100%; height: auto; }
.draw-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.float-group { animation: float-subtle 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.breathe-group { animation: breathe-opacity 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.slide-in-up { animation: slide-up 8s ease-in-out infinite; transform-box: fill-box; transform-origin: bottom; }

@keyframes draw-line {
  0%, 100% { stroke-dashoffset: 0; }
  50% { stroke-dashoffset: 1; }
}
@keyframes float-subtle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes breathe-opacity {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
@keyframes slide-up {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* 减少动态效果偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
  .draw-path { stroke-dashoffset: 0; }
}
