/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计变量与色板 */
:root {
  --color-dark: #19102D;
  --color-paper: #FCFCFD;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #D66EED;
  
  /* 结构 Token */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --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", sans-serif;
}

/* 容器与基础重置 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* 布局工具 */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
.section-divider { border-bottom: 1px solid var(--color-text); opacity: 0.15; margin: 0 calc(var(--gap) * -1); width: calc(100% + var(--gap) * 2); max-width: none; }
.bg-dark {
  background-color: var(--color-dark);
  --c-text: var(--color-paper);
  --c-highlight: var(--color-accent);
  --c-link: var(--color-accent);
}
.bg-paper {
  background-color: var(--color-paper);
  --c-text: var(--color-text);
  --c-highlight: var(--color-brand);
  --c-link: var(--color-brand);
}
.card-light {
  background-color: var(--color-paper);
  --c-text: var(--color-text);
  --c-highlight: var(--color-brand);
  --c-link: var(--color-brand);
}
.text-main { color: var(--c-text); }
.text-highlight { color: var(--c-highlight); }
.text-link { color: var(--c-link); }

/* 排版系统 */
h1, h2, h3, h4 { font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); margin-bottom: 1.5rem; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.5rem; }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: 1rem; }
p { margin-bottom: 1rem; max-width: 38em; }
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  color: var(--c-highlight);
}
.hl { font-weight: 700; color: var(--c-highlight); }

/* 页头与导航 */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding: 1rem 0;
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.nav-list { display: flex; gap: 2rem; align-items: center; }
.nav-item { font-weight: 600; font-size: 0.95rem; }
.nav-item[aria-current="page"] { color: var(--color-brand); border-bottom: 2px solid var(--color-brand); }
.header-actions { display: flex; gap: 1rem; align-items: center; }
.logo-img { height: 32px; width: auto; object-fit: contain; }

/* 按钮系统 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.75rem;
  padding: 0.875rem 1.5rem;
  font-weight: 700; font-size: 1rem; line-height: 1.5;
  border: none; cursor: pointer;
  border-radius: var(--radius-btn);
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-2px); background-color: #c95be4; }
.btn-secondary {
  background: transparent;
  border: 2px solid var(--c-text);
  color: var(--c-text);
}
.btn-secondary:hover { background-color: var(--c-text); color: var(--color-paper); }
.btn:focus-visible { outline: 3px solid var(--color-brand); outline-offset: 2px; }
.btn svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; fill: none; }

/* 卡片与网格 */
.card {
  border: var(--card-border);
  background-color: var(--color-paper);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  border-radius: var(--radius-card);
}
.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); }

/* 表格 */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
th, td { padding: 0.875rem 1rem; border-bottom: 1px solid var(--c-text); text-align: left; vertical-align: top; }
th { font-weight: 700; white-space: nowrap; }
td { max-width: 400px; }

/* FAQ (details/summary) */
.faq-item { border: var(--card-border); margin-bottom: 1rem; background-color: var(--color-paper); }
.faq-item summary {
  padding: 1rem; cursor: pointer; font-weight: 700; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
  color: var(--c-text);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.5rem; font-weight: 400; }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { padding: 0 1rem 1rem; line-height: 1.75; color: var(--c-text); }

/* SVG 响应式与动效 */
.svg-responsive { width: 100%; height: auto; display: block; }
.anim-float { animation: floatAnim 6s ease-in-out infinite; }
.anim-breathe { animation: breatheAnim 4s ease-in-out infinite; }
.anim-breathe-delay { animation: breatheAnim 4s ease-in-out infinite 2s; }
.anim-slide-in { animation: slideInAnim 1.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.anim-draw { stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawPathAnim 5s linear infinite alternate; }
.anim-twinkle { animation: twinkleAnim 5s ease-in-out infinite; }
.anim-twinkle-fast { animation: twinkleAnim 3.5s ease-in-out infinite 1s; }
.transform-box-fill { transform-box: fill-box; transform-origin: center; }

@keyframes floatAnim { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes breatheAnim { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
@keyframes slideInAnim { 0% { transform: translateX(24px); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
@keyframes drawPathAnim { 0% { stroke-dashoffset: 1; } 100% { stroke-dashoffset: 0; } }
@keyframes twinkleAnim { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.9; } }

/* 减少动态效果 */
@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;
  }
}

/* 移动端适配微调 */
@media (max-width: 768px) {
  .nav-list { gap: 1rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero-layout { flex-direction: column-reverse !important; }
}

/* 兜底：裁掉横向溢出 */
section.bg-paper,
#features,
div.grid-2,
main {
  overflow-x: clip;
}
