/* =========================================
   SafeW 共享样式系统
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 色板 */
  --color-dark: #2D1438;
  --color-paper: #F6F3F7;
  --color-body: #1F1523;
  --color-brand: #9E13DD;
  --color-accent: #6EEDA8;

  /* 几何与间距 */
  --radius-card: 20px;
  --radius-btn: 12px;
  --radius-badge: 8px;
  --card-border: 1px solid rgba(31, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;
  --text-col-max: 38em;

  /* 排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --line-height-base: 1.75;
  --line-height-tight: 1.15;
}

/* --- 基础重置与全局 --- */
*, *::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: var(--line-height-base);
  color: var(--color-body);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* --- 主题覆盖（取色规则） --- */
.theme-paper {
  --text-primary: var(--color-body);
  --text-secondary: var(--color-body);
  --text-accent: var(--color-brand);
  --link-hover: rgba(158, 19, 221, 0.8);
  --border-subtle: rgba(31, 21, 35, 0.1);
}
.theme-dark {
  --text-primary: var(--color-paper);
  --text-secondary: rgba(246, 243, 247, 0.85);
  --text-accent: var(--color-accent);
  --link-hover: rgba(110, 237, 168, 0.7);
  --border-subtle: rgba(246, 243, 247, 0.15);
}

/* --- 布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.section {
  padding-block: var(--section-y);
  position: relative;
}
.section + .section {
  border-top: 1px solid var(--border-subtle);
}
.text-col {
  max-width: var(--text-col-max);
  margin-bottom: var(--gap);
}

/* --- 眉标与标题 --- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  color: var(--text-accent);
}
.eyebrow::before {
  content: "";
  display: block;
  width: 1.2rem;
  height: 1px;
  background-color: currentColor;
}
h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 500;
  line-height: var(--line-height-tight);
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 500;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: 1rem;
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}
.hl {
  color: var(--text-accent);
  font-weight: 600;
}

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0 1.5rem;
  height: 48px;
  min-width: 140px;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  border: 2px solid transparent;
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 3px solid var(--text-accent);
  outline-offset: 2px;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border-color: var(--color-accent);
}
.btn-primary:hover { background-color: rgba(110, 237, 168, 0.85); }
.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border-color: var(--text-primary);
}
.theme-dark .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}
.btn-secondary:hover { background-color: rgba(255,255,255,0.08); }

/* --- 卡片与面板 --- */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  box-shadow: var(--card-shadow);
}
.panel {
  background-color: var(--color-dark);
  border-radius: var(--radius-card);
  padding: var(--gap);
  position: relative;
  overflow: hidden;
}
.card-light-on-dark {
  background-color: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  color: var(--color-body);
}

/* --- 列表与定义列表 --- */
dl.feature-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}
dt {
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
dd {
  color: var(--text-secondary);
  line-height: 1.7;
}
ul.check-list {
  display: grid;
  gap: 0.8rem;
}
ul.check-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  color: var(--text-secondary);
}
ul.check-list li::before {
  content: "";
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background-color: var(--color-accent);
  margin-top: 0.25rem;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 6L9 17l-5-5' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 6L9 17l-5-5' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* --- 表格 --- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.8rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}
th { font-weight: 600; color: var(--text-primary); }
td { color: var(--text-secondary); }
tr:last-child td { border-bottom: none; }

/* --- FAQ --- */
details.faq-item {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 1rem;
  background-color: var(--color-paper);
  overflow: hidden;
}
summary {
  padding: 1.2rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-primary);
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 400;
  transition: transform 0.2s ease;
}
details[open] summary::after { transform: rotate(45deg); }
details[open] summary { border-bottom: 1px solid var(--border-subtle); }
.faq-answer {
  padding: 1.2rem 1.5rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* --- 导航与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(246, 243, 247, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
}
.theme-dark .site-header { background-color: rgba(45, 20, 56, 0.9); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}
.brand img { width: 32px; height: 32px; object-fit: contain; }
.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s;
}
.nav-links a:hover, .nav-links a[aria-current="page"] {
  color: var(--text-accent);
}
.site-footer {
  padding-block: 3rem;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.footer-nav {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}
.footer-nav a { color: var(--text-secondary); }
.footer-nav a:hover { color: var(--text-accent); }

/* --- SVG 基础与动效 --- */
.svg-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  vertical-align: middle;
}
.hero-visual-svg {
  width: 100%;
  height: auto;
  max-width: 100%;
}
.grid-node {
  fill: var(--color-accent);
  opacity: 0.3;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes node-pulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}
.node-1 { animation: node-pulse 6s ease-in-out infinite alternate; animation-delay: 0s; }
.node-2 { animation: node-pulse 6s ease-in-out infinite alternate; animation-delay: 0.4s; }
.node-3 { animation: node-pulse 6s ease-in-out infinite alternate; animation-delay: 0.8s; }
.node-4 { animation: node-pulse 6s ease-in-out infinite alternate; animation-delay: 1.2s; }
.node-5 { animation: node-pulse 6s ease-in-out infinite alternate; animation-delay: 1.6s; }
.node-6 { animation: node-pulse 6s ease-in-out infinite alternate; animation-delay: 2.0s; }
.node-7 { animation: node-pulse 6s ease-in-out infinite alternate; animation-delay: 2.4s; }
.node-8 { animation: node-pulse 6s ease-in-out infinite alternate; animation-delay: 2.8s; }
.node-9 { animation: node-pulse 6s ease-in-out infinite alternate; animation-delay: 3.2s; }

.draw-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  stroke: var(--color-accent);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
}
@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.line-flow {
  animation: draw-line 4s linear infinite;
}

.float-element {
  transform-box: fill-box;
  transform-origin: center;
  animation: float-up 8s ease-in-out infinite alternate;
}
@keyframes float-up {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}

.bubble-fade {
  opacity: 0.85;
  animation: bubble-opacity 5s ease-in-out infinite alternate;
}
@keyframes bubble-opacity {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

.input-dots circle {
  fill: var(--color-accent);
  animation: dot-breathe 3s 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; }
@keyframes dot-breathe {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* --- 响应式与无障碍 --- */
@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 1rem 0; }
  .nav-links { order: 3; width: 100%; justify-content: center; margin-top: 0.5rem; }
  h1 { font-size: clamp(2rem, 8vw, 3.2rem); }
  .grid-stack { grid-template-columns: 1fr !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}
