/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 1. 设计 Token & 变量定义 --- */
:root {
  /* 品牌色板 */
  --color-bg-dark: #271334;
  --color-bg-paper: #E9E8EA;
  --color-text-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: 1120px;
  
  /* 字体与排版 */
  --font-sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --line-height-tight: 1.1;
  --line-height-normal: 1.55;
  --letter-spacing-tight: -0.02em;

  /* 语义化变量 (纸面环境) */
  --text-primary: var(--color-text-body);
  --text-secondary: color-mix(in srgb, var(--color-text-body) 70%, transparent);
  --accent-primary: var(--color-brand);
  --bg-surface: var(--color-bg-paper);
  --border-color: color-mix(in srgb, var(--color-text-body) 15%, transparent);
}

/* --- 2. 全局重置与基础排版 --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background-color: var(--bg-surface);
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* --- 3. 布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.section {
  padding-block: var(--section-y);
  position: relative;
}

/* 细线分节 */
.section-divider {
  height: 1px;
  background-color: var(--border-color);
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
}

/* --- 4. 排版系统 --- */
h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: var(--letter-spacing-tight);
  line-height: var(--line-height-tight);
  color: var(--text-primary);
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  margin-bottom: var(--gap);
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-bottom: calc(var(--gap) * 1.5);
  position: relative;
  padding-top: var(--gap);
}

/* 眉标 (Section Label) */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: var(--gap);
}

.section-label::before {
  content: "";
  display: block;
  width: 16px;
  height: 2px;
  background-color: currentColor;
}

h3 {
  font-size: clamp(1.3rem, 2vw, 1.6rem);
  margin-bottom: var(--gap);
  margin-top: var(--gap);
}

p {
  margin-bottom: var(--gap);
  max-width: 38em;
  font-size: 1.05rem;
}

/* 关键词高亮 */
.hl {
  color: var(--accent-primary);
}

/* --- 5. 组件：按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 52px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-bg-dark);
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-secondary {
  background-color: transparent;
  border: 1.5px solid var(--text-primary);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: color-mix(in srgb, var(--text-primary) 8%, transparent);
}

/* --- 6. 组件：卡片 --- */
.card {
  background-color: color-mix(in srgb, var(--bg-surface) 85%, var(--color-text-body));
  border-radius: var(--radius-card);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  transition: transform 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
}

/* --- 7. 组件：表格 --- */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: var(--gap);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

th {
  font-weight: 700;
  color: var(--text-primary);
  background-color: color-mix(in srgb, var(--bg-surface) 90%, var(--color-text-body));
}

td {
  color: var(--text-secondary);
}

tr:last-child td {
  border-bottom: none;
}

/* --- 8. 组件：FAQ (Details/Summary) --- */
.faq-item {
  border-bottom: 1px solid var(--border-color);
}

.faq-item summary {
  padding: 1.25rem 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 1.1rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-primary);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--accent-primary);
  transition: transform 0.3s ease;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item p {
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}

/* --- 9. 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(233, 232, 234, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text-primary);
}

.brand-logo img {
  height: 32px;
  width: auto;
}

.nav-list {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.nav-link:hover, .nav-link[aria-current="page"] {
  color: var(--accent-primary);
}

.site-footer {
  background-color: var(--color-bg-dark);
  color: var(--color-bg-paper);
  padding: var(--section-y) 0;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.footer-col h4 {
  color: var(--color-accent);
  margin-bottom: 1rem;
}

.footer-col a {
  display: block;
  color: color-mix(in srgb, var(--color-bg-paper) 75%, transparent);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.footer-col a:hover {
  color: var(--color-accent);
}

/* --- 10. SVG 动效 Keyframes --- */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

@keyframes draw-line {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes pulse-opacity {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* SVG 元素类 */
.svg-element {
  transform-box: fill-box;
  transform-origin: center;
}

.animate-float {
  animation: float 6s ease-in-out infinite;
}

.animate-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 2s ease forwards;
}

.animate-pulse {
  animation: pulse-opacity 4s ease-in-out infinite;
}

.animate-spin {
  animation: spin-slow 20s linear infinite;
}

.animate-fade-in {
  animation: fade-in-up 0.8s ease forwards;
}

/* 减少动态效果偏好 */
@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;
  }
  .svg-element {
    transform: none !important;
  }
}

/* --- 11. 响应式调整 --- */
@media (max-width: 768px) {
  .nav-list {
    display: none; /* 简化版：移动端隐藏导航，实际项目可加汉堡菜单 */
  }
  .hero-layout {
    flex-direction: column-reverse !important;
  }
  .split-layout {
    flex-direction: column !important;
  }
  .grid-2-col {
    grid-template-columns: 1fr !important;
  }
}

/* 深色面环境覆盖 */
.dark-surface {
  background-color: var(--color-bg-dark);
  color: var(--color-bg-paper);
}

.dark-surface h1, 
.dark-surface h2, 
.dark-surface h3, 
.dark-surface p {
  color: var(--color-bg-paper);
}

.dark-surface .section-label {
  color: var(--color-accent);
}

.dark-surface .hl {
  color: var(--color-accent);
}

.dark-surface .btn-secondary {
  border-color: var(--color-bg-paper);
  color: var(--color-bg-paper);
}

/* 浅色卡片在深色面上 */
.light-card-on-dark {
  background-color: var(--color-bg-paper);
  color: var(--color-text-body);
}

.light-card-on-dark h3,
.light-card-on-dark p,
.light-card-on-dark .section-label {
  color: var(--color-text-body);
}

.light-card-on-dark .section-label {
  color: var(--color-brand);
}

.light-card-on-dark .hl {
  color: var(--color-brand);
}
