/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* 1. 设计变量与重置 */
:root {
  /* 品牌色板 */
  --color-dark: #240F29;
  --color-paper: #F6F3F7;
  --color-text: #201523;
  --color-brand: #A711CF;
  --color-accent: #ED6E73;
  
  /* 结构性约束 */
  --radius-card: 0;
  --radius-btn: 0;
  --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-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-body: clamp(0.95rem, 1.1vw, 1.125rem);
  --text-h1: clamp(2rem, 4.6vw, 3.4rem);
  --text-h2: clamp(1.5rem, 2.5vw, 2rem);
  --text-h3: clamp(1.1rem, 1.5vw, 1.35rem);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.55;
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 链接与通用文本 */
a {
  color: var(--color-brand);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.85;
}

img, svg {
  display: block;
  max-width: 100%;
}

svg {
  width: 100%;
  height: auto;
}

/* 2. 布局系统：左栏品牌 + 右侧内容 */
.layout-wrapper {
  display: flex;
  min-height: 100vh;
}

/* 左侧吸顶品牌栏 (桌面端) */
.sidebar-brand {
  width: 280px;
  background-color: var(--color-dark);
  color: var(--color-paper);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem;
  z-index: 100;
  flex-shrink: 0;
}

.sidebar-logo img {
  width: 160px;
  height: auto;
  margin-bottom: 1.5rem;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 0.5rem;
}

.sidebar-nav a {
  color: rgba(246, 243, 247, 0.7);
  font-size: 0.95rem;
  display: block;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(246, 243, 247, 0.1);
}

.sidebar-nav a:hover,
.sidebar-nav a[aria-current="page"] {
  color: var(--color-paper);
  opacity: 1;
  padding-left: 0.5rem;
  transition: padding-left 0.2s ease;
}

.sidebar-footer {
  font-size: 0.8rem;
  color: rgba(246, 243, 247, 0.4);
}

/* 右侧主要内容区 */
.main-content {
  flex: 1;
  min-width: 0; /* 防止长文本溢出 */
}

/* 顶部导航 (移动端/平板显示，桌面端隐藏) */
.top-nav {
  display: none;
  position: sticky;
  top: 0;
  background-color: var(--color-dark);
  color: var(--color-paper);
  padding: 0.75rem 1.5rem;
  z-index: 90;
  align-items: center;
  justify-content: space-between;
}

.top-nav .logo-text {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.top-nav .nav-toggle {
  background: none;
  border: none;
  color: var(--color-paper);
  cursor: pointer;
}

/* 区块通用样式 */
.section {
  padding: var(--section-y) 1.5rem;
  max-width: var(--content-max);
  margin: 0 auto;
}

.section.dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
  max-width: 100%;
}

.section.dark .inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

.section-header {
  margin-bottom: var(--gap);
}

.milestone {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  color: var(--color-brand);
}

.section.dark .milestone {
  color: var(--color-accent);
}

h1 {
  font-size: var(--text-h1);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
  margin-bottom: 1.5rem;
  color: var(--color-text);
}

.section.dark h1 {
  color: var(--color-paper);
}

h2 {
  font-size: var(--text-h2);
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 1rem;
}

h3 {
  font-size: var(--text-h3);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}

p {
  margin-bottom: 1rem;
  max-width: 38em;
}

/* 关键词高亮 */
.hl {
  color: var(--color-brand);
}

.section.dark .hl {
  color: var(--color-accent);
}

/* 按钮组件 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  height: 48px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.btn-primary:hover {
  background-color: #d65a5f;
  transform: translateY(-1px);
  opacity: 1;
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-text);
}

.section.dark .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.btn-secondary:hover {
  background-color: rgba(32, 21, 35, 0.05);
}

.section.dark .btn-secondary:hover {
  background-color: rgba(246, 243, 247, 0.1);
}

.btn-icon {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

/* 卡片与面板 */
.card {
  background-color: rgba(32, 21, 35, 0.03);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  margin-bottom: var(--gap);
}

.panel {
  background-color: var(--color-dark);
  border-radius: var(--radius-card);
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

/* 表格 */
.table-responsive {
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(32, 21, 35, 0.1);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(32, 21, 35, 0.1);
}

th {
  font-weight: 600;
  background-color: rgba(32, 21, 35, 0.03);
}

tr:last-child th, tr:last-child td {
  border-bottom: none;
}

/* FAQ 折叠面板 */
details {
  border-bottom: 1px solid rgba(32, 21, 35, 0.1);
  padding: 1rem 0;
}

summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.05rem;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--color-brand);
}

details[open] summary::after {
  content: "−";
}

details p {
  margin-top: 0.75rem;
  margin-bottom: 0;
  color: rgba(32, 21, 35, 0.8);
}

/* 步骤徽标 */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background-color: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.9rem;
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.step-list {
  list-style: none;
}

.step-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.step-content {
  flex: 1;
}

/* 焦点样式 */
:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

/* 响应式适配 */
@media (max-width: 1024px) {
  .layout-wrapper {
    flex-direction: column;
  }

  .sidebar-brand {
    width: 100%;
    height: auto;
    position: relative;
    padding: 1rem;
  }

  .sidebar-nav {
    display: none; /* 移动端隐藏侧边栏导航，使用顶部导航 */
  }

  .top-nav {
    display: flex;
  }
}

@media (max-width: 640px) {
  .section {
    padding: var(--section-y) 1rem;
  }
  
  .panel {
    padding: 1rem;
  }
}

/* =========================================
   SVG 动效 (CSS Keyframes)
   ========================================= */

/* 星点明灭 */
@keyframes twinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.9; }
}

.star {
  fill: var(--color-accent);
  animation: twinkle 4s infinite ease-in-out;
}

/* 连线流动 */
@keyframes flow {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}

.connect-line {
  stroke: var(--color-accent);
  stroke-width: 0.5;
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: flow 6s infinite linear;
}

/* 减少动态效果偏好 */
@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;
  }
}
