/* ============================================
   SafeW 全站共享样式
   ============================================ */

/* --- 设计变量与色板 --- */
:root {
  /* 基础色板 */
  --color-dark: #141838;
  --color-paper: #F7F5F3;
  --color-text: #151723;
  --color-brand: #142CEB;
  --color-accent: #6EAFED;

  /* 圆角 */
  --radius-card: 8px;
  --radius-btn: 6px;

  /* 卡片边界 */
  --card-border: 0;
  --card-shadow: none;

  /* 节奏与密度 */
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);

  /* 内容最大宽度 */
  --content-max: 960px;

  /* 字体 */
  --font-sans: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

/* --- 深色面取色变量 --- */
.dark-surface {
  --bg-surface: var(--color-dark);
  --text-primary: var(--color-paper);
  --text-secondary: rgba(247, 245, 243, 0.75);
  --accent-color: var(--color-accent);
  --link-color: var(--color-accent);
  --badge-color: var(--color-accent);
  --icon-color: var(--color-accent);
  --divider-color: rgba(247, 245, 243, 0.12);
}

/* --- 纸面取色变量（默认） --- */
.paper-surface {
  --bg-surface: var(--color-paper);
  --text-primary: var(--color-text);
  --text-secondary: rgba(21, 23, 35, 0.65);
  --accent-color: var(--color-accent);
  --link-color: var(--color-brand);
  --badge-color: var(--color-brand);
  --icon-color: var(--color-brand);
  --divider-color: rgba(21, 23, 35, 0.1);
}

/* --- 全局重置与基础 --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-primary);
  background-color: var(--color-paper);
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.85;
}

a:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
  border-radius: 2px;
}

ul, ol {
  list-style: none;
}

/* --- 容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* --- 页头 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid var(--divider-color);
  transition: box-shadow 0.3s ease;
}

.site-header.scrolled {
  box-shadow: 0 1px 8px rgba(21, 23, 35, 0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand img {
  height: 32px;
  width: auto;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
}

.nav a:hover {
  color: var(--text-primary);
}

.nav a[aria-current="page"] {
  color: var(--text-primary);
  font-weight: 700;
}

.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--accent-color);
  border-radius: 1px;
}

.btn-download-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-dark);
  background-color: var(--color-accent);
  border-radius: var(--radius-btn);
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease;
}

.btn-download-nav:hover {
  transform: translateY(-1px);
  opacity: 1;
}

.btn-download-nav:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* --- 按钮通用 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  min-width: 160px;
  padding: 0 24px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  border: none;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, background-color 0.2s ease, opacity 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.btn-primary:hover {
  background-color: #5A9AD8;
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border: 1.5px solid var(--text-primary);
}

.btn-secondary:hover {
  background-color: rgba(21, 23, 35, 0.06);
}

.dark-surface .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.dark-surface .btn-secondary:hover {
  background-color: rgba(247, 245, 243, 0.08);
}

/* --- 眉标 --- */
.section-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--badge-color);
  margin-bottom: 12px;
}

/* --- 标题 --- */
h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: var(--gap);
}

h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.hl {
  color: var(--accent-color);
}

.dark-surface .hl {
  color: var(--color-accent);
}

/* --- 正文排版 --- */
p {
  margin-bottom: var(--gap);
  color: var(--text-primary);
  line-height: 1.55;
}

.text-secondary {
  color: var(--text-secondary);
}

.max-w-prose {
  max-width: 38em;
}

/* --- 区块分隔线 --- */
.section-divider {
  width: 100%;
  height: 1px;
  background-color: var(--divider-color);
  border: none;
}

/* --- 首屏 Hero --- */
.hero {
  background-color: var(--color-dark);
  padding: clamp(3rem, 6vw, 5rem) 0;
  position: relative;
  overflow: hidden;
}

.hero .container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 4vw, 3rem);
  align-items: center;
}

.hero-content {
  color: var(--color-paper);
}

.hero-content h1 {
  margin-bottom: 20px;
}

.hero-subtitle {
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  color: rgba(247, 245, 243, 0.8);
  line-height: 1.6;
  margin-bottom: 24px;
  max-width: 36em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.hero-fact {
  font-size: 0.82rem;
  color: rgba(247, 245, 243, 0.5);
}

.hero-svg-wrapper {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

/* --- 功能面板（深色背景圆角面板） --- */
.visual-panel {
  background-color: var(--color-dark);
  border-radius: 12px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.panel-light {
  background-color: var(--color-paper);
}

/* --- 特性胶囊 --- */
.feature-capsules {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.capsule {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-paper);
  background-color: rgba(247, 245, 243, 0.1);
  border-radius: 20px;
  border: 1px solid rgba(247, 245, 243, 0.15);
}

.capsule svg {
  width: 16px;
  height: 16px;
  stroke: var(--color-accent);
}

/* --- 深度专题长文 --- */
.long-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 32px;
}

.long-form-nav {
  position: sticky;
  top: 80px;
  align-self: start;
  padding-left: 16px;
  border-left: 2px solid var(--divider-color);
}

.long-form-nav a {
  display: block;
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 6px 0;
  transition: color 0.2s ease;
}

.long-form-nav a:hover {
  color: var(--text-primary);
}

.long-form-nav a.active {
  color: var(--brand);
  font-weight: 600;
}

.long-form-body h3 {
  margin-top: 32px;
  margin-bottom: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--divider-color);
}

.long-form-body h3:first-child {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

/* --- 定义列表（功能项） --- */
.func-list {
  display: grid;
  gap: 24px;
}

.func-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
}

.func-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  stroke: var(--icon-color);
}

.func-item h3 {
  margin-bottom: 6px;
}

.func-item p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* --- 场景走查 --- */
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}

.scenario-card {
  background-color: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 20px;
  position: relative;
}

.dark-surface .scenario-card {
  background-color: rgba(247, 245, 243, 0.06);
  border: 1px solid rgba(247, 245, 243, 0.1);
}

.scenario-card h3 {
  margin-bottom: 12px;
  font-size: 1rem;
}

.scenario-steps {
  counter-reset: step;
}

.scenario-steps li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.scenario-steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-dark);
  background-color: var(--color-accent);
  border-radius: 4px;
}

.scenario-result {
  margin-top: 12px;
  padding: 10px 14px;
  background-color: rgba(110, 175, 237, 0.08);
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--text-primary);
  border-left: 3px solid var(--color-accent);
}

/* --- 快速开始步骤 --- */
.step-list {
  display: grid;
  gap: 20px;
}

.step-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.step-number {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-dark);
  background-color: var(--color-accent);
  border-radius: 8px;
}

.step-content h3 {
  margin-bottom: 4px;
}

.step-content p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* --- 表格 --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--divider-color);
}

.data-table th {
  font-weight: 700;
  color: var(--text-primary);
}

.data-table td {
  color: var(--text-secondary);
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* --- 新闻卡片 --- */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--gap);
}

.news-card {
  background-color: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 20px;
  transition: transform 0.2s ease;
}

.news-card:hover {
  transform: translateY(-2px);
}

.news-card time {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.news-card h3 {
  font-size: 0.98rem;
  margin-bottom: 8px;
  line-height: 1.4;
}

.news-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 0;
}

/* --- FAQ --- */
.faq-list {
  display: grid;
  gap: 12px;
}

.faq-item {
  border: 1px solid var(--divider-color);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.faq-item summary {
  padding: 16px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-primary);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background-color 0.2s ease;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: var(--icon-color);
}

.faq-item[open] summary {
  background-color: rgba(21, 23, 35, 0.03);
}

.faq-item > div {
  padding: 0 20px 16px 48px;
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --- 页脚 --- */
.site-footer {
  background-color: var(--color-dark);
  color: var(--color-paper);
  padding: 48px 0 32px;
}

.footer-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 32px;
}

.footer-col h4 {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 12px;
}

.footer-col a {
  display: block;
  font-size: 0.88rem;
  color: rgba(247, 245, 243, 0.65);
  padding: 4px 0;
}

.footer-col a:hover {
  color: var(--color-paper);
}

.footer-bottom {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(247, 245, 243, 0.1);
  font-size: 0.82rem;
  color: rgba(247, 245, 243, 0.4);
  text-align: center;
}

/* ============================================
   SVG 动效 — 卡片层叠漂浮
   ============================================ */

.card-layer {
  position: absolute;
  border-radius: 12px;
  background-color: rgba(247, 245, 243, 0.06);
  border: 1.5px solid rgba(247, 245, 243, 0.12);
  backdrop-filter: blur(2px);
}

.card-main {
  width: 85%;
  height: 70%;
  top: 15%;
  left: 8%;
  z-index: 3;
  animation: floatCardMain 6s ease-in-out infinite;
}

.card-back {
  width: 70%;
  height: 55%;
  top: 5%;
  left: 25%;
  z-index: 1;
  background-color: rgba(110, 175, 237, 0.08);
  border-color: rgba(110, 175, 237, 0.15);
  animation: floatCardBack 7s ease-in-out infinite;
}

.card-side {
  width: 50%;
  height: 40%;
  top: 40%;
  left: 40%;
  z-index: 2;
  background-color: rgba(247, 245, 243, 0.04);
  border-color: rgba(247, 245, 243, 0.08);
  animation: floatCardSide 8s ease-in-out infinite;
}

/* 气泡浮现与呼吸 */
.bubble-msg {
  animation: bubbleIn 3s ease-in-out infinite;
}

.bubble-msg:nth-child(2) {
  animation-delay: 0.8s;
}

.bubble-msg:nth-child(3) {
  animation-delay: 1.6s;
}

/* 输入框三点呼吸 */
.input-dots circle {
  animation: dotBreathe 2s ease-in-out infinite;
}

.input-dots circle:nth-child(1) {
  animation-delay: 0s;
}

.input-dots circle:nth-child(2) {
  animation-delay: 0.3s;
}

.input-dots circle:nth-child(3) {
  animation-delay: 0.6s;
}

/* 通知卡片滑入 */
.notif-card {
  animation: notifSlide 5s ease-in-out infinite;
}

/* 连接线流动 */
.flow-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: flowDash 4s linear infinite;
}

/* 关键帧 */
@keyframes floatCardMain {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-12px); }
}

@keyframes floatCardBack {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

@keyframes floatCardSide {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-15px); }
}

@keyframes bubbleIn {
  0%, 100% { opacity: 0.6; transform: translateX(0px); }
  30%, 70% { opacity: 1; transform: translateX(4px); }
}

@keyframes dotBreathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

@keyframes notifSlide {
  0%, 100% { transform: translateX(0px); opacity: 0.7; }
  20%, 80% { transform: translateX(6px); opacity: 1; }
}

@keyframes flowDash {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .card-layer,
  .bubble-msg,
  .input-dots circle,
  .notif-card,
  .flow-line {
    animation: none !important;
  }
}

/* ============================================
   响应式适配
   ============================================ */
@media (max-width: 768px) {
  .hero .container {
    grid-template-columns: 1fr;
  }

  .hero-svg-wrapper {
    order: -1;
    max-width: 320px;
  }

  .long-form {
    grid-template-columns: 1fr;
  }

  .long-form-nav {
    display: none;
  }

  .nav {
    gap: 16px;
  }

  .nav a:not(.btn-download-nav) {
    display: none;
  }
}

@media (max-width: 480px) {
  .header-inner {
    height: 56px;
  }

  .btn {
    height: 44px;
    min-width: 140px;
    font-size: 0.88rem;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
