/* =========================================
   SafeW 全局样式 & Token 系统
   ========================================= */

:root {
  /* 色板 */
  --color-dark: #240F29;
  --color-paper: #F6F3F7;
  --color-text: #201523;
  --color-brand: #A711CF;
  --color-accent: #ED6E73;
  
  /* 结构性 Token */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;
  
  /* 衍生变量 */
  --btn-height: 52px;
  --header-height: 72px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* 页面级取色上下文 */
body {
  background-color: var(--color-paper);
  color: var(--color-text);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.55;
  margin: 0;
  padding: 0;
}

.dark-surface {
  background-color: var(--color-dark);
  color: var(--color-paper);
}

.paper-card {
  background-color: var(--color-paper);
  color: var(--color-text);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}

/* 排版基础 */
h1, h2, h3, h4, h5, h6 {
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-top: 0;
}

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  margin-bottom: var(--gap);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: calc(var(--gap) * 1.5);
}

h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  margin-bottom: var(--gap);
}

p {
  margin-bottom: var(--gap);
  max-width: 38em;
}

a {
  color: var(--color-brand);
  text-decoration: none;
  transition: color 0.2s ease;
}

.dark-surface a {
  color: var(--color-accent);
}

a:hover {
  opacity: 0.85;
}

/* 眉标 */
.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: var(--gap);
  color: var(--color-brand);
}

.dark-surface .section-label {
  color: var(--color-accent);
}

/* 容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
  overflow-x: hidden;
}

.section-wrapper {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--btn-height);
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  text-decoration: none;
  gap: 10px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: none;
}

.btn-primary:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text);
  border: 1px solid currentColor;
}

.dark-surface .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* 页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(246, 243, 247, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(32, 21, 35, 0.05);
  height: var(--header-height);
}

.dark-surface .site-header {
  background-color: rgba(36, 15, 41, 0.9);
  border-bottom-color: rgba(246, 243, 247, 0.1);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-weight: 500;
  color: inherit;
  padding: 8px 0;
}

.nav-links a[aria-current="page"] {
  color: var(--color-brand);
  border-bottom: 2px solid var(--color-brand);
}

.dark-surface .nav-links a[aria-current="page"] {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

/* 页脚 */
.site-footer {
  padding: 64px 0;
  border-top: 1px solid rgba(32, 21, 35, 0.1);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 48px;
}

.footer-col h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 16px;
  opacity: 0.6;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col li {
  margin-bottom: 12px;
}

.footer-col a {
  color: inherit;
  opacity: 0.8;
}

.footer-col a:hover {
  opacity: 1;
  color: var(--color-brand);
}

.dark-surface .footer-col a:hover {
  color: var(--color-accent);
}

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--gap);
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid rgba(32, 21, 35, 0.1);
}

.dark-surface .data-table th,
.dark-surface .data-table td {
  border-bottom-color: rgba(246, 243, 247, 0.1);
}

.data-table th {
  font-weight: 600;
  opacity: 0.8;
}

/* FAQ Details */
.faq-item {
  border-bottom: 1px solid rgba(32, 21, 35, 0.1);
  margin-bottom: 0;
}

.dark-surface .faq-item {
  border-bottom-color: rgba(246, 243, 247, 0.1);
}

.faq-item summary {
  padding: 24px 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 1.1rem;
  list-style: none;
  position: relative;
  padding-right: 40px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  font-weight: 300;
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  transform: translateY(-50%) rotate(45deg);
}

.faq-item p {
  margin-top: 0;
  margin-bottom: 24px;
  opacity: 0.9;
}

/* 核心功能 Tab (纯 CSS) */
.feature-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.feature-tabs input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.feature-tabs label {
  padding: 12px 24px;
  background: transparent;
  border: 1px solid rgba(32, 21, 35, 0.2);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.dark-surface .feature-tabs label {
  border-color: rgba(246, 243, 247, 0.2);
}

.feature-tabs label:hover {
  border-color: var(--color-brand);
}

.dark-surface .feature-tabs label:hover {
  border-color: var(--color-accent);
}

.feature-content {
  display: none;
  padding: 32px;
  background: rgba(32, 21, 35, 0.03);
}

.dark-surface .feature-content {
  background: rgba(246, 243, 247, 0.05);
}

#tab-1:checked ~ .panels #panel-1,
#tab-2:checked ~ .panels #panel-2,
#tab-3:checked ~ .panels #panel-3,
#tab-4:checked ~ .panels #panel-4 {
  display: block;
}

#tab-1:checked ~ .tabs label[for="tab-1"],
#tab-2:checked ~ .tabs label[for="tab-2"],
#tab-3:checked ~ .tabs label[for="tab-3"],
#tab-4:checked ~ .tabs label[for="tab-4"] {
  background-color: var(--color-brand);
  color: white;
  border-color: var(--color-brand);
}

.dark-surface #tab-1:checked ~ .tabs label[for="tab-1"],
.dark-surface #tab-2:checked ~ .tabs label[for="tab-2"],
.dark-surface #tab-3:checked ~ .tabs label[for="tab-3"],
.dark-surface #tab-4:checked ~ .tabs label[for="tab-4"] {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border-color: var(--color-accent);
}

/* SVG 动效 Keyframes */
@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

@keyframes breathe {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes slide-in-right {
  0% { transform: translateX(20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

/* SVG 动效 Class */
.svg-path-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 3s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

.svg-breathe {
  animation: breathe 4s ease-in-out infinite;
}

.svg-float {
  animation: float-y 5s ease-in-out infinite;
}

.svg-slide {
  animation: slide-in-right 1.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .nav-links {
    display: none; /* 简化移动端，实际项目可加汉堡菜单 */
  }
  
  .hero-layout {
    flex-direction: column-reverse !important;
  }
  
  .scenario-row {
    flex-direction: column !important;
  }
  
  .feature-tabs label {
    flex: 1 1 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
