/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 设计变量与基础重置 --- */
:root {
  /* 配色体系 */
  --color-dark: #271231;
  --color-paper: #F5F0E5;
  --color-text: #1F1523;
  --color-brand: #9B12D8;
  --color-accent: #ED6EC0;

  /* 结构 Token */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(31, 21, 35, 0.3);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;

  /* 字体与排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --line-height-base: 1.65;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-paper);
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

ul, ol {
  list-style: none;
}

/* --- 通用容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* --- 页面布局 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(245, 240, 229, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(31, 21, 35, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}

.brand-logo img {
  width: 32px;
  height: 32px;
}

.main-nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.main-nav a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
  opacity: 0.75;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  opacity: 1;
  color: var(--color-brand);
}

.site-footer {
  background-color: var(--color-dark);
  color: var(--color-paper);
  padding: 48px 0;
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: var(--color-paper);
  opacity: 0.7;
}

.footer-links a:hover {
  opacity: 1;
  color: var(--color-accent);
}

.copyright {
  opacity: 0.5;
  font-size: 0.8rem;
}

/* --- 按钮组件 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 24px;
  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;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.btn-primary:hover {
  background-color: #d95aae;
  box-shadow: 0 4px 12px rgba(237, 110, 192, 0.4);
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--color-text);
  color: var(--color-text);
}

.btn-secondary.dark-mode {
  border-color: var(--color-paper);
  color: var(--color-paper);
}

.btn-icon {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

/* --- 区块排版 --- */
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

.section-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}

.section-paper {
  background-color: var(--color-paper);
  color: var(--color-text);
}

.section-header {
  margin-bottom: var(--gap);
}

.breadcrumb {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.section-paper .breadcrumb {
  color: var(--color-brand);
}

.section-dark .breadcrumb {
  color: var(--color-accent);
}

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  text-wrap: balance;
  max-width: 100%;
  word-break: break-word;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 32px;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 16px;
}

p {
  margin-bottom: 16px;
  max-width: 38em;
}

.hl {
  font-weight: 600;
}

.section-paper .hl {
  color: var(--color-brand);
}

.section-dark .hl {
  color: var(--color-accent);
}

/* --- 表格样式 --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.data-table th,
.data-table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid rgba(31, 21, 35, 0.1);
}

.section-dark .data-table th,
.section-dark .data-table td {
  border-bottom-color: rgba(245, 240, 229, 0.1);
}

.data-table th {
  font-weight: 600;
  width: 30%;
}

/* --- 卡片样式 --- */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 24px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px -12px rgba(31, 21, 35, 0.35);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}

/* --- FAQ 样式 --- */
.faq-item {
  border-bottom: 1px solid rgba(31, 21, 35, 0.1);
  margin-bottom: 16px;
}

.faq-item summary {
  padding: 16px 0;
  font-weight: 600;
  cursor: pointer;
  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;
  font-weight: 400;
  color: var(--color-brand);
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item p {
  margin-top: 16px;
  margin-bottom: 0;
  opacity: 0.85;
}

/* --- SVG 动效系统 --- */
.svg-visual {
  width: 100%;
  height: auto;
  overflow: visible;
}

@keyframes drawLine {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes floatSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes pulseOpacity {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

@keyframes gridNodeLight {
  0%, 100% { opacity: 0.15; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.draw-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

.float-element {
  animation: floatSoft 4s ease-in-out infinite;
}

.pulse-dot {
  animation: pulseOpacity 2s ease-in-out infinite;
}

.grid-node {
  transform-box: fill-box;
  transform-origin: center;
  animation: gridNodeLight 3s ease-in-out infinite;
}

.grid-node:nth-child(odd) {
  animation-delay: 0.5s;
}

.grid-node:nth-child(even) {
  animation-delay: 1.5s;
}

/* --- 响应式适配 --- */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    height: auto;
    padding: 16px 0;
    gap: 16px;
  }

  .main-nav {
    width: 100%;
    justify-content: center;
  }

  h1 {
    font-size: 2.5rem;
  }

  .hero-layout {
    flex-direction: column-reverse !important;
  }
}

/* --- 减少动态效果偏好 --- */
@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;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
