/* SafeW 全站共享样式 */
:root {
  /* 色板 */
  --color-dark: #271231;
  --color-paper: #F5F0E5;
  --color-body: #1F1523;
  --color-brand: #9B12D8;
  --color-accent: #ED6EC0;
  --color-white: #FFFFFF;

  /* 结构 Token */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(31, 21, 35, 0.3);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;

  /* 排版 Token */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --line-height-body: 1.65;
  --line-height-title: 1.15;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--line-height-body);
  color: var(--color-body);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s ease;
}
a:hover { opacity: 0.85; }
a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

img, svg {
  display: block;
  max-width: 100%;
}

/* 布局容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section {
  padding: var(--section-y) 0;
  position: relative;
}
.section + .section::before {
  content: "";
  position: absolute;
  top: 0;
  left: calc(-1 * var(--gap));
  right: calc(-1 * var(--gap));
  height: 1px;
  background: rgba(31, 21, 35, 0.12);
}
.dark-surface + .section::before {
  background: rgba(245, 240, 229, 0.15);
}

/* 颜色上下文 */
.dark-surface {
  background: var(--color-dark);
  color: var(--color-paper);
}
.dark-surface .hl { color: var(--color-accent); }
.dark-surface .btn-primary { background: var(--color-accent); color: var(--color-dark); }
.dark-surface .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.dark-surface a:not(.btn) { color: var(--color-accent); }

.light-card {
  background: var(--color-paper);
  color: var(--color-body);
  box-shadow: var(--card-shadow);
  border: var(--card-border);
  padding: var(--gap);
}
.light-card .hl { color: var(--color-brand); }
.light-card .btn-primary { background: var(--color-brand); color: var(--color-paper); }
.light-card .btn-secondary { border-color: var(--color-body); color: var(--color-body); }

/* 排版 */
h1, h2, h3, h4 {
  font-weight: 500;
  line-height: var(--line-height-title);
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; max-width: 38em; }
mark, .hl { font-weight: 600; }

.meter {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  display: inline-block;
}
.paper-theme .meter { color: var(--color-brand); }
.dark-theme .meter { color: var(--color-accent); }

/* 按钮 */
.btn-group { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 48px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--color-accent); color: var(--color-dark); }
.btn-secondary { background: transparent; }
.btn svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.5; fill: none; }

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(31, 21, 35, 0.1);
}
.light-card .data-table th, .light-card .data-table td {
  border-bottom-color: rgba(31, 21, 35, 0.08);
}
.dark-surface .data-table th, .dark-surface .data-table td {
  border-bottom-color: rgba(245, 240, 229, 0.1);
}
.data-table th { font-weight: 600; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 1rem; }
.faq-item {
  border: 1px solid rgba(31, 21, 35, 0.1);
  background: rgba(255,255,255,0.4);
}
.light-card .faq-item { background: rgba(255,255,255,0.6); }
.dark-surface .faq-item { border-color: rgba(245, 240, 229, 0.15); background: rgba(245, 240, 229, 0.05); }
.faq-item summary {
  padding: 1rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-weight: 400;
  opacity: 0.6;
}
.faq-item[open] summary::after { content: "-"; }
.faq-item p { padding: 0 1rem 1rem; margin: 0; font-size: 0.95rem; line-height: 1.7; }

/* 步骤条 */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--gap);
  counter-reset: step;
}
.step-card {
  position: relative;
  padding: 1.5rem;
  border: 1px solid rgba(31, 21, 35, 0.1);
}
.step-card::before {
  counter-increment: step;
  content: "0" counter(step);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-accent);
  opacity: 0.8;
  line-height: 1;
  margin-bottom: 0.75rem;
  display: block;
}
.step-card h3 { margin-bottom: 0.5rem; }
.step-card p { margin: 0; font-size: 0.95rem; }

/* 新闻卡片 */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}
.news-card {
  border: 1px solid rgba(31, 21, 35, 0.1);
  padding: 1.25rem;
  transition: box-shadow 0.2s ease;
}
.news-card:hover { box-shadow: var(--card-shadow); }
.news-card time {
  font-size: 0.8rem;
  color: rgba(31, 21, 35, 0.6);
  margin-bottom: 0.5rem;
  display: block;
}
.news-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; line-height: 1.3; }
.news-card p { font-size: 0.9rem; margin: 0; }

/* 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 240, 229, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(31, 21, 35, 0.08);
}
.dark-surface .site-header { background: rgba(39, 18, 49, 0.95); border-bottom-color: rgba(245, 240, 229, 0.1); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 0.75rem; font-weight: 700; font-size: 1.1rem; }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.nav-links { display: flex; gap: 1.5rem; list-style: none; }
.nav-links a { font-size: 0.95rem; font-weight: 500; }
.nav-links a[aria-current="page"] { color: var(--color-accent); }
.site-footer {
  padding: 3rem 0;
  border-top: 1px solid rgba(31, 21, 35, 0.1);
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.8;
}

/* SVG 动效基础 */
.hero-svg {
  width: 100%;
  height: auto;
  max-width: 800px;
  margin: 0 auto;
  display: block;
}
.anim-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 6s ease-in-out infinite;
}
.anim-float {
  animation: float-wave 4.5s ease-in-out infinite;
}
.anim-slide {
  animation: slide-gentle 5s ease-in-out infinite;
}
.anim-breathe {
  animation: breathe-opacity 4s ease-in-out infinite;
}

@keyframes draw-line {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}
@keyframes float-wave {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes slide-gentle {
  0%, 100% { opacity: 0.7; transform: translateX(0); }
  50% { opacity: 1; transform: translateX(4px); }
}
@keyframes breathe-opacity {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .anim-draw, .anim-float, .anim-slide, .anim-breathe {
    animation: none !important;
  }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .steps-grid { grid-template-columns: 1fr; }
  .news-grid { grid-template-columns: 1fr; }
}

/* 兜底：裁掉横向溢出 */
#about,
section.section,
#features,
section.dark-surface.section,
#overview,
#toc,
#positioning,
#private-chat {
  overflow-x: clip;
}
