/* =========================================
   SafeW 共享样式表
   ========================================= */
:root {
  /* 色板 */
  --color-dark: #231334;
  --color-paper: #F5F3F7;
  --color-text: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;
  --color-text-on-dark: #F5F3F7;
  --color-accent-on-dark: #EDD26E;
  --color-brand-on-paper: #7D14EB;
  --color-text-on-paper: #1C1523;

  /* 结构变量 */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;

  /* 排版变量 */
  --font-sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --line-height-body: 1.75;
  --line-height-heading: 1.25;
  --font-weight-title: 600;
}

/* 基础重置与全局 */
*, *::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: var(--color-paper);
  color: var(--color-text-on-paper);
  line-height: var(--line-height-body);
  font-size: 16px;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* 容器与布局 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

/* 表面层取色覆盖 */
.surface-dark {
  background: var(--color-dark);
  color: var(--color-text-on-dark);
}
.surface-dark .hl { color: var(--color-accent-on-dark); }
.surface-dark .label, .surface-dark a:not(.btn), .surface-dark svg { color: var(--color-accent-on-dark); }
.surface-dark .card { background: rgba(255, 255, 255, 0.06); }
.surface-paper {
  background: var(--color-paper);
  color: var(--color-text-on-paper);
}
.surface-paper .hl { color: var(--color-brand-on-paper); }
.surface-paper .label, .surface-paper a:not(.btn), .surface-paper svg { color: var(--color-brand-on-paper); }
.surface-paper .card { background: rgba(0, 0, 0, 0.03); }

/* 组件：眉标与标题 */
.label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.5em;
  text-transform: uppercase;
}
h1, h2, h3 {
  font-weight: var(--font-weight-title);
  letter-spacing: 0;
  line-height: var(--line-height-heading);
}
h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  margin-bottom: 1em;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 0.8em;
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  margin-bottom: 0.6em;
  margin-top: 1.5em;
}
p { margin-bottom: 1em; max-width: 38em; }

/* 组件：按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  height: 52px;
  padding: 0 1.5em;
  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;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { background: #e0c55f; }
.btn-secondary {
  background: transparent;
  border: 1.5px solid currentColor;
  color: inherit;
}
.surface-dark .btn-secondary { color: var(--color-text-on-dark); border-color: var(--color-text-on-dark); }
.surface-paper .btn-secondary { color: var(--color-text-on-paper); border-color: var(--color-text-on-paper); }

/* 组件：卡片与面板 */
.card {
  border-radius: var(--radius-card);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 1.5em;
  position: relative;
}
.panel {
  background: var(--color-dark);
  border-radius: 24px;
  padding: 2em;
  position: relative;
  overflow: hidden;
}

/* 组件：表格 */
.table-wrapper {
  overflow-x: auto;
  margin-top: 1em;
  border-radius: var(--radius-card);
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th, td {
  padding: 1em;
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}
th { font-weight: 600; background: rgba(0,0,0,0.04); }
tr:last-child th, tr:last-child td { border-bottom: none; }

/* 组件：定义列表 */
.def-list dt {
  font-weight: 600;
  margin-top: 1.2em;
  margin-bottom: 0.3em;
  position: relative;
  padding-left: 1.2em;
}
.def-list dt::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.def-list dd {
  margin-left: 1.2em;
  margin-bottom: 1em;
  color: inherit;
  opacity: 0.9;
}

/* 组件：步骤徽标 */
.step-item {
  display: flex;
  gap: 1em;
  margin-bottom: 1.5em;
}
.step-badge {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: var(--color-accent);
  color: var(--color-dark);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

/* 组件：FAQ */
.faq details {
  margin-bottom: 1em;
  border-radius: var(--radius-card);
  background: rgba(0,0,0,0.02);
  padding: 1em 1.2em;
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-weight: 400;
  opacity: 0.5;
}
.faq details[open] summary::after { content: "-"; }
.faq p { margin-top: 0.8em; margin-bottom: 0; font-size: 0.95rem; }

/* 页头与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 243, 247, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.site-header.scrolled {
  border-bottom-color: rgba(0,0,0,0.08);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.brand { display: flex; align-items: center; gap: 0.8em; }
.brand img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 1.5em; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; transition: opacity 0.2s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { opacity: 0.7; }
.site-footer {
  padding: 3em var(--gap);
  border-top: 1px solid rgba(0,0,0,0.06);
  text-align: center;
  font-size: 0.9rem;
  color: rgba(0,0,0,0.6);
}
.footer-links { display: flex; justify-content: center; gap: 1.5em; margin-bottom: 1em; }
.footer-links a { opacity: 0.8; }
.footer-links a:hover { opacity: 1; }

/* SVG 动效基础设置 */
.svg-anim {
  width: 100%;
  height: auto;
}
.orbit-ring {
  fill: none;
  stroke-width: 1.5;
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.draw-path {
  fill: none;
  stroke-width: 1.5;
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.bubble-ui {
  transform-box: fill-box;
  transform-origin: center;
}
.dot-input {
  transform-box: fill-box;
  transform-origin: center;
}
.notif-card {
  transform-box: fill-box;
  transform-origin: center;
}

/* Keyframes */
@keyframes orbit-breathe {
  0%, 100% { transform: scale(1); opacity: 0.25; }
  50% { transform: scale(1.06); opacity: 0.55; }
}
@keyframes draw-flow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes float-gentle {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(-5px); opacity: 0.88; }
}
@keyframes breath-dots {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}
@keyframes slide-enter {
  0% { transform: translateX(24px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.4; }
  100% { transform: scale(1.15); opacity: 0; }
}

/* 动效类绑定 */
.anim-orbit { animation: orbit-breathe 8s infinite alternate ease-in-out; }
.anim-draw { animation: draw-flow 6s infinite linear; }
.anim-float { animation: float-gentle 5s infinite alternate ease-in-out; }
.anim-dot { animation: breath-dots 2.5s infinite alternate ease-in-out; }
.anim-slide { animation: slide-enter 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.anim-pulse { animation: pulse-ring 4s infinite ease-out; }

/* 响应式适配 */
@media (max-width: 768px) {
  .container { padding: 0 1.2em; }
  .grid-2 { grid-template-columns: 1fr !important; }
  .nav-links .hide-mobile { display: none; }
}
@media (min-width: 769px) {
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: center; }
  .grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
}

/* 减少动态效果偏好 */
@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;
  }
  .anim-orbit, .anim-draw, .anim-float, .anim-dot, .anim-slide, .anim-pulse {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
