/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量与基础重置 --- */
:root {
  --color-dark: #231334;
  --color-paper: #E9E8EA;
  --color-body: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;
  --color-paper-light: #F4F3F5;
  --color-dark-deep: #1A0D28;

  --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-main: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --text-base: 16px;
  --line-height: 1.65;

  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  font-size: var(--text-base);
  line-height: var(--line-height);
  color: var(--color-body);
  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; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* --- 容器与布局 --- */
.container {
  width: min(100% - 32px, var(--content-max));
  margin-inline: auto;
}
.section {
  padding-block: var(--section-y);
  position: relative;
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: var(--gap); align-items: center; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: var(--gap); }
.text-center { text-align: center; }
.mb-gap { margin-bottom: var(--gap); }

/* --- 取色变量覆盖 --- */
.section-paper {
  --bg: var(--color-paper);
  --fg: var(--color-body);
  --hl: var(--color-brand);
  --icon: var(--color-brand);
  --link: var(--color-brand);
}
.section-dark {
  --bg: var(--color-dark);
  --fg: var(--color-paper);
  --hl: var(--color-accent);
  --icon: var(--color-accent);
  --link: var(--color-accent);
}
.section-dark .card-light {
  --bg: var(--color-paper);
  --fg: var(--color-body);
  --hl: var(--color-brand);
  --icon: var(--color-brand);
  --link: var(--color-brand);
}
.section-dark p { color: #ffffff; }
.card-light { background: var(--bg); color: var(--fg); border-radius: var(--radius-card); }

/* --- 排版 --- */
.mark-label {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em;
  color: var(--hl); margin-bottom: 12px;
}
.h2-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800; line-height: 1.25; letter-spacing: -0.02em;
  margin-bottom: var(--gap); color: var(--fg);
}
.h3-title {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 800; line-height: 1.3; letter-spacing: -0.02em;
  margin-bottom: 12px; color: var(--fg);
}
p { margin-bottom: 1em; max-width: 38em; }
.hl { color: var(--hl); }

/* --- 按钮 --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 0 24px; height: 52px; border-radius: var(--radius-btn);
  font-weight: 600; font-size: 1rem; cursor: pointer; border: none;
  transition: transform 0.2s ease, filter 0.2s ease;
}
.btn-primary {
  background: var(--color-accent); color: var(--color-dark);
}
.btn-secondary {
  background: transparent; border: 1.5px solid var(--fg); color: var(--fg);
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn:focus-visible { outline: 2px solid var(--hl); outline-offset: 3px; }

/* --- 卡片与面板 --- */
.card {
  background: var(--bg);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  transition: transform 0.3s ease;
}
.card:hover { transform: translateY(-4px); }
.panel {
  background: var(--bg);
  border-radius: var(--radius-card);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* --- 表格 --- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-card); background: var(--bg); }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
th, td { padding: 16px; text-align: left; border-bottom: 1px solid rgba(128,128,128,0.2); }
th { font-weight: 700; color: var(--hl); }
td:first-child { font-weight: 600; color: var(--fg); }
tr:last-child td { border-bottom: none; }

/* --- 导航与页脚 --- */
header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(233, 232, 234, 0.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
section.dark-header ~ header { background: rgba(35, 19, 52, 0.9); border-bottom-color: rgba(255,255,255,0.1); }
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--nav-h); width: min(100% - 32px, var(--content-max)); margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.2rem; color: var(--fg); }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.nav-links { display: flex; gap: 24px; }
.nav-links a { font-weight: 500; opacity: 0.85; transition: opacity 0.2s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { opacity: 1; color: var(--hl); }
footer {
  background: var(--color-dark); color: var(--color-paper); padding: 48px 0;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.footer-inner { display: flex; flex-direction: column; gap: 24px; align-items: center; text-align: center; }
.footer-links { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; }
.footer-links a { opacity: 0.8; transition: opacity 0.2s; }
.footer-links a:hover { opacity: 1; color: var(--color-accent); }

/* --- FAQ --- */
details { margin-bottom: 16px; border-radius: var(--radius-card); background: var(--bg); overflow: hidden; }
summary {
  padding: 18px 24px; cursor: pointer; font-weight: 600; color: var(--fg);
  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; transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details .faq-content { padding: 0 24px 20px; color: var(--fg); line-height: 1.7; }

/* --- SVG 动效系统 --- */
.svg-container { width: 100%; height: auto; display: block; }
svg { width: 100%; height: auto; }
svg path, svg circle, svg rect, svg line { stroke-linecap: round; stroke-linejoin: round; }

/* 呼吸与浮动 */
@keyframes orbitBreath {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.06); opacity: 1; }
}
@keyframes floatUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes pulseDot {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* 描边绘制 */
@keyframes drawPath {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.draw-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawPath 3s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}
.draw-slow { animation-duration: 6s; }
.draw-fast { animation-duration: 2.5s; }

/* 应用类 */
.anim-orbit { animation: orbitBreath 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-float { animation: floatUp 4s ease-in-out infinite; }
.anim-pulse { animation: pulseDot 2.5s ease-in-out infinite; }
.anim-draw { animation: drawPath 4s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate; }

/* 减少动态效果 */
@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;
  }
}

/* --- 响应式微调 --- */
@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .nav-links { display: none; } /* 简化移动端导航，实际项目可加汉堡菜单 */
  .mobile-nav-toggle { display: block; }
}
.mobile-nav-toggle { display: none; background: none; border: none; color: var(--fg); cursor: pointer; }
