/* =========================================
   SafeW 全站共享样式
   ========================================= */
:root {
  /* 色板 */
  --color-dark: #231334;
  --color-paper: #E9E8EA;
  --color-paper-light: #F4F3F5;
  --color-body: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;

  /* 结构变量 */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;

  /* 排版变量 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lh-body: 1.65;
  --lh-title: 1.15;
  --fw-title: 500;

  /* 取色默认（纸面环境） */
  --text-primary: var(--color-body);
  --text-secondary: var(--color-body);
  --text-highlight: var(--color-brand);
  --bg-base: var(--color-paper);
  --bg-card: var(--color-paper-light);
  --border-subtle: rgba(28, 21, 35, 0.08);
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: var(--bg-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 容器 */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

/* 链接与图标 */
a { color: var(--text-highlight); text-decoration: none; transition: opacity .2s; }
a:hover { opacity: .85; }
svg.icon { width: 20px; height: 20px; flex-shrink: 0; }

/* 标题系统 */
h1, h2, h3, h4 { font-weight: var(--fw-title); line-height: var(--lh-title); color: var(--text-primary); }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); letter-spacing: -0.02em; text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-block: .6em; }
h3 { font-size: 1.25rem; margin-block: .5em; }
.subtitle { font-size: clamp(1rem, 1.5vw, 1.15rem); color: var(--text-secondary); margin-block: .8em 1.2em; max-width: 65ch; }
.highlight { color: var(--text-highlight); }

/* 眉标 */
.eyebrow {
  display: inline-flex; align-items: center; gap: .5em;
  font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-highlight); margin-bottom: .8em;
}
.eyebrow::before { content: ""; width: 1.5em; height: 2px; background: currentColor; border-radius: 2px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6em;
  height: 52px; padding-inline: 1.5em; border-radius: var(--radius-btn);
  font-weight: 600; font-size: 1rem; cursor: pointer; border: 2px solid transparent;
  transition: transform .2s ease, background-color .2s ease, color .2s ease;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background-color: var(--color-accent); color: var(--color-dark);
  border-color: var(--color-accent);
}
.btn-primary:hover { background-color: #e0c45f; border-color: #e0c45f; }
.btn-secondary {
  background: transparent; color: var(--text-primary); border-color: var(--text-primary);
}
.btn-secondary:hover { background: rgba(28, 21, 35, 0.05); }

/* 卡片与面板 */
.card {
  background: var(--bg-card);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  transition: transform .25s ease;
}
.card:hover { transform: translateY(-2px); }
.panel {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

/* 表格 */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { padding: .8em 1em; text-align: left; border-bottom: 1px solid var(--border-subtle); }
th { font-weight: 600; color: var(--text-primary); }
td { color: var(--text-secondary); }
tr:last-child td { border-bottom: none; }

/* FAQ */
details {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  margin-bottom: .8em;
  padding: 1.2rem 1.5rem;
  transition: background-color .2s;
}
summary {
  cursor: pointer; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.2em; color: var(--text-highlight); }
details[open] summary::after { content: "−"; }
details p { margin-top: .8em; color: var(--text-secondary); }

/* 头部与导航 */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(233, 232, 234, 0.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}
.section-dark .header { background: rgba(35, 19, 52, 0.9); border-bottom-color: rgba(237, 210, 110, 0.15); }
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; max-width: var(--content-max); margin-inline: auto; padding-inline: var(--gap);
}
.brand { display: flex; align-items: center; gap: .6em; font-weight: 700; color: var(--text-primary); }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.nav-links { display: flex; gap: 1.5em; align-items: center; }
.nav-links a { font-weight: 500; color: var(--text-secondary); }
.nav-links a:hover { color: var(--text-highlight); }
.nav-links [aria-current="page"] { color: var(--text-highlight); font-weight: 700; }
@media (max-width: 768px) {
  .nav-links { display: none; }
}

/* 页脚 */
.footer {
  padding: 3rem 0;
  border-top: 1px solid var(--border-subtle);
  text-align: center; color: var(--text-secondary); font-size: .9rem;
}
.footer a { margin-inline: .5em; }

/* 深色面覆盖 */
.section-dark {
  background-color: var(--color-dark);
  --text-primary: #F8F7F9;
  --text-secondary: #D6D2DA;
  --text-highlight: var(--color-accent);
  --bg-card: #2E1B42;
  --bg-base: var(--color-dark);
  --border-subtle: rgba(248, 247, 249, 0.1);
}
.section-dark .btn-secondary { color: #F8F7F9; border-color: #F8F7F9; }
.section-dark .btn-secondary:hover { background: rgba(248, 247, 249, 0.08); }

/* 响应式网格 */
.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); }
@media (min-width: 1024px) {
  .grid-2-lg { grid-template-columns: 1fr 1fr; }
  .grid-3-lg { grid-template-columns: repeat(3, 1fr); }
}

/* =========================================
   SVG 动效定义
   ========================================= */
.svg-container { width: 100%; height: auto; max-width: 100%; }
.svg-container svg { width: 100%; height: auto; display: block; }

/* 描边绘制 */
.draw-path { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
@keyframes draw-line {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
.draw-path.animate { animation: draw-line 3s ease forwards; }

/* 浮动呼吸 */
.float-slow { animation: float-slow 6s ease-in-out infinite alternate; }
@keyframes float-slow {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}
.float-fast { animation: float-fast 4s ease-in-out infinite alternate; }
@keyframes float-fast {
  0% { transform: translateY(0); }
  100% { transform: translateY(-5px); }
}

/* 输入点呼吸 */
.breath-dot { animation: breath 2s ease-in-out infinite; }
.breath-dot:nth-child(2) { animation-delay: .3s; }
.breath-dot:nth-child(3) { animation-delay: .6s; }
@keyframes breath {
  0%, 100% { opacity: .3; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1); }
}

/* 滑入通知 */
.slide-in { animation: slide-in 4s ease forwards; }
@keyframes slide-in {
  0%, 10% { transform: translateX(40px); opacity: 0; }
  20%, 90% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(40px); opacity: 0; }
}

/* 连接线流动 */
.flow-line { pathLength: 1; stroke-dasharray: 0.15 0.85; stroke-dashoffset: 0; }
@keyframes flow {
  to { stroke-dashoffset: -1; }
}
.flow-line.animate { animation: flow 2s linear infinite; }

/* 旋转拼合 */
.rotate-slow { animation: rotate-slow 12s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes rotate-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.rotate-reverse { animation: rotate-reverse 15s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes rotate-reverse {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

/* 减少动态效果 */
@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;
  }
  .draw-path, .flow-line { stroke-dashoffset: 0; }
}
