/* ============================================================
   SafeW — 全站共享样式
   ============================================================ */

/* ---------- 设计变量（色板 & 结构 token） ---------- */
:root {
  /* 色板 */
  --color-dark: #21163C;
  --color-paper: #E9E8EA;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED926E;

  /* 卡片边界 */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 1px solid rgba(25, 21, 35, 0.16);
  --card-shadow: none;

  /* 节奏与密度 */
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --line-height: 1.55;

  /* 内容最大宽度 */
  --content-max: 960px;

  /* 标题处理 */
  --title-weight: 800;
  --title-tracking: -0.02em;
  --title-lineheight: 1.1;
  --h1-size: clamp(2.4rem, 6vw, 4.5rem);
}

/* ---------- 基础排版 ---------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
  line-height: var(--line-height);
  color: var(--color-text);
  background-color: var(--color-paper);
  -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;
}

/* ---------- 容器 ---------- */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* ---------- 面色系统 ---------- */
.dark-face {
  background-color: var(--color-dark);
  color: var(--color-paper);
}

.dark-face .brand-hl {
  color: var(--color-accent);
}

.dark-face .subtle-link {
  color: var(--color-accent);
}

.paper-face {
  background-color: var(--color-paper);
  color: var(--color-text);
}

.paper-face .brand-hl {
  color: var(--color-brand);
}

.paper-face .subtle-link {
  color: var(--color-brand);
}

.card-on-dark {
  background-color: var(--color-paper);
  color: var(--color-text);
  border-radius: var(--radius-card);
  border: var(--card-border);
}

.card-on-dark .brand-hl {
  color: var(--color-brand);
}

.card-on-dark .subtle-link {
  color: var(--color-brand);
}

/* ---------- 眉标 ---------- */
.section-eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: calc(var(--gap) * 0.5);
}

.dark-face .section-eyebrow {
  color: var(--color-accent);
}

.paper-face .section-eyebrow {
  color: var(--color-brand);
}

/* ---------- 标题 ---------- */
h1, h2, h3, h4 {
  font-weight: var(--title-weight);
  letter-spacing: var(--title-tracking);
  line-height: var(--title-lineheight);
  margin-top: 0;
}

h1 {
  font-size: var(--h1-size);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.25;
}

h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  line-height: 1.25;
}

.brand-hl {
  font-weight: var(--title-weight);
}

/* ---------- 正文 ---------- */
p {
  margin: 0 0 var(--gap) 0;
  max-width: 38em;
}

.text-small {
  font-size: 0.875rem;
  line-height: 1.6;
  opacity: 0.8;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border-color: var(--color-accent);
}

.btn-primary:hover {
  background-color: #d97e5b;
  border-color: #d97e5b;
}

.btn-secondary {
  background: transparent;
}

.paper-face .btn-secondary {
  color: var(--color-text);
  border-color: var(--color-text);
}

.dark-face .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.btn-secondary:hover {
  opacity: 0.85;
}

.btn-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ---------- 卡片 ---------- */
.card {
  background-color: var(--color-paper);
  color: var(--color-text);
  border-radius: var(--radius-card);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
}

/* ---------- 表格 ---------- */
.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;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

.dark-face th,
.dark-face td {
  border-bottom-color: rgba(233, 232, 234, 0.12);
}

/* ---------- FAQ (details / summary) ---------- */
.faq-item {
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

.dark-face .faq-item {
  border-bottom-color: rgba(233, 232, 234, 0.12);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  list-style: none;
  gap: 12px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "";
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235214EB' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  transition: transform 0.25s ease;
}

.dark-face .faq-item summary::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ED926E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

.faq-item[open] summary::after {
  transform: rotate(180deg);
}

.faq-item .faq-answer {
  padding: 0 0 16px 0;
  line-height: var(--line-height);
}

/* ---------- 编号徽标 ---------- */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-dark);
  background-color: var(--color-accent);
  border-radius: 8px;
  flex-shrink: 0;
}

/* ---------- 胶囊标签 ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 999px;
  background-color: rgba(82, 20, 235, 0.08);
  color: var(--color-brand);
}

.dark-face .chip {
  background-color: rgba(237, 146, 110, 0.12);
  color: var(--color-accent);
}

.chip svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* ---------- 提示框 ---------- */
.notice-box {
  border-left: 3px solid var(--color-brand);
  padding: 12px 16px;
  margin: var(--gap) 0;
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
  background-color: rgba(82, 20, 235, 0.04);
}

.dark-face .notice-box {
  border-left-color: var(--color-accent);
  background-color: rgba(237, 146, 110, 0.08);
}

/* ---------- Tab 切换 ---------- */
.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--gap);
  border-bottom: 2px solid rgba(25, 21, 35, 0.1);
  padding-bottom: 0;
}

.dark-face .tab-nav {
  border-bottom-color: rgba(233, 232, 234, 0.12);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.dark-face .tab-btn {
  color: var(--color-paper);
}

.tab-btn:hover {
  color: var(--color-brand);
}

.dark-face .tab-btn:hover {
  color: var(--color-accent);
}

.tab-btn.active {
  color: var(--color-brand);
  border-bottom-color: var(--color-brand);
}

.dark-face .tab-btn.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ---------- 时间轴 ---------- */
.timeline {
  position: relative;
  padding-left: 32px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: rgba(25, 21, 35, 0.15);
}

.dark-face .timeline::before {
  background-color: rgba(233, 232, 234, 0.15);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--gap);
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -24px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--color-brand);
  border: 2px solid var(--color-paper);
}

.dark-face .timeline-item::before {
  background-color: var(--color-accent);
  border-color: var(--color-dark);
}

.timeline-time {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-brand);
  margin-bottom: 4px;
}

.dark-face .timeline-time {
  color: var(--color-accent);
}

/* ---------- 页头 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.dark-header {
  background-color: var(--color-dark);
  border-bottom-color: rgba(233, 232, 234, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.site-logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
  transition: color 0.2s ease;
}

.dark-header .nav-links a {
  color: var(--color-paper);
}

.nav-links a:hover {
  color: var(--color-brand);
}

.dark-header .nav-links a:hover {
  color: var(--color-accent);
}

.nav-links a[aria-current="page"] {
  color: var(--color-brand);
  font-weight: 700;
}

.dark-header .nav-links a[aria-current="page"] {
  color: var(--color-accent);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.mobile-menu-btn svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* ---------- 页脚 ---------- */
.site-footer {
  padding: 48px 0 32px;
  font-size: 0.85rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.footer-col h4 {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 12px;
  opacity: 0.6;
}

.footer-col a {
  display: block;
  padding: 4px 0;
  color: inherit;
  transition: opacity 0.2s ease;
}

.footer-col a:hover {
  opacity: 0.7;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid rgba(25, 21, 35, 0.1);
  opacity: 0.6;
}

.dark-face .footer-bottom {
  border-top-color: rgba(233, 232, 234, 0.1);
}

/* ---------- SVG 动效 ---------- */
@keyframes grid-node-brighten {
  0%, 100% {
    opacity: 0.25;
    transform: scale(0.85);
  }
  40%, 60% {
    opacity: 1;
    transform: scale(1);
  }
}

.grid-node {
  animation: grid-node-brighten 4s ease-in-out infinite;
}

.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; }
.grid-node:nth-child(10) { animation-delay: 2.7s; }
.grid-node:nth-child(11) { animation-delay: 3.0s; }
.grid-node:nth-child(12) { animation-delay: 3.3s; }

@keyframes float-gentle {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.float-gentle {
  animation: float-gentle 6s ease-in-out infinite;
}

@keyframes dash-flow {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}

.dash-flow {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: dash-flow 3s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
}

.pulse-dot {
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.slide-in-right {
  animation: slide-in-right 0.8s ease-out forwards;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    background-color: var(--color-paper);
    padding: 16px var(--gap);
    gap: 16px;
    border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  }

  .dark-header .nav-links {
    background-color: var(--color-dark);
    border-bottom-color: rgba(233, 232, 234, 0.1);
  }

  .nav-links.open {
    display: flex;
  }

  .mobile-menu-btn {
    display: block;
  }

  .header-inner .btn {
    display: none;
  }
}

/* ---------- 减少动态效果 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .grid-node,
  .float-gentle,
  .dash-flow,
  .pulse-dot,
  .slide-in-right {
    animation: none !important;
  }
}

/* ---------- 工具类 ---------- */
.flex-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
}

.flex-col {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.gap-md {
  gap: calc(var(--gap) * 1.5);
}

.text-center {
  text-align: center;
}

.mt-sm {
  margin-top: calc(var(--gap) * 0.5);
}

.mb-sm {
  margin-bottom: calc(var(--gap) * 0.5);
}

.max-w-38em {
  max-width: 38em;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

.min-w-0 {
  min-width: 0;
}

.overflow-wrap-anywhere {
  overflow-wrap: anywhere;
}

/* ---------- 视觉面板 ---------- */
.visual-panel {
  background-color: var(--color-dark);
  border-radius: var(--radius-card);
  padding: var(--gap);
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.dark-face .visual-panel {
  background-color: rgba(233, 232, 234, 0.06);
  border: 1px solid rgba(233, 232, 234, 0.1);
}

/* ---------- 特性胶囊行 ---------- */
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: var(--gap);
}
