/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* === 设计 Token === */
:root {
  /* 色板 */
  --color-dark-bg: #231334;
  --color-paper: #F5F3F7;
  --color-text: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;
  --color-dark-text: #F5F3F7;

  /* 结构变量 */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;

  /* 排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --line-height-base: 1.75;
}

/* === 基础重置与全局 === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background-color: var(--color-paper);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: opacity 0.2s ease; }
ul, ol { list-style: none; }

/* === 布局容器 === */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}
.bg-dark {
  background-color: var(--color-dark-bg);
  color: var(--color-dark-text);
}
.bg-paper { background-color: var(--color-paper); color: var(--color-text); }

/* === 排版系统 === */
.kicker {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.paper .kicker { color: var(--color-brand); }
.dark .kicker { color: var(--color-accent); }

h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 0.75em;
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-top: 0; }
h3 { font-size: 1.25rem; margin-top: 1.5rem; }
p { margin-bottom: 1em; max-width: 38em; }
.hl { font-weight: 800; }
.paper .hl { color: var(--color-brand); }
.dark .hl { color: var(--color-accent); }

/* === 组件：按钮 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0 1.5em;
  height: 52px;
  min-width: 160px;
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  border: none;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
}
.btn-secondary {
  background: transparent;
  border: 2px solid currentColor;
}
.paper .btn-secondary { color: var(--color-text); border-color: var(--color-text); }
.dark .btn-secondary { color: var(--color-dark-text); border-color: var(--color-dark-text); }
.btn-secondary:hover { opacity: 0.85; }

/* === 组件：卡片 === */
.card {
  background: rgba(0, 0, 0, 0.03);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  transition: background 0.3s ease;
}
.dark .card { background: rgba(255, 255, 255, 0.06); }
.card:hover { background: rgba(0, 0, 0, 0.06); }
.dark .card:hover { background: rgba(255, 255, 255, 0.1); }

/* === 组件：表格 === */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-card); }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}
.dark th, .dark td { border-bottom-color: rgba(255,255,255,0.15); }
th { font-weight: 700; }
tr:last-child td { border-bottom: none; }

/* === 组件：FAQ === */
details {
  margin-bottom: 1rem;
  border-radius: var(--radius-card);
  background: rgba(0,0,0,0.03);
  padding: 1.25rem;
  transition: background 0.2s;
}
.dark details { background: rgba(255,255,255,0.05); }
details:hover { background: rgba(0,0,0,0.05); }
.dark details:hover { background: rgba(255,255,255,0.08); }
summary {
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 2rem;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  transition: transform 0.2s;
}
details[open] summary::after { content: "-"; transform: translateY(-50%) rotate(90deg); }
details p { margin-top: 1rem; margin-bottom: 0; font-size: 0.95rem; opacity: 0.9; }

/* === 组件：时间线 === */
.timeline { counter-reset: step; }
.timeline-item {
  position: relative;
  padding-left: 3.5rem;
  margin-bottom: 2.5rem;
}
.timeline-item::before {
  counter-increment: step;
  content: "0" counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: var(--color-dark-bg);
  font-weight: 800;
  border-radius: 10px;
  font-size: 0.9rem;
}
.dark .timeline-item::before { background: var(--color-accent); color: var(--color-dark-bg); }

/* === 页头与页脚 === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 243, 247, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding: 1rem 0;
}
.dark .site-header { background: rgba(35, 19, 52, 0.9); border-bottom-color: rgba(255,255,255,0.1); }
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.logo img { height: 32px; width: auto; }
nav { display: flex; gap: 1.5rem; align-items: center; }
nav a { font-weight: 600; font-size: 0.95rem; position: relative; }
nav a:hover { opacity: 0.7; }
nav a[aria-current="page"] { color: var(--color-brand); }
.dark nav a[aria-current="page"] { color: var(--color-accent); }

.site-footer {
  padding: 4rem 0 2rem;
  border-top: 1px solid rgba(0,0,0,0.1);
  margin-top: 2rem;
}
.dark .site-footer { border-top-color: rgba(255,255,255,0.1); }
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
  margin-bottom: 3rem;
}
.footer-col h4 { font-size: 1rem; margin-bottom: 1rem; }
.footer-col a { display: block; margin-bottom: 0.6rem; font-size: 0.9rem; opacity: 0.8; }
.footer-col a:hover { opacity: 1; }
.copyright { text-align: center; font-size: 0.85rem; opacity: 0.6; padding-top: 2rem; border-top: 1px solid rgba(0,0,0,0.05); }
.dark .copyright { border-top-color: rgba(255,255,255,0.08); }

/* === SVG 动效类 === */
.svg-interface { width: 100%; height: auto; max-width: 100%; }
.draw-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.float-slow { animation: floatSlow 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.float-fast { animation: floatFast 4.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.breathe { animation: breathe 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.slide-in { animation: slideIn 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) both; transform-box: fill-box; transform-origin: center; }
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }

@keyframes floatSlow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes floatFast {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes slideIn {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.draw-path.animate { animation: drawLine 2.5s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

/* === 响应式 === */
@media (max-width: 768px) {
  .two-col { grid-template-columns: 1fr !important; }
  .grid-3 { grid-template-columns: 1fr !important; }
  h1 { font-size: clamp(2rem, 8vw, 3.2rem); }
  .header-inner { flex-wrap: wrap; gap: 1rem; }
  nav { order: 3; width: 100%; justify-content: space-between; padding-top: 1rem; border-top: 1px solid rgba(0,0,0,0.1); margin-top: 0.5rem; }
  .dark nav { border-top-color: rgba(255,255,255,0.1); }
}
@media (min-width: 769px) {
  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: center; }
  .grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
}

/* === 减少动态效果 === */
@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;
  }
  .draw-path.animate { animation: none; stroke-dashoffset: 0; }
}
