/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 配色 */
  --color-dark: #231334;
  --color-paper: #F5F3F7;
  --color-text: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;
  --color-white: #FFFFFF;

  /* 圆角 */
  --radius-card: 20px;
  --radius-btn: 12px;

  /* 卡片边界 */
  --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-body: 1.55;

  /* 内容最大宽度 */
  --content-max: 1280px;

  /* 字体 */
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

/* --- 基础重置 --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: var(--line-height-body);
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* --- 表面层变量继承 --- */
.surface-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
  --text-color: var(--color-paper);
  --brand-color: var(--color-accent);
  --accent-color: var(--color-accent);
  --link-color: var(--color-accent);
}

.surface-paper {
  background-color: var(--color-paper);
  color: var(--color-text);
  --text-color: var(--color-text);
  --brand-color: var(--color-brand);
  --accent-color: var(--color-accent);
  --link-color: var(--color-brand);
}

/* 卡片在深色面上恢复纸面取色逻辑 */
.surface-dark .card-light {
  background-color: var(--color-paper);
  color: var(--color-text);
  --text-color: var(--color-text);
  --brand-color: var(--color-brand);
  --accent-color: var(--color-accent);
  --link-color: var(--color-brand);
}

/* --- 布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.section {
  padding-block: var(--section-y);
}

/* --- 排版 --- */
h1, h2, h3, h4 {
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
}

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;
}

.text-hl {
  color: var(--brand-color);
}

.surface-dark .text-hl {
  color: var(--accent-color);
}

.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--brand-color);
  margin-bottom: 0.5em;
  text-transform: uppercase;
}

.surface-dark .badge {
  color: var(--accent-color);
}

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  height: 52px;
  padding-inline: 1.5em;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease, background-color 0.2s ease;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--accent-color);
  color: var(--color-dark);
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-color);
  border: 2px solid var(--text-color);
}

.surface-dark .btn-secondary {
  color: var(--paper);
  border-color: var(--paper);
}

.btn:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
}

.btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* --- 卡片 --- */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
}

/* --- 表格 --- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: var(--gap);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 400px;
}

th, td {
  padding: 0.75em 1em;
  text-align: left;
  border-bottom: 1px solid rgba(125, 20, 235, 0.15);
}

th {
  font-weight: 600;
  background-color: rgba(125, 20, 235, 0.05);
}

tr:last-child th, tr:last-child td {
  border-bottom: none;
}

/* --- FAQ (<details>) --- */
.faq-item {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  background-color: var(--color-paper);
}

.faq-item summary {
  padding: 1em 1.5em;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 2.5em;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 1.5em;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2em;
  color: var(--brand-color);
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item p {
  padding: 0 1.5em 1em;
  margin-bottom: 0;
  color: var(--text-color);
}

/* --- 页头页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(245, 243, 247, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(28, 21, 35, 0.08);
  padding-block: 0.75em;
}

.surface-dark .site-header {
  background-color: rgba(35, 19, 52, 0.9);
  border-bottom-color: rgba(245, 243, 247, 0.1);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-weight: 700;
  font-size: 1.1rem;
}

.logo img {
  width: 32px;
  height: 32px;
}

.nav-list {
  display: flex;
  gap: 1.5em;
}

.nav-link {
  font-weight: 500;
  padding: 0.5em 0;
  position: relative;
}

.nav-link[aria-current="page"] {
  color: var(--brand-color);
  font-weight: 700;
}

.surface-dark .nav-link[aria-current="page"] {
  color: var(--accent-color);
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--brand-color);
  transition: width 0.2s ease;
}

.surface-dark .nav-link::after {
  background-color: var(--accent-color);
}

.nav-link:hover::after {
  width: 100%;
}

.site-footer {
  margin-top: auto;
  padding-block: 2em;
  border-top: 1px solid rgba(125, 20, 235, 0.1);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1em;
}

.footer-links {
  display: flex;
  gap: 1.5em;
}

/* --- SVG 动效 --- */
.hero-svg {
  width: 100%;
  height: auto;
  max-width: 600px;
}

.anim-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 6s ease-in-out infinite;
}

.anim-float {
  animation: float 5s ease-in-out infinite;
}

.anim-breathe {
  animation: breathe 3s ease-in-out infinite;
}

.anim-slide {
  animation: slide-in 4.5s ease-in-out infinite;
}

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.8s; }
.delay-3 { animation-delay: 1.4s; }

@keyframes draw-line {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

@keyframes slide-in {
  0%, 100% { transform: translateY(8px); opacity: 0.7; }
  50% { transform: translateY(0); opacity: 1; }
}

/* 旋转元素居中修正 */
.anim-spin, .anim-pulse {
  transform-box: fill-box;
  transform-origin: center;
}

/* --- 响应式 --- */
@media (max-width: 768px) {
  .nav-list { display: none; }
  h1 { font-size: clamp(1.8rem, 6vw, 2.8rem); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .anim-draw, .anim-float, .anim-breathe, .anim-slide {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* 兜底：裁掉横向溢出 */
div.download-grid {
  overflow-x: clip;
}
