/* =========================================
   SafeW 全局样式与动效
   ========================================= */

/* --- 设计 Token (Variables) --- */
:root {
  /* 色板 */
  --color-dark-bg: #141838;
  --color-paper-bg: #FCFCFD;
  --color-text-body: #151723;
  --color-brand: #142CEB;
  --color-accent: #6EAFED;
  
  /* 圆角 */
  --radius-card: 8px;
  --radius-btn: 6px;

  /* 间距与布局 */
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;

  /* 字体 */
  --font-sans: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

/* --- 基础重置 --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--color-text-body);
  background-color: var(--color-paper-bg);
  -webkit-font-smoothing: antialiased;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* --- 排版系统 --- */
h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: var(--gap);
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1.25rem;
  max-width: 38em;
}

/* 眉标 */
.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  color: var(--color-brand);
}

.dark-section .section-label {
  color: var(--color-accent);
}

/* 高亮关键词 */
.hl {
  color: var(--color-brand);
}

.dark-section .hl {
  color: var(--color-accent);
}

/* --- 容器与网格 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: var(--gap);
}

/* --- 区块结构 --- */
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

.section-divider {
  border: 0;
  border-top: 1px solid rgba(21, 23, 35, 0.1);
  margin: 0;
}

.dark-section {
  background-color: var(--color-dark-bg);
  color: var(--color-paper-bg);
}

.dark-section p {
  color: var(--color-paper-bg);
}

/* --- 按钮组件 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  transition: transform 0.2s ease, opacity 0.2s ease;
  cursor: pointer;
  gap: 0.5rem;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid currentColor;
  color: inherit;
}

.dark-section .btn-secondary {
  color: var(--color-paper-bg);
  border-color: var(--color-paper-bg);
}

/* --- 卡片组件 --- */
.card {
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  transition: background-color 0.3s ease;
}

.dark-section .card {
  background-color: rgba(255, 255, 255, 0.05);
}

.paper-card {
  background-color: var(--color-paper-bg);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

/* --- 表格组件 --- */
.table-wrapper {
  overflow-x: auto;
  margin: 2rem 0;
  border-radius: var(--radius-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

th, td {
  padding: 1rem;
  border-bottom: 1px solid rgba(21, 23, 35, 0.1);
}

th {
  font-weight: 700;
  background-color: rgba(21, 23, 35, 0.03);
}

.dark-section th, .dark-section td {
  border-bottom-color: rgba(252, 252, 253, 0.1);
}

.dark-section th {
  background-color: rgba(252, 252, 253, 0.05);
}

/* --- FAQ 组件 --- */
.faq-item {
  border-bottom: 1px solid rgba(21, 23, 35, 0.1);
  margin-bottom: 0;
}

.faq-item summary {
  padding: 1.25rem 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 2rem;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 400;
  color: var(--color-brand);
}

.faq-item[open] summary::after {
  content: "-";
}

.faq-item p {
  margin-top: 0.5rem;
  margin-bottom: 1.25rem;
  color: var(--color-text-body);
}

.dark-section .faq-item {
  border-bottom-color: rgba(252, 252, 253, 0.1);
}

.dark-section .faq-item summary::after {
  color: var(--color-accent);
}

.dark-section .faq-item p {
  color: var(--color-paper-bg);
}

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(252, 252, 253, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(21, 23, 35, 0.05);
  padding: 1rem 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text-body);
}

.nav-links a:hover, .nav-links a[aria-current="page"] {
  color: var(--color-brand);
}

.site-footer {
  padding: 3rem 0;
  border-top: 1px solid rgba(21, 23, 35, 0.1);
  text-align: center;
  font-size: 0.9rem;
  color: rgba(21, 23, 35, 0.6);
}

/* --- SVG 动效 --- */
.svg-container {
  width: 100%;
  height: auto;
  max-width: 600px;
  margin: 0 auto;
}

svg {
  overflow: visible;
}

/* 描边绘制动画 */
.draw-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawStroke 4s ease-in-out infinite alternate;
}

@keyframes drawStroke {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

/* 呼吸与漂浮 */
.breathe {
  animation: breathe 4s ease-in-out infinite alternate;
}

@keyframes breathe {
  0% { transform: scale(1); }
  100% { transform: scale(1.02); }
}

.float-up {
  animation: floatUp 6s ease-in-out infinite alternate;
}

@keyframes floatUp {
  0% { transform: translateY(0); }
  100% { transform: translateY(-10px); }
}

/* 减少动态效果适配 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
