/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 设计变量与基础重置 --- */
:root {
  /* 色板 */
  --color-bg-dark: #13102D;
  --color-bg-light: #F7F5F3;
  --color-text-body: #171523;
  --color-brand: #2714EB;
  --color-accent: #89ED6E;
  
  /* 组件边界与阴影 */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(23, 21, 35, 0.3);
  --card-shadow-hover: 0 14px 32px -12px rgba(23, 21, 35, 0.4);

  /* 间距与布局 */
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;
  --nav-height: 72px;

  /* 字体 */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg-light);
  color: var(--color-text-body);
  line-height: 1.65;
  font-size: 16px;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* --- 排版系统 --- */
h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-bottom: var(--gap);
}

h3 {
  font-size: clamp(1.3rem, 2vw, 1.6rem);
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1.25rem;
  max-width: 38em;
}

strong {
  font-weight: 700;
}

/* 眉标 (Section Label) */
.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  padding: 0.3em 0.8em;
  border-radius: 999px;
}

/* 强调词 */
.hl {
  color: var(--color-brand);
}

/* 深色面上的强调词 */
.dark-surface .hl {
  color: var(--color-accent);
}

/* --- 容器与网格 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gap);
  padding-right: var(--gap);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: var(--gap);
  align-items: center;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: var(--gap);
}

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: 52px;
  padding: 0 28px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 3px solid var(--color-brand);
  outline-offset: 3px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-bg-dark);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(137, 237, 110, 0.3);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text-body);
  border: 2px solid var(--color-text-body);
}

.dark-surface .btn-secondary {
  color: var(--color-bg-light);
  border-color: var(--color-bg-light);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  background-color: rgba(23, 21, 35, 0.05);
}

.dark-surface .btn-secondary:hover {
  background-color: rgba(247, 245, 243, 0.1);
}

.btn-icon {
  width: 20px;
  height: 20px;
}

/* --- 卡片 --- */
.card {
  background-color: #fff;
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 24px;
  border: var(--card-border);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-4px);
}

.dark-surface .card {
  background-color: var(--color-bg-light);
  color: var(--color-text-body);
}

/* --- 页面区块通用 --- */
section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

.dark-surface {
  background-color: var(--color-bg-dark);
  color: var(--color-bg-light);
}

.dark-surface h2, 
.dark-surface h3, 
.dark-surface p {
  color: var(--color-bg-light);
}

/* --- 页头与导航 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(247, 245, 243, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(23, 21, 35, 0.06);
  height: var(--nav-height);
}

.dark-surface ~ .site-header {
  background-color: rgba(19, 16, 45, 0.85);
  border-bottom-color: rgba(247, 245, 243, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.brand-logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text-body);
  transition: color 0.2s;
}

.dark-surface ~ .site-header .nav-link {
  color: var(--color-bg-light);
  opacity: 0.85;
}

.dark-surface ~ .site-header .nav-link:hover,
.dark-surface ~ .site-header .nav-link[aria-current="page"] {
  opacity: 1;
  color: var(--color-accent);
}

.nav-link:hover {
  color: var(--color-brand);
}

.nav-link[aria-current="page"] {
  color: var(--color-brand);
  font-weight: 700;
}

/* --- 页脚 --- */
.site-footer {
  padding: 48px 0;
  border-top: 1px solid rgba(23, 21, 35, 0.08);
  text-align: center;
  color: rgba(23, 21, 35, 0.6);
  font-size: 0.9rem;
}

.dark-surface ~ .site-footer {
  border-top-color: rgba(247, 245, 243, 0.08);
  color: rgba(247, 245, 243, 0.5);
}

.footer-nav {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}

.footer-nav a {
  color: inherit;
  transition: color 0.2s;
}

.footer-nav a:hover {
  color: var(--color-brand);
}

.dark-surface ~ .site-footer .footer-nav a:hover {
  color: var(--color-accent);
}

/* --- 功能滚动带 --- */
.feature-scroll-wrapper {
  overflow-x: auto;
  padding-bottom: 24px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(23, 21, 35, 0.2) transparent;
}

.feature-scroll-wrapper::-webkit-scrollbar {
  height: 6px;
}

.feature-scroll-wrapper::-webkit-scrollbar-thumb {
  background-color: rgba(23, 21, 35, 0.2);
  border-radius: 3px;
}

.feature-scroll {
  display: flex;
  gap: var(--gap);
  width: max-content;
}

/* --- 表格 --- */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-card);
  border: 1px solid rgba(23, 21, 35, 0.08);
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: #fff;
  min-width: 0;
}

th, td {
  padding: 16px 24px;
  text-align: left;
  border-bottom: 1px solid rgba(23, 21, 35, 0.06);
}

th {
  font-weight: 700;
  color: var(--color-text-body);
  background-color: rgba(23, 21, 35, 0.02);
}

td {
  color: var(--color-text-body);
}

.dark-surface table {
  background-color: rgba(247, 245, 243, 0.05);
  border-color: rgba(247, 245, 243, 0.1);
}

.dark-surface th,
.dark-surface td {
  border-color: rgba(247, 245, 243, 0.08);
  color: var(--color-bg-light);
}

.dark-surface th {
  background-color: rgba(247, 245, 243, 0.08);
}

/* --- FAQ --- */
.faq-item {
  border-bottom: 1px solid rgba(23, 21, 35, 0.08);
}

.dark-surface .faq-item {
  border-color: rgba(247, 245, 243, 0.08);
}

details summary {
  padding: 20px 0;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: color 0.2s;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::after {
  content: "+";
  font-size: 1.5rem;
  font-weight: 400;
  opacity: 0.5;
  transition: transform 0.3s ease;
}

details[open] summary::after {
  transform: rotate(45deg);
}

details summary:hover {
  color: var(--color-brand);
}

.dark-surface details summary:hover {
  color: var(--color-accent);
}

details p {
  padding-bottom: 24px;
  color: var(--color-text-body);
  opacity: 0.9;
}

.dark-surface details p {
  color: var(--color-bg-light);
}

/* --- 新闻卡片 --- */
.news-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.news-date {
  font-size: 0.85rem;
  color: rgba(23, 21, 35, 0.5);
  margin-bottom: 8px;
  font-weight: 500;
}

.dark-surface .news-date {
  color: rgba(247, 245, 243, 0.5);
}

.news-card h3 {
  font-size: 1.2rem;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.news-card p {
  font-size: 0.95rem;
  color: rgba(23, 21, 35, 0.8);
  flex-grow: 1;
}

.dark-surface .news-card p {
  color: rgba(247, 245, 243, 0.8);
}

/* --- SVG 动效类 --- */
svg {
  width: 100%;
  height: auto;
}

/* 呼吸动画：透明度变化 */
@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* 漂浮动画：轻微上下位移 */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* 描边流动：用于连接线 */
@keyframes flowLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

/* 星点明灭 */
@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* 应用动画的类 */
.anim-breathe {
  animation: breathe 4s ease-in-out infinite;
}

.anim-breathe-delay-1 {
  animation-delay: 1s;
}

.anim-breathe-delay-2 {
  animation-delay: 2s;
}

.anim-float {
  animation: float 6s ease-in-out infinite;
}

.anim-float-delay {
  animation-delay: 3s;
}

.anim-flow {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: flowLine 3s linear infinite;
}

.anim-twinkle {
  animation: twinkle 5s ease-in-out infinite;
}

.anim-twinkle-delay {
  animation-delay: 2.5s;
}

/* 变换中心设置 */
.anim-float, .anim-twinkle {
  transform-box: fill-box;
  transform-origin: center;
}

/* --- 响应式适配 --- */
@media (max-width: 768px) {
  :root {
    --nav-height: 64px;
  }
  
  .nav-links {
    gap: 16px;
  }
  
  .grid-2 {
    grid-template-columns: 1fr;
  }
  
  .hero-canvas {
    order: -1;
    margin-bottom: 24px;
  }
  
  /* 修复 index.html 全宽深色区块在小屏因负边距/扩展宽度导致的横向溢出 */
  section[id="features"] {
    margin-left: 0;
    width: 100%;
    padding-left: var(--gap);
    padding-right: var(--gap);
  }
}

/* 减少动态效果偏好 */
@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;
  }
  
  .anim-flow {
    animation: none;
    stroke-dashoffset: 0;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
