/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 1. 设计变量与基础重置 --- */
:root {
  /* 色板 */
  --color-dark: #1B1231;
  --color-paper: #F4F3F7;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;

  /* 组件变量 */
  --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: 1280px;

  /* 字体 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background-color: var(--color-paper);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  text-decoration: none;
  color: inherit;
}

ul, ol {
  list-style: none;
}

/* --- 2. 排版系统 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

.section-header {
  margin-bottom: calc(var(--gap) * 2);
}

.badge {
  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 .badge {
  color: var(--color-accent);
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  margin-bottom: calc(var(--gap) * 1.5);
  color: var(--color-text);
}

.dark-section h1 {
  color: var(--color-paper);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: calc(var(--gap) * 1.5);
  color: var(--color-text);
}

.dark-section h2 {
  color: var(--color-paper);
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  color: var(--color-text);
}

.dark-section h3 {
  color: var(--color-paper);
}

.highlight {
  color: var(--color-brand);
}

.dark-section .highlight {
  color: var(--color-accent);
}

p {
  margin-bottom: 1rem;
  max-width: 38em;
}

/* --- 3. 按钮组件 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  gap: 8px;
  border: none;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 4px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 2px solid var(--color-text);
}

.dark-section .btn-secondary {
  color: var(--color-dark);
  border-color: var(--color-dark);
}

.btn-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* --- 4. 卡片与面板 --- */
.card {
  background: white;
  border-radius: var(--radius-card);
  padding: calc(var(--gap) * 1.5);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  transition: transform 0.3s ease;
}

.dark-card {
  background-color: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.card:hover {
  transform: translateY(-4px);
}

/* --- 5. 表格样式 --- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-card);
  background: white;
  padding: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
}

th, td {
  text-align: left;
  padding: 1rem;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

th {
  font-weight: 700;
  color: var(--color-text);
  background-color: rgba(0,0,0,0.02);
}

td:last-child {
  font-weight: 600;
  color: var(--color-brand);
}

/* --- 6. FAQ 组件 --- */
details {
  background: white;
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  padding: 1.5rem;
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  transition: all 0.3s ease;
}

summary {
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.1rem;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: '+';
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--color-brand);
  transition: transform 0.3s ease;
}

details[open] summary::after {
  transform: rotate(45deg);
}

details p {
  margin-top: 1rem;
  color: #555;
}

/* --- 7. 页头与页脚 --- */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(244, 243, 247, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding: 1rem 0;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.2rem;
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-link {
  font-weight: 600;
  color: var(--color-text);
  transition: color 0.2s;
}

.nav-link:hover, .nav-link[aria-current="page"] {
  color: var(--color-brand);
}

footer {
  background-color: var(--color-dark);
  color: var(--color-paper);
  padding: 4rem 0 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.footer-col h4 {
  color: var(--color-accent);
  margin-bottom: 1rem;
  font-size: 1rem;
}

.footer-col a {
  display: block;
  margin-bottom: 0.5rem;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.footer-col a:hover {
  opacity: 1;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 2rem;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.6;
}

/* --- 8. SVG 动效系统 --- */
.svg-container {
  width: 100%;
  height: auto;
  overflow: visible;
}

/* 呼吸效果 */
@keyframes breathe {
  0%, 100% { opacity: 0.4; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1.02); }
}

/* 浮动效果 */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* 流动描边 */
@keyframes flow-line {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

/* 滑入效果 */
@keyframes slide-in {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* 类名应用 */
.anim-breathe {
  animation: breathe 4s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}

.anim-float {
  animation: float 6s ease-in-out infinite;
}

.anim-flow {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: flow-line 3s linear infinite;
}

.anim-slide-in {
  animation: slide-in 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .svg-container {
    display: block;
  }
}

/* --- 9. 响应式适配 --- */
@media (max-width: 768px) {
  .nav-links {
    display: none; /* 简化版：移动端隐藏导航，仅留下载按钮或汉堡菜单（此处为静态站简化处理） */
  }
  
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
  
  .hero-layout {
    flex-direction: column;
  }
  
  .hero-svg-wrap {
    order: -1; /* 移动端图片在上 */
    margin-bottom: 2rem;
  }
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}

.hero-layout {
  display: flex;
  align-items: center;
  gap: 4rem;
}

.hero-text {
  flex: 1;
}

.hero-svg-wrap {
  flex: 1;
  position: relative;
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
