/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 1. 设计变量 */
:root {
  --color-dark: #19102D;
  --color-paper: #FCFCFD;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #D66EED;
  
  --radius-card: 0;
  --radius-btn: 0;
  
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;
  
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --line-height-base: 1.75;
}

/* 2. 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  color: var(--color-text);
  background-color: var(--color-paper);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* 3. 布局容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  position: relative;
}
.section + .section { border-top: 1px solid rgba(25, 21, 35, 0.15); }

/* 4. 标题系统 */
.label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: 0.75rem;
}
.dark-surface .label { color: var(--color-accent); }
.light-card .label { color: var(--color-brand); }

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-wrap: balance;
  max-width: 100%;
  margin-bottom: 1.5rem;
  color: var(--color-text);
}
.dark-surface h1 { color: var(--color-paper); }
.light-card h1 { color: var(--color-text); }

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.01em;
  margin-bottom: 1.25rem;
  color: var(--color-text);
}
.dark-surface h2 { color: var(--color-paper); }
.light-card h2 { color: var(--color-text); }

h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  color: var(--color-text);
}
.dark-surface h3 { color: var(--color-paper); }
.light-card h3 { color: var(--color-text); }

.hl { color: var(--color-brand); }
.dark-surface .hl { color: var(--color-accent); }
.light-card .hl { color: var(--color-brand); }

p { margin-bottom: 1rem; max-width: 38em; text-wrap: pretty; }
.dark-surface p { color: var(--color-paper); }
.light-card p { color: var(--color-text); }

/* 5. 按钮组件 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { background-color: #c05bd6; }

.btn-secondary {
  background: transparent;
  border: 2px solid var(--color-text);
  color: var(--color-text);
}
.dark-surface .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.light-card .btn-secondary { border-color: var(--color-text); color: var(--color-text); }
.btn-secondary:hover { background-color: rgba(25, 21, 35, 0.05); }
.dark-surface .btn-secondary:hover { background-color: rgba(252, 252, 253, 0.1); }
.light-card .btn-secondary:hover { background-color: rgba(25, 21, 35, 0.05); }

/* 6. 卡片与面板 */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  position: relative;
}
.dark-surface .card { background-color: var(--color-dark); border-color: var(--color-accent); box-shadow: 4px 4px 0 var(--color-accent); }
.light-card { background-color: var(--color-paper); border: var(--card-border); box-shadow: var(--card-shadow); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }

/* 7. 表格 */
.table-wrapper { overflow-x: auto; margin-top: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid rgba(25, 21, 35, 0.15); }
th { font-weight: 700; color: var(--color-text); }
.dark-surface th { color: var(--color-paper); }
.light-card th { color: var(--color-text); }
tr:last-child td { border-bottom: none; }

/* 8. FAQ / Details */
details { margin-bottom: 1rem; border: 1px solid rgba(25, 21, 35, 0.2); }
summary {
  padding: 1rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-left: 1.5rem;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 0.5rem; height: 0.5rem;
  border-right: 2px solid var(--color-brand);
  border-bottom: 2px solid var(--color-brand);
}
.dark-surface summary::before { border-color: var(--color-accent); }
.light-card summary::before { border-color: var(--color-brand); }
details[open] summary { border-bottom: 1px solid rgba(25, 21, 35, 0.15); }
.details-content { padding: 1rem 1.5rem; color: var(--color-text); line-height: 1.7; }
.dark-surface .details-content { color: var(--color-paper); }
.light-card .details-content { color: var(--color-text); }

/* 9. 时间线与编号徽标 */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: ""; position: absolute; left: 0.5rem; top: 0; bottom: 0;
  width: 2px; background: rgba(25, 21, 35, 0.15);
}
.timeline-item { position: relative; margin-bottom: 2rem; }
.timeline-item::before {
  content: attr(data-step);
  position: absolute; left: -2rem; top: 0;
  width: 1.5rem; height: 1.5rem;
  background: var(--color-accent); color: var(--color-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
}
.dark-surface .timeline-item::before { background: var(--color-accent); color: var(--color-dark); }
.light-card .timeline-item::before { background: var(--color-accent); color: var(--color-dark); }

/* 10. 定义列表 */
.def-list dt { font-weight: 700; margin-top: 1.25rem; margin-bottom: 0.4rem; color: var(--color-text); }
.dark-surface .def-list dt { color: var(--color-paper); }
.light-card .def-list dt { color: var(--color-text); }
.def-list dd { margin-left: 0; margin-bottom: 1rem; padding-left: 1rem; border-left: 3px solid var(--color-brand); }
.dark-surface .def-list dd { border-left-color: var(--color-accent); }
.light-card .def-list dd { border-left-color: var(--color-brand); }

/* 11. 页头与页脚 */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  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 ul { display: flex; gap: 1.5rem; }
nav a { font-weight: 500; font-size: 0.95rem; opacity: 0.8; transition: opacity 0.2s; }
nav a:hover, nav a[aria-current="page"] { opacity: 1; color: var(--color-brand); }
.dark-surface nav a { color: var(--color-paper); }
.dark-surface nav a:hover, nav a[aria-current="page"] { color: var(--color-accent); }
.light-card nav a { color: var(--color-text); }
.light-card nav a:hover, nav a[aria-current="page"] { color: var(--color-brand); }

.site-footer {
  background-color: var(--color-dark);
  color: var(--color-paper);
  padding: 2rem 0;
  border-top: 1px solid rgba(214, 110, 237, 0.3);
}
.footer-inner { display: flex; flex-direction: column; gap: 1.5rem; align-items: center; text-align: center; }
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.footer-links a { opacity: 0.8; transition: opacity 0.2s; }
.footer-links a:hover { opacity: 1; color: var(--color-accent); }
.copyright { font-size: 0.85rem; opacity: 0.6; }

/* 12. SVG 容器与动效 */
.hero-svg-container { width: 100%; max-width: 480px; margin: 0 auto; }
.hero-svg-container svg { width: 100%; height: auto; }
.anim-panel { stroke-dasharray: 1; stroke-dashoffset: 0; }
.anim-rotate { transform-box: fill-box; transform-origin: center; }
.anim-float { transform-box: fill-box; transform-origin: center; }
.anim-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }

@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes rotate-assemble {
  0%, 100% { transform: rotate(-12deg) scale(0.95); }
  50% { transform: rotate(12deg) scale(1.02); }
}
@keyframes float-bubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.draw-line { animation: draw-line 3s ease-in-out infinite alternate; }
.rotate-group { animation: rotate-assemble 6s ease-in-out infinite; }
.float-group { animation: float-bubble 4s ease-in-out infinite; }
.pulse-dot { animation: pulse-dot 2s ease-in-out infinite; }

/* 13. 响应式与减少动画 */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .header-inner { flex-direction: column; gap: 0.75rem; }
  nav ul { gap: 1rem; }
}
@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;
  }
  .draw-line, .rotate-group, .float-group, .pulse-dot {
    animation: none !important;
    stroke-dashoffset: 0 !important;
    transform: none !important;
    opacity: 1 !important;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
