/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 设计 Token / 变量 --- */
:root {
  /* 配色系统 */
  --color-dark-bg: #2D1438;
  --color-paper-bg: #F6F3F7;
  --color-text-main: #1F1523;
  --color-brand: #9E13DD;
  --color-accent: #6EEDA8;

  /* 语义化颜色映射 (默认纸面模式) */
  --bg-body: var(--color-paper-bg);
  --bg-surface: var(--color-dark-bg);
  --text-primary: var(--color-text-main);
  --text-secondary: #4A3B52;
  --text-inverse: var(--color-paper-bg);
  --accent-color: var(--color-accent);
  --brand-color: var(--color-brand);
  --link-color: var(--color-brand);
  --link-hover: #7A0FA8;
  --border-color: rgba(31, 21, 35, 0.12);
  --card-shadow: 0 10px 28px -14px rgba(31, 21, 35, 0.3);
  --card-shadow-hover: 0 14px 32px -12px rgba(31, 21, 35, 0.4);

  /* 几何与间距 */
  --radius-card: 20px;
  --radius-btn: 12px;
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --content-max: 1280px;

  /* 排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

/* 深色面模式覆盖 */
.dark-surface {
  --bg-surface: var(--color-dark-bg);
  --text-primary: var(--color-paper-bg);
  --text-secondary: #C9BFD0;
  --accent-color: var(--color-accent);
  --brand-color: var(--color-accent);
  --link-color: var(--color-accent);
  --link-hover: #A8FFD0;
  --border-color: rgba(246, 243, 247, 0.15);
  --card-shadow: 0 10px 28px -14px rgba(0, 0, 0, 0.5);
}

/* 深色面上的浅色卡片 (恢复纸面取色逻辑) */
.light-card-on-dark {
  background-color: var(--color-paper-bg);
  color: var(--color-text-main);
  border: 1px solid var(--border-color);
}
.light-card-on-dark .hl { color: var(--color-brand); }
.light-card-on-dark a { color: var(--color-brand); }
.light-card-on-dark a:hover { color: var(--color-brand); }

/* --- 基础排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 标题处理 */
h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; color: var(--text-primary); }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); margin-bottom: var(--gap); text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.5rem; text-wrap: balance; }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); margin-bottom: 0.75rem; text-wrap: balance; }
p { margin-bottom: 1rem; max-width: 38em; }

/* 眉标 (Section Label) */
.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  color: var(--brand-color);
}
.dark-surface .section-label { color: var(--accent-color); }

/* 高亮词 */
.hl { color: var(--brand-color); }
.dark-surface .hl { color: var(--accent-color); }

/* 链接 */
a { color: var(--link-color); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--link-hover); text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; border-radius: 2px; }

/* 容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* 区块通用 */
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  position: relative;
}
.section + .section { border-top: 1px solid var(--border-color); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.btn-primary {
  background-color: var(--accent-color);
  color: var(--color-dark-bg);
  border: 2px solid transparent;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(110, 237, 168, 0.4);
  text-decoration: none;
}
.btn-primary:focus-visible { outline-offset: 4px; }

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--text-primary);
}
.dark-surface .btn-secondary { color: var(--text-inverse); border-color: var(--text-inverse); }
.btn-secondary:hover {
  background-color: rgba(31, 21, 35, 0.05);
  transform: translateY(-2px);
  text-decoration: none;
}
.dark-surface .btn-secondary:hover { background-color: rgba(246, 243, 247, 0.1); }

/* 卡片 */
.card {
  background-color: var(--paper-bg, var(--color-paper-bg));
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.card:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-4px); }
.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.card-body { flex-grow: 1; font-size: 0.95rem; color: var(--text-secondary); }
.dark-surface .card { background-color: var(--color-paper-bg); color: var(--color-text-main); }

/* 表格 */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  background: var(--paper-bg, var(--color-paper-bg));
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 1rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}
th { font-weight: 700; background-color: rgba(31, 21, 35, 0.03); }
.dark-surface .table-wrapper { background-color: var(--color-paper-bg); color: var(--color-text-main); }
.dark-surface th { background-color: rgba(31, 21, 35, 0.05); }
tr:last-child td { border-bottom: none; }

/* FAQ (Details/Summary) */
.faq-item {
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0;
}
.faq-item summary {
  padding: 1.25rem 0;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-primary);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 1.5rem;
  font-weight: 300;
  transition: transform 0.3s ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p {
  padding-bottom: 1.25rem;
  margin-bottom: 0;
  color: var(--text-secondary);
}
.dark-surface .faq-item summary { color: var(--text-inverse); }
.dark-surface .faq-item p { color: var(--text-secondary); }

/* 页头页脚 */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(246, 243, 247, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}
.dark-surface .header { background-color: rgba(45, 20, 56, 0.85); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.nav-list {
  display: flex;
  list-style: none;
  gap: 2rem;
}
.nav-link { font-weight: 500; font-size: 0.95rem; }
.nav-link[aria-current="page"] { color: var(--accent-color); font-weight: 700; }
.footer {
  background-color: var(--color-dark-bg);
  color: var(--color-paper-bg);
  padding: 3rem 0;
  font-size: 0.9rem;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
}
.footer-links { display: flex; gap: 1.5rem; list-style: none; }
.footer-links a { color: var(--color-paper-bg); opacity: 0.8; }
.footer-links a:hover { opacity: 1; color: var(--accent-color); text-decoration: none; }

/* SVG 动效 Keyframes */
@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes float-delayed {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes dash {
  to { stroke-dashoffset: 0; }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
@keyframes slide-in-right {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* SVG 动效 Class */
.svg-float { animation: float-y 6s ease-in-out infinite; }
.svg-float-delayed { animation: float-delayed 7s ease-in-out infinite 1s; }
.svg-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: dash 2s linear infinite; }
.svg-blink { animation: blink 2s ease-in-out infinite; }
.svg-slide { animation: slide-in-right 0.8s ease-out forwards; }

/* 减少动态效果 */
@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;
  }
}

/* 响应式调整 */
@media (max-width: 768px) {
  .nav-list { display: none; } /* 移动端简化导航，实际项目可加汉堡菜单 */
  h1 { font-size: 2.2rem; }
  h2 { font-size: 1.5rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .hero-layout { flex-direction: column-reverse; }
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 2rem; }
.hero-layout { display: flex; align-items: center; gap: 3rem; }
.hero-text { flex: 1; min-width: 0; }
.hero-visual { flex: 1; min-width: 0; }
