/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* 设计变量与色板 */
:root {
  --color-dark: #271231;
  --color-paper: #F6F3F7;
  --color-text: #1F1523;
  --color-brand: #9E13DD;
  --color-accent: #ED6EC0;
  
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(31, 21, 35, 0.3);
  
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;
  
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* 上下文取色变量 */
.bg-dark {
  --text-body: var(--color-paper);
  --text-heading: var(--color-paper);
  --text-link: var(--color-accent);
  --text-icon: var(--color-accent);
  --bg-page: var(--color-dark);
}
.bg-paper {
  --text-body: var(--color-text);
  --text-heading: var(--color-text);
  --text-link: var(--color-brand);
  --text-icon: var(--color-brand);
  --bg-page: var(--color-paper);
}
.card-light {
  --text-body: var(--color-text);
  --text-heading: var(--color-text);
  --text-link: var(--color-brand);
  --text-icon: var(--color-brand);
  --bg-page: var(--color-paper);
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  line-height: 1.75;
  color: var(--text-body);
  background-color: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--text-link); text-decoration: none; transition: opacity 0.2s ease; }
a:hover { opacity: 0.85; }
ul, ol { list-style: none; }

/* 布局容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding: var(--section-y) 0;
  background-color: var(--bg-page);
  position: relative;
}
.section-header {
  margin-bottom: calc(var(--gap) * 1.5);
}
.mebiao {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-link);
  margin-bottom: 0.5em;
  display: block;
}
h1, h2, h3 {
  font-weight: 500;
  line-height: 1.15;
  color: var(--text-heading);
  margin-bottom: 0.6em;
}
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); letter-spacing: -0.02em; text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
h3 { font-size: 1.35rem; }
p { margin-bottom: 1em; max-width: 38em; }
.hl { color: var(--text-link); }

/* 页头与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246, 243, 247, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(31, 21, 35, 0.08);
}
.bg-dark ~ .site-header { background: rgba(39, 18, 49, 0.95); border-color: rgba(246, 243, 247, 0.1); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-list { display: flex; gap: 24px; }
.nav-list a { font-size: 0.95rem; font-weight: 500; color: var(--text-body); }
.nav-list a[aria-current="page"], .nav-list a:hover { color: var(--text-link); }
.site-footer {
  padding: 48px 0;
  border-top: 1px solid rgba(31, 21, 35, 0.1);
  background: var(--bg-page);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--gap);
}
.footer-col h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 12px; color: var(--text-heading); }
.footer-col ul li { margin-bottom: 8px; }
.footer-col a { font-size: 0.9rem; color: var(--text-body); }
.copyright { text-align: center; margin-top: 32px; font-size: 0.85rem; color: var(--text-body); opacity: 0.7; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.btn:focus-visible { outline: 2px solid var(--text-link); outline-offset: 2px; }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(237, 110, 192, 0.35); }
.btn-secondary {
  background: transparent;
  color: var(--text-body);
  border: 1px solid var(--text-body);
}
.btn-secondary:hover { background: rgba(31, 21, 35, 0.05); }
.bg-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.bg-dark .btn-secondary:hover { background: rgba(246, 243, 247, 0.1); }

/* 卡片与网格 */
.card {
  background: var(--bg-page);
  border: var(--card-border) solid currentColor;
  box-shadow: var(--card-shadow);
  padding: 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 32px -12px rgba(31, 21, 35, 0.35); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(31, 21, 35, 0.1);
  text-align: left;
}
.data-table th { font-weight: 700; color: var(--text-heading); width: 35%; }
.data-table td { color: var(--text-body); }
.bg-dark .data-table th, .bg-dark .data-table td { border-color: rgba(246, 243, 247, 0.1); }

/* FAQ */
.faq-item {
  border-bottom: 1px solid rgba(31, 21, 35, 0.1);
  margin-bottom: 16px;
}
.bg-dark .faq-item { border-color: rgba(246, 243, 247, 0.1); }
details summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 1.05rem;
  padding: 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-heading);
}
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; font-size: 1.2rem; transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details p { padding: 0 0 16px; color: var(--text-body); line-height: 1.7; }

/* 时间线 */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(to bottom, var(--text-link), transparent);
}
.step-item { position: relative; margin-bottom: 32px; }
.step-num {
  position: absolute;
  left: -36px; top: 0;
  width: 28px; height: 28px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}
.step-content h3 { margin-bottom: 0.3em; font-size: 1.2rem; }
.step-content p { font-size: 0.95rem; color: var(--text-body); }

/* SVG 基础与动效 */
.svg-panel {
  width: 100%;
  height: auto;
  overflow: hidden;
}
svg { width: 100%; height: auto; }
.star { fill: var(--text-link); opacity: 0.6; }
.line-draw { stroke: var(--text-link); stroke-width: 1.5; fill: none; pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
.bubble { fill: var(--bg-page); stroke: var(--text-link); stroke-width: 1.5; }
.input-dot { fill: var(--text-link); }
.notif-card { fill: var(--bg-page); stroke: var(--text-link); stroke-width: 1; }

@keyframes twinkle {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes floatBubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes breatheDots {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes slideIn {
  0% { transform: translateX(20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes pulseGlow {
  0%, 100% { filter: drop-shadow(0 0 2px var(--text-link)); }
  50% { filter: drop-shadow(0 0 8px var(--text-link)); }
}

.anim-star { animation: twinkle 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-line { animation: drawLine 3s ease-in-out infinite alternate; }
.anim-bubble { animation: floatBubble 5s ease-in-out infinite; }
.anim-dot1 { animation: breatheDots 2s ease-in-out infinite; }
.anim-dot2 { animation: breatheDots 2s ease-in-out infinite 0.4s; }
.anim-dot3 { animation: breatheDots 2s ease-in-out infinite 0.8s; }
.anim-slide { animation: slideIn 1.5s ease-out forwards; }
.anim-pulse { animation: pulseGlow 6s ease-in-out infinite; }

/* 响应式与无障碍 */
@media (max-width: 768px) {
  h1 { font-size: clamp(2.2rem, 8vw, 3.5rem); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .feature-row { flex-direction: column !important; }
  .nav-list { gap: 16px; }
}
@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-star, .anim-line, .anim-bubble, .anim-dot1, .anim-dot2, .anim-dot3, .anim-slide, .anim-pulse {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
