/* ========================================
   SafeW 全站共享样式
   ======================================== */

/* --- 设计变量 --- */
:root {
  /* 色板 */
  --color-dark: #140E25;
  --color-paper: #F5F0E5;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;

  /* 圆角 */
  --radius-card: 8px;
  --radius-btn: 6px;

  /* 卡片边界 */
  --card-border: 1px solid rgba(25, 21, 35, 0.16);
  --card-shadow: none;

  /* 节奏与密度 */
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --line-height: 1.75;

  /* 内容最大宽度 */
  --content-max: 1280px;

  /* 标题处理 */
  --h1-size: clamp(2rem, 4.6vw, 3.4rem);
  --h2-size: clamp(1.6rem, 3vw, 2.4rem);
  --body-size: clamp(1rem, 1.1vw, 1.125rem);

  /* 间距 */
  --header-h: 64px;
}

/* --- 基础排版 --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: var(--body-size);
  line-height: var(--line-height);
  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);
}

/* --- 面色类 --- */
.face-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}

.face-dark .hl {
  color: var(--color-accent);
}

.face-dark .badge {
  color: var(--color-accent);
}

.face-dark a:not(.btn) {
  color: var(--color-accent);
}

.face-dark .card-light {
  background-color: var(--color-paper);
  color: var(--color-text);
}

.face-dark .card-light .hl {
  color: var(--color-brand);
}

.face-dark .card-light .badge {
  color: var(--color-brand);
}

.face-dark .card-light a:not(.btn) {
  color: var(--color-brand);
}

.face-paper {
  background-color: var(--color-paper);
  color: var(--color-text);
}

.face-paper .hl {
  color: var(--color-brand);
}

.face-paper .badge {
  color: var(--color-brand);
}

.face-paper a:not(.btn) {
  color: var(--color-brand);
}

/* --- 眉标 --- */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

/* --- 标题 --- */
h1 {
  font-size: var(--h1-size);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

h2 {
  font-size: var(--h2-size);
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 1.5rem;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
}

strong {
  font-weight: 700;
}

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.btn-primary:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text);
  border: 1.5px solid var(--color-text);
}

.face-dark .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  opacity: 0.85;
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.btn svg {
  flex-shrink: 0;
}

/* --- 卡片 --- */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
}

/* --- 表格 --- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

th {
  font-weight: 700;
}

tr:last-child th, tr:last-child td {
  border-bottom: none;
}

/* --- FAQ --- */
.faq-item {
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

.faq-item summary {
  padding: 16px 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 1.05rem;
  list-style: none;
  position: relative;
  padding-right: 32px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  font-weight: 400;
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item p {
  padding-bottom: 16px;
  color: inherit;
  opacity: 0.85;
}

/* --- 页头 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
  height: var(--header-h);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.face-dark .site-header {
  background-color: var(--color-dark);
  border-bottom-color: rgba(245, 240, 229, 0.1);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.2rem;
}

.brand img {
  width: 32px;
  height: 32px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav a {
  font-size: 0.95rem;
  font-weight: 500;
  position: relative;
  padding: 4px 0;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--color-brand);
}

.face-dark .nav a:hover,
.face-dark .nav a[aria-current="page"] {
  color: var(--color-accent);
}

.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: currentColor;
  border-radius: 1px;
}

.header-cta {
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (max-width: 768px) {
  .nav {
    display: none;
  }
}

/* --- 页脚 --- */
.site-footer {
  padding: 48px var(--gap);
  border-top: 1px solid rgba(25, 21, 35, 0.08);
  font-size: 0.9rem;
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* --- SVG 动效方向：网格节点依次点亮 --- */
@keyframes gridGlow {
  0%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

@keyframes gridGlowStroke {
  0%, 100% {
    stroke-dashoffset: 1;
    opacity: 0.4;
  }
  50% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

@keyframes floatUp {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  50% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

@keyframes breathe {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

@keyframes slideInLeft {
  0%, 100% {
    transform: translateX(0);
    opacity: 0.8;
  }
  50% {
    transform: translateX(-8px);
    opacity: 1;
  }
}

.grid-node {
  animation: gridGlow 3s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.grid-node:nth-child(1) { animation-delay: 0s; }
.grid-node:nth-child(2) { animation-delay: 0.3s; }
.grid-node:nth-child(3) { animation-delay: 0.6s; }
.grid-node:nth-child(4) { animation-delay: 0.9s; }
.grid-node:nth-child(5) { animation-delay: 1.2s; }
.grid-node:nth-child(6) { animation-delay: 1.5s; }
.grid-node:nth-child(7) { animation-delay: 1.8s; }
.grid-node:nth-child(8) { animation-delay: 2.1s; }
.grid-node:nth-child(9) { animation-delay: 2.4s; }

.flow-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: gridGlowStroke 4s ease-in-out infinite;
}

.bubble {
  animation: floatUp 4s ease-in-out infinite;
}

.bubble:nth-child(odd) {
  animation-duration: 5s;
}

.breathe-dot {
  animation: breathe 2.5s ease-in-out infinite;
}

.slide-panel {
  animation: slideInLeft 5s ease-in-out infinite;
}

/* --- 减少动态效果 --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .grid-node,
  .flow-line,
  .bubble,
  .breathe-dot,
  .slide-panel {
    animation: none !important;
  }
  html {
    scroll-behavior: auto;
  }
}

/* --- 响应式 --- */
@media (max-width: 768px) {
  :root {
    --section-y: clamp(3rem, 8vw, 5rem);
    --gap: clamp(1rem, 4vw, 1.5rem);
  }

  .hero-grid {
    grid-template-columns: 1fr !important;
  }

  .feature-row {
    flex-direction: column !important;
  }

  .timeline-steps {
    padding-left: 0 !important;
  }

  .news-grid {
    grid-template-columns: 1fr !important;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* --- 辅助 --- */
.text-center {
  text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

.section-divider {
  width: 64px;
  height: 4px;
  border-radius: 2px;
  margin-bottom: 2rem;
}

.face-paper .section-divider {
  background-color: var(--color-brand);
}

.face-dark .section-divider {
  background-color: var(--color-accent);
}

.hero-sub {
  font-size: clamp(1.05rem, 1.3vw, 1.25rem);
  line-height: 1.7;
  max-width: 640px;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.hero-facts {
  font-size: 0.9rem;
  opacity: 0.7;
}

.hero-svg {
  width: 100%;
  max-width: 560px;
  height: auto;
}

.svg-panel {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-card);
  overflow: hidden;
}

.svg-panel svg {
  width: 100%;
  height: 100%;
}

.flow-bar {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  justify-content: center;
}

.flow-node {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: var(--radius-card);
  font-weight: 600;
  font-size: 0.95rem;
}

.flow-arrow {
  width: 32px;
  height: 20px;
  flex-shrink: 0;
}

.timeline-step {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.step-num {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-weight: 800;
  font-size: 1.1rem;
}

.face-paper .step-num {
  background-color: var(--color-brand);
  color: var(--color-paper);
}

.face-dark .step-num {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
}

.news-card {
  display: flex;
  flex-direction: column;
}

.news-card time {
  font-size: 0.85rem;
  opacity: 0.6;
  margin-bottom: 0.5rem;
}

.news-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.news-card p {
  font-size: 0.95rem;
  opacity: 0.8;
  line-height: 1.6;
}

.min-w-zero {
  min-width: 0;
}

.overflow-wrap-anywhere {
  overflow-wrap: anywhere;
}

/* 列表标记 */
.check-list {
  padding-left: 0;
}

.check-list li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 8px;
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background-color: currentColor;
  opacity: 0.5;
}

.face-paper .check-list li::before {
  background-color: var(--color-brand);
}

.face-dark .check-list li::before {
  background-color: var(--color-accent);
}
