/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 设计变量 (Design Tokens) --- */
:root {
  /* 色板 */
  --color-bg-dark: #10112D;
  --color-bg-paper: #F5F0E5;
  --color-text-body: #151523;
  --color-brand: #1416EB;
  --color-accent: #89ED6E;

  /* 圆角 */
  --radius-card: 24px;
  --radius-btn: 999px;

  /* 卡片边界与阴影 */
  --card-border: 1px solid rgba(21, 21, 35, 0.16);
  --card-shadow: none;

  /* 节奏与密度 */
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --line-height-body: 1.65;

  /* 内容最大宽度 */
  --content-max: 960px;

  /* 字体 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* --- 基础重置与排版 --- */
*, *::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);
  background-color: var(--color-bg-paper);
  color: var(--color-text-body);
  line-height: var(--line-height-body);
  font-size: 16px;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* --- 布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section {
  padding-block: var(--section-y);
  position: relative;
}

.section--dark {
  background-color: var(--color-bg-dark);
  color: var(--color-bg-paper);
}

.section--paper {
  background-color: var(--color-bg-paper);
  color: var(--color-text-body);
}

/* 分割线 */
.divider {
  height: 1px;
  background-color: rgba(21, 21, 35, 0.12);
  width: 100%;
  margin: 0;
  border: none;
}

.section--dark .divider {
  background-color: rgba(245, 240, 229, 0.15);
}

/* --- 标题与眉标 --- */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.section--paper .badge {
  color: var(--color-brand);
}

.section--dark .badge {
  color: var(--color-accent);
}

h1, h2, h3, h4 {
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  overflow-wrap: break-word;
}

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-bottom: 1.5rem;
}

h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  margin-bottom: 0.75rem;
}

.highlight {
  color: var(--color-brand);
}

.section--dark .highlight {
  color: var(--color-accent);
}

p {
  margin-bottom: 1rem;
  max-width: 38em;
}

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  border: none;
  text-align: center;
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-bg-dark);
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text-body);
  border: 1px solid currentColor;
}

.section--dark .btn-secondary {
  color: var(--color-bg-paper);
  border-color: var(--color-bg-paper);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  background-color: rgba(21, 21, 35, 0.05);
}

.section--dark .btn-secondary:hover {
  background-color: rgba(245, 240, 229, 0.1);
}

.btn-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* --- 卡片 --- */
.card {
  background-color: var(--color-bg-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease;
}

.section--dark .card {
  background-color: rgba(245, 240, 229, 0.05);
  border-color: rgba(245, 240, 229, 0.1);
  color: var(--color-bg-paper);
}

.card:hover {
  transform: translateY(-4px);
}

/* --- 表格 --- */
.table-wrapper {
  overflow-x: auto;
  width: 100%;
  margin: 1.5rem 0;
  border-radius: var(--radius-card);
  border: var(--card-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  padding: 1rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid rgba(21, 21, 35, 0.08);
}

th {
  font-weight: 600;
  background-color: rgba(21, 21, 35, 0.03);
}

.section--dark table th {
  background-color: rgba(245, 240, 229, 0.05);
  border-bottom-color: rgba(245, 240, 229, 0.1);
}

td {
  vertical-align: top;
}

tr:last-child th, tr:last-child td {
  border-bottom: none;
}

/* --- FAQ (<details>) --- */
.faq-list {
  display: grid;
  gap: 1rem;
}

.faq-item {
  border: var(--card-border);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.faq-item summary {
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(21, 21, 35, 0.02);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.25rem;
  font-weight: 400;
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item p {
  padding: 1.25rem 1.5rem;
  margin-bottom: 0;
  font-size: 0.95rem;
  line-height: 1.7;
}

/* --- 页头 (Header) --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(245, 240, 229, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(21, 21, 35, 0.08);
  padding: 1rem 0;
}

.section--dark ~ .header {
  background-color: rgba(16, 17, 45, 0.9);
  border-bottom-color: rgba(245, 240, 229, 0.1);
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav a {
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.nav a:hover, .nav a[aria-current="page"] {
  opacity: 1;
  color: var(--color-brand);
}

.section--dark .nav a {
  color: var(--color-bg-paper);
}

.section--dark .nav a:hover, .section--dark .nav a[aria-current="page"] {
  color: var(--color-accent);
}

/* --- 页脚 (Footer) --- */
.footer {
  padding: 3rem 0;
  background-color: var(--color-bg-dark);
  color: var(--color-bg-paper);
  border-top: 1px solid rgba(245, 240, 229, 0.1);
}

.footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  opacity: 0.7;
  font-size: 0.9rem;
  transition: opacity 0.2s;
}

.footer-links a:hover {
  opacity: 1;
  color: var(--color-accent);
}

.copyright {
  font-size: 0.85rem;
  opacity: 0.6;
}

/* --- SVG 动效 --- */
.svg-container {
  width: 100%;
  height: auto;
  overflow: visible;
}

/* 同心轨道呼吸 */
@keyframes orbit-breathe {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.08); opacity: 0.6; }
}

@keyframes orbit-breathe-alt {
  0%, 100% { transform: scale(1); opacity: 0.2; }
  50% { transform: scale(1.12); opacity: 0.5; }
}

.orbit-ring {
  transform-origin: center;
  transform-box: fill-box;
  animation: orbit-breathe 6s ease-in-out infinite;
}

.orbit-ring-alt {
  transform-origin: center;
  transform-box: fill-box;
  animation: orbit-breathe-alt 8s ease-in-out infinite;
}

/* 消息气泡浮现 */
@keyframes bubble-float {
  0%, 100% { transform: translateY(0); opacity: 0.8; }
  50% { transform: translateY(-6px); opacity: 1; }
}

.bubble {
  transform-origin: center;
  transform-box: fill-box;
  animation: bubble-float 4s ease-in-out infinite;
}

.bubble-delay-1 { animation-delay: 0.5s; }
.bubble-delay-2 { animation-delay: 1.2s; }
.bubble-delay-3 { animation-delay: 2.0s; }

/* 连接线流动 */
.flow-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: flow-draw 4s linear infinite;
}

@keyframes flow-draw {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

/* 输入点呼吸 */
@keyframes dot-breathe {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}

.typing-dot {
  transform-origin: center;
  transform-box: fill-box;
  animation: dot-breathe 1.5s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- 响应式微调 --- */
@media (max-width: 768px) {
  .nav {
    display: none; /* 简化处理，实际项目可加汉堡菜单，此处保持静态 */
  }
  
  .hero-grid {
    grid-template-columns: 1fr !important;
  }
  
  .scenario-grid {
    grid-template-columns: 1fr !important;
  }
  
  .feature-grid {
    grid-template-columns: 1fr !important;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
