/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量与 Token --- */
:root {
  /* 色板 */
  --color-dark: #21163C;
  --color-paper: #F4F3F7;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED926E;
  
  /* 结构 Token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.3);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;
  
  /* 排版 */
  --font-base: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", sans-serif;
  --lh-tight: 1.25;
  --lh-body: 1.75;
}

/* --- 基础重置与全局 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-base);
  font-size: 16px;
  line-height: var(--lh-body);
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* --- 容器与网格 --- */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.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); }
.flex-center { display: flex; align-items: center; justify-content: center; }

/* --- 面版取色规则 --- */
.face-light { background: var(--color-paper); color: var(--color-text); }
.face-light .hl { color: var(--color-brand); }
.face-light .tag { color: var(--color-brand); }
.face-dark { background: var(--color-dark); color: var(--color-paper); }
.face-dark .hl { color: var(--color-accent); }
.face-dark .tag { color: var(--color-accent); }
.face-dark .card { background: var(--color-paper); color: var(--color-text); }
.face-dark .card .hl { color: var(--color-brand); }
.face-dark .card .tag { color: var(--color-brand); }

/* --- 排版组件 --- */
.tag {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 0.75rem;
}
h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: 0.02em;
  margin-bottom: 1.5rem;
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: var(--lh-tight);
  margin-bottom: 0.75rem;
}
p { margin-bottom: 1rem; max-width: 38em; }
.section-padding { padding-block: var(--section-y); }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: 52px;
  padding-inline: 1.5rem;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s, background 0.2s, color 0.2s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-2px); background: #e08560; }
.btn-secondary {
  background: transparent;
  border-color: currentColor;
  color: inherit;
}
.btn-secondary:hover { transform: translateY(-2px); background: rgba(128,128,128,0.08); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }

/* --- 卡片与面板 --- */
.card {
  background: var(--color-paper);
  border: var(--card-border) solid currentColor;
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  transition: box-shadow 0.2s, transform 0.2s;
}
.card:hover { box-shadow: 0 14px 32px -12px rgba(25, 21, 35, 0.35); transform: translateY(-2px); }
.panel {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

/* --- 表格 --- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 320px;
}
.data-table th, .data-table td {
  padding: 0.8rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(128,128,128,0.2);
}
.data-table th { font-weight: 700; width: 40%; }
.data-table tr:last-child td { border-bottom: none; }

/* --- FAQ (Details/Summary) --- */
.faq-list { display: flex; flex-direction: column; gap: 0.75rem; }
details {
  background: rgba(128,128,128,0.05);
  border-radius: var(--radius-card);
  padding: 1rem 1.25rem;
  transition: background 0.2s;
}
details[open] { background: rgba(128,128,128,0.1); }
summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235214EB' stroke-width='2'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center/contain no-repeat;
  transition: transform 0.2s;
}
details[open] summary::before { transform: rotate(45deg); }
details p { margin-top: 0.75rem; margin-bottom: 0; font-size: 0.95rem; line-height: 1.7; }

/* --- 步骤徽标 --- */
.step-list { counter-reset: step; }
.step-item {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: flex-start;
}
.step-badge {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 800;
  font-size: 0.9rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- 时间轴 --- */
.timeline { position: relative; padding-left: 2rem; border-left: 2px solid rgba(128,128,128,0.2); }
.timeline-item { position: relative; margin-bottom: 2rem; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -2.55rem;
  top: 0.35rem;
  width: 12px;
  height: 12px;
  background: var(--color-accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(237, 146, 110, 0.2);
}
.time-label { font-weight: 700; font-size: 0.9rem; color: var(--color-accent); margin-bottom: 0.25rem; display: block; }

/* --- 页头页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(244, 243, 247, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(128,128,128,0.1);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo-link { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.1rem; }
.logo-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; position: relative; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--color-brand); }
.nav-links a[aria-current="page"]::after {
  content: ""; position: absolute; bottom: -4px; left: 0; width: 100%; height: 2px; background: var(--color-brand);
}
.site-footer {
  background: var(--color-dark);
  color: var(--color-paper);
  padding-block: 3rem;
  font-size: 0.9rem;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; margin-bottom: 2rem; }
.footer-col h4 { font-weight: 700; margin-bottom: 1rem; color: var(--color-accent); }
.footer-col ul li { margin-bottom: 0.5rem; }
.footer-col a:hover { text-decoration: underline; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 1.5rem; text-align: center; opacity: 0.7; }

/* --- SVG 动效 Keyframes --- */
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes breathe { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes drawLine { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes twinkle { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.7; } }

.anim-float { animation: float 4.5s ease-in-out infinite; }
.anim-breathe { animation: breathe 3.2s ease-in-out infinite; }
.anim-slide { animation: slideIn 1.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.anim-draw { stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawLine 3.5s linear infinite; }
.anim-twinkle { animation: twinkle 5s ease-in-out infinite; }

/* 旋转/缩放子元素中心点修正 */
.anim-group { transform-box: fill-box; transform-origin: center; }

/* --- 响应式与无障碍 --- */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .mobile-menu-btn { display: flex; }
  h1 { font-size: clamp(1.8rem, 6vw, 2.8rem); }
  .panel { padding: 1.25rem; }
}

@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;
  }
  .anim-float, .anim-breathe, .anim-slide, .anim-draw, .anim-twinkle {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    stroke-dashoffset: 0 !important;
  }
}
