/* =========================================
   SafeW Global Styles & Design Tokens
   ========================================= */

/* --- 设计变量 (Design Tokens) --- */
:root {
  /* 色板 */
  --c-dark: #2D1438;      /* 深色面底色 */
  --c-paper: #F6F3F7;     /* 纸面色底 */
  --c-body: #1F1523;      /* 正文色 */
  --c-brand: #9E13DD;     /* 品牌色（强调词、链接、图标） */
  --c-accent: #6EEDA8;    /* 强调色（按钮、徽标、状态点） */
  
  /* 圆角 */
  --radius-card: 20px;
  --radius-btn: 12px;
  --radius-sm: 8px;

  /* 阴影 */
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(31, 21, 35, 0.3);

  /* 节奏与间距 */
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --container-max: 960px;

  /* 字体 */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lh-tight: 1.1;
  --lh-normal: 1.55;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: var(--lh-normal);
  color: var(--c-body);
  background-color: var(--c-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 标题层级 */
h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: var(--lh-tight);
  color: var(--c-body);
  overflow-wrap: break-word;
  word-break: break-all;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  margin-bottom: 1.5rem;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 1rem;
}

h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
  max-width: 38em;
}

a {
  color: var(--c-brand);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--c-accent);
}

/* 眉标 (Section Label) */
.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  color: var(--c-brand);
}

.dark-surface .section-label {
  color: var(--c-accent);
}

/* 高亮关键词 */
.hl {
  color: var(--c-brand);
}

.dark-surface .hl {
  color: var(--c-accent);
}

/* --- 容器与布局 --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

section {
  padding: var(--section-y) 0;
  position: relative;
}

/* 背景面控制 */
.light-bg {
  background-color: var(--c-paper);
  color: var(--c-body);
}

.dark-surface {
  background-color: var(--c-dark);
  color: var(--c-paper);
}

/* 卡片样式 (用于深色面上的浅色卡片) */
.light-card {
  background-color: var(--c-paper);
  color: var(--c-body);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
}

/* --- 组件：按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

.btn:hover {
  transform: translateY(-2px);
}

/* 主按钮 (强调色底，深色文字) */
.btn-primary {
  background-color: var(--c-accent);
  color: var(--c-dark);
  border: 2px solid var(--c-accent);
}

.btn-primary:hover {
  background-color: #5bd693;
  border-color: #5bd693;
  box-shadow: 0 4px 12px rgba(110, 237, 168, 0.4);
}

/* 次按钮 (描边风格) */
.btn-secondary {
  background-color: transparent;
  color: var(--c-body);
  border: 2px solid var(--c-body);
}

.dark-surface .btn-secondary {
  color: var(--c-paper);
  border-color: var(--c-paper);
}

.btn-secondary:hover {
  opacity: 0.8;
}

/* --- 组件：表格 --- */
.table-wrapper {
  overflow-x: auto;
  width: 100%;
  margin-top: 1.5rem;
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--c-paper);
  color: var(--c-body);
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(31, 21, 35, 0.1);
}

th {
  font-weight: 700;
  background-color: rgba(158, 19, 221, 0.05);
  white-space: nowrap;
}

tr:last-child th, tr:last-child td {
  border-bottom: none;
}

/* --- 组件：FAQ (Details/Summary) --- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  margin-top: 2rem;
}

.faq-item {
  background-color: var(--c-paper);
  border: 1px solid rgba(31, 21, 35, 0.08);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.faq-item[open] {
  box-shadow: var(--card-shadow);
}

summary {
  padding: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--c-body);
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  font-size: 1.25rem;
  font-weight: 300;
  transition: transform 0.2s ease;
  color: var(--c-brand);
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-content {
  padding: 0 1.25rem 1.25rem;
  color: var(--c-body);
  line-height: var(--lh-normal);
}

.dark-surface .faq-item {
  background-color: rgba(246, 243, 247, 0.05);
  border-color: rgba(246, 243, 247, 0.1);
}

.dark-surface summary {
  color: var(--c-paper);
}

.dark-surface .faq-content {
  color: rgba(246, 243, 247, 0.85);
}

/* --- 组件：时间轴 (Workflow) --- */
.timeline {
  position: relative;
  padding-left: 2rem;
  margin-top: 2rem;
  border-left: 2px solid var(--c-brand);
}

.dark-surface .timeline {
  border-left-color: var(--c-accent);
}

.timeline-item {
  position: relative;
  margin-bottom: 2rem;
  padding-left: 1rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -2.55rem;
  top: 0.35rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--c-paper);
  border: 3px solid var(--c-brand);
  z-index: 1;
}

.dark-surface .timeline-item::before {
  background-color: var(--c-dark);
  border-color: var(--c-accent);
}

.timeline-time {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--c-brand);
  margin-bottom: 0.25rem;
  display: block;
}

.dark-surface .timeline-time {
  color: var(--c-accent);
}

/* --- 组件：步骤条 (Quick Start) --- */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
  margin-top: 2rem;
}

.step-card {
  background-color: var(--c-paper);
  padding: 1.5rem;
  border-radius: var(--radius-card);
  position: relative;
  border: 1px solid rgba(31, 21, 35, 0.05);
}

.dark-surface .step-card {
  background-color: rgba(246, 243, 247, 0.05);
  border: 1px solid rgba(246, 243, 247, 0.1);
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background-color: var(--c-accent);
  color: var(--c-dark);
  font-weight: 800;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* --- 组件：新闻卡片 --- */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
  margin-top: 2rem;
}

.news-card {
  background-color: var(--c-paper);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid rgba(31, 21, 35, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.news-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow);
}

.dark-surface .news-card {
  background-color: rgba(246, 243, 247, 0.05);
  border: 1px solid rgba(246, 243, 247, 0.1);
}

.news-date {
  font-size: 0.8rem;
  color: var(--c-brand);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.dark-surface .news-date {
  color: var(--c-accent);
}

.news-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.news-excerpt {
  font-size: 0.95rem;
  color: var(--c-body);
  opacity: 0.85;
  flex-grow: 1;
}

.dark-surface .news-excerpt {
  color: var(--c-paper);
}

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--c-paper);
  border-bottom: 1px solid rgba(31, 21, 35, 0.08);
  backdrop-filter: blur(8px);
  background-color: rgba(246, 243, 247, 0.9);
}

.dark-surface .site-header {
  background-color: var(--c-dark);
  border-bottom-color: rgba(246, 243, 247, 0.1);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--c-body);
  text-decoration: none;
}

.dark-surface .logo {
  color: var(--c-paper);
}

.logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--c-body);
  padding: 0.25rem 0;
  position: relative;
}

.dark-surface .nav-links a {
  color: var(--c-paper);
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--c-brand);
}

.dark-surface .nav-links a:hover,
.dark-surface .nav-links a[aria-current="page"] {
  color: var(--c-accent);
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--c-brand);
  transition: width 0.2s ease;
}

.dark-surface .nav-links a::after {
  background-color: var(--c-accent);
}

.nav-links a:hover::after,
.nav-links a[aria-current="page"]::after {
  width: 100%;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--c-body);
  cursor: pointer;
  padding: 0.5rem;
}

.dark-surface .mobile-menu-btn {
  color: var(--c-paper);
}

@media (max-width: 768px) {
  .nav-links {
    display: none; /* Simplified for this task, typically handled by JS toggle */
  }
  .mobile-menu-btn {
    display: block;
  }
  .header-actions {
    display: none;
  }
}

.site-footer {
  background-color: var(--c-dark);
  color: var(--c-paper);
  padding: 3rem 0;
  margin-top: var(--section-y);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.footer-col h4 {
  color: var(--c-paper);
  margin-bottom: 1rem;
  font-size: 1rem;
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: 0.5rem;
}

.footer-col a {
  color: rgba(246, 243, 247, 0.7);
  text-decoration: none;
  font-size: 0.9rem;
}

.footer-col a:hover {
  color: var(--c-accent);
}

.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(246, 243, 247, 0.1);
  text-align: center;
  font-size: 0.85rem;
  color: rgba(246, 243, 247, 0.5);
}

/* --- SVG 动效系统 --- */
svg {
  width: 100%;
  height: auto;
  display: block;
}

/* 几何旋转拼合 */
@keyframes geo-rotate {
  0%, 100% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.05); }
}

@keyframes geo-slide {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(8px); }
}

.anim-rotate {
  animation: geo-rotate 8s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.anim-slide {
  animation: geo-slide 6s ease-in-out infinite alternate;
}

/* 气泡浮现 */
@keyframes bubble-pop {
  0%, 100% { transform: translateY(0) scale(0.9); opacity: 0.8; }
  50% { transform: translateY(-10px) scale(1); opacity: 1; }
}

.anim-bubble {
  animation: bubble-pop 4s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.anim-delay-1 { animation-delay: 0.5s; }
.anim-delay-2 { animation-delay: 1.2s; }
.anim-delay-3 { animation-delay: 2s; }

/* 呼吸点 */
@keyframes breath {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.anim-breath {
  animation: breath 2s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

/* 减少动态效果 */
@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;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
