/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 设计变量与 Token --- */
:root {
  /* 色板 */
  --color-dark: #140E25;      /* 深色面底色 */
  --color-paper: #F7F5F3;     /* 纸面色底色 */
  --color-text: #191523;      /* 纸面上正文/标题色 */
  --color-brand: #5214EB;     /* 纸面上品牌色（强调词、链接、图标） */
  --color-accent: #C8ED6E;    /* 强调色（按钮底、深色面强调词） */
  --color-border-subtle: rgba(25, 21, 35, 0.16); /* 分割线/卡片边框 */
  
  /* 结构性约束 */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 1px solid var(--color-border-subtle);
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  line-height: 1.55;
  color: var(--color-text);
  background-color: var(--color-paper);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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-inline: auto;
  padding-inline: var(--gap);
}

.section {
  padding-block: var(--section-y);
}

/* 分节方式：细线分节（纸面区块之间） */
.section-divider {
  border-top: 1px solid var(--color-border-subtle);
}

/* --- 页面头部与尾部 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(247, 245, 243, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border-subtle);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.125rem;
}

.brand img {
  width: 32px;
  height: 32px;
}

.nav-list {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
  transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  color: var(--color-brand);
}

.site-footer {
  background-color: var(--color-dark);
  color: var(--color-paper);
  padding-block: 3rem;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
}

.footer-nav {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-link {
  color: var(--color-paper);
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.footer-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.copyright {
  font-size: 0.875rem;
  opacity: 0.6;
}

/* --- 按钮组件 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding-inline: 1.5rem;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.btn:focus-visible {
  outline: 3px solid var(--color-brand);
  outline-offset: 2px;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: none;
}

.btn-primary:hover {
  filter: brightness(0.95);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--color-text);
  color: var(--color-text);
}

.btn-secondary:hover {
  background-color: rgba(25, 21, 35, 0.05);
  transform: translateY(-1px);
}

/* 深色面上的按钮变体 */
.bg-dark .btn-primary {
  /* 保持强调色底，深色面文字 */
  color: var(--color-dark);
}

.bg-dark .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}

.bg-dark .btn-secondary:hover {
  background-color: rgba(247, 245, 243, 0.1);
}

/* --- 文本排版 --- */
.heading-xl {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
  text-wrap: balance;
}

.heading-lg {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
}

.heading-md {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}

.text-body {
  font-size: 1rem;
  line-height: 1.55;
  max-width: 38em;
}

.text-small {
  font-size: 0.875rem;
  line-height: 1.5;
}

.text-accent-highlight {
  color: var(--color-accent);
}

.text-brand-highlight {
  color: var(--color-brand);
}

.label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

/* --- 颜色面系统 --- */
.bg-paper {
  background-color: var(--color-paper);
  color: var(--color-text);
}

.bg-paper .label,
.bg-paper a:not(.btn),
.bg-paper .text-highlight {
  color: var(--color-brand);
}

.bg-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}

.bg-dark .label,
.bg-dark a:not(.btn),
.bg-dark .text-highlight {
  color: var(--color-accent);
}

/* --- 卡片与网格 --- */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: var(--gap);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: var(--gap);
}

/* --- 表格 --- */
.table-wrapper {
  overflow-x: auto;
  border: var(--card-border);
  border-radius: var(--radius-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border-subtle);
}

.data-table th {
  font-weight: 600;
  background-color: rgba(25, 21, 35, 0.03);
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* --- FAQ (Details/Summary) --- */
.faq-item {
  border-bottom: 1px solid var(--color-border-subtle);
}

.faq-item summary {
  padding: 1rem 0;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 2rem;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 400;
  color: var(--color-brand);
}

.faq-item[open] summary::after {
  content: "-";
}

.faq-item p {
  padding-bottom: 1rem;
  color: var(--color-text);
  opacity: 0.85;
}

/* --- SVG 动效 Keyframes --- */
@keyframes float-bubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes breathe-dot {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

@keyframes slide-in-right {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes dash-flow {
  to { stroke-dashoffset: -20; }
}

.animate-float-1 { animation: float-bubble 4s ease-in-out infinite; }
.animate-float-2 { animation: float-bubble 5s ease-in-out infinite 1s; }
.animate-float-3 { animation: float-bubble 4.5s ease-in-out infinite 2s; }
.animate-breathe { animation: breathe-dot 2s ease-in-out infinite; }
.animate-slide-in { animation: slide-in-right 0.8s ease-out forwards; }
.animate-dash { 
  stroke-dasharray: 10; 
  animation: dash-flow 1s linear infinite; 
}

/* 减少动态效果 */
@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;
  }
}

/* --- 响应式微调 --- */
@media (max-width: 768px) {
  .nav-list {
    display: none; /* 简化处理，实际项目可加汉堡菜单 */
  }
  
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
  
  .heading-xl {
    font-size: clamp(1.75rem, 6vw, 2.5rem);
  }
}
