/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 配色体系 */
  --color-dark: #231334;
  --color-paper: #E9E8EA;
  --color-body: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;

  /* 文本取色（跟随所在面） */
  --text-primary: var(--color-body);
  --text-secondary: rgba(28, 21, 35, 0.65);
  --text-link: var(--color-brand);
  --text-highlight: var(--color-brand);

  /* 结构 Token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --line-height-base: 1.65;
  --transition-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-main);
  line-height: var(--line-height-base);
  color: var(--text-primary);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--text-link); text-decoration: none; transition: color var(--transition-smooth); }
a:hover { color: var(--color-brand); }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* --- 布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-block: var(--section-y);
  position: relative;
}
.section--dark {
  background-color: var(--color-dark);
  color: #F0F0F2;
}
.section--dark .eyebrow { color: var(--color-accent); }
.section--dark .text-highlight { color: var(--color-accent); }
.section--dark a:not(.btn) { color: var(--color-accent); }
.section--dark a:not(.btn):hover { color: #FFF; }

/* --- 组件：按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 28px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
  cursor: pointer;
  border: none;
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), background-color var(--transition-smooth);
  white-space: nowrap;
}
.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);
}
.btn--primary:hover { background-color: #F5E099; }
.btn--secondary {
  background: transparent;
  border: 1.5px solid var(--text-primary);
  color: var(--text-primary);
}
.section--dark .btn--secondary {
  border-color: #F0F0F2;
  color: #F0F0F2;
}
.section--dark .btn--secondary:hover {
  border-color: #FFF;
  color: #FFF;
}

/* --- 组件：卡片 --- */
.card {
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-card);
  padding: var(--gap);
  transition: background var(--transition-smooth);
}
.section--paper .card { background: rgba(0, 0, 0, 0.03); }
.card:hover { background: rgba(255, 255, 255, 0.1); }
.section--paper .card:hover { background: rgba(0, 0, 0, 0.05); }

/* --- 组件：表格 --- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-card);
  background: rgba(0, 0, 0, 0.04);
}
.section--dark .table-wrap { background: rgba(255, 255, 255, 0.05); }
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th, td {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}
th { font-weight: 700; letter-spacing: 0.02em; }
td:first-child { font-weight: 600; }

/* --- 组件：FAQ --- */
.faq-item {
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
  padding: 16px 0;
}
.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform var(--transition-smooth);
}
.faq-item[open] summary::before { transform: rotate(45deg); }
.faq-item p { margin-top: 12px; color: var(--text-secondary); line-height: 1.7; }
.section--dark .faq-item p { color: rgba(240, 240, 242, 0.75); }

/* --- 排版辅助 --- */
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: 0.75rem;
}
.text-highlight { color: var(--text-highlight); }
.h1-hero {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
.h2-section {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 1.5rem;
  letter-spacing: 0.02em;
}
.h3-sub {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  margin-top: 1.25rem;
}
.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; }
.icon { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.5; fill: none; flex-shrink: 0; }
.max-w-prose { max-width: 38em; }

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(233, 232, 234, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-smooth), background var(--transition-smooth);
}
.section--dark ~ .site-header, .site-header.is-scrolled { border-bottom-color: rgba(128,128,128,0.3); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: inherit; }
.logo img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 24px; 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; }
.site-footer {
  padding: 48px 0;
  border-top: 1px solid rgba(128, 128, 128, 0.2);
  margin-top: 48px;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
}
.footer-col h4 { font-weight: 700; margin-bottom: 12px; }
.footer-col a { display: block; padding: 4px 0; font-size: 0.9rem; color: var(--text-secondary); }
.footer-col a:hover { color: var(--text-primary); }
.copyright { text-align: center; margin-top: 32px; font-size: 0.85rem; color: var(--text-secondary); }

/* --- SVG 动效 Keyframes --- */
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}
@keyframes breathe {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.anim-float-slow { animation: floatY 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-float-fast { animation: floatY 4.5s ease-in-out infinite reverse; transform-box: fill-box; transform-origin: center; }
.anim-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: drawLine 1.8s ease forwards; }
.anim-breathe { animation: breathe 3.5s ease-in-out infinite; }

/* --- 响应式与无障碍 --- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hero-layout { flex-direction: column; }
  .step-row { flex-direction: column; }
  .comparison-table th:nth-child(n+3), .comparison-table td:nth-child(n+3) { display: none; }
}
@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-slow, .anim-float-fast, .anim-draw, .anim-breathe { animation: none !important; }
}
