/* =========================================
   SafeW 全站共享样式
   Design Token & Base
   ========================================= */
:root {
  /* 色板 */
  --color-dark: #271334;
  --color-paper: #E9E8EA;
  --color-body: #1D1523;
  --color-brand: #8A13DD;
  --color-accent: #9EED6E;
  
  /* 结构变量 */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: none;
  --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, "Noto Sans SC", sans-serif;
  --line-height-tight: 1.25;
  --line-height-normal: 1.55;
}

*, *::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: var(--line-height-normal);
  color: var(--color-body);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

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-top: var(--section-y);
  padding-bottom: var(--section-y);
}

.section--dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}

.section--paper {
  background-color: var(--color-paper);
  color: var(--color-body);
}

/* 取色覆盖逻辑 */
.section--dark .hl,
.section--dark a:not(.btn) {
  color: var(--color-accent);
}

.section--paper .hl,
.section--paper a:not(.btn) {
  color: var(--color-brand);
}

/* 深色区块内的浅色卡片恢复纸面取色 */
.card--light-in-dark {
  background-color: #34203c;
  color: #f0f0f5;
  border-radius: var(--radius-card);
  padding: var(--gap);
}

.card--light-in-dark h3,
.card--light-in-dark p,
.card--light-in-dark strong {
  color: #ffffff;
}

.card--light-in-dark .hl,
.card--light-in-dark a {
  color: var(--color-accent);
}

/* =========================================
   排版组件
   ========================================= */
.label-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5em;
  opacity: 0.8;
}

.section--dark .label-tag {
  color: var(--color-accent);
}

.section--paper .label-tag {
  color: var(--color-brand);
}

h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 600;
  line-height: var(--line-height-tight);
  letter-spacing: 0;
  margin-bottom: 0.5em;
}

h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 600;
  line-height: var(--line-height-tight);
  margin-bottom: 0.75em;
}

h3 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: var(--line-height-tight);
  margin-bottom: 0.5em;
}

p {
  margin-bottom: 1em;
  max-width: 38em;
}

.hl {
  font-weight: 700;
}

/* =========================================
   按钮
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 48px;
  padding: 0 1.5em;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.btn--primary:hover {
  transform: translateY(-2px);
  filter: brightness(0.95);
}

.btn--secondary {
  background-color: transparent;
  border: 1px solid currentColor;
}

.section--dark .btn--secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.section--paper .btn--secondary {
  color: var(--color-body);
  border-color: var(--color-body);
}

.btn--secondary:hover {
  background-color: rgba(128, 128, 128, 0.1);
  transform: translateY(-2px);
}

/* =========================================
   卡片与面板
   ========================================= */
.card {
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-card);
  padding: var(--gap);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}

.section--paper .card {
  background-color: rgba(0, 0, 0, 0.03);
}

/* =========================================
   表格
   ========================================= */
.table-wrapper {
  overflow-x: auto;
  width: 100%;
  border-radius: var(--radius-card);
  background-color: rgba(255, 255, 255, 0.05);
}

.section--paper .table-wrapper {
  background-color: rgba(0, 0, 0, 0.03);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px;
}

th, td {
  padding: 0.75em 1em;
  text-align: left;
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}

th {
  font-weight: 700;
  white-space: nowrap;
}

tr:last-child th, tr:last-child td {
  border-bottom: none;
}

/* =========================================
   FAQ (<details>)
   ========================================= */
.faq-item {
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
  padding: 1em 0;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::before {
  content: "+";
  display: inline-block;
  width: 1em;
  text-align: center;
  transition: transform 0.2s ease;
}

.faq-item[open] summary::before {
  transform: rotate(45deg);
}

.faq-item p {
  margin-top: 0.5em;
  opacity: 0.9;
}

/* =========================================
   页头与页脚
   ========================================= */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 0.75em 0;
}

.section--dark ~ .header,
.footer {
  background-color: var(--color-dark);
  color: var(--color-paper);
  border: none;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-list {
  display: flex;
  gap: 1.5em;
}

.nav-link {
  font-weight: 500;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.footer {
  padding: 2em 0;
  margin-top: var(--section-y);
}

.footer .container {
  display: flex;
  flex-direction: column;
  gap: 1em;
  align-items: center;
  text-align: center;
}

.footer-nav {
  display: flex;
  gap: 1.5em;
}

/* =========================================
   SVG 动效系统
   ========================================= */
.svg-visual {
  width: 100%;
  height: auto;
  max-width: 100%;
}

.svg-panel {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-card);
  padding: 1em;
  overflow: hidden;
}

.section--paper .svg-panel {
  background-color: rgba(0, 0, 0, 0.05);
}

/* 动画类 */
.anim-float {
  animation: float 6s ease-in-out infinite;
}

.anim-float-delayed {
  animation: float 6s ease-in-out infinite 3s;
}

.anim-pulse {
  animation: pulse 4s ease-in-out infinite;
}

.anim-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 8s ease-in-out infinite;
}

.anim-spin-slow {
  animation: spinSlow 20s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.anim-spin-reverse {
  animation: spinReverse 25s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}

/* Keyframes */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes drawLine {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes spinReverse {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================================
   响应式适配
   ========================================= */
@media (max-width: 768px) {
  .nav-list {
    display: none; /* 简化移动端，实际项目可加汉堡菜单，此处保持静态 */
  }
  
  h1 {
    font-size: clamp(1.8rem, 6vw, 2.5rem);
  }
  
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: center;
}

@media (max-width: 768px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
}

/* 步骤条样式 */
.steps-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  counter-reset: step-counter;
}

.step-card {
  flex: 1 1 200px;
  counter-increment: step-counter;
  position: relative;
  padding-left: 3em;
}

.step-card::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 2em;
  height: 2em;
  background-color: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

/* 标签页导航 (纯 CSS) */
.tabs-nav {
  display: flex;
  gap: 0.5em;
  margin-bottom: 1em;
  overflow-x: auto;
  padding-bottom: 0.5em;
}

.tab-radio {
  display: none;
}

.tab-label {
  padding: 0.5em 1em;
  border-radius: var(--radius-btn);
  background-color: rgba(128, 128, 128, 0.1);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  transition: background-color 0.2s;
}

.tab-label:hover {
  background-color: rgba(128, 128, 128, 0.2);
}

.tab-content {
  display: none;
}

/* 激活状态 */
#tab-1:checked ~ .tabs-nav .tab-label[for="tab-1"],
#tab-2:checked ~ .tabs-nav .tab-label[for="tab-2"],
#tab-3:checked ~ .tabs-nav .tab-label[for="tab-3"],
#tab-4:checked ~ .tabs-nav .tab-label[for="tab-4"] {
  background-color: var(--color-brand);
  color: var(--color-paper);
}

#tab-1:checked ~ .tab-content[for="tab-1"],
#tab-2:checked ~ .tab-content[for="tab-2"],
#tab-3:checked ~ .tab-content[for="tab-3"],
#tab-4:checked ~ .tab-content[for="tab-4"] {
  display: block;
}

/* 非交互设备/降级显示：始终显示所有内容 */
@media (hover: none) and (pointer: coarse) {
  .tab-content {
    display: block;
    margin-bottom: 2em;
    border-top: 1px solid rgba(128, 128, 128, 0.2);
    padding-top: 1em;
  }
  .tabs-nav {
    display: none;
  }
}
