/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 0. 设计 Token 与全局变量 --- */
:root {
  /* 色板 */
  --color-dark-bg: #21163C;
  --color-paper: #E9E8EA;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED926E;
  
  /* 圆角 */
  --radius-card: 20px;
  --radius-btn: 12px;

  /* 卡片边界与阴影 */
  --card-border: 1px solid rgba(25, 21, 35, 0.16);
  --card-shadow: none;

  /* 节奏与密度 */
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);

  /* 内容最大宽度 */
  --content-max: 1120px;
}

/* --- 1. 基础排版与重置 --- */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--color-paper);
  color: var(--color-text);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-top: 0;
  margin-bottom: 0;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-bottom: var(--gap);
}

h3 {
  font-size: clamp(1.3rem, 2vw, 1.6rem);
  margin-bottom: calc(var(--gap) / 2);
}

p {
  margin-top: 0;
  margin-bottom: var(--gap);
}

a {
  color: inherit;
  text-decoration: none;
}

img, svg {
  display: block;
  max-width: 100%;
}

ul, ol {
  padding-left: 0;
  list-style: none;
}

/* --- 2. 布局容器 --- */
.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--paper {
  background-color: var(--color-paper);
  color: var(--color-text);
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

/* 取色覆盖逻辑 */
.section--dark .hl {
  color: var(--color-accent);
}
.section--dark a:not(.btn) {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.section--paper .hl {
  color: var(--color-brand);
}
.section--paper a:not(.btn) {
  color: var(--color-brand);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* 眉标 */
.label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: calc(var(--gap) / 2);
  text-transform: uppercase;
}
.section--dark .label {
  color: var(--color-accent);
}
.section--paper .label {
  color: var(--color-brand);
}

/* --- 3. 组件：按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  text-align: center;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
  border: none;
}

.btn--secondary {
  background-color: transparent;
  border: 1px solid var(--color-text);
  color: var(--color-text);
}

.section--dark .btn--secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}

.btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* --- 4. 组件：卡片 --- */
.card {
  background-color: #fff; /* 默认浅色背景 */
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  box-shadow: var(--card-shadow);
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* 深色面上的卡片需恢复纸面取色 */
.section--dark .card {
  background-color: var(--color-paper);
  color: var(--color-text);
  border-color: rgba(25, 21, 35, 0.1);
}
.section--dark .card .label {
  color: var(--color-brand);
}
.section--dark .card a {
  color: var(--color-brand);
}

/* --- 5. 组件：表格 --- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: var(--card-border);
  border-radius: var(--radius-card);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 400px;
}

th, td {
  padding: 16px 24px;
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: 700;
  background-color: rgba(82, 20, 235, 0.05);
  width: 35%;
}

td {
  border-top: 1px solid rgba(25, 21, 35, 0.08);
}

tr:last-child td {
  border-bottom: none;
}

/* --- 6. 组件：FAQ --- */
.faq-item {
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

.faq-item summary {
  padding: 20px 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 1.1rem;
  list-style: none;
  position: relative;
  padding-right: 32px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--color-brand);
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item p {
  margin-top: 0;
  margin-bottom: 24px;
  color: rgba(25, 21, 35, 0.8);
}

/* --- 7. 页头与页脚 --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(233, 232, 234, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
  padding: 16px 0;
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.logo img {
  height: 32px;
  width: auto;
}

.nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.nav a {
  font-weight: 500;
  font-size: 0.95rem;
  padding: 8px 0;
  position: relative;
}

.nav a:hover, .nav a[aria-current="page"] {
  color: var(--color-brand);
}

.footer {
  background-color: var(--color-dark-bg);
  color: var(--color-paper);
  padding: 64px 0 32px;
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}

.footer__col h4 {
  font-size: 1rem;
  margin-bottom: 20px;
  color: var(--color-accent);
}

.footer__col ul li {
  margin-bottom: 12px;
}

.footer__col ul li a {
  color: rgba(233, 232, 234, 0.7);
  font-size: 0.9rem;
}

.footer__col ul li a:hover {
  color: var(--color-paper);
}

.footer__bottom {
  border-top: 1px solid rgba(233, 232, 234, 0.1);
  padding-top: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: rgba(233, 232, 234, 0.5);
}

/* --- 8. SVG 动效 Keyframes --- */
/* 星点明灭 */
@keyframes star-blink {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.8; }
}

/* 连线流动 */
@keyframes line-flow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

/* 气泡浮动 */
@keyframes bubble-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* 输入点呼吸 */
@keyframes dot-breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* 动效类应用 */
.anim-star {
  animation: star-blink 4s infinite ease-in-out;
}
.anim-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: line-flow 3s infinite linear;
}
.anim-bubble {
  animation: bubble-float 5s infinite ease-in-out;
}
.anim-dot {
  animation: dot-breathe 2s infinite ease-in-out;
}
.delay-1 { animation-delay: 0.5s; }
.delay-2 { animation-delay: 1s; }
.delay-3 { animation-delay: 1.5s; }

/* 减少动态效果偏好 */
@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;
  }
}

/* --- 9. 响应式调整 --- */
@media (max-width: 768px) {
  body, html {
    overflow-x: hidden;
  }

  #hero .container {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  #hero .container > div:last-child {
    width: 100%;
    max-width: 100%;
  }

  .header__inner {
    flex-wrap: wrap;
    gap: 16px;
  }
  
  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
  }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .footer__bottom {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
}
