/* =========================================
   SafeW 全站共享样式
   ========================================= */

:root {
  /* 色板 */
  --bg-dark: #1B1231;
  --bg-paper: #F4F3F7;
  --text-body: #191523;
  --brand: #5214EB;
  --accent: #9977EE;

  /* 结构 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 2px solid var(--text-body);
  --card-shadow: 4px 4px 0 var(--text-body);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 960px;

  /* 排版 */
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

*, *::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);
  background: var(--bg-paper);
  color: var(--text-body);
  line-height: 1.65;
  font-size: 16px;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.85;
}

a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* 布局容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

section {
  padding: var(--section-y) 0;
  position: relative;
}

section + section {
  border-top: 1px solid rgba(25, 21, 35, 0.12);
}

/* 面色切换变量 */
.paper-section {
  background: var(--bg-paper);
  color: var(--text-body);
}

.dark-section {
  background: var(--bg-dark);
  color: var(--bg-paper);
}

.dark-section a {
  color: var(--accent);
}

.dark-section .hl {
  color: var(--accent);
}

/* 眉标与高亮 */
.subtitle {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.5em;
  display: inline-block;
}

.paper-section .subtitle {
  color: var(--brand);
}

.dark-section .subtitle {
  color: var(--accent);
}

.hl {
  font-weight: 700;
}

.paper-section .hl {
  color: var(--brand);
}

.dark-section .hl {
  color: var(--accent);
}

/* 标题 */
h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
  margin-bottom: var(--gap);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: var(--gap);
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.5em;
}

p {
  margin-bottom: 1em;
  max-width: 38em;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.75em 1.5em;
  border-radius: var(--radius-btn);
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-size: 1rem;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-dark);
}

.btn-primary:hover {
  transform: translateY(-2px);
  background: #8a68df;
}

.btn-secondary {
  background: transparent;
  border: 2px solid var(--text-body);
  color: var(--text-body);
}

.dark-section .btn-secondary {
  border-color: var(--bg-paper);
  color: var(--bg-paper);
}

.btn-secondary:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

.btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* 卡片 */
.card {
  background: var(--bg-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  height: 100%;
}

.card-light {
  background: var(--bg-paper);
  color: var(--text-body);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}

/* 网格与弹性布局 */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

.flex-row {
  display: flex;
  gap: var(--gap);
  align-items: center;
}

.flex-col {
  flex-direction: column;
}

@media (min-width: 768px) {
  .flex-row {
    flex-direction: row;
  }
}

/* 表格 */
.table-wrapper {
  overflow-x: auto;
  margin: 1rem 0;
  border-radius: 12px;
  border: 1px solid rgba(25, 21, 35, 0.12);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-paper);
}

th, td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
  text-align: left;
}

th {
  font-weight: 600;
  background: rgba(25, 21, 35, 0.04);
}

td:first-child {
  font-weight: 600;
  width: 35%;
}

/* FAQ */
details {
  margin-bottom: 1rem;
  border: 1px solid rgba(25, 21, 35, 0.12);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-paper);
}

summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  font-size: 1.4em;
  line-height: 1;
  font-weight: 400;
}

details[open] summary::after {
  content: "-";
}

details p {
  padding: 0 1.25rem 1rem;
  line-height: 1.7;
}

/* SVG 动效基础 */
.svg-panel {
  width: 100%;
  height: auto;
  max-width: 100%;
}

.anim-rotate {
  animation: rotate-slow 12s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.anim-interlock {
  animation: interlock 8s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}

.anim-float {
  animation: float 4s ease-in-out infinite;
}

.anim-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 3s ease-out infinite alternate;
}

.anim-bubble {
  animation: bubble-in 3s ease-in-out infinite alternate;
}

@keyframes rotate-slow {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(180deg); }
}

@keyframes interlock {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  50% { transform: translateX(12px) rotate(90deg); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

@keyframes bubble-in {
  0% { opacity: 0; transform: scale(0.85) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .anim-rotate, .anim-interlock, .anim-float, .anim-draw, .anim-bubble {
    animation: none !important;
  }
}

/* 页头页脚 */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  background: var(--bg-paper);
  padding: 0.75rem 0;
}

.dark-section header {
  background: var(--bg-dark);
  border-color: rgba(244, 243, 247, 0.1);
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text-body);
  display: flex;
  align-items: center;
  gap: 0.5em;
  line-height: 1;
}

.dark-section .logo {
  color: var(--bg-paper);
}

.logo img {
  height: 28px;
  width: auto;
}

nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

nav a {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-body);
  position: relative;
}

.dark-section nav a {
  color: var(--bg-paper);
}

nav a[aria-current="page"] {
  color: var(--brand);
  font-weight: 700;
}

.dark-section nav a[aria-current="page"] {
  color: var(--accent);
}

nav a:not([aria-current="page"]):hover {
  opacity: 0.7;
}

footer {
  background: var(--bg-paper);
  padding: var(--section-y) 0;
  border-top: 1px solid rgba(25, 21, 35, 0.1);
  margin-top: var(--section-y);
}

.dark-section footer {
  background: var(--bg-dark);
  border-color: rgba(244, 243, 247, 0.1);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--gap);
}

.footer-brand {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-links a {
  color: var(--text-body);
  font-size: 0.9rem;
}

.dark-section .footer-links a {
  color: var(--bg-paper);
}

.footer-copy {
  margin-top: 2rem;
  font-size: 0.85rem;
  opacity: 0.7;
  text-align: center;
}
