/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 色板 */
  --color-dark: #271231;
  --color-paper: #F6F3F7;
  --color-body: #1F1523;
  --color-brand: #9E13DD;
  --color-accent: #ED6EC0;

  /* 排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --lh-body: 1.65;
  --lh-heading: 1.25;

  /* 尺寸与间距 */
  --content-max: 1280px;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);

  /* 组件几何 */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 1px solid rgba(31, 21, 35, 0.16);
  --card-shadow: none;
  --header-height: 64px;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--lh-body);
  color: var(--color-body);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: opacity 0.2s ease; }
a:hover { opacity: 0.85; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* --- 容器与网格 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.grid-auto {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}
.flex-row { display: flex; gap: var(--gap); align-items: center; }
.flex-col { display: flex; flex-direction: column; gap: var(--gap); }

/* --- 标题系统 --- */
.section-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  color: var(--color-brand);
}
.surface-dark .section-label { color: var(--color-accent); }
h1 {
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 1rem 0;
  text-wrap: balance;
  overflow-wrap: break-word;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: var(--lh-heading);
  margin: 0 0 1.5rem 0;
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 0.75rem 0;
}
p { margin: 0 0 1rem 0; max-width: 38em; }
.hl { color: var(--color-brand); font-weight: 700; }
.surface-dark .hl { color: var(--color-accent); }

/* --- 表面主题控制 --- */
.surface-paper { background-color: var(--color-paper); color: var(--color-body); }
.surface-dark { background-color: var(--color-dark); color: var(--color-paper); }
.surface-dark a:not(.btn) { color: var(--color-accent); }
.surface-dark .section-label { color: var(--color-accent); }
.surface-dark .hl { color: var(--color-accent); }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  border-radius: var(--radius-btn);
  text-align: center;
}
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { background-color: #d95aad; transform: translateY(-1px); }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--color-body);
  color: var(--color-body);
}
.surface-dark .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}
.surface-dark .btn-secondary:hover { background-color: rgba(246, 243, 247, 0.1); }

/* --- 卡片 --- */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  border-radius: var(--radius-card);
  display: flex;
  flex-direction: column;
}
.surface-dark .card {
  background: rgba(246, 243, 247, 0.06);
  border-color: rgba(246, 243, 247, 0.12);
}

/* --- 表格 --- */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin-top: 1rem;
}
th, td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(31, 21, 35, 0.12);
  text-align: left;
}
th { font-weight: 700; white-space: nowrap; }
td:first-child { font-weight: 600; }
tr:last-child td { border-bottom: none; }
.surface-dark th, .surface-dark td { border-bottom-color: rgba(246, 243, 247, 0.12); }

/* --- FAQ --- */
.faq-item { border-bottom: 1px solid rgba(31, 21, 35, 0.12); }
.surface-dark .faq-item { border-bottom-color: rgba(246, 243, 247, 0.12); }
details summary {
  padding: 1rem 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 2rem;
}
details summary::-webkit-details-marker { display: none; }
details summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}
details[open] summary::after { content: "−"; }
details p { margin: 0.5rem 0 1rem 0; line-height: 1.7; }

/* --- 步骤条 --- */
.step-list { counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--gap); }
.step-item { position: relative; padding-left: 3rem; }
.step-num {
  position: absolute; left: 0; top: 0;
  width: 2rem; height: 2rem;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  display: grid; place-items: center;
  border-radius: var(--radius-card);
}
.step-item h4 { margin: 0.5rem 0 0.25rem 0; font-size: 1.1rem; font-weight: 700; }
.step-item p { margin: 0; font-size: 0.95rem; opacity: 0.9; }

/* --- 分隔条 --- */
.section-divider {
  width: 100%;
  height: 1px;
  background: rgba(31, 21, 35, 0.12);
  border: none;
  margin: var(--section-y) 0;
}
.surface-dark + .surface-paper,
.surface-paper + .surface-dark { margin-top: 0; }

/* --- 页头页脚 --- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(246, 243, 247, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(31, 21, 35, 0.1);
  height: var(--header-height);
}
.surface-dark .site-header { background: rgba(39, 18, 49, 0.95); border-bottom-color: rgba(246, 243, 247, 0.1); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%;
}
.brand { display: flex; align-items: center; gap: 0.75rem; font-weight: 700; font-size: 1.1rem; }
.brand img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; color: var(--color-paper); }
.nav-links a[aria-current="page"] { color: var(--color-accent); font-weight: 700; }
.surface-dark .nav-links a[aria-current="page"] { color: var(--color-accent); }

.site-footer {
  padding: var(--section-y) 0;
  border-top: 1px solid rgba(31, 21, 35, 0.12);
  margin-top: var(--section-y);
}
.footer-inner {
  display: flex; flex-direction: column; gap: 1.5rem;
  align-items: center; text-align: center;
}
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.footer-links a { font-size: 0.9rem; opacity: 0.8; }
.footer-copy { font-size: 0.85rem; opacity: 0.7; margin-top: 0.5rem; }

/* --- 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;
}
/* 描边自绘 */
.anim-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawStroke 5s ease-in-out infinite alternate;
}
/* 呼吸点 */
.anim-breathe { animation: breatheOpacity 3s ease-in-out infinite alternate; }
/* 浮动 */
.anim-float { animation: floatY 6s ease-in-out infinite alternate; }
/* 滑入循环 */
.anim-slide { animation: slideIn 7s ease-in-out infinite alternate; }
/* 旋转中心修正 */
.anim-spin { transform-box: fill-box; transform-origin: center; animation: spinSlow 12s linear infinite alternate; }

@keyframes drawStroke {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes breatheOpacity {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}
@keyframes floatY {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}
@keyframes slideIn {
  0% { transform: translateX(20px); opacity: 0.6; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes spinSlow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}

/* --- 响应式适配 --- */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; height: auto; padding: 0.75rem 0; gap: 0.75rem; }
  .nav-links { gap: 1rem; flex-wrap: wrap; justify-content: center; }
  .flex-row { flex-direction: column; }
  .step-list { grid-template-columns: 1fr; }
  table { font-size: 0.9rem; }
  th, td { padding: 0.6rem 0.75rem; }
}
@media (min-width: 769px) and (max-width: 1024px) {
  .grid-auto { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1025px) {
  .grid-auto { grid-template-columns: repeat(3, 1fr); }
}
/* factory-contrast-width */
@media (min-width: 1440px) {
  [data-fc-1440="ink"] {
    color: #1f1523 !important;
    -webkit-text-fill-color: #1f1523 !important;
  }
}
@media (min-width: 1440px) {
  [data-fc-1440="ink"] {
    color: #1f1523 !important;
    -webkit-text-fill-color: #1f1523 !important;
  }
}
@media (min-width: 1440px) {
  [data-fc-1440="ink"] {
    color: #1f1523 !important;
    -webkit-text-fill-color: #1f1523 !important;
  }
}
@media (min-width: 1440px) {
  [data-fc-1440="ink"] {
    color: #1f1523 !important;
    -webkit-text-fill-color: #1f1523 !important;
  }
}
@media (min-width: 1440px) {
  [data-fc-1440="ink"] {
    color: #1f1523 !important;
    -webkit-text-fill-color: #1f1523 !important;
  }
}
@media (min-width: 1440px) {
  [data-fc-1440="ink"] {
    color: #1f1523 !important;
    -webkit-text-fill-color: #1f1523 !important;
  }
}
@media (min-width: 1440px) {
  [data-fc-1440="ink"] {
    color: #1f1523 !important;
    -webkit-text-fill-color: #1f1523 !important;
  }
}
@media (min-width: 1440px) {
  [data-fc-1440="ink"] {
    color: #1f1523 !important;
    -webkit-text-fill-color: #1f1523 !important;
  }
}
@media (min-width: 1440px) {
  [data-fc-1440="ink"] {
    color: #1f1523 !important;
    -webkit-text-fill-color: #1f1523 !important;
  }
}
