/* SafeW 全站共享样式 */

/* 1. 设计变量与重置 */
:root {
  /* 色板 */
  --color-dark: #1B1231;
  --color-paper: #DBD4ED;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;

  /* 结构 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --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: 1120px;
  --body-line-height: 1.55;

  /* 字体 */
  --font-sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", 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: var(--body-line-height);
  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;
}

/* 2. 通用排版与布局 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  position: relative;
}

.section-divider {
  height: 1px;
  background-color: rgba(25, 21, 35, 0.15);
  margin: 0 auto;
  max-width: var(--content-max);
  width: 100%;
}

/* 眉标 */
.eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5em;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}

.eyebrow::before {
  content: "";
  display: block;
  width: 1.5em;
  height: 2px;
  background-color: currentColor;
}

/* 标题 */
h1, h2, h3, h4 {
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-bottom: 1em;
}

h3 {
  font-size: clamp(1.3rem, 2vw, 1.6rem);
  margin-bottom: 0.6em;
}

p {
  margin-bottom: 1em;
  max-width: 38em;
}

.hl {
  color: var(--color-brand);
}

/* 深色面覆盖类 */
.bg-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}

.bg-dark .hl {
  color: var(--color-accent);
}

.bg-dark .eyebrow {
  color: var(--color-accent);
}

.bg-dark p, .bg-dark li {
  color: var(--color-paper);
}

/* 3. 组件：按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: 48px;
  padding: 0 1.5em;
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 1rem;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
  border: none;
}

.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-secondary {
  background: transparent;
  border: 2px solid currentColor;
  color: inherit;
}

.bg-dark .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  background-color: rgba(255, 255, 255, 0.05);
}

.bg-dark .btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

/* 4. 组件：卡片 */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.bg-dark .card {
  background-color: var(--color-dark);
  border-color: var(--color-accent);
  box-shadow: 4px 4px 0 var(--color-accent);
  color: var(--color-paper);
}

/* 5. 组件：表格 */
.table-wrapper {
  overflow-x: auto;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 400px;
}

th, td {
  text-align: left;
  padding: 0.8em 1em;
  border-bottom: 1px solid rgba(25, 21, 35, 0.15);
}

th {
  font-weight: 700;
  background-color: rgba(25, 21, 35, 0.05);
}

.bg-dark th {
  background-color: rgba(255, 255, 255, 0.05);
}

tr:last-child td {
  border-bottom: none;
}

/* 6. 组件：FAQ (Details/Summary) */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  background-color: var(--color-paper);
  overflow: hidden;
}

details[open] summary {
  margin-bottom: 0.5em;
}

summary {
  padding: 1em 1.5em;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s;
}

summary::-webkit-details-marker {
  display: none;
}

summary:hover {
  background-color: rgba(25, 21, 35, 0.03);
}

summary::after {
  content: "+";
  font-size: 1.2em;
  font-weight: 400;
  transition: transform 0.2s;
}

details[open] summary::after {
  transform: rotate(45deg);
}

details > div {
  padding: 0 1.5em 1.5em;
  line-height: var(--body-line-height);
}

.bg-dark details {
  background-color: var(--color-dark);
  border-color: var(--color-accent);
}

.bg-dark summary:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* 7. 页头与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  padding: 0.8em 0;
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-weight: 800;
  font-size: 1.2rem;
}

.logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 1.5em;
  align-items: center;
}

.nav-links a {
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--color-brand);
}

.bg-dark .nav-links a {
  color: var(--color-paper);
}

.bg-dark .nav-links a:hover,
.bg-dark .nav-links a[aria-current="page"] {
  color: var(--color-accent);
}

.site-footer {
  background-color: var(--color-dark);
  color: var(--color-paper);
  padding: 3em 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1em;
}

.footer-links {
  display: flex;
  gap: 1.5em;
}

.footer-links a {
  font-size: 0.9rem;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.footer-links a:hover {
  opacity: 1;
  color: var(--color-accent);
}

/* 8. SVG 动效 Keyframes */
@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

@keyframes floatBubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.star {
  animation: twinkle 4s infinite ease-in-out;
}

.line {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 6s infinite linear;
}

.bubble {
  animation: floatBubble 5s infinite ease-in-out;
}

/* 9. 响应式与无障碍 */
@media (max-width: 768px) {
  .nav-links {
    display: none; /* 简化移动端，实际项目可加汉堡菜单，此处保持纯静态简洁 */
  }
  
  h1 {
    font-size: clamp(2rem, 8vw, 3rem);
  }
  
  .grid-3 {
    grid-template-columns: 1fr !important;
  }
}

@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;
  }
}

/* 兜底：裁掉横向溢出 */
div {
  overflow-x: clip;
}
