/* SafeW 共享样式 */
:root {
  --color-dark: #271231;
  --color-paper: #F5F0E5;
  --color-text: #1F1523;
  --color-brand: #9B12D8;
  --color-accent: #ED6EC0;
  --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: 960px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--color-paper);
  color: var(--color-text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
section { padding: var(--section-y) 0; }

/* 排版层级 */
h1, h2, h3 { font-weight: 500; line-height: 1.15; letter-spacing: -0.02em; }
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: 1.25rem; margin-bottom: 0.5rem; }
p { margin-bottom: 1rem; max-width: 38em; }
ul, ol { margin-bottom: 1rem; padding-left: 1.5rem; }
li { margin-bottom: 0.5rem; }

/* 表面主题变量覆盖 */
.surface-dark {
  background: var(--color-dark);
  color: var(--color-paper);
  --label-color: var(--color-accent);
  --heading-color: var(--color-paper);
  --body-color: var(--color-paper);
}
.surface-paper {
  background: var(--color-paper);
  color: var(--color-text);
  --label-color: var(--color-brand);
  --heading-color: var(--color-text);
  --body-color: var(--color-text);
}
.surface-light-card {
  background: var(--color-paper);
  color: var(--color-text);
  --label-color: var(--color-brand);
  --heading-color: var(--color-text);
  --body-color: var(--color-text);
}

.surface-dark h1, .surface-dark h2, .surface-dark h3, .surface-dark p, .surface-dark li, .surface-dark strong { color: var(--heading-color); }
.surface-paper h1, .surface-paper h2, .surface-paper h3, .surface-paper p, .surface-paper li, .surface-paper strong { color: var(--heading-color); }

/* 眉标与高亮 */
.eyebrow { display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; color: var(--label-color); margin-bottom: 0.5rem; text-transform: uppercase; }
.highlight { color: var(--label-color); }

/* 导航与页脚 */
header { position: sticky; top: 0; z-index: 100; background: var(--color-paper); border-bottom: 1px solid rgba(31, 21, 35, 0.1); }
.footer { background: var(--color-dark); color: var(--color-paper); padding: var(--section-y) 0; }
.nav-row { display: flex; justify-content: space-between; align-items: center; }
.logo-img { height: 32px; width: auto; vertical-align: middle; }
nav ul { display: flex; gap: 1.5rem; list-style: none; }
nav a { color: var(--body-color); text-decoration: none; font-weight: 500; transition: color 0.2s; }
nav a:hover, nav a[aria-current="page"] { color: var(--label-color); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.875rem 1.75rem; font-size: 1rem; font-weight: 600;
  text-decoration: none; border: 2px solid transparent; cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--color-accent); color: var(--color-dark); }
.btn-secondary { background: transparent; border-color: currentColor; color: var(--body-color); }
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 2px solid var(--label-color); outline-offset: 2px; }

/* 卡片与网格 */
.card {
  background: var(--bg, var(--color-paper));
  border: var(--card-border, 1px solid rgba(0,0,0,0.1));
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: 0 14px 32px -10px rgba(31, 21, 35, 0.4); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }

/* 表格 */
table { width: 100%; border-collapse: collapse; margin-bottom: var(--gap); font-size: 0.95rem; }
th, td { padding: 0.85rem 0.75rem; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.1); }
th { font-weight: 600; }
.surface-dark table th, .surface-dark table td { border-bottom-color: rgba(245, 240, 229, 0.15); }

/* FAQ */
details { border: 1px solid rgba(0,0,0,0.1); margin-bottom: 0.75rem; padding: 1rem; background: var(--bg, var(--color-paper)); }
.summary-wrap { cursor: pointer; font-weight: 600; list-style: none; position: relative; padding-left: 1.5rem; }
.summary-wrap::-webkit-details-marker { display: none; }
.summary-wrap::before { content: "+"; position: absolute; left: 0; color: var(--label-color); font-weight: 700; }
details[open] .summary-wrap::before { content: "-"; }
details[open] .faq-answer { margin-top: 0.75rem; line-height: 1.7; }

/* 步骤徽标 */
.step-list { counter-reset: step; list-style: none; padding: 0; }
.step-list li { counter-increment: step; display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 1.25rem; }
.step-badge {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; width: 2rem; height: 2rem; background: var(--color-accent);
  color: var(--color-dark); font-weight: 700; font-size: 0.9rem;
}

/* SVG 基础 */
svg { width: 100%; height: auto; max-width: 100%; display: block; }
.svg-panel { background: var(--color-dark); padding: var(--gap); }
.surface-paper .svg-panel { background: var(--color-paper); border: 1px solid rgba(0,0,0,0.08); }

/* 动效 Keyframes */
@keyframes float-layer {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes float-subtle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes draw-path {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes pulse-opacity {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
@keyframes slide-in-right {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* 动效类 */
.anim-float-main { animation: float-layer 7s ease-in-out infinite; }
.anim-float-sub { animation: float-subtle 6s ease-in-out infinite 1.5s; }
.anim-draw-line { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw-path 4s linear infinite alternate; }
.anim-pulse { animation: pulse-opacity 3s ease-in-out infinite; }
.anim-slide { animation: slide-in-right 5s ease-in-out infinite alternate; }

/* 子元素旋转/缩放中心 */
.anim-float-main [class*="rot"], .anim-float-sub [class*="rot"] {
  transform-box: fill-box;
  transform-origin: center;
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .flex-row { flex-direction: column; }
  .text-left-mobile { text-align: left; }
}
