/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计变量 */
:root {
  /* 配色体系 */
  --color-dark: #231334;
  --color-paper: #F5F3F7;
  --color-body: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;

  /* 结构令牌 */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;
  --sidebar-w: 260px;

  /* 字体与间距 */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --line-height-base: 1.75;
}

/* 基础重置 */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background: var(--color-paper);
  color: var(--color-body);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* 面色控制 */
.face-dark {
  background: var(--color-dark);
  color: var(--color-paper);
}
.face-dark .hl { color: var(--color-accent); }
.face-dark a:not(.btn) { color: var(--color-accent); text-decoration: underline; text-underline-offset: 2px; }
.face-dark .marker { color: var(--color-accent); }

.face-paper {
  background: var(--color-paper);
  color: var(--color-body);
}
.face-paper .hl { color: var(--color-brand); }
.face-paper a:not(.btn) { color: var(--color-brand); text-decoration: underline; text-underline-offset: 2px; }
.face-paper .marker { color: var(--color-brand); }

/* 布局容器 */
.site-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.sidebar-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 2rem 1.5rem;
  background: var(--color-dark);
  border-right: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.sidebar-nav .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-paper);
}
.sidebar-nav .brand img { width: 28px; height: 28px; object-fit: contain; }
.sidebar-nav nav a {
  display: block;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.4rem;
  border-radius: 8px;
  font-size: 0.9rem;
  color: rgba(245,243,247,0.7);
  transition: background 0.2s, color 0.2s;
}
.sidebar-nav nav a:hover, .sidebar-nav nav a[aria-current="page"] {
  background: rgba(255,255,255,0.08);
  color: var(--color-paper);
}
.content-area {
  width: 100%;
  overflow-x: hidden;
}

/* 顶部导航（移动端可见，桌面端隐藏） */
.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245,243,247,0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(28,21,35,0.08);
  padding: 0.75rem var(--gap);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.face-dark .top-header { background: rgba(35,19,52,0.9); border-bottom-color: rgba(245,243,247,0.08); }
.top-header .brand-mobile { font-weight: 700; color: var(--color-body); display: flex; align-items: center; gap: 0.5rem; }
.face-dark .top-header .brand-mobile { color: var(--color-paper); }
.top-header .brand-mobile img { width: 24px; height: 24px; }
.top-header nav { display: flex; gap: 1.5rem; align-items: center; }
.top-header nav a { font-size: 0.9rem; font-weight: 500; }
.top-header nav a:hover { opacity: 0.8; }

/* 区块排版 */
.section {
  padding: var(--section-y) var(--gap);
  border-bottom: 1px solid rgba(28,21,35,0.06);
}
.face-dark .section { border-bottom-color: rgba(245,243,247,0.06); }
.container {
  max-width: var(--content-max);
  margin: 0 auto;
}
.marker {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.02em;
  margin: 0 0 1.5rem;
}
h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 1.5rem 0 0.75rem;
  line-height: 1.3;
}
p { margin: 0 0 1rem; max-width: 38em; }
.text-balance { text-wrap: balance; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s ease, filter 0.2s ease;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(0.95); }
.btn-secondary {
  background: transparent;
  color: var(--color-body);
  border-color: var(--color-body);
}
.face-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.btn-secondary:hover { background: rgba(28,21,35,0.05); }
.face-dark .btn-secondary:hover { background: rgba(245,243,247,0.08); }
.btn-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* 卡片与面板 */
.card {
  background: var(--bg-card, var(--color-paper));
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
}
.panel {
  background: var(--panel-bg, var(--color-dark));
  border-radius: var(--radius-card);
  padding: var(--gap);
  position: relative;
  overflow: hidden;
}

/* 网格系统 */
.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); }

/* 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
th, td { padding: 0.8rem 1rem; text-align: left; border-bottom: 1px solid rgba(28,21,35,0.08); }
.face-dark th, .face-dark td { border-bottom-color: rgba(245,243,247,0.08); }
th { font-weight: 600; }

/* 详情列表 (FAQ) */
details {
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(28,21,35,0.08);
  padding-bottom: 1rem;
}
.face-dark details { border-bottom-color: rgba(245,243,247,0.08); }
summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "+";
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  border: 1px solid currentColor;
  border-radius: 4px;
  text-align: center;
  line-height: 1.2em;
  font-size: 0.8em;
  transition: transform 0.2s;
}
details[open] summary::before { transform: rotate(45deg); content: "+"; }
details p { margin-top: 0.75rem; }

/* 新闻卡片 */
.news-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.news-card time { font-size: 0.8rem; opacity: 0.7; margin-bottom: 0.5rem; display: block; }
.news-card h4 { margin: 0 0 0.5rem; font-size: 1rem; }
.news-card p { font-size: 0.9rem; margin: 0; }

/* 编号徽标 */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 8px;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

/* SVG 动画基础 */
svg.anim-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}
svg.anim-svg path, svg.anim-svg circle, svg.anim-svg rect, svg.anim-svg line {
  fill: none;
  stroke-width: 1.5;
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
svg.anim-svg .fill-solid { fill: currentColor; stroke: none; }

/* 关键帧定义 */
@keyframes geo-rotate {
  0%, 100% { transform: rotate(0deg) scale(0.95); opacity: 0.6; }
  50% { transform: rotate(180deg) scale(1.05); opacity: 1; }
}
@keyframes geo-align {
  0%, 100% { transform: translateX(0) translateY(0); opacity: 0.5; }
  50% { transform: translateX(4px) translateY(-3px); opacity: 1; }
}
@keyframes bubble-float {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(-6px); opacity: 1; }
}
@keyframes dash-flow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes pulse-dot {
  0%, 100% { r: 3; opacity: 0.4; }
  50% { r: 5; opacity: 1; }
}

/* 动效类绑定 */
.geo-rotate { animation: geo-rotate 8s linear infinite; transform-box: fill-box; transform-origin: center; }
.geo-align { animation: geo-align 6s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.bubble-float { animation: bubble-float 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.dash-flow { animation: dash-flow 3s ease-in-out infinite; }
.pulse-dot { animation: pulse-dot 2.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

/* 响应式适配 */
@media (max-width: 1023px) {
  .site-layout { grid-template-columns: 1fr; }
  .sidebar-nav { display: none; }
  .top-header { display: flex; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (min-width: 1024px) {
  .top-header { display: none; }
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}
