/* ========================================
   SafeW — 全站共享样式
   ======================================== */

/* ---------- 设计变量 ---------- */
:root {
  /* 色板 */
  --color-dark: #19102D;
  --color-paper: #FCFCFD;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #D66EED;

  /* 组件层取色 */
  --bg-dark: var(--color-dark);
  --bg-paper: var(--color-paper);
  --text-body: var(--color-text);
  --text-highlight: var(--color-brand);
  --accent: var(--color-accent);

  /* 圆角 */
  --radius-card: 0;
  --radius-btn: 0;

  /* 卡片边界与阴影 */
  --card-border: 0;
  --card-shadow: none;

  /* 节奏与密度 */
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --line-height: 1.65;

  /* 内容宽度 */
  --content-max: 1280px;

  /* 标题 */
  --heading-weight: 600;
  --heading-lh: 1.25;
  --heading-letter-spacing: 0;

  /* 按钮尺寸 */
  --btn-h: 52px;
}

/* ---------- 重置与基础 ---------- */
*, *::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", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: var(--line-height);
  color: var(--text-body);
  background-color: var(--bg-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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);
}

/* ---------- 页头 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-paper);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
  transition: box-shadow 0.3s ease;
}

.site-header.scrolled {
  box-shadow: 0 1px 8px rgba(25, 21, 35, 0.06);
}

.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);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo img {
  width: 32px;
  height: 32px;
}

.header-logo span {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-body);
  letter-spacing: -0.01em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-body);
  transition: color 0.2s ease;
  padding: 4px 0;
  position: relative;
}

.header-nav a:hover,
.header-nav a[aria-current="page"] {
  color: var(--text-highlight);
}

.header-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--text-highlight);
}

.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ---------- 按钮 ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: var(--btn-h);
  padding: 0 28px;
  background: var(--accent);
  color: var(--color-dark);
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: var(--btn-h);
  padding: 0 28px;
  background: transparent;
  color: var(--text-body);
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid var(--text-body);
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-secondary:hover {
  transform: translateY(-1px);
  border-color: var(--text-highlight);
  color: var(--text-highlight);
}

.btn-secondary:focus-visible {
  outline: 2px solid var(--text-body);
  outline-offset: 3px;
}

/* 深色面上的按钮变体 */
.dark-surface .btn-primary {
  background: var(--accent);
  color: var(--color-dark);
}

.dark-surface .btn-secondary {
  color: var(--paper-text);
  border-color: var(--paper-text);
}

.dark-surface .btn-secondary:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- 眉标 ---------- */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-highlight);
  margin-bottom: 12px;
}

.dark-surface .section-label {
  color: var(--accent);
}

/* ---------- 标题 ---------- */
h1, h2, h3, h4 {
  font-weight: var(--heading-weight);
  line-height: var(--heading-lh);
  letter-spacing: var(--heading-letter-spacing);
  color: var(--text-body);
}

.hero-title {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: var(--heading-weight);
  line-height: var(--heading-lh);
  letter-spacing: var(--heading-letter-spacing);
  color: var(--paper-text);
}

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 16px;
}

.sub-section-title {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  margin-top: 32px;
  margin-bottom: 12px;
}

.hl {
  color: var(--text-highlight);
}

.dark-surface .hl {
  color: var(--accent);
}

/* ---------- 正文 ---------- */
.body-text {
  font-size: 1rem;
  line-height: var(--line-height);
  color: var(--text-body);
  max-width: 38em;
}

.dark-surface .body-text {
  color: var(--paper-text);
}

/* ---------- 段落间距 ---------- */
p {
  margin-bottom: 1em;
}

/* ---------- 列表 ---------- */
.content-list {
  padding-left: 0;
}

.content-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 12px;
  line-height: var(--line-height);
}

.content-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  background: var(--text-highlight);
}

.dark-surface .content-list li::before {
  background: var(--accent);
}

/* ---------- 表格 ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.95rem;
  overflow-x: auto;
  display: block;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
}

.data-table th {
  font-weight: 700;
  color: var(--text-body);
  width: 35%;
}

.data-table td {
  color: var(--text-body);
}

.dark-surface .data-table th,
.dark-surface .data-table td {
  border-bottom-color: rgba(252, 252, 253, 0.08);
}

.dark-surface .data-table th {
  color: var(--paper-text);
}

.dark-surface .data-table td {
  color: var(--paper-text);
}

/* ---------- FAQ ---------- */
.faq-item {
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
}

.dark-surface .faq-item {
  border-bottom-color: rgba(252, 252, 253, 0.08);
}

.faq-item summary {
  padding: 20px 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-body);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: color 0.2s ease;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 400;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  color: var(--text-highlight);
}

.dark-surface .faq-item summary::after {
  color: var(--accent);
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item summary:hover {
  color: var(--text-highlight);
}

.dark-surface .faq-item summary:hover {
  color: var(--accent);
}

.faq-item summary:focus-visible {
  outline: 2px solid var(--text-highlight);
  outline-offset: 4px;
}

.dark-surface .faq-item summary:focus-visible {
  outline-color: var(--accent);
}

.faq-item .faq-answer {
  padding-bottom: 20px;
  line-height: var(--line-height);
  color: var(--text-body);
}

.dark-surface .faq-item .faq-answer {
  color: var(--paper-text);
}

/* ---------- 卡片 ---------- */
.card {
  background: rgba(25, 21, 35, 0.03);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 24px;
  transition: background 0.2s ease;
}

.card:hover {
  background: rgba(25, 21, 35, 0.05);
}

.dark-surface .card {
  background: rgba(252, 252, 253, 0.05);
}

.dark-surface .card:hover {
  background: rgba(252, 252, 253, 0.08);
}

/* ---------- 面板 ---------- */
.visual-panel {
  background: var(--bg-dark);
  border-radius: var(--radius-card);
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}

.dark-surface .visual-panel {
  background: rgba(252, 252, 253, 0.05);
}

/* ---------- 步骤编号徽标 ---------- */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: var(--color-dark);
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ---------- 提示框 ---------- */
.callout {
  border-left: 3px solid var(--text-highlight);
  padding: 16px 20px;
  margin: 24px 0;
  font-size: 0.95rem;
  line-height: var(--line-height);
  background: rgba(82, 20, 235, 0.04);
}

.dark-surface .callout {
  border-left-color: var(--accent);
  background: rgba(214, 110, 237, 0.06);
}

/* ---------- 焦点样式 ---------- */
*:focus-visible {
  outline: 2px solid var(--text-highlight);
  outline-offset: 2px;
}

.dark-surface *:focus-visible {
  outline-color: var(--accent);
}

/* ---------- 页脚 ---------- */
.site-footer {
  background: var(--bg-dark);
  color: var(--paper-text);
  padding: 48px 0 32px;
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 32px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.footer-brand img {
  width: 28px;
  height: 28px;
}

.footer-brand span {
  font-size: 1rem;
  font-weight: 700;
  color: var(--paper-text);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links a {
  font-size: 0.9rem;
  color: var(--paper-text);
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.footer-links a:hover {
  opacity: 1;
  color: var(--accent);
}

.footer-copy {
  width: 100%;
  text-align: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(252, 252, 253, 0.08);
  font-size: 0.8rem;
  color: var(--paper-text);
  opacity: 0.5;
}

/* ---------- 两列布局 ---------- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: center;
}

.text-side {
  order: 1;
}

.visual-side {
  order: 2;
}

.reverse .text-side {
  order: 2;
}

.reverse .visual-side {
  order: 1;
}

/* ---------- 场景对照 ---------- */
.scene-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

.scene-block {
  padding: 28px;
  background: rgba(25, 21, 35, 0.03);
  border: var(--card-border);
}

.dark-surface .scene-block {
  background: rgba(252, 252, 253, 0.04);
}

.scene-block h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-body);
}

.dark-surface .scene-block h4 {
  color: var(--paper-text);
}

.scene-step {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-start;
}

.scene-step-num {
  width: 24px;
  height: 24px;
  background: var(--text-highlight);
  color: var(--bg-paper);
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.dark-surface .scene-step-num {
  background: var(--accent);
  color: var(--color-dark);
}

.scene-step p {
  margin: 0;
  font-size: 0.95rem;
  line-height: var(--line-height);
}

/* ---------- 新闻卡片 ---------- */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
}

.news-card {
  padding: 24px;
  background: rgba(25, 21, 35, 0.03);
  border: var(--card-border);
  transition: background 0.2s ease;
}

.news-card:hover {
  background: rgba(25, 21, 35, 0.05);
}

.dark-surface .news-card {
  background: rgba(252, 252, 253, 0.04);
}

.dark-surface .news-card:hover {
  background: rgba(252, 253, 253, 0.07);
}

.news-card time {
  font-size: 0.8rem;
  color: var(--text-highlight);
  font-weight: 600;
  display: block;
  margin-bottom: 8px;
}

.dark-surface .news-card time {
  color: var(--accent);
}

.news-card h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
  line-height: 1.4;
}

.news-card p {
  font-size: 0.9rem;
  line-height: var(--line-height);
  color: var(--text-body);
  margin: 0;
}

.dark-surface .news-card p {
  color: var(--paper-text);
}

/* ---------- 核心功能标签页 ---------- */
.feature-tabs {
  margin-top: 24px;
}

.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.dark-surface .tab-nav {
  border-bottom-color: rgba(252, 252, 253, 0.1);
}

.tab-btn {
  padding: 14px 24px;
  font-size: 0.9rem;
  font-weight: 600;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-body);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-highlight);
}

.tab-btn[aria-selected="true"] {
  color: var(--text-highlight);
  border-bottom-color: var(--text-highlight);
}

.dark-surface .tab-btn[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel {
  display: none;
  padding: 24px 0;
}

.tab-panel.active {
  display: block;
}

/* ---------- 快速开始编号清单 ---------- */
.quick-steps {
  counter-reset: step;
}

.quick-step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
  counter-increment: step;
}

.quick-step .step-badge {
  font-size: 0.85rem;
}

.quick-step-content h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-body);
}

.dark-surface .quick-step-content h4 {
  color: var(--paper-text);
}

.quick-step-content p {
  font-size: 0.95rem;
  line-height: var(--line-height);
  color: var(--text-body);
  margin: 0;
}

.dark-surface .quick-step-content p {
  color: var(--paper-text);
}

/* ---------- 深度专题 ---------- */
.deep-dive h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
  color: var(--text-body);
}

.dark-surface .deep-dive h3 {
  color: var(--paper-text);
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .two-col {
    grid-template-columns: 1fr;
  }

  .text-side,
  .visual-side {
    order: unset;
  }

  .scene-grid {
    grid-template-columns: 1fr;
  }

  .header-nav {
    display: none;
  }

  .footer-inner {
    flex-direction: column;
  }

  .tab-nav {
    flex-wrap: nowrap;
  }
}

@media (max-width: 480px) {
  :root {
    --btn-h: 48px;
  }

  .header-inner {
    height: 56px;
  }

  .container {
    padding: 0 16px;
  }
}

/* ---------- 减少动态效果 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ========================================
   SVG 动效 — 几何体旋转拼合
   ======================================== */

/* 几何体缓慢旋转 */
@keyframes geo-rotate-slow {
  0%, 100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(6deg);
  }
}

@keyframes geo-rotate-reverse {
  0%, 100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(-5deg);
  }
}

@keyframes geo-rotate-medium {
  0%, 100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(4deg);
  }
}

/* 气泡浮动 */
@keyframes float-gentle {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes float-delayed {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

/* 通知卡片滑入 */
@keyframes slide-in-right {
  0%, 100% {
    transform: translateX(0);
    opacity: 1;
  }
  10% {
    transform: translateX(12px);
    opacity: 0.7;
  }
}

@keyframes slide-in-up {
  0%, 100% {
    transform: translateY(0);
    opacity: 1;
  }
  10% {
    transform: translateY(10px);
    opacity: 0.6;
  }
}

/* 连接线流动 */
@keyframes dash-flow {
  0% {
    stroke-dashoffset: 1;
  }
  50% {
    stroke-dashoffset: 0;
  }
  100% {
    stroke-dashoffset: 1;
  }
}

/* 呼吸点 */
@keyframes breathe {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

/* 窗口淡入 */
@keyframes fade-window {
  0%, 100% {
    opacity: 0.85;
  }
  50% {
    opacity: 1;
  }
}

/* 应用类 */
.geo-rotate-slow {
  animation: geo-rotate-slow 12s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.geo-rotate-reverse {
  animation: geo-rotate-reverse 14s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.geo-rotate-medium {
  animation: geo-rotate-medium 10s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.float-gentle {
  animation: float-gentle 6s ease-in-out infinite;
}

.float-delayed {
  animation: float-delayed 7s ease-in-out infinite;
  animation-delay: 1.5s;
}

.slide-in-right {
  animation: slide-in-right 8s ease-in-out infinite;
}

.slide-in-up {
  animation: slide-in-up 9s ease-in-out infinite;
  animation-delay: 0.5s;
}

.dash-flow {
  pathLength: 1;
  stroke-dasharray: 1;
  animation: dash-flow 4s ease-in-out infinite;
}

.breathe-dot {
  animation: breathe 3s ease-in-out infinite;
}

.breathe-dot-delay {
  animation: breathe 3s ease-in-out infinite;
  animation-delay: 1s;
}

.breathe-dot-delay2 {
  animation: breathe 3s ease-in-out infinite;
  animation-delay: 2s;
}

.fade-window {
  animation: fade-window 8s ease-in-out infinite;
}

/* ========================================
   深色面取色覆盖
   ======================================== */
.dark-surface {
  --bg-surface: var(--color-dark);
  --paper-text: #FCFCFD;
  --text-body: #FCFCFD;
  --text-highlight: var(--accent);
}

.dark-surface .section-label {
  color: var(--accent);
}

.dark-surface .hl {
  color: var(--accent);
}

/* 浅色卡片在深色面上恢复纸面取色 */
.light-card-on-dark {
  --text-body: var(--color-text);
  --text-highlight: var(--color-brand);
  --paper-text: var(--color-paper);
  background: var(--color-paper);
  color: var(--color-text);
}

.light-card-on-dark .section-label {
  color: var(--color-brand);
}

.light-card-on-dark .hl {
  color: var(--color-brand);
}

.light-card-on-dark .content-list li::before {
  background: var(--color-brand);
}

.light-card-on-dark .scene-step-num {
  background: var(--color-brand);
  color: var(--color-paper);
}

.light-card-on-dark .news-card time {
  color: var(--color-brand);
}
