/* ============================================================
   SafeW — 全站共享样式
   设计变量、排版、组件、SVG 动效
   ============================================================ */

/* ---------- 设计变量 ---------- */
:root {
  /* 色板 */
  --color-dark: #140E25;
  --color-paper: #F7F5F3;
  --color-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;

  /* 取色变量（纸面默认） */
  --fg-title: var(--color-body);
  --fg-body: var(--color-body);
  --fg-link: var(--color-brand);
  --fg-eyebrow: var(--color-brand);
  --fg-emphasis: var(--color-brand);

  /* 圆角 */
  --radius-card: 8px;
  --radius-btn: 6px;
  --radius-sm: 4px;

  /* 卡片 */
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.30);
  --card-shadow-hover: 0 14px 36px -12px rgba(25, 21, 35, 0.38);

  /* 节奏 */
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --line-height: 1.65;

  /* 宽度 */
  --content-max: 1120px;

  /* 字体 */
  --font-sans: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

/* 深色面覆盖 */
.dark-face {
  --bg-section: var(--color-dark);
  --fg-title: var(--color-paper);
  --fg-body: var(--color-paper);
  --fg-link: var(--color-accent);
  --fg-eyebrow: var(--color-accent);
  --fg-emphasis: var(--color-accent);
}

/* 浅色卡片（放在深色块内时恢复纸面取色） */
.light-card {
  --bg-card: var(--color-paper);
  --fg-title: var(--color-body);
  --fg-body: var(--color-body);
  --fg-link: var(--color-brand);
  --fg-eyebrow: var(--color-brand);
  --fg-emphasis: var(--color-brand);
}

/* ---------- 基础重置与排版 ---------- */
*, *::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);
  font-size: 16px;
  line-height: var(--line-height);
  color: var(--fg-body);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--fg-link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--fg-link); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3, h4 { font-weight: 500; line-height: 1.15; color: var(--fg-title); text-wrap: balance; }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: calc(var(--gap) * 0.75); }
h3 { font-size: clamp(1.15rem, 2vw, 1.45rem); margin-bottom: calc(var(--gap) * 0.5); }
p { max-width: 38em; margin-bottom: 1em; }

/* ---------- 容器 ---------- */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* ---------- 眉标 ---------- */
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--fg-eyebrow);
  margin-bottom: 0.6rem;
}

/* ---------- 高亮关键词 ---------- */
.hl { color: var(--fg-emphasis); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  min-height: 48px;
  padding: 0 1.5em;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--fg-link); outline-offset: 3px; }

.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { background: #d5f58a; }

.btn-secondary {
  background: transparent;
  color: var(--fg-body);
  border: 1.5px solid var(--fg-body);
}
.btn-secondary:hover { background: rgba(25, 21, 35, 0.06); }
.dark-face .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}
.dark-face .btn-secondary:hover { background: rgba(247, 245, 243, 0.08); }

/* ---------- 图标（内联 SVG 通用） ---------- */
.icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-card, var(--color-paper));
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: calc(var(--gap) * 1.25);
  transition: box-shadow 0.25s ease;
}
.card:hover { box-shadow: var(--card-shadow-hover); }

/* ---------- 网格 ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: var(--gap);
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--gap);
}

/* ---------- 表格 ---------- */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.spec-table th,
.spec-table td {
  text-align: left;
  padding: 0.75em 1em;
  border-bottom: 1px solid rgba(25, 21, 35, 0.10);
}
.spec-table th { font-weight: 600; white-space: nowrap; }
.dark-face .spec-table th,
.dark-face .spec-table td { border-color: rgba(247, 245, 243, 0.12); }

/* ---------- FAQ ---------- */
.faq-item {
  border-bottom: 1px solid rgba(25, 21, 35, 0.10);
}
.dark-face .faq-item { border-color: rgba(247, 245, 243, 0.12); }
.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 1em 0;
  font-weight: 600;
  font-size: 1.05rem;
  position: relative;
  padding-right: 2em;
  color: var(--fg-title);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--fg-eyebrow);
  transition: transform 0.2s ease;
}
.faq-item[open] summary::after { content: "−"; }
.faq-item .answer {
  padding: 0 0 1em 0;
  color: var(--fg-body);
  line-height: var(--line-height);
}

/* ---------- 步骤编号徽标 ---------- */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-btn);
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* ---------- 提示框 ---------- */
.callout {
  border-left: 3px solid var(--color-brand);
  background: rgba(82, 20, 235, 0.06);
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
  padding: 1em 1.25em;
  margin: 1.5em 0;
  font-size: 0.95rem;
}
.dark-face .callout {
  border-left-color: var(--color-accent);
  background: rgba(200, 237, 110, 0.08);
}

/* ---------- 流程条 ---------- */
.flow-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em;
  padding: 1.25em 1.5em;
  border-radius: var(--radius-card);
  background: rgba(25, 21, 35, 0.04);
}
.dark-face .flow-bar { background: rgba(247, 245, 243, 0.06); }
.flow-node {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
}
.flow-arrow {
  flex-shrink: 0;
  color: var(--fg-eyebrow);
}

/* ---------- 页头 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-paper);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.dark-face.site-header {
  background: var(--color-dark);
  border-bottom-color: rgba(247, 245, 243, 0.08);
}
.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: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--fg-title);
  text-decoration: none;
}
.brand img { height: 32px; width: auto; }
.nav-links {
  display: flex;
  align-items: center;
  gap: calc(var(--gap) * 1.25);
  list-style: none;
}
.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--fg-body);
  text-decoration: none;
  transition: color 0.15s ease;
}
.nav-links a:hover { color: var(--fg-emphasis); }
.nav-links [aria-current="page"] { color: var(--fg-emphasis); font-weight: 700; }
.nav-cta { margin-left: 0.5em; }

/* ---------- 页脚 ---------- */
.site-footer {
  padding: 2.5rem 0;
  border-top: 1px solid rgba(25, 21, 35, 0.08);
  font-size: 0.9rem;
  color: var(--fg-body);
  opacity: 0.75;
}
.dark-face.site-footer {
  border-top-color: rgba(247, 245, 243, 0.08);
}
.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.footer-nav {
  display: flex;
  gap: calc(var(--gap) * 1.25);
  list-style: none;
}
.footer-nav a { color: var(--fg-body); text-decoration: none; }
.footer-nav a:hover { text-decoration: underline; }

/* ---------- SVG 面板 ---------- */
.svg-panel {
  border-radius: var(--radius-card);
  overflow: hidden;
  position: relative;
}

/* ============================================================
   SVG 动效 — @keyframes
   ============================================================ */

/* 几何体缓慢旋转 */
@keyframes geo-spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes geo-spin-reverse {
  from { transform: rotate(0deg); }
  to   { transform: rotate(-360deg); }
}

/* 几何体交错位移 */
@keyframes geo-drift {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(6px, -4px); }
}
@keyframes geo-drift-alt {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(-5px, 3px); }
}

/* 描边绘制 */
@keyframes draw-stroke {
  from { stroke-dashoffset: 1; }
  to   { stroke-dashoffset: 0; }
}

/* 呼吸点 */
@keyframes breathe-dot {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50%      { opacity: 1; transform: scale(1); }
}

/* 气泡浮现 */
@keyframes bubble-in {
  0%    { opacity: 0; transform: translateY(8px); }
  15%   { opacity: 1; transform: translateY(0); }
  85%   { opacity: 1; transform: translateY(0); }
  100%  { opacity: 0; transform: translateY(-8px); }
}

/* 通知滑入 */
@keyframes notif-slide {
  0%    { opacity: 0; transform: translateX(12px); }
  10%   { opacity: 1; transform: translateX(0); }
  80%   { opacity: 1; transform: translateX(0); }
  100%  { opacity: 0; transform: translateX(-12px); }
}

/* 连接线流动 */
@keyframes line-flow {
  from { stroke-dashoffset: 1; }
  to   { stroke-dashoffset: 0; }
}

/* 浮动 */
@keyframes float-gentle {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

/* ---------- 动效类 ---------- */
.geo-spin { animation: geo-spin-slow 18s linear infinite; transform-box: fill-box; transform-origin: center; }
.geo-spin-r { animation: geo-spin-reverse 22s linear infinite; transform-box: fill-box; transform-origin: center; }
.geo-drift  { animation: geo-drift 12s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.geo-drift-alt { animation: geo-drift-alt 14s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.draw       { animation: draw-stroke 6s ease-in-out infinite alternate; }
.breath-1   { animation: breathe-dot 2.5s ease-in-out infinite; }
.breath-2   { animation: breathe-dot 2.5s ease-in-out 0.4s infinite; }
.breath-3   { animation: breathe-dot 2.5s ease-in-out 0.8s infinite; }
.bubble     { animation: bubble-in 8s ease-in-out infinite; }
.bubble-d1  { animation-delay: 0s; }
.bubble-d2  { animation-delay: 2s; }
.bubble-d3  { animation-delay: 4s; }
.notif      { animation: notif-slide 10s ease-in-out infinite; }
.line-flow  { animation: line-flow 4s ease-in-out infinite alternate; }
.float      { animation: float-gentle 6s ease-in-out infinite; }

/* ---------- 减少动态效果 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .geo-spin, .geo-spin-r, .geo-drift, .geo-drift-alt,
  .draw, .breath-1, .breath-2, .breath-3,
  .bubble, .notif, .line-flow, .float {
    animation: none !important;
  }
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .nav-links { gap: 0.8em; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .header-inner { height: 56px; }
  .footer-inner { flex-direction: column; text-align: center; }
}
