/* =========================================
   SafeW 全站共享样式
   设计变量 / 排版 / 组件 / SVG 动效
   ========================================= */

:root {
  /* 配色系统 */
  --bg-dark: #231334;
  --bg-paper: #E9E8EA;
  --text-main: #1C1523;
  --brand: #7D14EB;
  --accent: #EDD26E;
  
  /* 结构 Token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 2px solid var(--text-main);
  --card-shadow: 4px 4px 0 var(--text-main);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;
  
  /* 字体与节奏 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --line-height-body: 1.75;
  --line-height-head: 1.15;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-paper);
  color: var(--text-main);
  line-height: var(--line-height-body);
  font-size: 16px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* 容器与网格 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.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);
}

.flex-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  align-items: center;
}

/* 防止长文本溢出 */
.long-text { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }

/* 排版层级 */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
  padding: 4px 12px;
  border-radius: 99px;
  background: rgba(var(--brand-rgb, 125, 20, 231), 0.1);
  color: var(--brand);
}
.section-dark .badge { background: rgba(237, 210, 110, 0.15); color: var(--accent); }

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 500;
  line-height: var(--line-height-head);
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 1.5rem;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

p { margin-bottom: 1rem; max-width: 38em; }
strong { font-weight: 600; }

mark.hl {
  font-weight: 700;
  color: var(--brand);
}
.section-dark mark.hl { color: var(--accent); }

/* 分割线 */
.divider {
  height: 1px;
  background: var(--text-main);
  opacity: 0.15;
  margin: var(--section-y) 0;
}
.section-dark .divider { background: var(--bg-paper); opacity: 0.2; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.btn-primary {
  background-color: var(--accent);
  color: var(--bg-dark);
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(0.95); }
.btn-primary:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

.btn-secondary {
  background: transparent;
  border: 2px solid var(--text-main);
  color: var(--text-main);
}
.section-dark .btn-secondary {
  border-color: var(--bg-paper);
  color: var(--bg-paper);
}
.btn-secondary:hover { transform: translateY(-2px); opacity: 0.9; }
.btn-secondary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.btn svg { width: 20px; height: 20px; stroke-width: 2; }

/* 卡片 */
.card {
  background: var(--bg-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;
}
.section-dark .card {
  background: var(--bg-paper);
  color: var(--text-main);
}
.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 1.1rem;
}
.card-icon {
  width: 24px;
  height: 24px;
  stroke: var(--brand);
}
.section-dark .card-icon { stroke: var(--accent); }

/* 表格 */
.table-wrapper {
  overflow-x: auto;
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
}
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-paper);
}
th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(28, 21, 35, 0.1);
}
th { font-weight: 600; background: rgba(125, 20, 231, 0.05); }
td { vertical-align: top; }
tr:last-child th, tr:last-child td { border-bottom: none; }

/* FAQ / Details */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  margin-bottom: 1rem;
  background: var(--bg-paper);
}
summary {
  padding: 1rem var(--gap);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-main);
  border-bottom: 2px solid var(--text-main);
  transform: rotate(-45deg);
  transition: transform 0.2s;
}
details[open] summary::before { transform: rotate(45deg); }
details .answer {
  padding: 0 var(--gap) 1rem;
  color: var(--text-main);
}

/* 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(233, 232, 234, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(28, 21, 35, 0.1);
  padding: 0.75rem 0;
}
.section-dark .site-header { background: rgba(35, 19, 52, 0.9); border-color: rgba(233, 232, 234, 0.15); }
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
}
.brand img { width: 32px; height: 32px; object-fit: contain; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; opacity: 0.85; transition: opacity 0.2s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { opacity: 1; color: var(--brand); }
.section-dark .nav-links a { color: var(--bg-paper); }
.section-dark .nav-links a:hover, .section-dark .nav-links a[aria-current="page"] { color: var(--accent); }

.site-footer {
  background: var(--bg-dark);
  color: var(--bg-paper);
  padding: var(--section-y) 0;
  text-align: center;
}
.footer-inner { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
.footer-links { display: flex; justify-content: center; gap: 2rem; margin: 1.5rem 0; flex-wrap: wrap; }
.footer-links a { opacity: 0.8; transition: opacity 0.2s; }
.footer-links a:hover { opacity: 1; color: var(--accent); }
.copy { font-size: 0.85rem; opacity: 0.6; margin-top: 1rem; }

/* SVG 基础与动效 */
.hero-svg, .feature-svg {
  width: 100%;
  height: auto;
  max-width: 100%;
}
.draw-path {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 2.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
.breathe {
  animation: breathe 4s ease-in-out infinite;
}
.float-up {
  animation: floatUp 5s ease-in-out infinite;
}
.flow-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: flowDash 3s linear infinite;
}

@keyframes drawLine {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.02); opacity: 0.9; }
}
@keyframes floatUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes flowDash {
  to { stroke-dashoffset: -2; }
}

/* 旋转/缩放子元素修正 */
.anim-transform {
  transform-box: fill-box;
  transform-origin: center;
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .draw-path, .flow-line { stroke-dashoffset: 0; }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
  .flex-row { flex-direction: column; align-items: stretch; }
}
