/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* === 设计变量与语义映射 === */
:root {
  /* 色板 */
  --color-dark: #271231;
  --color-paper: #F6F3F7;
  --color-text: #1F1523;
  --color-brand: #9E13DD;
  --color-accent: #ED6EC0;
  --color-white: #FFFFFF;

  /* 结构性约束 */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(31, 21, 35, 0.3);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;

  /* 语义化取色变量（默认纸面） */
  --text-primary: var(--color-text);
  --text-secondary: rgba(31, 21, 35, 0.7);
  --accent-color: var(--color-brand);
  --link-color: var(--color-brand);
  --icon-color: var(--color-brand);
  --bg-base: var(--color-paper);
  --bg-card: var(--color-white);
  --border-subtle: rgba(31, 21, 35, 0.1);
}

/* 深色面上下文覆盖 */
.dark-face {
  --text-primary: var(--color-paper);
  --text-secondary: rgba(246, 243, 247, 0.8);
  --accent-color: var(--color-accent);
  --link-color: var(--color-accent);
  --icon-color: var(--color-accent);
  --bg-base: var(--color-dark);
  --bg-card: var(--color-dark);
  --border-subtle: rgba(246, 243, 247, 0.15);
}

/* 浅色卡片上下文覆盖（用于深色块内的内容区） */
.light-card {
  --text-primary: var(--color-text);
  --text-secondary: rgba(31, 21, 35, 0.7);
  --accent-color: var(--color-brand);
  --link-color: var(--color-brand);
  --icon-color: var(--color-brand);
  --bg-base: var(--color-paper);
  --bg-card: var(--color-white);
  --border-subtle: rgba(31, 21, 35, 0.1);
}

/* === 基础重置与排版 === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-primary);
  background-color: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--link-color); text-decoration: none; transition: color 0.2s ease; }
a:hover { opacity: 0.85; }
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); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }

/* === 标题系统 === */
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-color);
  margin-bottom: 0.6rem;
}

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
  text-wrap: balance;
}

h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); margin-bottom: 0.8rem; max-width: 60ch; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.2rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.6rem; }
p { margin-bottom: 1rem; max-width: 38em; }
.hl { color: var(--accent-color); font-weight: 600; }

/* === 页头与页脚 === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: saturate(180%) blur(8px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand img { height: 28px; width: auto; }
.brand span { font-weight: 700; font-size: 1.1rem; color: var(--text-primary); }
nav ul { display: flex; gap: 1.5rem; }
nav a { font-size: 0.95rem; font-weight: 500; color: var(--text-secondary); }
nav a:hover, nav a[aria-current="page"] { color: var(--accent-color); }
.btn-nav {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-nav:hover { background: var(--accent-color); color: var(--color-dark); }

.site-footer {
  padding-block: 3rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
}
.footer-col h4 { font-size: 0.9rem; margin-bottom: 0.8rem; color: var(--text-secondary); }
.footer-col a { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; color: var(--text-secondary); }
.footer-col a:hover { color: var(--accent-color); }
.copyright { margin-top: 2rem; font-size: 0.85rem; color: var(--text-secondary); text-align: center; }

/* === 按钮系统 === */
.btn-group { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.5rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.btn:focus-visible { outline: 3px solid var(--accent-color); outline-offset: 2px; }
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: none;
}
.btn-primary:hover { background-color: #d95aad; }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--text-primary);
  color: var(--text-primary);
}
.dark-face .btn-secondary {
  border-color: var(--color-paper);
  color: #ffffff;
}
.btn-secondary:hover { background: rgba(128,128,128,0.1); }

/* === 卡片与面板 === */
.card {
  background: var(--bg-card);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: 0 12px 32px -12px rgba(31, 21, 35, 0.35); }
.panel {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  padding: 1.5rem;
  border-radius: var(--radius-card);
}

/* === 表格 === */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 0.8rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}
.data-table th { font-weight: 600; color: var(--text-secondary); width: 40%; }
.data-table tr:last-child td { border-bottom: none; }

/* === FAQ === */
.faq-item {
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.5rem;
}
.faq-item summary {
  padding: 1rem 0;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 2rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 1rem;
  font-weight: 400;
  color: var(--accent-color);
}
.faq-item[open] summary::after { content: "−"; }
.faq-item p { margin-top: 0.5rem; margin-bottom: 1rem; color: var(--text-secondary); }

/* === 提示框 === */
.alert {
  border-left: 3px solid var(--accent-color);
  padding: 1rem 1.2rem;
  background: rgba(158, 19, 221, 0.05);
  margin: 1.5rem 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
}
.dark-face .alert { background: rgba(237, 110, 192, 0.08); }

/* === SVG 动效系统 === */
.svg-panel {
  width: 100%;
  height: auto;
  max-width: 100%;
  overflow: hidden;
}
svg { width: 100%; height: auto; display: block; }
svg path, svg rect, svg circle, svg line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

/* 绘制线条 */
@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.anim-draw { animation: draw-line 5s ease-in-out infinite alternate; }

/* 缓慢漂浮 */
@keyframes float-gentle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.anim-float { animation: float-gentle 6s ease-in-out infinite; }

/* 几何旋转拼合 */
@keyframes rotate-slow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.anim-rotate {
  animation: rotate-slow 14s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes rotate-reverse {
  0% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}
.anim-rotate-rev {
  animation: rotate-reverse 18s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}

/* 滑入对齐 */
@keyframes slide-align {
  0% { transform: translateX(15px); opacity: 0.4; }
  100% { transform: translateX(0); opacity: 1; }
}
.anim-slide { animation: slide-align 4s ease-out forwards; }

/* 呼吸点 */
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.anim-breathe { animation: breathe 2.5s 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;
  }
}

/* === 响应式适配 === */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero-layout { grid-template-columns: 1fr !important; }
  .hero-svg-wrap { order: -1; margin-bottom: 1rem; }
  nav ul { display: none; }
  .btn-group { flex-direction: column; }
  .btn { width: 100%; }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
