/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计变量 */
:root {
  --surface-dark: #19102D;
  --surface-paper: #FCFCFD;
  --text-main: #191523;
  --text-on-dark: #FCFCFD;
  --brand: #5214EB;
  --accent: #D66EED;
  --card-bg-paper: #F4F4F5;
  --card-bg-dark: #2A2045;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-subtle-dark: rgba(255, 255, 255, 0.1);
  --radius-none: 0;
  --shadow-none: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;
  --font-base: 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; }
body {
  font-family: var(--font-base);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-main);
  background-color: var(--surface-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; }

/* 容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* 面版系统 */
.paper-surface { background-color: var(--surface-paper); color: var(--text-main); }
.dark-surface { background-color: var(--surface-dark); color: var(--text-on-dark); }

/* 标题与眉标 */
.section-subtitle {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  color: var(--brand);
}
.dark-surface .section-subtitle { color: var(--accent); }
h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.02em;
  margin-bottom: 1.5rem;
}
h3 {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 0.75rem;
}
.text-hl {
  color: var(--brand);
  font-weight: 700;
}
.dark-surface .text-hl { color: var(--accent); }

/* 段落控制 */
.prose {
  max-width: 38em;
  margin-bottom: var(--gap);
}
.prose p { margin-bottom: 1rem; }

/* 按钮系统 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.btn-primary {
  background-color: var(--accent);
  color: var(--surface-dark);
}
.btn-secondary {
  background-color: transparent;
  border: 1px solid currentColor;
  color: var(--text-main);
}
.dark-surface .btn-secondary { color: var(--text-on-dark); }
.btn:hover { transform: translateY(-1px); opacity: 0.9; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 卡片系统（无圆角、无边框、无阴影，靠底色区分） */
.card {
  background-color: var(--card-bg-paper);
  padding: var(--gap);
  border-radius: var(--radius-none);
  box-shadow: var(--shadow-none);
  border: var(--card-border);
}
.dark-surface .card { background-color: var(--card-bg-dark); }
.card-grid {
  display: grid;
  gap: var(--gap);
}
@media (min-width: 768px) { .card-grid.two { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .card-grid.three { grid-template-columns: repeat(3, 1fr); } }

/* 表格系统 */
.table-wrapper { overflow-x: auto; margin: var(--gap) 0; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}
.dark-surface th, .dark-surface td { border-bottom-color: var(--border-subtle-dark); }
th { font-weight: 700; }
td:first-child { font-weight: 600; }

/* FAQ 细节组件 */
details {
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1rem;
}
.dark-surface details { border-bottom-color: var(--border-subtle-dark); }
summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.5rem 0;
  list-style: none;
  position: relative;
  padding-left: 1.75rem;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35rem;
  width: 1rem;
  height: 1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235214EB' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18l6-6-6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  transition: transform 0.2s;
}
.dark-surface summary::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23D66EED' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18l6-6-6-6'/%3E%3C/svg%3E");
}
details[open] summary::before { transform: rotate(90deg); }
.details-content { padding-top: 0.5rem; color: var(--text-main); }
.dark-surface .details-content { color: var(--text-on-dark); }

/* 页头与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(252, 252, 253, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.dark-surface .site-header { background-color: rgba(25, 16, 45, 0.95); }
.scrolled { border-bottom-color: var(--border-subtle); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-link { font-weight: 500; font-size: 0.95rem; }
.nav-link[aria-current="page"] { font-weight: 700; color: var(--brand); }
.dark-surface .nav-link[aria-current="page"] { color: var(--accent); }
.site-footer {
  padding: var(--section-y) 0;
  border-top: 1px solid var(--border-subtle);
  margin-top: var(--section-y);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--gap);
}
@media (max-width: 768px) { .footer-grid { grid-template-columns: 1fr; } }

/* SVG 动效关键帧 */
@keyframes nodePulse {
  0%, 100% { opacity: 0.25; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}
@keyframes lineDraw {
  0%, 100% { stroke-dashoffset: 0; }
  50% { stroke-dashoffset: 1; }
}
@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0); opacity: 0.8; }
  50% { transform: translateY(-6px); opacity: 1; }
}
@keyframes notifSlide {
  0%, 100% { transform: translateX(0); opacity: 0.6; }
  50% { transform: translateX(4px); opacity: 1; }
}
@keyframes inputDots {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* 动效类绑定 */
.grid-node { animation: nodePulse 4s ease-in-out infinite; }
.draw-line { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: lineDraw 3s ease-in-out infinite; }
.chat-bubble { animation: bubbleFloat 3.5s ease-in-out infinite; }
.notif-card { animation: notifSlide 4s ease-in-out infinite; }
.input-dot { animation: inputDots 1.5s ease-in-out infinite; }

/* 减少动态效果偏好 */
@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) {
  .two-col { grid-template-columns: 1fr !important; }
  .flex-row-mobile { flex-direction: column; }
  .prose { max-width: 100%; }
}
.flex-row-mobile { display: flex; flex-wrap: wrap; gap: var(--gap); }
.col-main { flex: 1 1 0; min-width: 0; }
.col-side { flex: 1 1 0; min-width: 0; }
@media (min-width: 768px) {
  .col-side { order: 2; }
}
@media (min-width: 1024px) {
  .col-side { order: 0; }
}
