/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计 Token --- */
:root {
  --color-dark: #271334;
  --color-paper: #E9E8EA;
  --color-text: #1D1523;
  --color-brand: #8A13DD;
  --color-accent: #9EED6E;

  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);

  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;

  --line-height-body: 1.65;
  --line-height-title: 1.15;
}

/* --- 基础重置 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: var(--line-height-body);
  color: var(--color-text);
  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: color 0.2s; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* --- 布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

/* --- 排版 --- */
h1, h2, h3, h4 {
  font-weight: 500;
  line-height: var(--line-height-title);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; max-width: 38em; }
.text-accent { color: var(--color-brand); }
.text-dark { color: var(--color-dark); }
.hl { font-weight: 700; }

/* 眉标 */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.section-label::before {
  content: "";
  display: block;
  width: 1.2rem;
  height: 2px;
  background-color: currentColor;
}

/* --- 主题覆盖 --- */
.theme-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.theme-dark .section-label { color: var(--color-accent); }
.theme-dark a:not(.btn) { color: var(--color-accent); }
.theme-dark .hl { color: var(--color-accent); }

.theme-light-card {
  background-color: var(--color-paper);
  color: var(--color-text);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}
.theme-light-card .section-label { color: var(--color-brand); }
.theme-light-card a:not(.btn) { color: var(--color-brand); }
.theme-light-card .hl { color: var(--color-brand); }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 52px;
  padding-inline: 1.5rem;
  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;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  box-shadow: 0 4px 12px rgba(158, 237, 110, 0.3);
}
.btn-primary:hover { background-color: #8ad95c; }
.btn-secondary {
  background: transparent;
  border: 2px solid currentColor;
  color: inherit;
}
.btn-secondary:hover { background-color: rgba(0,0,0,0.05); }
.theme-dark .btn-secondary { border-color: var(--color-paper); }
.theme-dark .btn-secondary:hover { background-color: rgba(255,255,255,0.1); }

/* --- 卡片 --- */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: var(--gap);
}

/* --- 表格 --- */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 300px;
}
th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}
td:first-child { font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: none; }

/* --- FAQ --- */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 1rem var(--gap);
  margin-bottom: var(--gap);
  background-color: var(--color-paper);
}
summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 1.5rem;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 400;
}
details[open] summary::after { content: "−"; }
details p { margin-top: 1rem; margin-bottom: 0; }

/* --- 页头页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(233, 232, 234, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding: 0.75rem 0;
}
.theme-dark .site-header { background-color: rgba(39, 19, 52, 0.9); border-bottom-color: rgba(255,255,255,0.08); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
}
.logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; }
.logo img { width: 32px; height: 32px; object-fit: contain; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-size: 0.95rem; font-weight: 500; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--color-brand); }
.theme-dark .nav-links a:hover, .theme-dark .nav-links a[aria-current="page"] { color: var(--color-accent); }
@media (max-width: 768px) {
  .nav-links { display: none; }
}

.site-footer {
  padding: var(--section-y) 0;
  border-top: 1px solid rgba(0,0,0,0.1);
  margin-top: var(--section-y);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--gap);
}
.footer-col h4 { margin-bottom: 0.75rem; font-size: 0.9rem; }
.footer-col ul li { margin-bottom: 0.5rem; }
.footer-col a { 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(0,0,0,0.1);
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* --- 分隔线 --- */
.divider {
  height: 1px;
  background-color: rgba(0,0,0,0.15);
  margin-block: var(--section-y);
}
.theme-dark .divider { background-color: rgba(255,255,255,0.15); }

/* --- SVG 动效核心 --- */
.svg-visual {
  width: 100%;
  height: auto;
  max-width: 100%;
}
.star-dot { animation: twinkle 3s infinite alternate ease-in-out; }
.line-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 4s infinite alternate ease-in-out;
}
.float-group { animation: float 5s infinite ease-in-out; }
.breathe-dot { animation: breathe 2.5s infinite ease-in-out; }

@keyframes twinkle {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}
@keyframes draw-line {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* 旋转/缩放原点约束 */
.anim-rotate { 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;
  }
}

/* --- 响应式微调 --- */
@media (max-width: 640px) {
  .two-col-split { flex-direction: column-reverse; }
  .timeline-list { padding-left: 1.5rem; }
}
.flex-row { display: flex; gap: var(--gap); align-items: stretch; }
@media (min-width: 769px) {
  .two-col-split { flex-direction: row; }
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: var(--gap); }
