/* =========================================
   SafeW 全站共享样式
   设计变量 · 基础排版 · 组件 · SVG 动效
   ========================================= */

/* --- 设计 Token --- */
:root {
  --color-dark: #121531;
  --color-paper: #E8E9EA;
  --color-text: #151723;
  --color-brand: #142CEB;
  --color-accent: #ED7D6E;
  --color-light: #FFFFFF;

  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;

  --font-main: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --lh-body: 1.75;
  --lh-heading: 1.25;
  --fw-heading: 600;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-main);
  line-height: var(--lh-body);
  color: var(--color-text);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* --- 容器与分节 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
section {
  padding-block: var(--section-y);
  border-bottom: 1px solid rgba(21, 23, 35, 0.1);
}
.bg-dark {
  background: var(--color-dark);
  color: var(--color-paper);
  border-bottom: none;
}
.surface-dark { background: var(--color-dark); color: var(--color-paper); }
.surface-paper { background: var(--color-paper); color: var(--color-text); }

/* --- 颜色作用域控制 --- */
.surface-dark .label, .surface-dark .link-highlight, .surface-dark .hl { color: var(--color-accent); }
.surface-dark .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.surface-paper .label, .surface-paper .link-highlight, .surface-paper .hl { color: var(--color-brand); }

.card-light {
  background: var(--color-paper);
  color: var(--color-text);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
}
.card-light .label, .card-light .hl { color: var(--color-brand); }
.card-light .btn-secondary { border-color: var(--color-text); color: var(--color-text); }

/* --- 排版细节 --- */
.label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.6em;
  display: inline-block;
}
h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: var(--fw-heading);
  line-height: var(--lh-heading);
  letter-spacing: 0;
  margin: 0.4em 0 0.6em;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: var(--fw-heading);
  line-height: var(--lh-heading);
  margin: 0 0 0.8em;
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: var(--fw-heading);
  line-height: var(--lh-heading);
  margin: 1.5em 0 0.5em;
}
p { margin: 0 0 1em; max-width: 38em; }
strong { font-weight: 600; }
.hl { font-weight: 700; }

/* --- 布局网格 --- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: var(--gap); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: var(--gap); }
.flex-row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; }
.text-center { text-align: center; }
.mt-1 { margin-top: 1em; }
.mb-1 { margin-bottom: 1em; }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 52px;
  padding: 0 1.8em;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border: 2px solid var(--color-accent);
}
.btn-primary:hover { transform: translateY(-2px); background: #d96b5c; }
.btn-secondary {
  background: transparent;
  border: 2px solid var(--color-text);
  color: var(--color-text);
}
.btn-secondary:hover { transform: translateY(-2px); background: rgba(21,23,35,0.05); }
.surface-dark .btn-primary { color: var(--color-dark); }
.surface-dark .btn-primary:hover { background: #d96b5c; }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }

/* --- 卡片与面板 --- */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  position: relative;
}
.panel {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: var(--gap);
  overflow: hidden;
}
.surface-dark .panel { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); }

/* --- 表格 --- */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.8em 1em;
  border-bottom: 1px solid rgba(21, 23, 35, 0.15);
  text-align: left;
  vertical-align: top;
}
th { font-weight: 600; }
tr:last-child td { border-bottom: none; }
.surface-dark th, .surface-dark td { border-bottom-color: rgba(232, 233, 234, 0.15); }

/* --- FAQ --- */
details {
  border: 1px solid rgba(21, 23, 35, 0.2);
  border-radius: 16px;
  margin-bottom: 1em;
  padding: 1.2em;
  transition: background 0.2s ease;
}
.surface-dark details { border-color: rgba(232, 233, 234, 0.2); }
summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-left: 1.8em;
}
summary::marker, summary::-webkit-details-marker { display: none; }
summary::before {
  content: "+";
  position: absolute;
  left: 0;
  font-weight: 700;
  color: var(--color-brand);
}
.surface-dark summary::before { color: var(--color-accent); }
details[open] summary::before { content: "-"; }
details p { margin-top: 0.8em; margin-bottom: 0; }

/* --- 步骤徽标 --- */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--color-accent);
  color: var(--color-dark);
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  margin-right: 0.6em;
  flex-shrink: 0;
}

/* --- 导航链接高亮 --- */
.link-highlight { font-weight: 600; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.link-highlight:hover { opacity: 0.85; }

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(232, 233, 234, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(21, 23, 35, 0.1);
}
.surface-dark.site-header { background: rgba(18, 21, 49, 0.95); border-bottom-color: rgba(232, 233, 234, 0.1); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 0.6em; font-weight: 700; font-size: 1.1rem; }
.brand img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 1.5em; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; }
.nav-links a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
.surface-dark .nav-links a[aria-current="page"] { color: var(--color-accent); }
@media (max-width: 768px) {
  .nav-links { gap: 1em; }
  .nav-links .btn { height: 40px; font-size: 0.9rem; padding: 0 1em; }
}
.site-footer {
  padding: var(--section-y) 0;
  border-top: 1px solid rgba(21, 23, 35, 0.1);
  font-size: 0.9rem;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5em;
  align-items: center;
  text-align: center;
}
.footer-links { display: flex; gap: 1.5em; flex-wrap: wrap; justify-content: center; }
.surface-dark .site-footer { border-top-color: rgba(232, 233, 234, 0.1); }

/* --- SVG 动效系统 --- */
.svg-container {
  width: 100%;
  height: auto;
  max-width: 600px;
  margin: 0 auto;
}
svg { width: 100%; height: auto; overflow: visible; }
svg path, svg rect, svg circle, svg polyline, svg line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 浮动层叠 */
@keyframes floatLayerA { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes floatLayerB { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-18px); } }
@keyframes floatLayerC { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.anim-float-a { animation: floatLayerA 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-float-b { animation: floatLayerB 7.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-float-c { animation: floatLayerC 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

/* 描边绘制 */
@keyframes drawStroke { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.anim-draw { stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawStroke 1.8s ease forwards; }

/* 呼吸与滑入 */
@keyframes breathe { 0%, 100% { opacity: 0.5; transform: scale(0.98); } 50% { opacity: 1; transform: scale(1.02); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.anim-breathe { animation: breathe 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-slide-up { animation: slideUp 1.2s ease forwards; }

/* 减少动态效果 */
@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;
  }
}
