/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 颜色系统 */
  --color-dark: #19102D;
  --color-paper: #FCFCFD;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #D66EED;
  --color-divider: rgba(25, 21, 35, 0.12);

  /* 结构 Token */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;

  /* 字体与排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --lh-body: 1.75;
  --lh-heading: 1.15;
}

/* --- 基础重置 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--color-paper);
  color: var(--color-text);
  line-height: var(--lh-body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { transition: color 0.2s ease; }
ul, ol { list-style: none; }

/* --- 排版层级 --- */
h1, h2, h3, h4 {
  font-weight: 500;
  line-height: var(--lh-heading);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
h3 { font-size: 1.25rem; margin-top: 1.5em; }
p { margin-bottom: 1em; max-width: 38em; }
small { font-size: 0.875rem; }

/* 眉标 */
.label-tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.75em;
  text-transform: uppercase;
}
.paper-surface .label-tag { color: var(--color-brand); }
.dark-surface .label-tag { color: var(--color-accent); }

/* 高亮词 */
.hl { font-weight: 700; }
.paper-surface .hl { color: var(--color-brand); }
.dark-surface .hl { color: var(--color-accent); }

/* --- 布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section-wrapper {
  padding: var(--section-y) 0;
  border-bottom: 1px solid var(--color-divider);
}
.section-wrapper:last-child { border-bottom: none; }
.grid-auto {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}
.flex-row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: flex-start; }
.flex-col { display: flex; flex-direction: column; gap: var(--gap); }

/* --- 按钮组件 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border: none;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-outline {
  background: transparent;
  border: 2px solid currentColor;
  color: inherit;
}
.paper-surface .btn-outline { color: var(--color-text); }
.dark-surface .btn-outline { color: var(--color-paper); }

/* --- 卡片组件 --- */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  border-radius: var(--radius-card);
}
/* 深色面上的浅色卡片覆盖为纸面取色 */
.dark-surface .card {
  background: var(--color-paper);
  color: var(--color-text);
}
.dark-surface .card .label-tag { color: var(--color-brand); }
.dark-surface .card .hl { color: var(--color-brand); }

/* --- 表格组件 --- */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th, td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-divider);
}
th { font-weight: 700; }
td { white-space: nowrap; }
td a { color: var(--color-brand); }
.dark-surface td a { color: var(--color-accent); }

/* --- FAQ 组件 --- */
details {
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-card);
  background: var(--color-paper);
}
summary {
  cursor: pointer;
  font-weight: 600;
  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: 8px;
  height: 8px;
  background: var(--color-brand);
}
.dark-surface summary::before { background: var(--color-accent); }
details[open] summary { margin-bottom: 0.75rem; }
details p { margin-top: 0.5rem; font-size: 0.95rem; }

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252, 252, 253, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-divider);
}
.dark-surface .site-header { background: rgba(25, 16, 45, 0.95); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-link {
  color: inherit;
  font-weight: 500;
  padding: 0.5em 0.75em;
}
.nav-link:hover { color: var(--color-brand); }
.dark-surface .nav-link:hover { color: var(--color-accent); }
.nav-link[aria-current="page"] { font-weight: 700; }
.site-footer {
  padding: 3rem 0;
  border-top: 1px solid var(--color-divider);
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-text);
}
.dark-surface .site-footer { border-top-color: rgba(252,252,253,0.15); color: var(--color-paper); }

/* --- SVG 动效核心 --- */
.anim-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
@keyframes drawLine {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
.anim-draw { animation: drawLine 4s ease-in-out infinite alternate; }

@keyframes breatheOrbit {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.06); opacity: 1; }
}
.anim-breathe { animation: breatheOrbit 8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

@keyframes floatUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.anim-float { animation: floatUp 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

@keyframes popIn {
  0%, 100% { transform: scale(1) translateY(0); opacity: 1; }
  50% { transform: scale(1.03) translateY(-6px); opacity: 0.88; }
}
.anim-pop { animation: popIn 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.7; }
}
.anim-pulse { animation: pulseDot 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

@media (prefers-reduced-motion: reduce) {
  .anim-draw, .anim-breathe, .anim-float, .anim-pop, .anim-pulse {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}
