/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 1. 设计变量与基础重置 */
:root {
  /* 配色体系 */
  --color-dark: #251943;
  --color-paper: #DBD4ED;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED6E89;

  /* 结构 Token */
  --radius-card: 0;
  --radius-btn: 0;
  --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;

  /* 排版 Token */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lh-body: 1.55;
  --lh-heading: 1.15;
  --fw-heading: 500;
  --fs-h1: clamp(2.6rem, 6.4vw, 5rem);
  --fs-h2: clamp(1.6rem, 3vw, 2.4rem);
  --fs-body: 16px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-main);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--color-text);
  background-color: var(--color-paper);
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

svg {
  width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* 2. 布局容器 */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.surface-dark {
  --bg-surface: var(--color-dark);
  --text-surface: var(--color-paper);
  --accent-surface: var(--color-accent);
  background-color: var(--bg-surface);
  color: var(--text-surface);
}

.surface-paper {
  --bg-surface: var(--color-paper);
  --text-surface: var(--color-text);
  --accent-surface: var(--color-brand);
  background-color: var(--bg-surface);
  color: var(--text-surface);
}

.section {
  padding-block: var(--section-y);
}

/* 3. 页头与导航 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(219, 212, 237, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  transition: background-color 0.3s ease;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
}

.logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.nav-links {
  display: flex;
  gap: 24px;
  font-size: 0.95rem;
  font-weight: 500;
}

.nav-links a {
  position: relative;
  padding-block: 4px;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--color-brand);
}

.nav-links a[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--color-brand);
}

/* 4. 按钮系统 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding-inline: 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.btn-primary:hover {
  transform: translateY(-1px);
  background-color: #d95a75;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--color-text);
  color: var(--color-text);
}

.surface-dark .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}

.btn-secondary:hover {
  background-color: rgba(25, 21, 35, 0.05);
}

.surface-dark .btn-secondary:hover {
  background-color: rgba(219, 212, 237, 0.08);
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-icon {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

/* 5. 排版组件 */
.breadcrumb {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: block;
}

.surface-paper .breadcrumb { color: var(--color-brand); }
.surface-dark .breadcrumb { color: var(--color-accent); }

.section-title {
  font-size: var(--fs-h2);
  font-weight: var(--fw-heading);
  line-height: var(--lh-heading);
  margin-bottom: 24px;
  color: inherit;
}

.section-title .hl {
  color: var(--color-brand);
}

.surface-dark .section-title .hl {
  color: var(--color-accent);
}

.intro-lead {
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 60ch;
  margin-bottom: 24px;
  opacity: 0.9;
}

/* 6. 表格系统 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin-top: 16px;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

.surface-dark .data-table th,
.surface-dark .data-table td {
  border-bottom-color: rgba(219, 212, 237, 0.15);
}

.data-table th {
  font-weight: 600;
  background-color: rgba(25, 21, 35, 0.03);
}

.surface-dark .data-table th {
  background-color: rgba(219, 212, 237, 0.05);
}

/* 7. 卡片与网格 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}

.content-card {
  background-color: #fff;
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.surface-dark .content-card {
  background-color: rgba(219, 212, 237, 0.05);
  box-shadow: none;
  border: 1px solid rgba(219, 212, 237, 0.1);
}

.content-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px -12px rgba(25, 21, 35, 0.35);
}

.card-meta {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 8px;
  opacity: 0.7;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.3;
}

.card-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  opacity: 0.85;
}

/* 8. 步骤与列表 */
.step-list {
  counter-reset: step;
  display: grid;
  gap: 24px;
}

.step-item {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 16px;
  align-items: start;
}

.step-badge {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 1.1rem;
}

.step-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.step-content p {
  font-size: 0.95rem;
  opacity: 0.85;
}

.feature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  margin-bottom: 64px;
  overflow-x: hidden;
}

.feature-row:last-child { margin-bottom: 0; }
.feature-row.reverse .feature-text { order: 2; }
.feature-row.reverse .feature-visual { order: 1; }

.feature-text h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.feature-text ul {
  padding-left: 20px;
  list-style-type: disc;
}

.feature-text li {
  margin-bottom: 8px;
  line-height: 1.6;
}

.feature-visual {
  background-color: rgba(25, 21, 35, 0.03);
  border: 1px solid rgba(25, 21, 35, 0.08);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.surface-dark .feature-visual {
  background-color: rgba(219, 212, 237, 0.05);
  border-color: rgba(219, 212, 237, 0.1);
}

/* 9. FAQ 组件 */
.faq-list {
  display: grid;
  gap: 16px;
}

.faq-item {
  border: 1px solid rgba(25, 21, 35, 0.1);
  padding: 20px;
  background-color: #fff;
}

.surface-dark .faq-item {
  background-color: transparent;
  border-color: rgba(219, 212, 237, 0.15);
}

.faq-item summary {
  font-weight: 600;
  cursor: pointer;
  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-size: 1.2rem;
  font-weight: 400;
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-answer {
  margin-top: 12px;
  font-size: 0.95rem;
  line-height: 1.7;
  opacity: 0.9;
  padding-top: 12px;
  border-top: 1px dashed rgba(25, 21, 35, 0.1);
}

.surface-dark .faq-answer {
  border-top-color: rgba(219, 212, 237, 0.1);
}

.faq-item:focus-within {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* 10. SVG 动效 Keyframes */
@keyframes drawLine {
  0% { stroke-dashoffset: 1; opacity: 0; }
  15% { opacity: 1; }
  25% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}

@keyframes breatheStroke {
  0%, 100% { stroke-dashoffset: 0; opacity: 1; }
  50% { stroke-dashoffset: 0.02; opacity: 0.85; }
}

@keyframes floatSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes slideInRight {
  0% { transform: translateX(20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

.anim-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 4s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate, breatheStroke 6s ease-in-out infinite;
}

.anim-float {
  animation: floatSoft 5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.anim-slide {
  animation: slideInRight 3s cubic-bezier(0.2, 0, 0.2, 1) infinite alternate;
}

.anim-pulse {
  animation: pulseDot 2s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

/* 11. 响应式与无障碍 */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .feature-row { grid-template-columns: 1fr; gap: 24px; }
  .feature-row.reverse .feature-text { order: 0; }
  .feature-row.reverse .feature-visual { order: 0; }
  .step-item { grid-template-columns: 40px 1fr; }
  .step-badge { width: 40px; height: 40px; font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation-delay: 0ms !important;
  }
  .anim-draw, .anim-float, .anim-slide, .anim-pulse {
    animation: none !important;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
