/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计变量 */
:root {
  /* 色板 */
  --color-dark: #240F29;
  --color-paper: #F6F3F7;
  --color-body: #201523;
  --color-brand: #A711CF;
  --color-accent: #ED6E73;
  
  /* 取色变量（由容器类覆写） */
  --text-color: var(--color-body);
  --highlight-color: var(--color-brand);
  --bg-color: var(--color-paper);
  --link-color: var(--color-brand);
  --btn-text: var(--color-dark);
  --btn-bg: var(--color-accent);

  /* 结构 Token */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 960px;
  --line-height-body: 1.55;
  --line-height-title: 1.1;
  --font-weight-title: 800;
  --letter-spacing-title: -0.02em;
}

/* 重置与基础 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  line-height: var(--line-height-body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--link-color); text-decoration: none; transition: opacity 0.2s; }
a:hover, a:focus-visible { opacity: 0.85; }
a:focus-visible { outline: 2px solid var(--highlight-color); outline-offset: 2px; }
ul, ol { list-style: none; }

/* 容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

/* 面色控制类 */
.bg-dark {
  --bg-color: var(--color-dark);
  --text-color: #f6f3f7;
  --highlight-color: var(--color-highlight-on-dark);
  --link-color: var(--color-highlight-on-dark);
}
.bg-paper {
  --bg-color: var(--color-paper);
  --text-color: var(--color-body);
  --highlight-color: var(--color-brand);
  --link-color: var(--color-brand);
}

/* 排版 */
.section-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: var(--font-weight-title);
  letter-spacing: var(--letter-spacing-title);
  line-height: var(--line-height-title);
  margin-bottom: var(--gap);
}
.section-subtitle {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--highlight-color);
  margin-bottom: 0.5em;
  display: block;
}
.hl { color: var(--highlight-color); }
p { margin-bottom: 1em; max-width: 38em; }
h2 { margin-top: calc(var(--section-y) * 1.5); }
h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: var(--font-weight-title);
  letter-spacing: var(--letter-spacing-title);
  line-height: var(--line-height-title);
  margin: 1.5em 0 0.75em;
}
code, kbd, samp { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.9em; }

/* 头部与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-color);
  border-bottom: 1px solid rgba(128,128,128,0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand img { height: 32px; width: auto; }
.brand span { font-weight: 800; font-size: 1.1rem; letter-spacing: -0.01em; }
nav ul { display: flex; gap: 1.5rem; align-items: center; }
nav a { font-size: 0.95rem; font-weight: 500; }
nav a[aria-current="page"] { color: var(--highlight-color); font-weight: 700; }
.nav-btn {
  height: 40px;
  padding: 0 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.site-footer {
  padding: 3rem 0;
  border-top: 1px solid rgba(128,128,128,0.15);
  margin-top: var(--section-y);
  font-size: 0.9rem;
  opacity: 0.85;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 2rem; }
.footer-col h4 { font-weight: 700; margin-bottom: 0.75rem; }
.footer-col ul li { margin-bottom: 0.5rem; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  height: 48px;
  padding: 0 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  text-decoration: none;
}
.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-secondary {
  background: transparent;
  color: var(--text-color);
  border: 1px solid currentColor;
}
.btn-secondary:hover { background: rgba(128,128,128,0.08); }
.btn svg { width: 20px; height: 20px; stroke-width: 2; }

/* 卡片与面板 */
.card {
  background: var(--bg-color);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  transition: transform 0.2s ease;
}
.panel {
  background: var(--bg-color);
  border-radius: var(--radius-card);
  padding: 2rem;
  margin-top: var(--gap);
}
.panel.dark-panel { background: var(--color-dark); }
.panel.light-card {
  background: var(--color-paper);
  color: var(--color-body);
  border: 1px solid rgba(128,128,128,0.1);
}

/* 网格布局 */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .header-inner { flex-direction: column; height: auto; padding: 1rem 0; }
  nav ul { flex-wrap: wrap; justify-content: center; margin-top: 1rem; }
}

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(128,128,128,0.2);
}
.data-table th { font-weight: 700; width: 40%; }
.data-table tr:last-child td { border-bottom: none; }

/* FAQ */
details {
  border-bottom: 1px solid rgba(128,128,128,0.2);
  padding: 1rem 0;
}
summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 1.5rem;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  position: absolute;
  right: 0;
  font-weight: 400;
  transition: transform 0.2s;
}
details[open] summary::after { transform: rotate(45deg); }
details p { margin-top: 0.75rem; color: var(--text-color); opacity: 0.9; }

/* 提示框 */
.alert {
  border-left: 3px solid var(--highlight-color);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  background: rgba(128,128,128,0.05);
  font-size: 0.95rem;
}

/* SVG 动效基础 */
.svg-anim { width: 100%; height: auto; overflow: visible; }
.svg-anim g { transform-box: fill-box; transform-origin: center; }
.draw-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.draw-path.animate-draw { animation: draw-line 3s ease-in-out infinite alternate; }
.float-slow { animation: float 6s ease-in-out infinite; }
.rotate-slow { animation: rotate 12s linear infinite; }
.pulse-opacity { animation: pulse-opacity 4s ease-in-out infinite; }
.bubble-enter { animation: bubble-enter 5s ease-out infinite; }

/* Keyframes */
@keyframes draw-line {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes pulse-opacity {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
@keyframes bubble-enter {
  0%, 15% { opacity: 0; transform: translateY(10px); }
  20%, 80% { opacity: 1; transform: translateY(0); }
  85%, 100% { opacity: 0; transform: translateY(-5px); }
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .draw-path.animate-draw, .float-slow, .rotate-slow, .pulse-opacity, .bubble-enter {
    animation: none !important;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
