/* SafeW 全站共享样式 */
:root {
  /* 色板 */
  --color-dark: #141838;
  --color-paper: #F7F5F3;
  --color-body: #151723;
  --color-brand: #142CEB;
  --color-accent: #6EAFED;

  /* 结构性约束 */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;

  /* 字号与排版 */
  --text-h1: clamp(2rem, 4.6vw, 3.4rem);
  --text-h2: clamp(1.6rem, 3vw, 2.4rem);
  --text-base: 16px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--color-body);
  background-color: var(--color-paper);
  overflow-x: hidden;
}

/* 容器与布局 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

section {
  padding: var(--section-y) 0;
  position: relative;
}

.dark-surface {
  background-color: var(--color-dark);
  color: var(--color-paper);
}

.dark-surface a:not(.btn) {
  color: var(--color-accent);
  text-decoration-color: var(--color-accent);
}

.dark-surface .eyebrow {
  color: var(--color-accent);
}

.dark-surface .hl {
  color: var(--color-accent);
}

/* 分隔线 */
.section-divider {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  margin: 0 calc(var(--gap) * -1);
}

.dark-surface .section-divider {
  border-top-color: rgba(255, 255, 255, 0.08);
}

/* 排版组件 */
h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
  margin-top: 0;
  text-wrap: balance;
}

h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); margin-bottom: var(--gap); }
h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }

p {
  margin: 0 0 1em;
  max-width: 38em;
}

a {
  color: var(--color-brand);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity 0.2s;
}

a:hover { opacity: 0.85; }

.hl {
  color: var(--color-brand);
  font-weight: 600;
}

.eyebrow {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--color-brand);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

/* 按钮系统 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1.25rem;
  height: 48px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease, background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border: none;
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn-secondary {
  background: transparent;
  color: var(--color-body);
  border: 1px solid var(--color-body);
}

.dark-surface .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.btn-secondary:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

/* 卡片与面板 */
.card {
  background: rgba(255, 255, 255, 0.6);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease;
}

.dark-surface .card {
  background: rgba(255, 255, 255, 0.05);
}

.card:hover {
  transform: translateY(-2px);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
  overflow-wrap: anywhere;
  max-width: 100%;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
  overflow-wrap: anywhere;
  max-width: 100%;
}

.flex-row {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

@media (min-width: 768px) {
  .flex-row { flex-direction: row; align-items: center; }
  .flex-row.reverse { flex-direction: row-reverse; }
}

/* 表格 */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
}

th, td {
  padding: 0.75rem 0;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.dark-surface th, .dark-surface td {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

th { font-weight: 600; }

/* FAQ */
details {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-card);
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: rgba(255, 255, 255, 0.4);
  transition: background 0.2s;
}

.dark-surface details {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

summary::-webkit-details-marker { display: none; }

summary::after {
  content: "+";
  font-weight: 400;
  font-size: 1.2rem;
  margin-left: 0.5rem;
}

details[open] summary::after { content: "−"; }

details p {
  margin-top: 0.75rem;
  color: inherit;
  line-height: 1.6;
}

/* 页头与导航 */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 245, 243, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.dark-surface header {
  background: rgba(20, 24, 56, 0.95);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.nav-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: inherit;
  text-decoration: none;
}

.logo img {
  height: 32px;
  width: auto;
}

nav ul {
  display: flex;
  gap: var(--gap);
  list-style: none;
  margin: 0;
  padding: 0;
}

nav a {
  color: inherit;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

nav a:hover { opacity: 0.8; }

nav a[aria-current="page"] {
  color: var(--color-brand);
  font-weight: 700;
}

.dark-surface nav a[aria-current="page"] {
  color: var(--color-accent);
}

/* 页脚 */
footer {
  padding: var(--section-y) 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.9rem;
}

.dark-surface footer {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.footer-col h4 {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  opacity: 0.8;
}

.footer-col ul {
  list-style: none;
  padding: 0;
}

.footer-col li { margin-bottom: 0.5rem; }
.footer-col a { color: inherit; text-decoration: none; }
.footer-col a:hover { text-decoration: underline; }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  opacity: 0.7;
}

/* SVG 基础与动效 */
svg {
  overflow: visible;
  shape-rendering: geometricPrecision;
}

.svg-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  vertical-align: middle;
}

.svg-hero {
  width: 100%;
  height: auto;
  max-width: 640px;
  margin: 0 auto;
  display: block;
}

/* 路径绘制动画 */
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

/* 星点明灭 */
@keyframes pulseDot {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

/* 柔和漂浮 */
@keyframes floatSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.anim-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: drawLine 3s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

.anim-pulse {
  animation: pulseDot 4s ease-in-out infinite;
}

.anim-float {
  animation: floatSoft 5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

/* 减少动态效果偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* 响应式辅助 */
.max-w-prose { max-width: 38em; }
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.overflow-wrap-anywhere { overflow-wrap: anywhere; }

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
