/* SafeW 全站共享样式 */
:root {
  /* 色板 */
  --color-dark: #141838;
  --color-paper: #FCFCFD;
  --color-text: #151723;
  --color-brand: #142CEB;
  --color-accent: #6EAFED;

  /* 圆角与边界 */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);

  /* 节奏与密度 */
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;
  --line-height-body: 1.55;

  /* 字体栈 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  margin: 0;
  font-family: var(--font-sans);
  line-height: var(--line-height-body);
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; height: auto; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* 容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

/* 区块基底 */
.section { padding-block: var(--section-y); position: relative; }
.section--dark { background-color: var(--color-dark); color: var(--color-paper); }
.section--paper { background-color: var(--color-paper); color: var(--color-text); }
.section__title {
  margin-bottom: var(--gap);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.section__subtitle {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}
.section--paper .section__subtitle { color: var(--color-brand); }
.section--dark .section__subtitle { color: var(--color-accent); }

/* 标题层级 */
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); font-weight: 500; line-height: 1.15; margin: 0.5em 0; text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 500; line-height: 1.25; margin-top: 0; margin-bottom: 1.5rem; }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; margin-top: 0; margin-bottom: 0.75rem; }
p { margin: 0 0 1rem; max-width: 38em; }
.hl { font-weight: 600; }
.section--paper .hl { color: var(--color-brand); }
.section--dark .hl { color: var(--color-accent); }

/* 页头与导航 */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  backdrop-filter: blur(8px);
}
.site-header.is-scrolled { border-bottom-color: rgba(0,0,0,0.15); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand img { height: 32px; width: auto; }
.nav { display: flex; gap: 1.5rem; align-items: center; }
.nav a { font-size: 0.95rem; font-weight: 500; padding: 0.5rem 0; position: relative; }
.nav a:hover, .nav a:focus-visible { color: var(--color-brand); }
.nav a[aria-current="page"] { color: var(--color-brand); }
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: var(--color-brand);
}
.mobile-toggle { display: none; background: none; border: none; cursor: pointer; padding: 0.5rem; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  height: 48px; padding: 0 1.5rem;
  border-radius: var(--radius-btn);
  font-weight: 600; font-size: 1rem;
  cursor: pointer; border: none;
  transition: transform 0.2s ease, background-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(-1px); background-color: #5a9bd6; }
.btn--primary:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn--secondary {
  background: transparent; border: 2px solid var(--color-text); color: var(--color-text);
}
.section--dark .btn--secondary { border-color: var(--color-paper); color: var(--color-paper); }
.btn--secondary:hover { transform: translateY(-1px); background-color: rgba(0,0,0,0.05); }
.section--dark .btn--secondary:hover { background-color: rgba(255,255,255,0.08); }

/* 卡片 */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  height: 100%;
}
.section--dark .card { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.2); box-shadow: 4px 4px 0 rgba(0,0,0,0.3); }

/* 网格与布局 */
.grid { display: grid; gap: var(--gap); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.flex-row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; }
.flex-col { display: flex; flex-direction: column; gap: var(--gap); }

/* 特性导航（无 JS 降级为锚点跳转） */
.feature-nav { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.feature-nav a { padding: 0.5rem 1rem; border-radius: var(--radius-btn); border: 1px solid currentColor; opacity: 0.7; transition: opacity 0.2s; }
.feature-nav a:hover { opacity: 1; }
.feature-section { scroll-margin-top: 80px; }

/* 杂志长文排版 */
.magazine-layout { display: grid; grid-template-columns: 220px 1fr; gap: 2rem; }
.magazine-toc { position: sticky; top: 80px; align-self: start; }
.magazine-toc a { display: block; padding: 0.5rem 0; font-size: 0.9rem; opacity: 0.7; border-left: 2px solid transparent; }
.magazine-toc a:hover, .magazine-toc a.active { opacity: 1; border-left-color: var(--color-brand); }
.magazine-content { min-width: 0; }

/* 时间线 */
.timeline { counter-reset: step; }
.timeline li { position: relative; padding-left: 3rem; margin-bottom: 2rem; }
.timeline li::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: 0;
  width: 2rem; height: 2rem;
  background: var(--color-accent); color: var(--color-dark);
  border-radius: 4px; font-weight: 700; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
}

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.data-table th, .data-table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.1); }
.section--dark .data-table th, .section--dark .data-table td { border-bottom-color: rgba(255,255,255,0.15); }
.data-table th { font-weight: 600; width: 40%; }

/* FAQ */
.faq details { margin-bottom: 1rem; border: 1px solid rgba(0,0,0,0.1); border-radius: var(--radius-card); overflow: hidden; }
.section--dark .faq details { border-color: rgba(255,255,255,0.15); }
.faq summary {
  padding: 1rem; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-weight: 300; font-size: 1.2rem; }
.faq details[open] summary::after { content: "−"; }
.faq .answer { padding: 0 1rem 1rem; font-size: 0.95rem; line-height: 1.6; }

/* SVG 动效基础 */
.svg-container { width: 100%; max-width: 100%; }
.svg-animated svg { width: 100%; height: auto; }
.anim-float { animation: float 6s ease-in-out infinite; }
.anim-float-delay { animation: float 6s ease-in-out infinite 2s; }
.anim-breathe { animation: breathe 4s ease-in-out infinite; }
.anim-slide-in { animation: slideIn 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.anim-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawLine 5s ease-in-out infinite alternate; }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes breathe { 0%, 100% { opacity: 0.3; } 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; } }

/* 响应式适配 */
@media (max-width: 768px) {
  .nav { display: none; }
  .mobile-toggle { display: block; }
  .magazine-layout { grid-template-columns: 1fr; }
  .magazine-toc { position: static; display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 0.5rem; }
  .hero-grid { grid-template-columns: 1fr; }
  .scenario-grid { grid-template-columns: 1fr; }
}

@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;
  }
}
