/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 色板 */
  --bg-dark: #21163C;
  --bg-paper: #F4F3F7;
  --text-main: #191523;
  --brand: #5214EB;
  --accent: #ED926E;

  /* 结构 Token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 1px solid rgba(25, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;

  /* 动态上下文变量（纸面默认） */
  --surface-bg: var(--bg-paper);
  --text-body: var(--text-main);
  --text-hl: var(--brand);
  --link-color: var(--brand);
  --border-subtle: rgba(25, 21, 35, 0.1);
}

/* 深色面覆盖 */
.face-dark {
  --surface-bg: var(--bg-dark);
  --text-body: var(--bg-paper);
  --text-hl: var(--accent);
  --link-color: var(--accent);
  --border-subtle: rgba(244, 243, 247, 0.15);
}

/* 浅色卡片在深色面上恢复纸面取色 */
.card-light {
  background: var(--bg-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  color: var(--text-main);
}

/* --- 基础排版 --- */
*, *::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, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-body);
  background: var(--surface-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: 0.02em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); font-weight: 700; margin-bottom: 0.6em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 700; margin-bottom: 0.5em; }
h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.4em; }
p { margin-bottom: 1em; max-width: 38em; }
a { color: var(--link-color); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.85; }
ul, ol { padding-left: 1.2em; margin-bottom: 1em; }
li { margin-bottom: 0.4em; }

/* 眉标 */
.micro-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-hl);
  margin-bottom: 0.5em;
}

/* 强调词 */
.hl { color: var(--text-hl); }

/* 布局容器 */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
section { padding-block: var(--section-y); }

/* --- 组件：按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:focus-visible { outline: 2px solid var(--link-color); outline-offset: 3px; }
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--accent);
  color: var(--bg-dark);
  border: none;
}
.btn-primary:hover { background: #d9825e; }

.btn-secondary {
  background: transparent;
  color: var(--text-body);
  border: 1px solid var(--text-body);
}
.btn-secondary:hover { background: rgba(25, 21, 35, 0.06); }
.face-dark .btn-secondary { border-color: var(--bg-paper); color: var(--bg-paper); }
.face-dark .btn-secondary:hover { background: rgba(244, 243, 247, 0.1); }

/* --- 组件：卡片 --- */
.card {
  background: var(--surface-bg);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--card-shadow);
}
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

/* --- 组件：表格 --- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin-bottom: 1em;
}
th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}
th { font-weight: 600; color: var(--text-hl); }
td:first-child { font-weight: 600; }

/* --- 组件：FAQ (Details/Summary) --- */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 12px;
  background: var(--surface-bg);
  overflow: hidden;
}
summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 40px;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 400;
  color: var(--text-hl);
  transition: transform 0.2s;
}
details[open] summary::after { content: "−"; }
details p { padding: 0 20px 16px; color: var(--text-body); opacity: 0.9; }

/* --- 组件：时间轴 --- */
.timeline { position: relative; padding-left: 24px; border-left: 2px solid var(--border-subtle); }
.timeline-item { position: relative; margin-bottom: 32px; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -29px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-hl);
  border: 2px solid var(--surface-bg);
}
.time-tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-hl);
  margin-bottom: 4px;
}

/* --- 组件：Tab (纯 CSS) --- */
.tab-radio { display: none; }
.tab-nav { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab-nav label {
  padding: 8px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-btn);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
}
.tab-panel { display: none; }
.tab-radio:checked + .tab-nav label[for],
.tab-radio:nth-of-type(1):checked ~ .tab-panel:nth-of-type(1) { background: var(--text-hl); color: var(--bg-paper); }
.tab-radio:nth-of-type(1):checked ~ .tab-panel:nth-of-type(1) { display: block; }
.tab-radio:nth-of-type(2):checked ~ .tab-panel:nth-of-type(2) { display: block; }
.tab-radio:nth-of-type(3):checked ~ .tab-panel:nth-of-type(3) { display: block; }
.tab-radio:nth-of-type(4):checked ~ .tab-panel:nth-of-type(4) { display: block; }
.tab-radio:nth-of-type(5):checked ~ .tab-panel:nth-of-type(5) { display: block; }

/* 无 JS 降级：全部显示 */
@media (max-width: 768px) {
  .tab-panel { display: block !important; }
  .tab-nav { display: none; }
}

/* --- SVG 动效 --- */
svg { width: 100%; height: auto; max-width: 100%; display: block; }
svg [class*="anim-"] { transform-box: fill-box; transform-origin: center; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes spin-slow {
  to { transform: rotate(360deg); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes slide-in {
  0%, 100% { transform: translateX(0); opacity: 0.8; }
  50% { transform: translateX(4px); opacity: 1; }
}
@keyframes snap-together {
  0%, 100% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(3deg) scale(1.02); }
}

.anim-float { animation: float 4s ease-in-out infinite; }
.anim-spin { animation: spin-slow 12s linear infinite; }
.anim-breathe { animation: breathe 3s ease-in-out infinite; }
.anim-slide { animation: slide-in 5s ease-in-out infinite; }
.anim-snap { animation: snap-together 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;
  }
}

/* --- 页头页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(244, 243, 247, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
}
.face-dark .site-header { background: rgba(33, 22, 60, 0.9); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo-area { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text-body); }
.logo-area img { height: 32px; width: auto; }
nav ul { display: flex; gap: 24px; list-style: none; }
nav a { font-weight: 500; font-size: 0.95rem; }
nav a[aria-current="page"] { color: var(--text-hl); font-weight: 700; }
.nav-actions { display: flex; align-items: center; gap: 12px; }

.site-footer {
  padding: 48px 0;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.9rem;
  color: var(--text-body);
  opacity: 0.9;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 24px;
}
.footer-grid h4 { font-size: 0.95rem; margin-bottom: 12px; color: var(--text-hl); }
.footer-grid ul { list-style: none; padding: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}
