/* =========================================
   SafeW 全站共享样式 (style.css)
   设计系统：紫罗兰深底 + 翠绿强调
   ========================================= */

/* --- 1. 基础变量与重置 --- */
:root {
  /* 色板 */
  --color-dark: #2D1438;
  --color-paper: #F6F3F7;
  --color-text: #1F1523;
  --color-brand: #9E13DD;
  --color-accent: #6EEDA8;

  /* 结构 Token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(31, 21, 35, 0.3);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 960px;

  /* 字体 */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-text);
  background-color: var(--color-paper);
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* --- 2. 页面布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

/* --- 3. 取色变量系统 (Paper vs Dark) --- */
/* 默认纸面环境 */
.paper-surface {
  --bg: var(--color-paper);
  --text: var(--color-text);
  --highlight: var(--color-brand);
  --link: var(--color-brand);
  --border: rgba(31, 21, 35, 0.08);
}

/* 深色面环境 */
.dark-surface {
  --bg: var(--color-dark);
  --text: var(--color-paper);
  --highlight: var(--color-accent);
  --link: var(--color-accent);
  --border: rgba(246, 243, 247, 0.1);
}

/* 深色面内的浅色卡片恢复纸面取色 */
.dark-surface .card {
  --bg: var(--color-paper);
  --text: var(--color-text);
  --highlight: var(--color-brand);
  --link: var(--color-brand);
  --border: rgba(31, 21, 35, 0.08);
}

/* 通用背景应用 */
.bg-layer {
  background-color: var(--bg);
  color: var(--text);
}

/* --- 4. 排版系统 --- */
h1, h2, h3, h4 {
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  margin-bottom: var(--gap);
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-bottom: calc(var(--gap) * 1.5);
  text-wrap: balance;
}

h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  margin-bottom: var(--gap);
  text-wrap: balance;
}

p {
  margin-bottom: var(--gap);
  max-width: 38em;
}

.hl {
  color: var(--highlight);
}

/* 眉标 */
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--highlight);
  margin-bottom: 0.75rem;
}

/* --- 5. 组件：按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--highlight);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--text);
  color: var(--text);
}

.dark-surface .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}

.btn-secondary:hover {
  background-color: rgba(128, 128, 128, 0.1);
  transform: translateY(-2px);
}

/* --- 6. 组件：卡片 --- */
.card {
  background-color: var(--bg);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  border: var(--card-border) solid var(--border);
  padding: var(--gap);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px -12px rgba(31, 21, 35, 0.35);
}

/* --- 7. 组件：表格 --- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 500px;
}

th, td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  background-color: rgba(128, 128, 128, 0.05);
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

/* --- 8. 组件：FAQ (Details/Summary) --- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.faq-item summary {
  padding: 20px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 40px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  transition: background-color 0.2s;
}

.faq-item summary:hover {
  background-color: rgba(128, 128, 128, 0.05);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: var(--highlight);
}

.faq-item[open] summary::after {
  content: "-";
}

.faq-item p {
  padding: 20px;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
  background-color: rgba(128, 128, 128, 0.03);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}

/* --- 9. 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(246, 243, 247, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.dark-surface .site-header {
  background-color: rgba(45, 20, 56, 0.85);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  opacity: 0.8;
  transition: opacity 0.2s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  opacity: 1;
  color: var(--highlight);
}

@media (max-width: 768px) {
  .nav-links { display: none; }
}

.site-footer {
  padding: 48px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.8;
}

/* --- 10. SVG 动效系统 --- */
.svg-anim {
  width: 100%;
  height: auto;
  max-width: 100%;
}

.svg-anim path,
.svg-anim circle,
.svg-anim rect {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

/* 线条自绘 */
@keyframes draw-line {
  0%, 10% { stroke-dashoffset: 1; }
  30%, 70% { stroke-dashoffset: 0; }
  90%, 100% { stroke-dashoffset: 1; }
}

@keyframes fade-float {
  0%, 100% { opacity: 0.6; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-6px); }
}

@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.animate-draw {
  animation: draw-line 6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.animate-float {
  animation: fade-float 5s ease-in-out infinite;
}

.animate-breathe {
  animation: breathe 3s ease-in-out infinite;
}

/* 延迟错开 */
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }

/* 减少动态效果 */
@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;
  }
  .svg-anim path,
  .svg-anim circle,
  .svg-anim rect {
    stroke-dashoffset: 0 !important;
  }
}

/* 旋转中心修正 */
.rotate-center {
  transform-box: fill-box;
  transform-origin: center;
}

/* --- 11. 响应式辅助 --- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

@media (max-width: 768px) {
  .grid-3 { grid-template-columns: 1fr; }
  h1 { font-size: clamp(2.2rem, 8vw, 3.5rem); }
  h2 { font-size: clamp(1.6rem, 5vw, 2.2rem); }
}
