/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量与基础重置 --- */
:root {
  /* 色板 */
  --color-dark: #1B1231;
  --color-paper: #F4F3F7;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;
  
  /* 结构 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;
  
  /* 排版 */
  --font-main: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --lh-body: 1.55;
  --lh-heading: 1.25;
  --fw-heading: 600;
  --tracking-heading: 0;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: var(--lh-body);
  color: var(--color-text);
  background-color: var(--color-paper);
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* --- 布局工具 --- */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.grid-auto {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- 页头 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(244, 243, 247, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
  transition: box-shadow 0.3s ease;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
}

.brand-link img {
  height: 28px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: clamp(1rem, 2vw, 2rem);
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--color-brand);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 24px;
  border-radius: var(--radius-btn);
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  background: #8a66e0;
}

.btn-primary:focus-visible {
  outline: 3px solid var(--color-brand);
  outline-offset: 2px;
}

/* --- 按钮变体 --- */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--color-text);
  border: 1.5px solid var(--color-text);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 24px;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(25, 21, 35, 0.05);
  transform: translateY(-1px);
}

.btn-secondary:focus-visible {
  outline: 3px solid var(--color-brand);
  outline-offset: 2px;
}

/* --- 排版组件 --- */
.section-spacer {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

.sector-divider {
  border: none;
  border-top: 1px solid rgba(25, 21, 35, 0.1);
  margin: var(--section-y) 0;
}

.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 12px;
  color: var(--color-brand);
}

.dark-surface .badge {
  color: var(--color-accent);
}

.paper-card .badge {
  color: var(--color-brand);
}

h1, h2, h3 {
  font-weight: var(--fw-heading);
  letter-spacing: var(--tracking-heading);
  line-height: var(--lh-heading);
  color: var(--color-text);
}

h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  margin-bottom: 16px;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 24px;
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.highlight {
  color: var(--color-brand);
}

.dark-surface .highlight {
  color: var(--color-accent);
}

.text-intro {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--color-text);
  max-width: 65ch;
  margin-bottom: 24px;
}

.dark-surface .text-intro {
  color: var(--color-paper);
}

.card {
  background: var(--color-paper);
  border-radius: var(--radius-card);
  padding: 24px;
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease;
}

.dark-surface .card {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-paper);
}

.card:hover {
  transform: translateY(-2px);
}

.card p {
  margin-bottom: 12px;
  line-height: 1.65;
}

.card-icon {
  width: 28px;
  height: 28px;
  margin-bottom: 12px;
  color: var(--color-brand);
}

.dark-surface .card-icon {
  color: var(--color-accent);
}

/* --- 表格 --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

.data-table th {
  font-weight: 600;
  color: var(--color-text);
  background: rgba(25, 21, 35, 0.03);
}

.dark-surface .data-table th {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-paper);
}

/* --- FAQ --- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.faq-item {
  background: rgba(25, 21, 35, 0.03);
  border-radius: 16px;
  padding: 16px 20px;
}

.faq-item summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-brand);
  border-bottom: 2px solid var(--color-brand);
  transform: rotate(-45deg);
  transition: transform 0.2s;
}

.faq-item[open] summary::before {
  transform: rotate(45deg);
}

.faq-item .answer {
  margin-top: 12px;
  padding-left: 18px;
  color: var(--color-text);
  line-height: 1.7;
}

.dark-surface .faq-item {
  background: rgba(255, 255, 255, 0.06);
}

.dark-surface .faq-item .answer {
  color: var(--color-paper);
}

/* --- SVG 动效基础 --- */
.svg-deco {
  width: 100%;
  height: auto;
}

.draw-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.draw-line.animate {
  animation: drawPath 4s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

.breathe-dot {
  animation: breatheOpacity 3s ease-in-out infinite alternate;
}

.float-element {
  transform-box: fill-box;
  transform-origin: center;
  animation: floatY 4s ease-in-out infinite alternate;
}

.slide-in-panel {
  animation: slideIn 5s cubic-bezier(0.2, 0.8, 0.2, 1) infinite alternate;
}

@keyframes drawPath {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes breatheOpacity {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

@keyframes floatY {
  from { transform: translateY(0); }
  to { transform: translateY(-6px); }
}

@keyframes slideIn {
  from { transform: translateX(10px); opacity: 0.8; }
  to { transform: translateX(0); opacity: 1; }
}

/* --- 响应式与无障碍 --- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  h1 { font-size: clamp(1.8rem, 6vw, 2.8rem); }
  .grid-auto { grid-template-columns: 1fr; }
}

@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;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
