/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 1. 设计变量与基础重置 */
:root {
  /* 色板 */
  --color-dark: #251943;
  --color-paper: #DBD4ED;
  --color-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED6E89;
  --color-body-rgb: 25, 21, 35;

  /* 结构 Token */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 1px solid rgba(var(--color-body-rgb), 0.16);
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;
  --text-line-height: 1.75;
  --title-line-height: 1.15;
  --title-weight: 500;

  /* 上下文取色变量 */
  --ctx-text: var(--color-body);
  --ctx-heading: var(--color-body);
  --ctx-link: var(--color-brand);
  --ctx-subtext: var(--color-body);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: var(--text-line-height);
  color: var(--ctx-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--ctx-link); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.85; }
ul, ol { list-style: none; }

/* 2. 布局容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gap);
  padding-right: var(--gap);
}

.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

.section--dark {
  background-color: var(--color-dark);
  --ctx-text: var(--color-paper);
  --ctx-heading: var(--color-paper);
  --ctx-link: var(--color-accent);
  --ctx-subtext: rgba(219, 212, 237, 0.7);
}

.section--paper {
  background-color: var(--color-paper);
  --ctx-text: var(--color-body);
  --ctx-heading: var(--color-body);
  --ctx-link: var(--color-brand);
  --ctx-subtext: rgba(25, 21, 35, 0.6);
}

/* 卡片与面板 */
.card {
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  background: rgba(255, 255, 255, 0.05);
}

.panel {
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  background: var(--color-dark);
  padding: calc(var(--gap) * 1.5);
  position: relative;
  overflow: hidden;
}

/* 3. 排版 */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.8rem;
  text-transform: uppercase;
}

.section--dark .badge { color: var(--color-accent); }
.section--paper .badge { color: var(--color-brand); }

h1, h2, h3, h4 {
  font-weight: var(--title-weight);
  line-height: var(--title-line-height);
  color: var(--ctx-heading);
  margin-bottom: 1rem;
}

h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.5rem; }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: 0.8rem; }

.text-lg { font-size: clamp(1rem, 1.2vw, 1.125rem); }
.text-muted { color: var(--ctx-subtext); }

.hl { color: var(--ctx-link); font-weight: 600; }

/* 4. 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: 2px solid var(--color-accent);
}
.btn--primary:hover { transform: translateY(-2px); background-color: #e05d78; }

.btn--secondary {
  background: transparent;
  border: 2px solid var(--ctx-text);
  color: var(--ctx-text);
}
.btn--secondary:hover { transform: translateY(-2px); opacity: 0.8; }

/* 5. 表格 */
.data-table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  margin: var(--gap) 0;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
  white-space: normal;
  word-break: break-word;
}
.data-table th { font-weight: 600; color: var(--ctx-heading); }
.data-table td { color: var(--ctx-text); }
.data-table tr:last-child td { border-bottom: none; }

/* 6. FAQ */
.faq-item {
  border: var(--card-border);
  margin-bottom: 12px;
  background: rgba(255,255,255,0.03);
}
.faq-item summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 600;
  color: var(--ctx-heading);
  list-style: none;
  position: relative;
  padding-right: 40px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 400;
  color: var(--ctx-link);
}
.faq-item[open] summary::after { content: "-"; }
.faq-item .faq-content {
  padding: 0 20px 16px 20px;
  color: var(--ctx-text);
  line-height: 1.7;
}

/* 7. 网格与两栏布局 */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: center;
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-2 > *:first-child { order: -1; }
}

/* 8. SVG 动效关键帧 */
@keyframes draw-line {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes float-bubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}
@keyframes slide-panel {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes dash-flow {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

.anim-draw { pathLength: 1; stroke-dasharray: 1; animation: draw-line 3.5s ease-in-out infinite alternate; }
.anim-float { animation: float-bubble 4.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-pulse { animation: pulse-dot 3s ease-in-out infinite; }
.anim-slide { animation: slide-panel 1.8s ease forwards; }
.anim-dash-flow { pathLength: 1; stroke-dasharray: 1; animation: dash-flow 2.5s linear infinite; }

.hero-svg-container svg {
  width: 100%;
  height: auto;
  max-width: 100%;
}

/* 9. 响应式与无障碍 */
@media (max-width: 600px) {
  .container { padding-left: 16px; padding-right: 16px; }
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
  .btn { width: 100%; }
}

@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;
  }
}
