/* =========================================
   SafeW 全局样式与 SVG 动效
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 配色 */
  --color-dark: #231334;
  --color-paper: #F5F3F7;
  --color-text: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;

  /* 结构与间距 */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;

  /* 排版 */
  --font-body: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --line-height-base: 1.55;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--color-brand); text-decoration: none; transition: color 0.2s; }
a:hover { color: color-mix(in srgb, var(--color-brand) 80%, black); }
a:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; color: inherit; }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); margin-bottom: var(--gap); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: calc(var(--gap) * 1.5); }
h3 { font-size: clamp(1.2rem, 2vw, 1.6rem); margin-bottom: var(--gap); }
p { margin-bottom: var(--gap); max-width: 38em; }
ul, ol { padding-left: 1.5em; margin-bottom: var(--gap); }
li { margin-bottom: 0.5em; }

/* --- 布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section-divider {
  width: 100%;
  height: 1px;
  background-color: color-mix(in srgb, var(--color-text) 15%, transparent);
  margin: var(--section-y) 0;
}

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(245, 243, 247, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid color-mix(in srgb, var(--color-text) 10%, transparent);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.1rem; color: var(--color-text); }
.brand img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { color: var(--color-text); font-weight: 500; }
.nav-links a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
.header-actions { display: flex; gap: 12px; align-items: center; }

.site-footer {
  background-color: var(--color-dark);
  color: var(--color-paper);
  padding: var(--section-y) 0;
  margin-top: var(--section-y);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
}
.footer-col h4 { font-size: 1rem; margin-bottom: 12px; color: var(--color-accent); }
.footer-col a { color: var(--color-paper); opacity: 0.85; display: block; margin-bottom: 8px; }
.footer-col a:hover { opacity: 1; color: var(--color-accent); }
.footer-bottom {
  margin-top: var(--section-y);
  padding-top: 24px;
  border-top: 1px solid color-mix(in srgb, var(--color-paper) 20%, transparent);
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* --- 按钮系统 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 24px;
  height: 48px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s, border-color 0.2s;
  text-decoration: none;
}
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: none;
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 2px solid var(--color-text);
}
.btn-secondary:hover { background-color: color-mix(in srgb, var(--color-text) 8%, transparent); }
.btn-icon { width: 20px; height: 20px; }

/* --- 卡片与面板 --- */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 24px;
  margin-bottom: var(--gap);
}
.dark-panel {
  background-color: var(--color-dark);
  border: 2px solid color-mix(in srgb, var(--color-paper) 30%, transparent);
  border-radius: var(--radius-card);
  padding: 32px;
  color: var(--color-paper);
}
.light-card-inside-dark {
  background-color: var(--color-paper);
  color: var(--color-text);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 20px;
}

/* --- 表格系统 --- */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--gap);
  display: block;
  overflow-x: auto;
}
.spec-table th, .spec-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid color-mix(in srgb, var(--color-text) 15%, transparent);
}
.spec-table th { font-weight: 700; width: 40%; }
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: none; }

/* --- FAQ --- */
.faq-item {
  margin-bottom: 16px;
  border: var(--card-border);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.faq-item summary {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: color-mix(in srgb, var(--color-text) 4%, transparent);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.2rem; font-weight: 400; }
.faq-item[open] summary::after { content: "−"; }
.faq-item .faq-answer {
  padding: 16px 20px;
  border-top: 1px solid color-mix(in srgb, var(--color-text) 10%, transparent);
  line-height: 1.6;
}

/* --- 眉标与高亮 --- */
.label-tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 12px;
  color: var(--color-brand);
}
.text-on-dark .label-tag { color: var(--color-accent); }
.hl { color: var(--color-brand); }
.text-on-dark .hl { color: var(--color-accent); }

/* --- 图文交错布局 --- */
.split-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--section-y);
  align-items: center;
  margin-bottom: var(--section-y);
}
.split-section.reverse { direction: rtl; }
.split-section.reverse > * { direction: ltr; }
.visual-panel {
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* --- SVG 基础与动效 --- */
.svgs-container {
  width: 100%;
  height: auto;
  max-width: 100%;
}
.svgs-container svg {
  width: 100%;
  height: auto;
  display: block;
}
.star-dot { animation: starTwinkle 4s ease-in-out infinite; }
.star-dot:nth-child(odd) { animation-delay: 1.5s; }
.connect-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: lineDraw 6s linear infinite;
}
.msg-bubble { animation: bubbleFloat 5s ease-in-out infinite; }
.input-dots { animation: dotBreathe 3s ease-in-out infinite; }
.notification-card { animation: slideIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }

@keyframes starTwinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.9; }
}
@keyframes lineDraw {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes dotBreathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* 变换中心约束 */
svg .rotatable { transform-box: fill-box; transform-origin: center; }

/* --- 响应式适配 --- */
@media (max-width: 768px) {
  .split-section { grid-template-columns: 1fr; }
  .split-section.reverse { direction: ltr; }
  .nav-links { display: none; }
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
  .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;
    animation-name: none;
  }
}
