/* =========================================
   SafeW 全站共享样式 (Global Styles)
   ========================================= */

/* --- 设计变量 (Design Tokens) --- */
:root {
  /* 色板 (Palette) */
  --color-dark-bg: #13102D;
  --color-paper-bg: #D6D4ED;
  --color-text-main: #171523;
  --color-brand: #2714EB;
  --color-accent: #89ED6E;

  /* 圆角 (Radii) */
  --radius-card: 24px;
  --radius-btn: 999px;
  --radius-sm: 8px;

  /* 阴影 (Shadows) */
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(23, 21, 35, 0.3);
  --shadow-hover: 0 14px 32px -12px rgba(23, 21, 35, 0.4);

  /* 节奏与密度 (Rhythm & Density) */
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --line-height-base: 1.55;
  --content-max: 960px;

  /* 字体 (Typography) */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
}

/* --- 基础重置 (Reset) --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--line-height-base);
  color: var(--color-text-main);
  background-color: var(--color-paper-bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* --- 通用排版 (Typography) --- */
h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  margin-bottom: var(--gap);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: var(--gap);
}

h3 {
  font-size: 1.25rem;
  margin-bottom: var(--gap);
}

p {
  margin-bottom: var(--gap);
  max-width: 38em;
}

.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding-left: var(--gap);
  padding-right: var(--gap);
  overflow-x: hidden;
}

.section-padding {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

/* --- 眉标 (Eyebrow Label) --- */
.eyebrow {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: var(--gap);
  color: var(--color-brand);
}

.dark-mode .eyebrow {
  color: var(--color-accent);
}

.paper-card .eyebrow {
  color: var(--color-brand);
}

/* --- 按钮 (Buttons) --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
}

.btn-primary:hover {
  filter: brightness(1.05);
  box-shadow: 0 4px 12px rgba(137, 237, 110, 0.4);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text-main);
  border: 1px solid var(--color-text-main);
}

.dark-mode .btn-secondary {
  color: var(--color-paper-bg);
  border-color: var(--color-paper-bg);
}

.btn-secondary:hover {
  filter: brightness(0.9);
}

.dark-mode .btn-secondary:hover {
  filter: brightness(1.2);
}

/* --- 卡片与面板 (Cards & Panels) --- */
.card {
  background-color: #fff;
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 24px;
  transition: box-shadow 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.panel {
  background-color: var(--color-dark-bg);
  border-radius: var(--radius-card);
  padding: 32px;
  position: relative;
  overflow: hidden;
}

.paper-card {
  background-color: var(--color-paper-bg);
  border-radius: var(--radius-card);
  padding: 32px;
}

/* --- 表格 (Tables) --- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 400px;
}

th, td {
  text-align: left;
  padding: 16px;
  border-bottom: 1px solid rgba(23, 21, 35, 0.1);
}

.dark-mode th, .dark-mode td {
  border-bottom-color: rgba(214, 212, 237, 0.15);
}

th {
  font-weight: 700;
  color: var(--color-brand);
}

.dark-mode th {
  color: var(--color-accent);
}

tr:last-child td {
  border-bottom: none;
}

/* --- FAQ (Details/Summary) --- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.faq-item summary {
  padding: 16px 20px;
  background-color: #fff;
  border-radius: var(--radius-card);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary:hover {
  background-color: #f0f0f5;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.5rem;
  font-weight: 300;
  transition: transform 0.3s ease;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item p {
  padding: 16px 20px 24px;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-text-main);
}

.dark-mode .faq-item summary {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--color-paper-bg);
}

.dark-mode .faq-item summary:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .faq-item p {
  color: var(--color-paper-bg);
}

/* --- 页头与页脚 (Header & Footer) --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(214, 212, 237, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(23, 21, 35, 0.05);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.2rem;
}

.logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
}

.nav-links a {
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--color-brand);
}

.site-footer {
  background-color: var(--color-dark-bg);
  color: var(--color-paper-bg);
  padding: 64px 0;
  margin-top: var(--section-y);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 32px;
}

.footer-col h4 {
  color: var(--color-accent);
  margin-bottom: 16px;
  font-size: 1rem;
}

.footer-col ul li {
  margin-bottom: 12px;
}

.footer-col a {
  opacity: 0.8;
  transition: opacity 0.2s;
}

.footer-col a:hover {
  opacity: 1;
}

.copyright {
  text-align: center;
  margin-top: 48px;
  font-size: 0.85rem;
  opacity: 0.6;
}

/* --- 响应式布局 (Responsive Layout) --- */
@media (max-width: 768px) {
  .nav-links {
    display: none; /* 简化移动端处理，实际项目中可加汉堡菜单 */
  }
  
  .header-inner .btn {
    display: none;
  }

  .grid-2, .grid-3 {
    grid-template-columns: 1fr !important;
  }

  .alt-row {
    flex-direction: column !important;
  }
  
  .alt-row.reverse {
    flex-direction: column !important;
  }
}

@media (min-width: 769px) {
  .grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--gap);
  }
  
  .grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap);
  }
}

/* =========================================
   SVG 动效 (SVG Animations)
   ========================================= */

/* 呼吸效果 (Breathing) */
@keyframes breathe {
  0%, 100% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.05); opacity: 1; }
}

/* 浮动效果 (Floating) */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* 滑动进入 (Slide In) */
@keyframes slideInUp {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* 描边绘制 (Draw Stroke) */
@keyframes drawStroke {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

/* 闪烁/脉冲 (Pulse) */
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* 动画类应用 */
.anim-breathe {
  animation: breathe 4s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.anim-float {
  animation: float 5s ease-in-out infinite;
}

.anim-slide-in {
  animation: slideInUp 1.5s ease-out forwards;
}

.anim-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawStroke 2s ease forwards;
}

.anim-pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* 延迟控制 */
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }
.delay-4 { animation-delay: 0.8s; }

/* 减少动态效果偏好 */
@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;
  }
}
