/* ========================================
   SafeW 全站共享样式
   Design System & Utilities
   ======================================== */

:root {
  /* 色板 */
  --color-dark: #141838;
  --color-paper: #FCFCFD;
  --color-text: #151723;
  --color-brand: #142CEB;
  --color-accent: #6EAFED;

  /* 语义化取色变量 */
  --bg-body: var(--color-paper);
  --bg-surface: var(--color-paper);
  --text-main: var(--color-text);
  --text-muted: #4a5073; /* 辅助文字，同色系加深 */
  --text-link: var(--color-brand);
  --text-highlight: var(--color-brand);
  
  /* 组件颜色 */
  --btn-primary-bg: var(--color-brand);
  --btn-primary-text: var(--color-paper);
  --btn-secondary-border: var(--color-text);
  --btn-secondary-text: var(--color-text);

  /* 圆角 */
  --radius-card: 8px;
  --radius-btn: 6px;
  --radius-sm: 4px;

  /* 卡片边界与阴影 */
  --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);
  --line-height-base: 1.55;
  
  /* 布局 */
  --content-max: 960px;
  --header-height: 64px;
}

/* 深色面覆盖 */
[data-theme="dark"] {
  --bg-body: var(--color-dark);
  --bg-surface: var(--color-dark);
  --text-main: var(--color-paper);
  --text-muted: #a0a5c0;
  --text-link: var(--color-accent);
  --text-highlight: var(--color-accent);
  
  --btn-primary-bg: var(--color-accent);
  --btn-primary-text: var(--color-dark);
  --btn-secondary-border: var(--color-paper);
  --btn-secondary-text: var(--color-paper);
  
  --card-border: 2px solid var(--color-paper);
  --card-shadow: 4px 4px 0 var(--color-paper);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: var(--line-height-base);
  font-size: 16px;
  -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: opacity 0.2s ease;
}
a:hover {
  opacity: 0.8;
}
a:focus-visible {
  outline: 2px solid var(--text-highlight);
  outline-offset: 2px;
  border-radius: 2px;
}

h1, h2, h3, h4 {
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--text-main);
  margin-bottom: var(--gap);
}

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  margin-bottom: 1.5rem;
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-top: var(--section-y);
  margin-bottom: 1.25rem;
}

h3 {
  font-size: clamp(1.3rem, 2vw, 1.6rem);
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: var(--gap);
  max-width: 38em;
}

ul, ol {
  margin-bottom: var(--gap);
  padding-left: 1.5rem;
}
li {
  margin-bottom: 0.5rem;
}

.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* 眉标 */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-highlight);
  margin-bottom: 0.75rem;
}
.eyebrow::before {
  content: "";
  display: block;
  width: 16px;
  height: 2px;
  background-color: currentColor;
}

/* 高亮词 */
.hl {
  color: var(--text-highlight);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 2px solid var(--text-highlight);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border: none;
}
.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-secondary {
  background: transparent;
  color: var(--btn-secondary-text);
  border: 2px solid var(--btn-secondary-border);
}
.btn-secondary:hover {
  transform: translateY(-2px);
  background-color: rgba(128,128,128,0.1);
}

/* 卡片与面板 */
.card {
  background-color: var(--bg-surface);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  margin-bottom: var(--gap);
}

.panel {
  background-color: var(--bg-surface);
  border-radius: 16px;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}
/* 深色面板特殊处理 */
.panel-dark {
  background-color: var(--color-dark);
  border: 1px solid rgba(255,255,255,0.1);
}

/* 表格 */
.table-wrapper {
  overflow-x: auto;
  margin-bottom: var(--gap);
  border: var(--card-border);
  border-radius: var(--radius-card);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--text-muted);
}
th {
  font-weight: 600;
  background-color: rgba(128,128,128,0.05);
}
tr:last-child th, tr:last-child td {
  border-bottom: none;
}

/* FAQ Details */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  background-color: var(--bg-surface);
  box-shadow: 2px 2px 0 var(--text-muted);
}
summary {
  padding: 1rem 1.5rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 2.5rem;
}
summary::-webkit-details-marker {
  display: none;
}
summary::after {
  content: "+";
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: var(--text-highlight);
}
details[open] summary::after {
  content: "-";
}
details > div {
  padding: 0 1.5rem 1.5rem;
  color: var(--text-main);
}

/* 页头 */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-body);
  border-bottom: 1px solid var(--text-muted);
  height: var(--header-height);
  display: flex;
  align-items: center;
}
.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-main);
}
.logo img {
  height: 32px;
  width: auto;
}
.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.nav-links a {
  font-weight: 500;
  font-size: 0.95rem;
}
.nav-links a[aria-current="page"] {
  color: var(--text-highlight);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* 页脚 */
.footer {
  background-color: var(--color-dark);
  color: var(--color-paper);
  padding: 3rem 0;
  margin-top: var(--section-y);
}
.footer .container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
  text-align: center;
}
.footer-nav {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-nav a {
  color: var(--color-accent);
}
.footer-copy {
  font-size: 0.85rem;
  color: #a0a5c0;
}

/* 响应式 */
@media (max-width: 768px) {
  .nav-links {
    display: none; /* 简化版：移动端隐藏导航，实际项目需汉堡菜单 */
  }
  .header .btn {
    display: none;
  }
  h1 {
    font-size: clamp(2rem, 8vw, 3rem);
  }
}

/* SVG 动效 Keyframes */
@keyframes twinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}
@keyframes dash-flow {
  to { stroke-dashoffset: -20; }
}
@keyframes float-bubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes slide-in {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.svg-star {
  animation: twinkle 4s infinite ease-in-out;
}
.svg-star:nth-child(odd) {
  animation-delay: 1s;
}
.svg-line {
  stroke-dasharray: 10;
  animation: dash-flow 2s linear infinite;
}
.svg-bubble {
  animation: float-bubble 6s ease-in-out infinite;
}
.svg-panel {
  animation: slide-in 1s ease-out forwards;
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
