/* SafeW 全站共享样式 */

/* 1. 设计变量与基础重置 */
:root {
  /* 色板 */
  --dark: #121531;
  --paper: #E8E9EA;
  --text: #151723;
  --brand: #142CEB;
  --accent: #ED7D6E;

  /* 组件 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 2px solid var(--text);
  --card-shadow: 4px 4px 0 var(--text);
  
  /* 间距与布局 */
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;
  --header-height: 72px;

  /* 排版 */
  --font-sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --line-height-body: 1.75;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--paper);
  color: var(--text);
  line-height: var(--line-height-body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* 2. 通用排版工具类 */
.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);
  position: relative;
}

/* 分节线 */
.section-divider {
  width: 100%;
  height: 1px;
  background-color: rgba(21, 23, 35, 0.15);
  border: none;
}

/* 眉标 */
.label {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.label-brand {
  color: var(--brand);
}

.label-accent {
  color: var(--accent);
}

/* 标题 */
h1, h2, h3, h4 {
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  margin-bottom: 1.5rem;
}

h2 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 2rem;
}

h3 {
  font-size: clamp(1.3rem, 2.5vw, 1.6rem);
  margin-bottom: 1rem;
}

p {
  margin-bottom: 1.5rem;
  max-width: 38em;
}

strong {
  font-weight: 700;
}

/* 关键词高亮 */
.hl {
  color: var(--brand);
}

.dark-mode .hl {
  color: var(--accent);
}

/* 3. 按钮组件 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 2rem;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--accent);
  color: var(--dark);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(237, 125, 110, 0.3);
}

.btn-secondary {
  background-color: transparent;
  border: 2px solid var(--text);
  color: var(--text);
}

.dark-mode .btn-secondary {
  border-color: var(--paper);
  color: var(--paper);
}

.btn-secondary:hover {
  background-color: rgba(21, 23, 35, 0.05);
  transform: translateY(-2px);
}

.dark-mode .btn-secondary:hover {
  background-color: rgba(232, 233, 234, 0.1);
}

.btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
}

/* 4. 卡片与面板 */
.card {
  background-color: var(--paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 2rem;
  transition: transform 0.2s ease;
}

.dark-mode .card {
  background-color: var(--dark); /* 实际上深色面上的浅色卡片应该用纸面逻辑，这里作为容器底色处理 */
  /* 根据规则：深色区块里的浅色卡片按纸面取色。所以这里保持默认 paper 背景或显式指定 */
}

.panel {
  background-color: var(--dark);
  border-radius: var(--radius-card);
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

/* 5. 表格 */
.table-wrapper {
  overflow-x: auto;
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 2rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--paper);
  min-width: 600px;
}

th, td {
  padding: 1rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid rgba(21, 23, 35, 0.1);
}

th {
  font-weight: 700;
  background-color: rgba(21, 23, 35, 0.03);
}

tr:last-child td {
  border-bottom: none;
}

/* 6. FAQ (Details/Summary) */
.faq-item {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 1rem;
  background-color: var(--paper);
}

summary {
  padding: 1.25rem 1.5rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  font-size: 1.5rem;
  font-weight: 400;
  transition: transform 0.2s ease;
}

details[open] summary::after {
  transform: rotate(45deg);
}

details[open] summary {
  border-bottom: 1px solid rgba(21, 23, 35, 0.1);
  margin-bottom: 0;
}

.faq-answer {
  padding: 1.25rem 1.5rem;
  color: var(--text);
  font-size: 0.95rem;
}

/* 7. 页头与页脚 */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: rgba(232, 233, 234, 0.9);
  backdrop-filter: blur(10px);
  z-index: 100;
  border-bottom: 1px solid rgba(21, 23, 35, 0.1);
  display: flex;
  align-items: center;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.2rem;
}

.brand-logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-link {
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--brand);
}

.nav-link[aria-current="page"] {
  color: var(--brand);
  font-weight: 700;
}

@media (max-width: 768px) {
  .nav-links {
    display: none; /* 简化版移动端隐藏导航，仅保留主按钮 */
  }
  .header-inner {
    justify-content: space-between;
  }
}

.site-footer {
  background-color: var(--dark);
  color: var(--paper);
  padding: 4rem 0 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-col h4 {
  color: var(--accent);
  margin-bottom: 1.5rem;
  font-size: 1rem;
}

.footer-col ul li {
  margin-bottom: 0.75rem;
}

.footer-col a {
  opacity: 0.8;
  transition: opacity 0.2s;
}

.footer-col a:hover {
  opacity: 1;
  text-decoration: underline;
}

.footer-bottom {
  border-top: 1px solid rgba(232, 233, 234, 0.1);
  padding-top: 2rem;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.6;
}

/* 8. SVG 动效 (CSS Keyframes) */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes rotateMerge {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(10deg); }
}

@keyframes dashFlow {
  to { stroke-dashoffset: -10; }
}

/* 动画类 */
.anim-float {
  animation: float 6s ease-in-out infinite;
}

.anim-breathe {
  animation: breathe 3s ease-in-out infinite;
}

.anim-slide-in {
  animation: slideIn 0.8s ease-out forwards;
}

.anim-rotate {
  animation: rotateMerge 12s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}

/* 9. 响应式适配 */
@media (max-width: 768px) {
  h1 {
    font-size: clamp(2rem, 8vw, 3rem);
  }
  .grid-3 {
    grid-template-columns: 1fr !important;
  }
  .panel {
    padding: 1.5rem;
  }
}

/* 10. 减少动态效果 */
@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;
  }
}
