/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 设计 Token 与变量 --- */
:root {
  /* 颜色系统 */
  --color-dark-bg: #140E25;
  --color-paper-bg: #F5F0E5;
  --color-text-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;
  
  /* 派生透明度 (用于边框等装饰) */
  --border-opacity: 0.16;

  /* 圆角与边界 */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 1px solid rgba(25, 21, 35, var(--border-opacity));
  --card-shadow: none;

  /* 节奏与间距 */
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --line-height: 1.75;
  
  /* 内容宽度 */
  --content-max: 1120px;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: var(--line-height);
  color: var(--color-text-body);
  background-color: var(--color-paper-bg);
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* --- 容器与网格 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}

@media (max-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* --- 标题系统 --- */
h1, h2, h3, h4 {
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-top: 0;
  margin-bottom: 0.6em;
}

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-bottom: 1.5rem;
}

h3 {
  font-size: clamp(1.3rem, 2vw, 1.6rem);
  margin-bottom: 0.8em;
}

p {
  margin-bottom: 1.2em;
  max-width: 38em;
}

/* 眉标 (Section Label) */
.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.8em;
  padding-left: 1.2em;
  position: relative;
}

.section-label::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 0.6em;
  height: 1px;
  background-color: currentColor;
}

/* 强调词高亮 */
.hl {
  /* 默认由父级颜色控制，或通过类名覆盖 */
}

/* --- 按钮组件 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid currentColor;
}

/* 按钮图标 */
.btn-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* --- 卡片组件 --- */
.card {
  background-color: transparent;
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--card-shadow);
}

/* --- 表格组件 --- */
.table-wrapper {
  overflow-x: auto;
  width: 100%;
  border: var(--card-border);
  border-radius: var(--radius-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 500px;
}

th, td {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(25, 21, 35, var(--border-opacity));
}

th {
  font-weight: 700;
  background-color: rgba(25, 21, 35, 0.03);
}

tr:last-child td {
  border-bottom: none;
}

/* --- FAQ 组件 (Details/Summary) --- */
.faq-item {
  border-bottom: 1px solid rgba(25, 21, 35, var(--border-opacity));
}

.faq-item summary {
  padding: 20px 0;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  font-size: 1.5rem;
  font-weight: 400;
  transition: transform 0.3s ease;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item p {
  margin-top: 0.5em;
  margin-bottom: 1.5em;
  color: inherit;
  opacity: 0.9;
}

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(245, 240, 229, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(25, 21, 35, var(--border-opacity));
  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.2rem;
  color: var(--color-text-body);
}

.logo img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  position: relative;
}

.nav-link[aria-current="page"] {
  color: var(--color-brand);
}

.nav-link[aria-current="page"]::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: currentColor;
}

@media (max-width: 640px) {
  .nav-links {
    display: none; /* 简化版：移动端隐藏导航链接，仅保留品牌与按钮 */
  }
  .btn-mobile-menu {
    display: block;
  }
}

.site-footer {
  padding: 64px 0 32px;
  border-top: 1px solid rgba(25, 21, 35, var(--border-opacity));
  margin-top: var(--section-y);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--gap);
  margin-bottom: 48px;
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.footer-col h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 16px;
  opacity: 0.6;
}

.footer-col ul li {
  margin-bottom: 10px;
}

.footer-col a:hover {
  text-decoration: underline;
}

.copyright {
  font-size: 0.85rem;
  opacity: 0.6;
  text-align: center;
  padding-top: 32px;
  border-top: 1px solid rgba(25, 21, 35, var(--border-opacity));
}

/* --- 页面背景变体 --- */
.bg-dark {
  background-color: var(--color-dark-bg);
  color: var(--color-paper-bg);
}

.bg-dark .section-label {
  color: var(--color-accent);
}

.bg-dark h2, .bg-dark h3, .bg-dark p {
  color: var(--color-paper-bg);
}

.bg-dark .hl {
  color: var(--color-accent);
}

.bg-dark .card {
  border-color: rgba(245, 240, 229, var(--border-opacity));
  background-color: rgba(245, 240, 229, 0.03);
}

.bg-dark .table-wrapper {
  border-color: rgba(245, 240, 229, var(--border-opacity));
}

.bg-dark th, .bg-dark td {
  border-bottom-color: rgba(245, 240, 229, var(--border-opacity));
}

.bg-dark th {
  background-color: rgba(245, 240, 229, 0.05);
}

/* 深色面上的浅色卡片 (复用纸面取色逻辑) */
.paper-card-in-dark {
  background-color: var(--color-paper-bg);
  color: var(--color-text-body);
  border-color: rgba(25, 21, 35, var(--border-opacity));
}

.paper-card-in-dark .hl {
  color: var(--color-brand);
}

.paper-card-in-dark .section-label {
  color: var(--color-brand);
}

/* --- SVG 动效关键帧 --- */
@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

@keyframes breathe {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.02); }
}

@keyframes float-up {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes slide-in-right {
  0% { transform: translateX(20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

/* 动效类应用 */
.anim-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 2.5s ease-out forwards;
}

.anim-breathe {
  animation: breathe 4s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.anim-float {
  animation: float-up 5s ease-in-out infinite;
}

.anim-slide-in {
  animation: slide-in-right 1s ease-out forwards;
}

/* 延迟控制 */
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.5s; }
.delay-3 { animation-delay: 0.8s; }

/* --- 减少动态效果偏好 --- */
@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;
  }
}
