/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* === 设计变量 === */
:root {
  --color-dark: #140E25;
  --color-paper: #F5F0E5;
  --color-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;
  
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.3);
  
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;
  
  --font-sans: 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-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-body);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* === 主题取色覆盖 === */
.theme-dark { color: var(--color-paper); }
.theme-dark a, .theme-dark .hl, .theme-dark mark { color: var(--color-accent); }
.theme-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.theme-dark .btn-secondary:hover { background: rgba(200, 237, 110, 0.15); }

.theme-paper { color: var(--color-body); }
.theme-paper a, .theme-paper .hl { color: var(--color-brand); }
.theme-paper .btn-secondary { color: var(--color-body); border-color: var(--color-body); }
.theme-paper .btn-secondary:hover { background: rgba(82, 20, 235, 0.08); }

/* === 布局容器 === */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
.section { padding-block: var(--section-y); }
.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); }

/* === 侧边栏 / 顶部导航 === */
.site-layout { display: flex; min-height: 100vh; }
.sidebar-nav {
  width: 260px;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--color-dark);
  color: var(--color-paper);
  z-index: 50;
}
.nav-brand { display: flex; align-items: center; gap: 0.75rem; font-weight: 700; font-size: 1.1rem; margin-bottom: 2rem; }
.nav-brand img { width: 32px; height: 32px; object-fit: contain; }
.nav-links { display: flex; flex-direction: column; gap: 1rem; font-size: 0.95rem; }
.nav-links a { padding: 0.5rem 0; border-bottom: 1px solid rgba(245, 240, 229, 0.1); transition: opacity 0.2s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { opacity: 1; color: var(--color-accent); }
.nav-footer { font-size: 0.8rem; opacity: 0.7; }

.main-content { flex: 1; overflow-x: hidden; }
@media (max-width: 768px) {
  .site-layout { flex-direction: column; }
  .sidebar-nav {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 64px;
    flex-direction: row; align-items: center; justify-content: space-between;
    padding: 0 1rem;
    z-index: 100;
  }
  .nav-links, .nav-footer { display: none; }
  .main-content { padding-top: 64px; }
}

/* === 按钮组件 === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0 1.5rem; height: 52px; border-radius: var(--radius-btn);
  font-weight: 600; font-size: 1rem; cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  border: none; text-align: center;
}
.btn-primary { background: var(--color-accent); color: var(--color-dark); }
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-secondary { background: transparent; border: 1px solid currentColor; }
.btn-secondary:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* === 卡片与面板 === */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: 0 12px 32px -12px rgba(25, 21, 35, 0.35); }
.panel-dark {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

/* === 标题与眉标 === */
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.theme-dark .eyebrow { color: var(--color-accent); }
.theme-paper .eyebrow { color: var(--color-brand); }

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 500; line-height: 1.15; text-wrap: balance;
  margin-bottom: 1rem; letter-spacing: -0.02em;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 500; line-height: 1.25; margin-bottom: 1.5rem; text-wrap: balance;
}
h3 { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.75rem; line-height: 1.3; }
p { margin-bottom: 1rem; max-width: 38em; }
.hl { font-weight: 600; }

/* === 表格 === */
.spec-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.spec-table th, .spec-table td { padding: 0.75rem 0; text-align: left; border-bottom: 1px solid rgba(25, 21, 35, 0.1); }
.spec-table th { font-weight: 600; width: 40%; }
.theme-dark .spec-table th, .theme-dark .spec-table td { border-color: rgba(245, 240, 229, 0.15); }

/* === FAQ === */
.faq-item { margin-bottom: 1rem; border: var(--card-border); border-radius: var(--radius-card); overflow: hidden; }
.faq-item summary {
  padding: 1rem 1.25rem; cursor: pointer; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(25, 21, 35, 0.03);
}
.theme-dark .faq-item summary { background: rgba(245, 240, 229, 0.05); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.2rem; transition: transform 0.2s; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding: 1rem 1.25rem; margin: 0; font-size: 0.95rem; opacity: 0.9; }

/* === 流程条 === */
.flow-steps { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; counter-reset: step; }
.flow-step { flex: 1 1 200px; position: relative; padding: 1.25rem; background: rgba(25, 21, 35, 0.04); border-radius: var(--radius-card); }
.theme-dark .flow-step { background: rgba(245, 240, 229, 0.08); }
.flow-step::before {
  counter-increment: step; content: "0" counter(step);
  display: block; font-size: 0.85rem; font-weight: 700; color: var(--color-accent);
  background: rgba(200, 237, 110, 0.15); width: 28px; height: 28px;
  border-radius: 6px; text-align: center; line-height: 28px; margin-bottom: 0.5rem;
}
.flow-arrow { font-size: 1.2rem; opacity: 0.4; }

/* === 新闻卡片 === */
.news-card { display: flex; flex-direction: column; height: 100%; }
.news-card time { font-size: 0.8rem; opacity: 0.7; margin-bottom: 0.5rem; display: block; }
.news-card h4 { margin-bottom: 0.5rem; font-size: 1rem; }
.news-card p { font-size: 0.9rem; flex-grow: 1; }

/* =========================================
   SVG 动效系统
   ========================================= */
.safew-svg { width: 100%; height: auto; max-width: 100%; }

/* 星点明灭 */
.svg-star { opacity: 0.6; }
@keyframes twinkle {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}
.svg-star.s1 { animation: twinkle 4s ease-in-out infinite; }
.svg-star.s2 { animation: twinkle 5s ease-in-out infinite 1s; }
.svg-star.s3 { animation: twinkle 4.5s ease-in-out infinite 0.5s; }
.svg-star.s4 { animation: twinkle 6s ease-in-out infinite 2s; }

/* 连线流动 */
.svg-line { stroke-dasharray: 1; stroke-dashoffset: 0; }
@keyframes drawLine {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}
.svg-line.l1 { animation: drawLine 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.svg-line.l2 { animation: drawLine 7s ease-in-out infinite 1s; transform-box: fill-box; transform-origin: center; }

/* 气泡浮动 */
.svg-bubble { transform-box: fill-box; transform-origin: center; }
@keyframes floatBubble {
  0%, 100% { transform: translateY(0); opacity: 0.85; }
  50% { transform: translateY(-6px); opacity: 1; }
}
.svg-bubble.b1 { animation: floatBubble 5s ease-in-out infinite; }
.svg-bubble.b2 { animation: floatBubble 6s ease-in-out infinite 1s; }
.svg-bubble.b3 { animation: floatBubble 5.5s ease-in-out infinite 0.5s; }
.svg-bubble.b4 { animation: floatBubble 6.5s ease-in-out infinite 2s; }

/* 通知卡片滑入 */
.svg-notif { transform-box: fill-box; transform-origin: center; }
@keyframes slideInNotif {
  0%, 100% { transform: translateX(0); opacity: 1; }
  10% { transform: translateX(4px); opacity: 0.9; }
  90% { transform: translateX(4px); opacity: 0.9; }
}
.svg-notif { animation: slideInNotif 8s ease-in-out infinite; }

/* 输入框呼吸点 */
.svg-input-dot { transform-box: fill-box; transform-origin: center; }
@keyframes breatheDot {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}
.svg-input-dot.d1 { animation: breatheDot 2s ease-in-out infinite; }
.svg-input-dot.d2 { animation: breatheDot 2s ease-in-out infinite 0.3s; }
.svg-input-dot.d3 { animation: breatheDot 2s ease-in-out infinite 0.6s; }

/* 减少动态效果 */
@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;
  }
}
