/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  --color-dark: #141838;
  --color-paper: #F7F5F3;
  --color-text: #151723;
  --color-brand: #142CEB;
  --color-accent: #6EAFED;
  
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: none;
  
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;
  
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --line-height-body: 1.55;
}

/* --- 基础重置 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--line-height-body);
  color: var(--color-text);
  background: var(--color-paper);
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; transition: color 0.2s ease; }
ul, ol { list-style: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }

/* --- 布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.section {
  padding-block: var(--section-y);
}

/* --- 颜色主题切换 --- */
.section-paper { background: var(--color-paper); color: var(--color-text); }
.section-dark { background: var(--color-dark); color: var(--color-paper); }
.section-dark a, .section-dark .hl { color: var(--color-accent); }
.section-dark a:hover { opacity: 0.85; }
.section-paper a, .section-paper .hl { color: var(--color-brand); }
.section-paper a:hover { opacity: 0.85; }

/* 深色区内的浅色卡片恢复纸面取色 */
.card-light-on-dark {
  background: var(--color-paper);
  color: var(--color-text);
  border: var(--card-border) solid transparent;
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
}
.card-light-on-dark a, .card-light-on-dark .hl { color: var(--color-brand); }

/* --- 排版 --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.section-paper .badge { color: var(--color-brand); }
.section-dark .badge { color: var(--color-accent); }

h1, h2, h3, h4 { line-height: 1.25; font-weight: 600; letter-spacing: 0; }
h1 { font-size: clamp(2.2rem, 5vw, 4rem); text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); margin-bottom: 0.5rem; }
p { margin-bottom: var(--gap); max-width: 38em; }
.hi { font-weight: 800; }
.hl { font-weight: 800; }

/* --- 组件：按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding-inline: 20px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-secondary {
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
}
.section-dark .btn-secondary { color: var(--color-paper); }
.section-paper .btn-secondary { color: var(--color-text); }
.btn-secondary:hover { background: rgba(128,128,128,0.1); }

/* --- 组件：卡片网格 --- */
.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }

.card {
  background: var(--color-paper);
  color: var(--color-text);
  border: var(--card-border) solid transparent;
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.section-dark .card {
  background: rgba(255,255,255,0.06);
  color: var(--color-paper);
}
.card-icon { width: 28px; height: 28px; flex-shrink: 0; }
.card-icon svg { width: 100%; height: 100%; stroke: currentColor; }
.section-paper .card-icon svg { stroke: var(--color-brand); }
.section-dark .card-icon svg { stroke: var(--color-accent); }

/* --- 组件：表格 --- */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid rgba(128,128,128,0.2); }
th { font-weight: 700; }
td:first-child { font-weight: 600; }

/* --- 组件：FAQ --- */
details { border-bottom: 1px solid rgba(128,128,128,0.2); padding-block: 12px; }
summary { cursor: pointer; font-weight: 600; list-style: none; position: relative; padding-right: 24px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; position: absolute; right: 0; top: 50%; transform: translateY(-50%); font-weight: 400; }
details[open] summary::after { content: "-"; }
details p { margin-top: 8px; font-size: 0.95rem; max-width: 100%; }

/* --- 组件：步骤徽标 --- */
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 6px;
  flex-shrink: 0;
}
.section-paper .step-num { background: var(--color-brand); color: var(--color-paper); }

/* --- SVG 容器与动效 --- */
.svg-wrap { width: 100%; height: auto; display: block; }
.svg-wrap svg { width: 100%; height: auto; }
.anim-path { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
.anim-bubble { transform-box: fill-box; transform-origin: center; }

@keyframes flow-line {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes float-up {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes slide-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

.anim-flow { animation: flow-line 5s linear infinite alternate; }
.anim-breathe { animation: breathe 3s ease-in-out infinite; }
.anim-float { animation: float-up 6s ease-in-out infinite; }
.anim-slide { animation: slide-in 0.8s ease-out forwards; }

/* 减少动态效果偏好 */
@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) {
  .magazine-layout { grid-template-columns: 1fr !important; }
  .scenario-row { flex-direction: column !important; }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
}
/* factory-contrast-width */
@media (min-width: 1440px) {
  [data-fc-1440="paper"] {
    color: #f7f5f3 !important;
    -webkit-text-fill-color: #f7f5f3 !important;
  }
}
@media (max-width: 1439px) {
  [data-fc-1440="paper"] {
    color: #151723 !important;
    -webkit-text-fill-color: #151723 !important;
  }
}
@media (min-width: 1440px) {
  [data-fc-1440="paper"] {
    color: #f7f5f3 !important;
    -webkit-text-fill-color: #f7f5f3 !important;
  }
}
@media (max-width: 1439px) {
  [data-fc-1440="paper"] {
    color: #151723 !important;
    -webkit-text-fill-color: #151723 !important;
  }
}
@media (min-width: 1440px) {
  [data-fc-1440="paper"] {
    color: #f7f5f3 !important;
    -webkit-text-fill-color: #f7f5f3 !important;
  }
}
@media (max-width: 1439px) {
  [data-fc-1440="paper"] {
    color: #151723 !important;
    -webkit-text-fill-color: #151723 !important;
  }
}
@media (min-width: 1440px) {
  [data-fc-1440="paper"] {
    color: #f7f5f3 !important;
    -webkit-text-fill-color: #f7f5f3 !important;
  }
}
@media (max-width: 1439px) {
  [data-fc-1440="paper"] {
    color: #151723 !important;
    -webkit-text-fill-color: #151723 !important;
  }
}
