/* ============================================
   SafeW 全站共享样式
   ============================================ */

/* 设计变量 */
:root {
  --c-dark: #19102D;
  --c-paper: #FCFCFD;
  --c-body: #191523;
  --c-brand: #5214EB;
  --c-accent: #D66EED;
  
  --r-card: 0;
  --r-btn: 0;
  --card-border: 2px solid var(--c-body);
  --card-shadow: 4px 4px 0 var(--c-body);
  
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;
  
  --lh-body: 1.75;
  --lh-h1: 1.1;
  --lh-h2: 1.25;
  --fs-h1: clamp(2.4rem, 6vw, 4.5rem);
  --fs-h2: clamp(1.6rem, 3vw, 2.4rem);
  
  --tx-primary: var(--c-body);
  --tx-secondary: var(--c-body);
  --accent-color: var(--c-brand);
  --btn-bg: var(--c-accent);
  --btn-text: var(--c-dark);
}

/* 主题覆盖 */
.section-dark {
  --tx-primary: var(--c-paper);
  --tx-secondary: var(--c-paper);
  --accent-color: var(--c-accent);
  --btn-bg: var(--c-accent);
  --btn-text: var(--c-dark);
  background-color: var(--c-dark);
  color: var(--tx-primary);
}

.card-light {
  --tx-primary: var(--c-body);
  --tx-secondary: var(--c-body);
  --accent-color: var(--c-brand);
  background-color: var(--c-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}

/* 重置与基础 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: var(--lh-body);
  color: var(--tx-primary);
  background-color: var(--c-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--accent-color); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.85; }
ul, ol { list-style: none; }

/* 布局容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
section {
  padding-block: var(--section-y);
}

/* 排版 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-color);
  margin-bottom: 1rem;
}
.badge::before {
  content: "";
  display: inline-block;
  width: 1.2em;
  height: 2px;
  background: var(--accent-color);
}
h1 {
  font-size: var(--fs-h1);
  font-weight: 800;
  line-height: var(--lh-h1);
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  color: var(--tx-primary);
}
h2 {
  font-size: var(--fs-h2);
  font-weight: 800;
  line-height: var(--lh-h2);
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  color: var(--tx-primary);
}
h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  color: var(--tx-primary);
}
p {
  margin-bottom: 1rem;
  color: var(--tx-secondary);
  max-width: 38em;
}
strong { font-weight: 700; }
.hl { color: var(--accent-color); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  height: 52px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--r-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 2px solid var(--btn-bg);
}
.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(0.95);
}
.btn-secondary {
  background: transparent;
  color: var(--tx-primary);
  border: 2px solid var(--tx-primary);
}
.btn-secondary:hover {
  background: rgba(128,128,128,0.1);
  transform: translateY(-1px);
}
.btn-icon { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; fill: none; }

/* 卡片 */
.card-grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}
.card {
  padding: 2rem;
  border-radius: var(--r-card);
  background: var(--c-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-4px); }

/* 表格 */
.table-wrap { overflow-x: auto; margin-top: 1.5rem; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 1rem;
  border-bottom: 2px solid var(--tx-primary);
  text-align: left;
}
th { font-weight: 700; background: rgba(128,128,128,0.05); }
td { vertical-align: top; }
tr:last-child td { border-bottom: none; }

/* 详情组 (FAQ) */
details {
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  background: var(--c-paper);
  margin-bottom: 1rem;
  border-radius: var(--r-card);
}
summary {
  padding: 1.25rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  font-size: 1.25rem;
  font-weight: 400;
}
details[open] summary::after { content: "−"; }
details p {
  padding: 0 1.5rem 1.5rem;
  margin: 0;
  font-size: 0.95rem;
}

/* 页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252,252,253,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--c-body);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.logo { display: flex; align-items: center; gap: 0.75rem; }
.logo img { height: 32px; width: auto; }
.nav { display: flex; gap: 2rem; align-items: center; }
.nav a {
  font-weight: 600;
  color: var(--tx-primary);
  padding: 0.5rem 0;
  position: relative;
}
.nav a[aria-current="page"] { color: var(--accent-color); }
.nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-color);
  transition: width 0.2s;
}
.nav a:hover::after { width: 100%; }

/* 页脚 */
.site-footer {
  padding: 4rem 0;
  background: var(--c-dark);
  color: var(--c-paper);
  border-top: 2px solid var(--c-body);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
}
.footer-col h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--c-paper);
}
.footer-col a {
  display: block;
  color: var(--c-paper);
  opacity: 0.8;
  margin-bottom: 0.75rem;
}
.footer-col a:hover { opacity: 1; text-decoration: underline; }
.copyright {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 0.85rem;
  opacity: 0.7;
  text-align: center;
}

/* SVG 响应式基类 */
.svg-responsive {
  width: 100%;
  height: auto;
}

/* SVG 动效关键帧 */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes drawPath {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes spinMerge {
  0% { transform: rotate(0deg) scale(0.9); }
  50% { transform: rotate(180deg) scale(1.05); }
  100% { transform: rotate(360deg) scale(0.9); }
}

/* 动效类 */
.anim-float { animation: float 4s ease-in-out infinite; }
.anim-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawPath 6s linear infinite;
}
.anim-breathe { animation: breathe 2.5s ease-in-out infinite; }
.anim-spin {
  transform-box: fill-box;
  transform-origin: center;
  animation: spinMerge 12s ease-in-out infinite;
}

/* 减少动态效果 */
@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;
  }
  .anim-float, .anim-draw, .anim-breathe, .anim-spin {
    animation: none !important;
  }
}

/* 响应式适配 */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; height: auto; padding: 1rem 0; gap: 1rem; }
  .nav { gap: 1rem; flex-wrap: wrap; justify-content: center; }
  .hero-layout { grid-template-columns: 1fr !important; }
  .scenario-layout { grid-template-columns: 1fr !important; }
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
}
