/* =========================================
   SafeW 全站共享样式
   ========================================= */

:root {
  /* 色板 */
  --color-dark: #13102D;
  --color-paper: #D6D4ED;
  --color-text: #171523;
  --color-brand: #2714EB;
  --color-accent: #89ED6E;

  /* 设计 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(23, 21, 35, 0.3);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;

  /* 排版 */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --line-height-body: 1.55;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  line-height: var(--line-height-body);
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* 面上下文取色变量 */
.paper-face {
  background-color: var(--color-paper);
  color: var(--color-text);
}
.dark-face {
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.paper-face .hl { color: var(--color-brand); }
.dark-face .hl { color: var(--color-accent); }

/* 容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* 排版 */
h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
}
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
h3 { font-size: 1.25rem; }
p {
  margin-bottom: var(--gap);
  max-width: 38em;
}
small { font-size: 0.875rem; opacity: 0.85; }

/* 布局网格 */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
  align-items: center;
}
.row-reverse { direction: rtl; }
.row-reverse > * { direction: ltr; }

/* 组件：卡片 */
.card {
  background-color: var(--color-paper);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  border: var(--card-border);
}
.dark-face .card {
  background-color: #1c193a;
  color: var(--color-paper);
}
.dark-face .card .hl { color: var(--color-accent); }

/* 组件：按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.8em 1.6em;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-secondary {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
}
.dark-face .btn-primary { color: var(--color-dark); }
.dark-face .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }

/* 组件：眉标 */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.75em;
  text-transform: uppercase;
}
.paper-face .badge { color: var(--color-brand); }
.dark-face .badge { color: var(--color-accent); }

/* 组件：表格 */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--gap);
  font-size: 0.95rem;
}
th, td {
  padding: 0.8em 1em;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
.dark-face th, .dark-face td {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}
th { font-weight: 600; }
td:first-child { font-weight: 500; }

/* 组件：FAQ / Details */
details {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-card);
  padding: var(--gap);
  margin-bottom: var(--gap);
  transition: background-color 0.2s;
}
.dark-face details {
  border-color: rgba(255, 255, 255, 0.15);
}
summary {
  cursor: pointer;
  font-weight: 600;
  outline: none;
  list-style: none;
  position: relative;
  padding-left: 1.2em;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 0.5em;
  height: 0.5em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s;
}
details[open] summary::before { transform: rotate(45deg); }
details p { margin-top: 0.75em; margin-bottom: 0; }

/* 页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background-color: rgba(214, 212, 237, 0.92);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.dark-face .site-header {
  background-color: rgba(19, 16, 45, 0.92);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-weight: 700;
  font-size: 1.1rem;
}
.brand img { width: 32px; height: 32px; object-fit: contain; }
nav ul { display: flex; gap: 1.5em; }
nav a { font-weight: 500; transition: opacity 0.2s; }
nav a:hover { opacity: 0.8; }
nav a[aria-current="page"] { font-weight: 700; }
.paper-face nav a[aria-current="page"] { color: var(--color-brand); }
.dark-face nav a[aria-current="page"] { color: var(--color-accent); }
.header-actions { display: flex; align-items: center; gap: 0.8em; }

/* 页脚 */
.site-footer {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.dark-face .site-footer { border-top-color: rgba(255, 255, 255, 0.1); }
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.footer-col h4 { font-size: 0.9rem; margin-bottom: 0.6em; opacity: 0.9; }
.footer-col ul { display: flex; flex-direction: column; gap: 0.5em; }
.footer-col a { opacity: 0.8; transition: opacity 0.2s; }
.footer-col a:hover { opacity: 1; }
.copyright { text-align: center; font-size: 0.85rem; opacity: 0.7; margin-top: var(--gap); }

/* SVG 基础 */
svg { width: 100%; height: auto; display: block; }
svg.fixed-icon { width: 24px; height: 24px; flex-shrink: 0; }
svg.panel-svg { max-width: 100%; }

/* SVG 动效关键帧 */
@keyframes float-slow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes float-fast {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@keyframes draw-path {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes fade-in-up {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.anim-float-slow { animation: float-slow 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-float-fast { animation: float-fast 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-draw { animation: draw-path 2.5s ease forwards; }
.anim-fade-in { animation: fade-in-up 0.8s ease forwards; }

/* 减少动态效果偏好 */
@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-template-columns: 1fr; }
  .row-reverse { direction: ltr; }
  nav { display: none; } /* 简化版：移动端隐藏导航，实际生产可加汉堡菜单 */
  .header-actions .btn { padding: 0.6em 1.2em; font-size: 0.9rem; }
}
:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}
.dark-face :focus-visible {
  outline-color: var(--color-accent);
}
