/* ========================================
   SafeW 全局样式与设计变量
   ======================================== */
:root {
  /* 色板 */
  --color-dark: #141838;
  --color-paper: #FCFCFD;
  --color-paper-light: #F3F4F6;
  --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: 960px;

  /* 排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lh-tight: 1.1;
  --lh-body: 1.55;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--lh-body);
  color: var(--color-text);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* ========================================
   背景分层
   ======================================== */
.bg-dark {
  background: var(--color-dark);
  color: var(--color-paper);
}
.bg-dark .hl {
  color: var(--color-accent);
}
.bg-dark a:not(.btn) {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.bg-dark .card-light {
  background: var(--color-paper);
  color: var(--color-text);
  border-color: var(--color-text);
  box-shadow: var(--card-shadow);
}

.bg-paper-light {
  background: var(--color-paper-light);
}

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
  margin-bottom: var(--gap);
  text-wrap: balance;
}

.section-subtitle {
  font-size: clamp(0.8rem, 1.2vw, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  display: inline-block;
}
.bg-paper .section-subtitle { color: var(--color-brand); }
.bg-dark .section-subtitle { color: var(--color-accent); }

.h1-hero {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin-bottom: var(--gap);
}

p {
  margin-bottom: 1em;
  max-width: 38em;
}

h3 {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: var(--lh-tight);
  margin: 1.5em 0 0.5em;
}

/* ========================================
   页头与导航
   ======================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252, 252, 253, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(21, 23, 35, 0.08);
}
.bg-dark .site-header {
  background: rgba(20, 24, 56, 0.95);
  border-bottom-color: rgba(252, 252, 253, 0.1);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.brand img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.main-nav {
  display: flex;
  gap: var(--gap);
}
.main-nav a {
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-btn);
  transition: background 0.2s;
}
.main-nav a:hover, .main-nav a[aria-current="page"] {
  background: rgba(20, 44, 235, 0.08);
  color: var(--color-brand);
}
.bg-dark .main-nav a:hover, .bg-dark .main-nav a[aria-current="page"] {
  background: rgba(110, 175, 237, 0.15);
  color: var(--color-accent);
}

/* 横向标签式功能导航 */
.section-nav {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem 0;
  scrollbar-width: none;
}
.section-nav::-webkit-scrollbar { display: none; }
.section-nav a {
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  border: 1px solid currentColor;
  opacity: 0.7;
  transition: all 0.2s;
}
.section-nav a:hover, .section-nav a:focus-visible {
  opacity: 1;
  background: currentColor;
  color: var(--color-paper);
}
.bg-dark .section-nav a {
  border-color: rgba(252, 252, 253, 0.3);
}
.bg-dark .section-nav a:hover, .bg-dark .section-nav a:focus-visible {
  background: var(--color-accent);
  color: var(--color-dark);
}

/* ========================================
   按钮组件
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 1.25rem;
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
}
.btn:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(0.95);
}
.btn-secondary {
  background: transparent;
  border: 2px solid var(--color-text);
  color: var(--color-text);
}
.bg-dark .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}
.btn-secondary:hover {
  transform: translateY(-1px);
  background: rgba(21, 23, 35, 0.05);
}
.btn-sm {
  height: 40px;
  padding: 0 1rem;
  font-size: 0.9rem;
}

/* ========================================
   卡片与面板
   ======================================== */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  margin-bottom: var(--gap);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

/* ========================================
   表格
   ======================================== */
.table-wrap {
  overflow-x: auto;
  border: var(--card-border);
  border-radius: var(--radius-card);
  background: var(--color-paper);
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th, td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(21, 23, 35, 0.1);
}
th {
  font-weight: 700;
  background: rgba(20, 44, 235, 0.04);
}
td:first-child { font-weight: 600; }

/* ========================================
   FAQ (Details/Summary)
   ======================================== */
.faq-list details {
  border-bottom: 1px solid rgba(21, 23, 35, 0.1);
  padding: 1rem 0;
}
.faq-list summary {
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: "+";
  font-weight: 400;
  font-size: 1.2rem;
  transition: transform 0.2s;
}
.faq-list details[open] summary::after {
  transform: rotate(45deg);
}
.faq-list p {
  margin-top: 0.75rem;
  font-size: 0.95rem;
  opacity: 0.9;
}

/* ========================================
   SVG 动效系统
   ======================================== */
.svg-container {
  width: 100%;
  height: auto;
  max-width: 100%;
}
svg {
  width: 100%;
  height: auto;
}

/* 同心轨道呼吸 */
@keyframes orbit-breathe {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.06); opacity: 0.7; }
}
.anim-orbit {
  animation: orbit-breathe 6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.anim-orbit.delay-1 { animation-delay: -2s; }
.anim-orbit.delay-2 { animation-delay: -4s; }

/* 描边绘制 */
@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.anim-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* 消息浮动 */
@keyframes float-bubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.anim-float {
  animation: float-bubble 5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

/* 输入指示呼吸 */
@keyframes pulse-dot {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
.anim-pulse {
  animation: pulse-dot 2.5s ease-in-out infinite;
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   响应式适配
   ======================================== */
@media (max-width: 768px) {
  .hero-grid {
    grid-template-columns: 1fr !important;
  }
  .split-row {
    grid-template-columns: 1fr !important;
  }
  .split-row.reverse {
    order: 1;
  }
  .main-nav { display: none; }
  .h1-hero { font-size: clamp(2rem, 8vw, 3rem); }
}
