/* SafeW 全站共享样式 */

/* --- 设计变量 (Tokens) --- */
:root {
  /* 颜色系统 */
  --color-dark-bg: #1B1231;      /* 深色面：首屏、重点区 */
  --color-paper-bg: #F4F3F7;     /* 浅色纸面：内容区 */
  --color-text-main: #191523;    /* 正文色（纸面上） */
  --color-text-light: #F4F3F7;   /* 正文色（深色面上） */
  
  --color-brand: #5214EB;        /* 品牌色（纸面上的强调） */
  --color-accent: #9977EE;       /* 强调色（按钮、深色面上的强调） */
  
  /* 结构尺寸 */
  --radius-card: 24px;
  --radius-btn: 999px;
  --content-max: 1280px;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  
  /* 字体与排版 */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Noto Sans SC", sans-serif;
  --line-height-base: 1.55;
}

/* --- 基础重置 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  background-color: var(--color-paper-bg);
  color: var(--color-text-main);
  line-height: var(--line-height-base);
  font-size: 16px;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* --- 布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
  overflow-x: hidden;
}

/* --- 区块通用 --- */
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}
.section-divider {
  border: none;
  border-top: 1px solid rgba(25, 21, 35, 0.1);
  margin: 0 calc(var(--gap) * -1);
}

/* 眉标 (Subtitle Label) */
.label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.5em;
}
.paper-face .label { color: var(--color-brand); }
.dark-face .label { color: var(--color-accent); }

/* 标题 */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
}
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.5em; }
h3 { font-size: 1.25rem; margin-bottom: 0.75em; }

/* 高亮词 */
.hl { font-weight: 800; }
.paper-face .hl { color: var(--color-brand); }
.dark-face .hl { color: var(--color-accent); }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
}
.btn-secondary {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
}
.dark-face .btn-secondary { color: #ffffff; border-color: #ffffff; }
.paper-face .btn-secondary { color: var(--color-text-main); border-color: var(--color-text-main); }

/* --- 卡片 --- */
.card {
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-card);
  padding: 24px;
  /* 无阴影，无描边，靠背景色区分 */
}
.dark-face .card {
  background: rgba(255, 255, 255, 0.05);
}

/* --- 表格 --- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-card);
  background: white;
  border: 1px solid rgba(0,0,0,0.05);
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th, td {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
th { font-weight: 700; color: var(--color-text-main); background: rgba(0,0,0,0.02); }
td { color: var(--color-text-main); }
tr:last-child td { border-bottom: none; }

/* --- FAQ --- */
details {
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  padding-bottom: 16px;
}
summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  position: relative;
  padding-left: 24px;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 8px; height: 8px;
  border-right: 2px solid var(--color-brand);
  border-bottom: 2px solid var(--color-brand);
  transform: translateY(-60%) rotate(45deg);
}
[open] summary::before {
  transform: translateY(-40%) rotate(-45deg);
}
details p { margin-top: 8px; color: var(--color-text-main); }

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(244, 243, 247, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding: 16px 0;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-links { display: flex; gap: 32px; }
.nav-link { font-weight: 600; font-size: 0.95rem; }
.nav-link[aria-current="page"] { color: var(--color-brand); }

.site-footer {
  background: var(--color-dark-bg);
  color: var(--color-text-light);
  padding: 64px 0 32px;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 48px;
  margin-bottom: 48px;
}
.footer-col h4 { color: var(--color-accent); margin-bottom: 16px; }
.footer-col ul li { margin-bottom: 12px; }
.footer-col a:hover { color: var(--color-accent); }
.copyright {
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 32px;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* --- SVG 动效类 --- */
.svg-panel {
  width: 100%;
  height: auto;
  max-width: 100%;
}
.anim-spin-slow { animation: spin 20s linear infinite; transform-box: fill-box; transform-origin: center; }
.anim-spin-reverse { animation: spin-reverse 15s linear infinite; transform-box: fill-box; transform-origin: center; }
.anim-pulse { animation: pulse 4s ease-in-out infinite alternate; }
.anim-draw { 
  stroke-dasharray: 1; 
  stroke-dashoffset: 0; 
  animation: draw-line 6s ease-in-out infinite alternate; 
}

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes spin-reverse { 100% { transform: rotate(-360deg); } }
@keyframes pulse { 0% { opacity: 0.6; } 100% { opacity: 1; } }
@keyframes draw-line { 0% { stroke-dashoffset: 1; } 100% { stroke-dashoffset: 0; } }

@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;
  }
}

/* 兜底：裁掉横向溢出 */
html, body {
  overflow-x: hidden;
}
body > * {
  max-width: 100%;
}
