/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 色板 */
  --color-dark: #140E25;
  --color-paper: #FCFCFD;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #6EEDD2;
  
  /* 圆角 */
  --radius-card: 8px;
  --radius-btn: 6px;
  
  /* 卡片边界与阴影 */
  --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;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background-color: var(--color-paper);
  line-height: 1.75;
  max-width: 100vw;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; height: auto; }

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

ul, ol { list-style: none; }

/* --- 容器 --- */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* --- 页头 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  backdrop-filter: saturate(180%) blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.brand img { width: 28px; height: 28px; object-fit: contain; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  padding: 6px 0;
  position: relative;
  transition: color 0.2s ease;
}

.nav-links a:hover, .nav-links a[aria-current="page"] {
  color: var(--color-brand);
}

.nav-links a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -2px;
  height: 2px;
  background-color: var(--color-brand);
  border-radius: 1px;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  border: none;
  text-align: center;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(110, 237, 210, 0.3);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text);
  border: 2px solid var(--color-text);
}

.btn-secondary:hover {
  background-color: rgba(0,0,0,0.04);
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 3px solid var(--color-brand);
  outline-offset: 2px;
}

/* --- 眉标 --- */
.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.paper-theme .section-eyebrow { color: var(--color-brand); }
.dark-theme .section-eyebrow { color: var(--color-accent); }

/* --- 标题 --- */
h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--color-text);
}

.paper-theme h1, .paper-theme h2, .paper-theme h3 { color: var(--color-text); }
.dark-theme h1, .dark-theme h2, .dark-theme h3 { color: var(--color-paper); }

.highlight {
  color: var(--color-brand);
}

.dark-theme .highlight { color: var(--color-accent); }

.hero-title {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  margin-bottom: 16px;
}

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: var(--gap);
}

.sub-title {
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  margin-bottom: 24px;
}

/* --- 段落 --- */
.lead {
  font-size: 1.125rem;
  line-height: 1.7;
  max-width: 38em;
  margin-bottom: 24px;
}

.text-body {
  font-size: 1rem;
  line-height: 1.75;
  max-width: 38em;
}

/* --- 分割线 --- */
.divider {
  border: none;
  border-top: 1px solid rgba(0,0,0,0.08);
  margin: 0;
}

/* --- 卡片 --- */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 24px;
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translate(-1px, -1px);
}

.card-grid {
  display: grid;
  gap: var(--gap);
}

.card-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.card-grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.card-grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }

/* --- 表格 --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th, .data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  text-align: left;
}

.data-table th {
  font-weight: 700;
  background-color: rgba(0,0,0,0.03);
}

.data-table tr:last-child th,
.data-table tr:last-child td { border-bottom: none; }

/* --- FAQ --- */
.faq-item {
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: var(--radius-card);
  margin-bottom: 12px;
  overflow: hidden;
}

.faq-item summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s ease;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after { transform: rotate(45deg); }

.faq-item summary:hover { background-color: rgba(0,0,0,0.03); }

.faq-item .faq-answer {
  padding: 0 20px 16px 20px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: rgba(0,0,0,0.75);
}

/* --- 页脚 --- */
.site-footer {
  background-color: var(--color-dark);
  color: var(--color-paper);
  padding: var(--section-y) 0;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
}

.footer-brand img { width: 24px; height: 24px; }

.footer-nav {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-nav a {
  color: rgba(255,255,255,0.8);
  transition: color 0.2s ease;
}

.footer-nav a:hover { color: var(--color-accent); }

.footer-copy {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
}

/* --- SVG 动效 Keyframes --- */
@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}

@keyframes dash-flow {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes slide-in-right {
  0% { opacity: 0; transform: translateX(20px); }
  100% { opacity: 1; transform: translateX(0); }
}

.star-dot { animation: twinkle 4s ease-in-out infinite; }
.star-line { 
  stroke-dasharray: 1; 
  stroke-dashoffset: 0; 
  animation: dash-flow 8s linear infinite; 
}
.float-element { animation: float 6s ease-in-out infinite; }
.slide-element { animation: slide-in-right 5s ease-out infinite alternate; }

/* --- 响应式 --- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: block; }
  .card-grid.cols-2, .card-grid.cols-3, .card-grid.cols-4 { grid-template-columns: 1fr; }
  .footer-inner { gap: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .star-dot, .star-line, .float-element, .slide-element {
    animation: none !important;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
