/* =========================================
   SafeW 全站共享样式
   ========================================= */
:root {
  /* 色板 */
  --color-dark: #19102D;
  --color-paper: #F4F3F7;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #D66EED;

  /* 结构约束 */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;

  /* 排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --text-base: 1rem;
  --line-height-body: 1.75;
}

/* 基础重置 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--line-height-body);
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* 容器与区块 */
.container {
  width: min(var(--content-max), 100% - 32px);
  margin-inline: auto;
}
.section {
  padding-block: var(--section-y);
  position: relative;
}
.section--dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.section--dark a:not(.btn),
.section--dark [class*="icon"],
.section--dark .hl { color: var(--color-accent); }
.card--light {
  background-color: var(--color-paper);
  color: var(--color-text);
}

/* 排版系统 */
.breadcrumb {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section--dark .breadcrumb { color: var(--color-accent); }
h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  margin-bottom: 1.5rem;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 1.25rem;
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}
p { margin-bottom: 1rem; max-width: 38em; }
.hl { color: var(--color-brand); font-weight: 600; }
.section--dark .hl { color: var(--color-accent); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding-inline: 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn:hover { transform: translateY(-1px); }
.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn--primary:hover { background-color: #c45de0; }
.btn--secondary {
  background: transparent;
  border-color: currentColor;
  color: inherit;
}
.btn--secondary:hover { opacity: 0.85; }

/* 布局网格 */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
@media (max-width: 960px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* 头部与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(244, 243, 247, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding-block: 16px;
}
.section--dark ~ .site-header,
body.has-dark-hero .site-header { background-color: rgba(25, 16, 45, 0.9); border-bottom-color: rgba(255,255,255,0.08); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
}
.logo { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.1rem; }
.logo img { height: 32px; width: auto; }
.nav { display: flex; gap: 24px; }
.nav a { font-size: 0.95rem; font-weight: 500; opacity: 0.85; transition: opacity 0.2s; }
.nav a:hover, .nav a[aria-current="page"] { opacity: 1; }
@media (max-width: 768px) { .nav { display: none; } }

.site-footer {
  padding-block: 64px;
  background-color: var(--color-dark);
  color: var(--color-paper);
  border-top: 1px solid rgba(255,255,255,0.06);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 32px;
}
.footer-nav { display: flex; gap: 24px; }
.footer-copy { font-size: 0.85rem; opacity: 0.7; margin-top: 24px; }

/* 卡片与面板 */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 24px;
  border-radius: var(--radius-card);
  position: relative;
}
.panel {
  background-color: var(--color-dark);
  padding: 24px;
  border-radius: var(--radius-card);
  aspect-ratio: 4 / 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.panel--light { background-color: var(--color-paper); }

/* 表格 */
.table-wrapper { overflow-x: auto; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.08); }
.section--dark th, .section--dark td { border-bottom-color: rgba(255,255,255,0.1); }
th { font-weight: 600; }

/* FAQ */
details {
  margin-bottom: 16px;
  border: 1px solid rgba(0,0,0,0.08);
  padding: 16px;
  border-radius: var(--radius-card);
}
.section--dark details { border-color: rgba(255,255,255,0.1); background-color: rgba(255,255,255,0.03); }
summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
summary::-webkit-details-marker { display: none; }
summary::before { content: ""; display: inline-block; width: 16px; height: 16px; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat center; mask-size: contain; transform: rotate(0deg); transition: transform 0.2s; }
details[open] summary::before { transform: rotate(180deg); }
details p { margin-top: 12px; font-size: 0.95rem; opacity: 0.9; }

/* 步骤条 */
.steps { display: flex; gap: 24px; counter-reset: step; }
.step { flex: 1; position: relative; padding-left: 32px; }
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: 0;
  width: 24px; height: 24px;
  background-color: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-btn);
}
@media (max-width: 768px) { .steps { flex-direction: column; } }

/* 场景卡片 */
.scenario { padding: 24px; border: 1px solid rgba(0,0,0,0.06); background: var(--color-paper); }
.section--dark .scenario { border-color: rgba(255,255,255,0.08); background: rgba(244,243,247,0.05); }
.scenario-tag {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; margin-bottom: 8px; color: var(--color-brand);
}
.section--dark .scenario-tag { color: var(--color-accent); }

/* SVG 动效基础 */
.svg-panel { width: 100%; height: auto; }
.svg-panel path, .svg-panel rect, .svg-panel circle, .svg-panel line {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.draw-stroke {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawPath 5s ease-in-out infinite alternate;
}
.float-element {
  animation: gentleFloat 6s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}
.breathe-element {
  animation: breathe 4s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.flow-line {
  stroke-dasharray: 0.6 0.4;
  animation: dashFlow 3s linear infinite;
}

@keyframes drawPath {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes gentleFloat {
  from { transform: translateY(0); }
  to { transform: translateY(-6px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.03); }
}
@keyframes dashFlow {
  to { stroke-dashoffset: -1; }
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .draw-stroke, .float-element, .breathe-element, .flow-line {
    animation: none !important;
    stroke-dashoffset: 0 !important;
    opacity: 1 !important;
  }
}
