/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 色板 */
  --color-bg-dark: #1B1231;
  --color-bg-paper: #DBD4ED;
  --color-text-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;
  --color-white: #F8F7FA;
  --color-btn-text: #1B1231;

  /* 结构令牌 */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 2px solid var(--color-text-body);
  --card-shadow: 4px 4px 0 var(--color-text-body);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;
  --line-height: 1.55;

  /* 主题默认（纸面） */
  --color-bg: var(--color-bg-paper);
  --color-text: var(--color-text-body);
  --color-link: var(--color-brand);
  --color-highlight: var(--color-brand);
  --color-badge: var(--color-brand);
  --color-icon: var(--color-brand);
  --color-card-bg: var(--color-bg-paper);
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
  line-height: var(--line-height);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--color-link); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.85; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* --- 容器与布局 --- */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding: var(--section-y) 0;
  position: relative;
}
.section + .section {
  border-top: 1px solid rgba(25, 21, 35, 0.1);
}
.grid-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: center;
}
@media (max-width: 768px) {
  .grid-split { grid-template-columns: 1fr; }
  .grid-split.reverse { display: flex; flex-direction: column-reverse; }
}

/* --- 标题与眉标 --- */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-badge);
  margin-bottom: 0.75rem;
}
h1, h2, h3 {
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
  margin: 0 0 1rem 0;
  color: var(--color-text);
}
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
h3 { font-size: 1.25rem; margin-top: 1.5rem; }
.hl { color: var(--color-highlight); }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 1.5rem;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-btn-text);
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-secondary {
  background: transparent;
  border: 2px solid var(--color-text);
  color: var(--color-text);
}
.btn-secondary:hover { background-color: rgba(25, 21, 35, 0.05); }
@media (prefers-color-scheme: dark) { /* 兼容深色模式下的次按钮 */ }

/* --- 卡片与面板 --- */
.card {
  background-color: var(--color-card-bg);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
}
.visual-panel {
  background-color: var(--color-bg-dark);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.visual-panel svg { width: 100%; height: auto; }

/* --- 列表与定义 --- */
.def-list dt {
  font-weight: 700;
  margin-top: 1rem;
  margin-bottom: 0.25rem;
  color: var(--color-text);
}
.def-list dd {
  margin-left: 0;
  padding-left: 1rem;
  border-left: 3px solid var(--color-brand);
  color: var(--color-text);
  opacity: 0.9;
}
.step-list li {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}
.step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background-color: var(--color-accent);
  color: var(--color-btn-text);
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

/* --- 表格 --- */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(25, 21, 35, 0.15);
  text-align: left;
}
th { font-weight: 700; }
td:last-child { color: var(--color-link); }

/* --- FAQ --- */
details {
  border: var(--card-border);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  background-color: var(--color-card-bg);
  overflow: hidden;
}
summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 400;
}
details[open] summary::after { content: "−"; }
details p {
  padding: 0 1.25rem 1rem 1.25rem;
  margin: 0;
  color: var(--color-text);
  opacity: 0.9;
}

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(219, 212, 237, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
}
.theme-dark .site-header { background-color: rgba(27, 18, 49, 0.95); border-bottom-color: rgba(248, 247, 250, 0.1); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo { display: flex; align-items: center; gap: 0.75rem; font-weight: 700; font-size: 1.1rem; color: var(--color-text); }
.logo img { height: 32px; width: auto; }
.nav { display: flex; gap: 1.5rem; align-items: center; }
.nav a { font-weight: 500; font-size: 0.95rem; }
.nav a[aria-current="page"] { color: var(--color-highlight); font-weight: 700; }
@media (max-width: 640px) {
  .nav { display: none; }
}
.site-footer {
  background-color: var(--color-bg-dark);
  color: var(--color-white);
  padding: 2rem 0;
  margin-top: 2rem;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.85;
}
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { color: var(--color-white); }

/* --- SVG 动效关键帧 --- */
@keyframes draw-line {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes slide-up {
  0%, 100% { transform: translateY(8px); opacity: 0.7; }
  50% { transform: translateY(0); opacity: 1; }
}
@keyframes pulse-dot {
  0%, 100% { r: 3; opacity: 0.6; }
  50% { r: 4.5; opacity: 1; }
}

.anim-flow { animation: draw-line 6s ease-in-out infinite; }
.anim-float { animation: float 5s ease-in-out infinite; }
.anim-breathe { animation: breathe 2.5s ease-in-out infinite; }
.anim-breathe-delay-1 { animation-delay: 0.4s; }
.anim-breathe-delay-2 { animation-delay: 0.8s; }
.anim-slide { animation: slide-up 7s ease-in-out infinite; }
.anim-pulse { animation: pulse-dot 3s ease-in-out infinite; }

/* 旋转中心规范 */
svg [class^="anim-"], svg [class*=" anim-"] {
  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;
    animation: none !important;
  }
}
