/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 1. 设计变量与基础重置 */
:root {
  /* 色板 */
  --color-dark: #141838;
  --color-paper: #FCFCFD;
  --color-body: #151723;
  --color-brand: #142CEB;
  --color-accent: #6EAFED;

  /* 卡片区分色（仅靠底色深浅区分） */
  --card-bg-light: #F4F5F7;
  --card-bg-dark: #1A1F45;

  /* 结构参数 */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;

  /* 字体栈 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", 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-sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--color-body);
  background-color: var(--color-paper);
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease;
}

ul, ol {
  list-style: none;
}

/* 2. 上下文取色覆盖 */
.bg-light {
  background-color: var(--color-paper);
  color: var(--color-body);
}
.bg-light .hl, .bg-light .label, .bg-light .link, .bg-light a:not(.btn) {
  color: var(--color-brand);
}
.bg-light .hl span { color: var(--color-brand); }

.bg-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.bg-dark .hl, .bg-dark .label, .bg-dark .link, .bg-dark a:not(.btn) {
  color: var(--color-accent);
}
.bg-dark .hl span { color: var(--color-accent); }
.bg-dark .card {
  background-color: var(--card-bg-dark);
}

/* 3. 排版系统 */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.section {
  padding-block: var(--section-y);
  position: relative;
}

.section + .section {
  border-top: 1px solid rgba(128, 128, 128, 0.2);
}

.label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
  margin-bottom: 1rem;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.75rem;
  text-wrap: balance;
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
  max-width: 38em;
}

.text-center { text-align: center; }
.text-lg { font-size: 1.125rem; }
.text-muted { opacity: 0.8; }

/* 4. 组件：按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 52px;
  padding-inline: 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover {
  background-color: #5A9DE0;
  transform: translateY(-2px);
}

.btn-secondary {
  background: transparent;
  border-color: currentColor;
  color: inherit;
}
.btn-secondary:hover {
  background-color: rgba(128, 128, 128, 0.1);
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* 5. 组件：卡片 */
.card {
  background-color: var(--card-bg-light);
  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);
}

/* 6. 组件：表格 */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 300px;
}
th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}
th {
  font-weight: 600;
  background-color: rgba(128, 128, 128, 0.05);
}
td a {
  word-break: break-all;
}

/* 7. 组件：FAQ */
.faq-item {
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}
.faq-item summary {
  padding: 1rem 0;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 1.25rem;
  transition: transform 0.2s ease;
}
.faq-item[open] summary::after {
  transform: rotate(45deg);
}
.faq-item p {
  margin-top: 0.5rem;
  padding-bottom: 1rem;
  max-width: 100%;
}

/* 8. 布局辅助 */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}
.flex-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  align-items: center;
}
.min-w-0 { min-width: 0; }

/* 9. 页头与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid rgba(128, 128, 128, 0.15);
  backdrop-filter: blur(8px);
}
.bg-dark .site-header {
  background-color: var(--color-dark);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}
.nav-list {
  display: flex;
  gap: 1.5rem;
}
.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0.85;
}
.nav-link:hover, .nav-link[aria-current="page"] {
  opacity: 1;
  font-weight: 600;
}
.site-footer {
  padding-block: 2rem;
  border-top: 1px solid rgba(128, 128, 128, 0.15);
  font-size: 0.875rem;
  opacity: 0.8;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* 10. SVG 动效关键帧与类 */
.svg-container {
  width: 100%;
  height: auto;
  max-width: 100%;
}

.star {
  animation: starTwinkle 4s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.line-flow {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: lineDraw 6s linear infinite;
}
.bubble {
  animation: bubbleFloat 5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.notify {
  animation: slideIn 4s ease-out forwards;
  opacity: 0;
}
.dot-typing {
  animation: typingBreathe 1.5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.dot-typing:nth-child(2) { animation-delay: 0.2s; }
.dot-typing:nth-child(3) { animation-delay: 0.4s; }

@keyframes starTwinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}
@keyframes lineDraw {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes slideIn {
  0% { transform: translateX(30px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes typingBreathe {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 11. 响应式微调 */
@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .flex-row { flex-direction: column; align-items: flex-start; }
  .hero-layout { flex-direction: column-reverse; }
  h1 { font-size: clamp(1.8rem, 6vw, 2.8rem); }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
