/* =========================================
   SafeW 全站共享样式 (style.css)
   设计系统：蓝紫深底 + 紫罗兰强调 | 现代潮流 | 直角硬阴影
   ========================================= */

/* --- 1. 设计 Token & 变量 --- */
:root {
  /* 色彩系统 */
  --color-surface-dark: #19102D;
  --color-paper: #F4F3F7;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #D66EED;
  --color-border: rgba(25, 21, 35, 0.12);

  /* 语义变量：浅色纸面 */
  --bg-page: var(--color-paper);
  --text-primary: var(--color-text);
  --text-secondary: var(--color-text);
  --brand-highlight: var(--color-brand);
  --accent-highlight: var(--color-accent);
  --card-bg: var(--color-paper);
  --card-border-color: var(--color-text);

  /* 语义变量：深色面 */
  .dark-surface {
    --bg-page: var(--color-surface-dark);
    --text-primary: var(--color-paper);
    --text-secondary: var(--color-paper);
    --brand-highlight: var(--color-accent);
    --accent-highlight: var(--color-accent);
    --card-bg: var(--color-paper); /* 深色面上的浅色卡片恢复纸面取色 */
    --card-border-color: var(--color-text);
  }

  /* 几何与间距 */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 2px solid var(--card-border-color);
  --card-shadow: 4px 4px 0 var(--card-border-color);
  --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;
}

/* --- 2. 基础重置与全局 --- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-primary);
  background-color: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* --- 3. 布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

section {
  padding: var(--section-y) 0;
  border-bottom: 1px solid var(--border);
}

section:last-of-type {
  border-bottom: none;
}

/* --- 4. 排版组件 --- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--brand-highlight);
  margin-bottom: 0.75em;
}

.eyebrow::before {
  content: "";
  display: block;
  width: 1.5em;
  height: 2px;
  background-color: currentColor;
}

.dark-surface .eyebrow {
  color: var(--accent-highlight);
}

h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
  margin-top: 0;
  margin-bottom: 0.5em;
}

h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  margin-bottom: 1em;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 1.5em;
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75em;
}

p {
  margin-bottom: 1em;
  max-width: 38em;
}

.text-center {
  text-align: center;
}

.highlight {
  color: var(--brand-highlight);
}

.dark-surface .highlight {
  color: var(--accent-highlight);
}

/* --- 5. 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.8em 1.6em;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  box-shadow: var(--card-shadow);
}

.btn:focus-visible {
  outline: 3px solid var(--accent-highlight);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--accent-highlight);
  color: var(--color-surface-dark);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 6px 6px 0 var(--card-border-color);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border: 2px solid var(--text-primary);
  box-shadow: none;
}

.btn-secondary:hover {
  background-color: var(--text-primary);
  color: var(--bg-page);
  transform: translateY(-2px);
}

.dark-surface .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.dark-surface .btn-secondary:hover {
  background-color: var(--color-paper);
  color: var(--color-surface-dark);
}

.btn-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* --- 6. 卡片与面板 --- */
.card {
  background-color: var(--card-bg);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
}

.panel {
  background-color: var(--color-surface-dark);
  border-radius: var(--radius-card);
  padding: var(--gap);
  overflow: hidden;
}

/* --- 7. 表格 --- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  padding: 0.75em 1em;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  background-color: rgba(25, 21, 35, 0.05);
}

.dark-surface th {
  background-color: rgba(244, 243, 247, 0.1);
}

td:first-child {
  font-weight: 600;
}

/* --- 8. FAQ (Details/Summary) --- */
.faq-item {
  margin-bottom: var(--gap);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  background-color: var(--card-bg);
}

.faq-item summary {
  padding: var(--gap);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.25rem;
  font-weight: 400;
  transition: transform 0.2s;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item[open] summary {
  border-bottom: 1px solid var(--border);
}

.faq-item .answer {
  padding: var(--gap);
  margin: 0;
  color: var(--text-secondary);
}

/* --- 9. 时间线 --- */
.timeline {
  position: relative;
  padding-left: 2.5em;
  counter-reset: step;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background-color: var(--brand-highlight);
}

.timeline-item {
  position: relative;
  margin-bottom: var(--gap);
  counter-increment: step;
}

.timeline-item::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: -2.5em;
  top: 0;
  width: 2em;
  height: 2em;
  background-color: var(--accent-highlight);
  color: var(--color-surface-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  z-index: 1;
}

.timeline-item .step-title {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.25em;
  display: block;
}

/* --- 10. 交错图文 --- */
.feature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: center;
  margin-bottom: calc(var(--section-y) * 1.5);
}

.feature-row:nth-child(even) .feature-text {
  order: 2;
}

.feature-row:nth-child(even) .feature-visual {
  order: 1;
}

.feature-text ul {
  margin-top: 0.5em;
}

.feature-text li {
  position: relative;
  padding-left: 1.25em;
  margin-bottom: 0.5em;
}

.feature-text li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 0.5em;
  height: 2px;
  background-color: var(--brand-highlight);
}

/* --- 11. 网格与卡片组 --- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}

.news-card {
  background-color: var(--card-bg);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.news-card time {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-highlight);
  margin-bottom: 0.5em;
  display: block;
}

.news-card p {
  margin-bottom: 0;
  flex-grow: 1;
}

/* --- 12. 提示框 --- */
.callout {
  border-left: 4px solid var(--brand-highlight);
  padding: var(--gap);
  background-color: rgba(82, 20, 235, 0.05);
  margin: var(--gap) 0;
}

.dark-surface .callout {
  background-color: rgba(214, 110, 237, 0.1);
  border-left-color: var(--accent-highlight);
}

/* --- 13. SVG 动效 --- */
.svg-visual {
  width: 100%;
  height: auto;
}

/* 描边绘制 */
.draw-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 4s ease-in-out infinite;
}

@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  20% { stroke-dashoffset: 0; }
  80% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}

/* 气泡浮动 */
.float-bubble {
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* 节点依次点亮 */
.grid-node {
  fill: var(--border);
  transition: fill 0.3s;
}

.grid-node.light-up {
  animation: node-glow 5s ease-in-out infinite;
}

@keyframes node-glow {
  0%, 100% { fill: var(--border); }
  50% { fill: var(--accent-highlight); }
}

/* 呼吸点 */
.pulse-dot {
  animation: pulse-opacity 3s ease-in-out infinite;
}

@keyframes pulse-opacity {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* 滑入通知 */
.slide-in-card {
  animation: slide-in 7s ease-in-out infinite;
}

@keyframes slide-in {
  0%, 10% { transform: translateX(120%); opacity: 0; }
  20%, 80% { transform: translateX(0); opacity: 1; }
  90%, 100% { transform: translateX(120%); opacity: 0; }
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .grid-node.light-up {
    fill: var(--accent-highlight);
  }
}

/* --- 14. 响应式适配 --- */
@media (max-width: 768px) {
  .feature-row,
  .grid-2 {
    grid-template-columns: 1fr;
  }
  
  .feature-row:nth-child(even) .feature-text,
  .feature-row:nth-child(even) .feature-visual {
    order: unset;
  }

  h1 {
    font-size: clamp(1.8rem, 6vw, 2.5rem);
  }
  
  h2 {
    font-size: clamp(1.4rem, 4vw, 1.8rem);
  }
}

/* --- 15. 页头页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-page);
  border-bottom: 1px solid var(--border);
  padding: 0.75em 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75em;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.brand-logo img {
  width: auto;
  height: 32px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5em;
}

.nav-links a {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--brand-highlight);
}

.dark-surface .nav-links a {
  color: var(--color-paper);
}

.dark-surface .nav-links a:hover,
.dark-surface .nav-links a[aria-current="page"] {
  color: var(--accent-highlight);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block;
  }
  .nav-links {
    display: none;
  }
}

.site-footer {
  background-color: var(--color-surface-dark);
  color: var(--color-paper);
  padding: var(--section-y) 0;
  margin-top: var(--section-y);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
}

.footer-col h4 {
  color: var(--accent-highlight);
  margin-bottom: 0.75em;
}

.footer-col a {
  display: block;
  color: var(--color-paper);
  margin-bottom: 0.5em;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.footer-col a:hover {
  opacity: 1;
}

.footer-bottom {
  margin-top: var(--gap);
  padding-top: var(--gap);
  border-top: 1px solid rgba(244, 243, 247, 0.1);
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.6;
}
