/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计变量与取色体系 */
:root {
  --color-dark: #231334;
  --color-paper: #E9E8EA;
  --color-text: #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-main: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

/* 面层级取色覆盖 */
.face-dark {
  background: var(--color-dark);
  color: var(--color-paper);
}
.face-dark .hl { color: var(--color-accent); }
.face-dark .badge { color: var(--color-accent); }
.face-dark a:not(.btn):not([class]) { color: var(--color-accent); text-decoration: underline; text-underline-offset: 4px; }
.face-dark .card { background: rgba(255,255,255,0.06); color: inherit; }
.face-dark table { color: var(--color-paper); }
.face-dark td, .face-dark th { border-color: rgba(255,255,255,0.15); }
.face-dark summary { color: var(--color-paper); }

.face-paper {
  background: var(--color-paper);
  color: var(--color-text);
}
.face-paper .hl { color: var(--color-brand); }
.face-paper .badge { color: var(--color-brand); }
.face-paper a:not(.btn):not([class]) { color: var(--color-brand); text-decoration: underline; text-underline-offset: 4px; }
.face-paper .card { background: #ffffff; color: inherit; }
.face-paper table { color: var(--color-text); }
.face-paper td, .face-paper th { border-color: rgba(28,21,35,0.12); }
.face-paper summary { color: var(--color-text); }

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.65;
  background: var(--color-paper);
  color: var(--color-text);
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: opacity 0.2s; }
ul, ol { list-style: none; }

/* 容器与布局 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.section {
  padding-block: var(--section-y);
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
@media (min-width: 900px) {
  .grid-2-lg { grid-template-columns: 1fr 1fr; }
  .grid-3-lg { grid-template-columns: repeat(3, 1fr); }
}

/* 页头与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(233,232,234,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(28,21,35,0.08);
  transition: box-shadow 0.3s;
}
.site-header.scrolled { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.02em; }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.nav { display: flex; gap: 24px; align-items: center; }
.nav a { font-size: 0.95rem; font-weight: 500; padding: 4px 0; position: relative; }
.nav a:hover { opacity: 0.7; }
.nav a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
.face-dark .site-header { background: rgba(35,19,52,0.9); border-bottom-color: rgba(255,255,255,0.08); }
.face-dark .nav a[aria-current="page"] { color: var(--color-accent); }

.site-footer {
  padding-block: 48px;
  border-top: 1px solid rgba(28,21,35,0.1);
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.8;
}
.face-dark .site-footer { border-top-color: rgba(255,255,255,0.1); }

/* 按钮系统 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding-inline: 24px;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s, border-color 0.2s;
  border: none;
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 3px; }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-secondary {
  background: transparent;
  border: 1.5px solid currentColor;
  color: currentColor;
}
.btn-secondary:hover { background: rgba(0,0,0,0.04); }
.face-dark .btn-primary { color: var(--color-dark); }
.face-dark .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.face-dark .btn-secondary:hover { background: rgba(255,255,255,0.08); }

/* 标题与眉标 */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  text-transform: uppercase;
}
h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 24px;
  text-wrap: balance;
}
h3 {
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 12px;
}
.hl { font-weight: 700; }
.text-lead { font-size: 1.15rem; line-height: 1.7; max-width: 65ch; margin-bottom: 24px; }

/* 卡片与面板 */
.card {
  background: #ffffff;
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 24px;
  transition: transform 0.2s;
}
.card:hover { transform: translateY(-2px); }
.panel {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: 32px;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.panel.light { background: #ffffff; }

/* 表格 */
table { width: 100%; border-collapse: collapse; margin-block: 16px; }
th, td { padding: 12px 16px; border-bottom: 1px solid rgba(0,0,0,0.1); text-align: left; }
th { font-weight: 600; }
td:last-child { text-align: right; }

/* FAQ 组件 */
details {
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  margin-bottom: 12px;
  transition: background 0.2s;
}
details:hover { background: rgba(0,0,0,0.02); }
summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s;
  flex-shrink: 0;
}
details[open] summary::before { transform: rotate(45deg); }
.details-content { padding-top: 12px; line-height: 1.7; color: inherit; opacity: 0.9; }

/* SVG 动效基础 */
.svg-responsive { width: 100%; height: auto; }
.anim-group { transform-box: fill-box; transform-origin: center; }
.stroke-path { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes pulse-opacity {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes draw-flow {
  0% { stroke-dashoffset: 0; }
  40% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes fade-slide {
  0%, 100% { opacity: 0; transform: translateY(8px); }
  10%, 90% { opacity: 1; transform: translateY(0); }
}

.anim-float { animation: float 4s ease-in-out infinite; }
.anim-pulse { animation: pulse-opacity 3s ease-in-out infinite; }
.anim-draw { animation: draw-flow 5s ease-in-out infinite; }
.anim-fade-slide { animation: fade-slide 6s ease-in-out infinite; }

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .anim-float, .anim-pulse, .anim-draw, .anim-fade-slide {
    animation: none !important;
  }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .header-inner { height: 56px; }
  .nav { gap: 16px; }
  h1 { font-size: clamp(2rem, 8vw, 3.2rem); }
  .panel { aspect-ratio: 16/9; }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
