/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 设计变量与基础重置 --- */
:root {
  /* 色板 */
  --color-dark-bg: #271231;
  --color-paper: #F6F3F7;
  --color-text-body: #1F1523;
  --color-brand: #9E13DD;
  --color-accent: #ED6EC0;
  
  /* 结构 Token */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 1px solid rgba(31, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;
  
  /* 字体与排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lh-tight: 1.25;
  --lh-body: 1.65;
}

*, *::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-body);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
}

body {
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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);
}

.section {
  padding-block: var(--section-y);
  position: relative;
}

.section--dark {
  background-color: var(--color-dark-bg);
  color: var(--color-paper);
}

/* 深色区块内的浅色卡片（恢复纸面取色） */
.section--dark .card {
  background-color: var(--color-paper);
  color: var(--color-text-body);
  border-color: rgba(31, 21, 35, 0.16);
}

/* 文本层级 */
.hl {
  color: var(--color-brand);
}

.section--dark .hl {
  color: var(--color-accent);
}

h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: 0;
  line-height: var(--lh-tight);
}

h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  margin-bottom: var(--gap);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: var(--gap);
}

h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  margin-bottom: calc(var(--gap) * 0.75);
}

p {
  margin-bottom: var(--gap);
  max-width: 38em;
}

/* 眉标 */
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: calc(var(--gap) * 0.5);
  color: var(--color-brand);
}

.section--dark .eyebrow {
  color: var(--color-accent);
}

/* --- 组件：按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 48px;
  padding-inline: 1.5em;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
  border-color: var(--color-accent);
}

.btn--primary:hover {
  background-color: #d65aa8;
  transform: translateY(-2px);
}

.btn--secondary {
  background-color: transparent;
  color: var(--color-text-body);
  border-color: var(--color-text-body);
}

.section--dark .btn--secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.btn--secondary:hover {
  background-color: rgba(31, 21, 35, 0.05);
  transform: translateY(-2px);
}

.section--dark .btn--secondary:hover {
  background-color: rgba(246, 243, 247, 0.1);
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* --- 组件：卡片 --- */
.card {
  background-color: var(--color-paper);
  color: var(--color-text-body);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(31, 21, 35, 0.08);
}

/* --- 网格系统 --- */
.grid {
  display: grid;
  gap: var(--gap);
}

.grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr));
}

.grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

/* --- 表格 --- */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  text-align: left;
  padding: 0.75em 1em;
  border-bottom: 1px solid rgba(31, 21, 35, 0.1);
}

th {
  font-weight: 600;
  background-color: rgba(31, 21, 35, 0.03);
}

.section--dark th {
  background-color: rgba(246, 243, 247, 0.05);
  color: var(--color-paper);
}

/* --- 列表与时间线 --- */
.list-disc li {
  position: relative;
  padding-left: 1.5em;
  margin-bottom: 0.5em;
}

.list-disc li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 6px;
  background-color: var(--color-brand);
}

.section--dark .list-disc li::before {
  background-color: var(--color-accent);
}

.timeline {
  border-left: 2px solid rgba(31, 21, 35, 0.1);
  padding-left: 2em;
}

.section--dark .timeline {
  border-left-color: rgba(246, 243, 247, 0.2);
}

.timeline-item {
  position: relative;
  margin-bottom: var(--gap);
}

.timeline-item::before {
  content: attr(data-step);
  position: absolute;
  left: calc(-2em - 6px);
  top: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
  font-weight: 700;
  font-size: 0.85rem;
  z-index: 1;
}

/* --- FAQ --- */
details {
  border-bottom: 1px solid rgba(31, 21, 35, 0.1);
  padding: 1em 0;
}

.section--dark details {
  border-bottom-color: rgba(246, 243, 247, 0.15);
}

summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 1.05rem;
  position: relative;
  padding-right: 2em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  font-weight: 400;
  opacity: 0.6;
}

details[open] summary::after {
  content: "−";
}

details p {
  margin-top: 0.75em;
  margin-bottom: 0;
  opacity: 0.9;
}

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid rgba(31, 21, 35, 0.08);
  backdrop-filter: blur(8px);
  background-color: rgba(246, 243, 247, 0.9);
}

.section--dark ~ .site-header {
  background-color: rgba(39, 18, 49, 0.95);
  border-bottom-color: rgba(246, 243, 247, 0.1);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo img {
  height: 32px;
  width: auto;
}

.nav {
  display: flex;
  gap: calc(var(--gap) * 1.5);
}

.nav a {
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.nav a:hover, .nav a[aria-current="page"] {
  opacity: 1;
  color: var(--color-brand);
}

.section--dark .nav a {
  color: var(--color-paper);
}

.section--dark .nav a:hover, .section--dark .nav a[aria-current="page"] {
  color: var(--color-accent);
}

.site-footer {
  background-color: var(--color-dark-bg);
  color: var(--color-paper);
  padding-block: var(--section-y);
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
}

.footer-col h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 1em;
  color: var(--color-accent);
}

.footer-col ul li {
  margin-bottom: 0.5em;
}

.footer-col a {
  opacity: 0.7;
  font-size: 0.9rem;
  transition: opacity 0.2s;
}

.footer-col a:hover {
  opacity: 1;
}

/* --- SVG 动效 --- */
.svg-anim {
  width: 100%;
  height: auto;
  max-width: 100%;
}

.float-slow {
  animation: float 6s ease-in-out infinite alternate;
}

.float-medium {
  animation: float 5s ease-in-out infinite alternate-reverse;
}

.float-fast {
  animation: float 4s ease-in-out infinite alternate;
}

@keyframes float {
  0% { transform: translateY(0); }
  100% { transform: translateY(-12px); }
}

/* 减少动态效果偏好 */
@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;
  }
  .float-slow, .float-medium, .float-fast {
    animation: none;
    transform: none;
  }
}

/* --- 响应式微调 --- */
@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
    height: auto;
    padding-block: 0.75em;
  }
  .nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
    padding-top: 0.75em;
    border-top: 1px solid rgba(31, 21, 35, 0.1);
    margin-top: 0.75em;
  }
  .section--hero {
    padding-top: var(--section-y);
  }
}
