/* =========================================
   SafeW 全局样式与动效系统
   ========================================= */

/* 设计 Token 与基础变量 */
:root {
  /* 色板 */
  --color-dark: #1B1231;
  --color-paper: #F4F3F7;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;

  /* 结构与间距 */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;

  /* 排版 */
  --font-main: "PingFang SC", "Noto Sans SC", "Segoe UI", system-ui, -apple-system, sans-serif;
  --lh-body: 1.55;
  --lh-title: 1.25;
  --fw-title: 600;
}

/* 基础重置与容器 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: var(--lh-body);
  color: var(--color-text);
  background-color: var(--color-paper);
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

/* 表面层配色覆盖规则 */
.surface-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.surface-dark .hl { color: var(--color-accent); }
.surface-dark a:not(.btn) { color: var(--color-accent); }
.surface-dark .眉标 { color: var(--color-accent); }
.surface-dark .table-head { color: var(--color-paper); }
.surface-dark .table-row td:first-child { color: var(--color-paper); }

.surface-paper {
  background-color: var(--color-paper);
  color: var(--color-text);
}
.surface-paper .hl { color: var(--color-brand); }
.surface-paper a:not(.btn) { color: var(--color-brand); }
.surface-paper .眉标 { color: var(--color-brand); }
.surface-paper .table-head { color: var(--color-text); }
.surface-paper .table-row td:first-child { color: var(--color-text); }

/* 深色块内的浅色卡片恢复纸面取色 */
.surface-card-light {
  background-color: var(--color-paper);
  color: var(--color-text);
  border: var(--card-border) solid transparent;
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
}

/* 修复 zh-cn.html #features 区块内浅色卡片文字对比度 */
#features .surface-card-light p {
  color: #191523;
}
.surface-card-light .hl { color: var(--color-brand); }
.surface-card-light a:not(.btn) { color: var(--color-brand); }
.surface-card-light .眉标 { color: var(--color-brand); }

/* 页头与导航 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(244, 243, 247, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo-group { display: flex; align-items: center; gap: 10px; }
.logo-img { width: 32px; height: 32px; object-fit: contain; }
.brand-name { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em; }
.main-nav { display: flex; gap: 24px; align-items: center; }
.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 0.2s;
}
.nav-link:hover, .nav-link[aria-current="page"] { background: rgba(25, 21, 35, 0.06); }
.nav-link[aria-current="page"] { color: var(--color-brand); }
@media (max-width: 768px) {
  .main-nav { gap: 12px; }
  .nav-link { font-size: 0.85rem; padding: 4px 8px; }
}

/* 页脚 */
.site-footer {
  padding-block: 48px;
  border-top: 1px solid rgba(25, 21, 35, 0.1);
  font-size: 0.9rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
}
.footer-col h4 { font-weight: 600; margin-bottom: 12px; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col a:hover { text-decoration: underline; }
.copyright { text-align: center; margin-top: 32px; opacity: 0.7; }

/* 按钮系统 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 28px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  border: none;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-1px); background-color: #8a68dd; }
.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--color-text);
  color: var(--color-text);
}
.surface-dark .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}
.btn-secondary:hover { background: rgba(25, 21, 35, 0.05); }
.surface-dark .btn-secondary:hover { background: rgba(244, 243, 247, 0.1); }

/* 通用组件：卡片、表格、FAQ */
.card {
  background: transparent;
  border: var(--card-border) solid rgba(25, 21, 35, 0.08);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  transition: transform 0.2s;
}
.card:hover { transform: translateY(-2px); }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}
.surface-dark .data-table th,
.surface-dark .data-table td { border-bottom-color: rgba(244, 243, 247, 0.15); }
.table-head { font-weight: 600; }
.table-row td:last-child { color: var(--color-text); opacity: 0.85; }
.surface-dark .table-row td:last-child { color: var(--color-paper); }

.faq-item { margin-bottom: 16px; }
.faq-summary {
  cursor: pointer;
  font-weight: 600;
  padding: 16px;
  background: rgba(25, 21, 35, 0.03);
  border-radius: 12px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-summary::-webkit-details-marker { display: none; }
.faq-summary::after { content: "+"; font-size: 1.2rem; transition: transform 0.2s; }
.faq-item[open] .faq-summary::after { transform: rotate(45deg); }
.faq-answer { padding: 16px; line-height: 1.7; }

/* 眉标 */
.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  text-transform: uppercase;
}

/* 区块容器 */
.section { padding-block: var(--section-y); }
.section-grid {
  display: grid;
  gap: var(--gap);
}
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: 1fr 1fr; align-items: center; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* 正文段落行宽控制 */
.container p { max-width: 40em; }

/* SVG 动效 Keyframes */
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes flowDash {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes slidePanel {
  0%, 100% { transform: translateX(0); opacity: 0.85; }
  50% { transform: translateX(4px); opacity: 1; }
}

.svg-float { animation: floatY 5s ease-in-out infinite; }
.svg-breathe { animation: breathe 4s ease-in-out infinite; }
.svg-flow { stroke-dasharray: 1; stroke-dashoffset: 0; animation: flowDash 6s ease-in-out infinite alternate; }
.svg-panel { animation: slidePanel 7s ease-in-out infinite alternate; }

/* 限制动态效果偏好 */
@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;
  }
}
