/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 色板 */
  --color-dark: #231334;
  --color-paper: #F5F3F7;
  --color-text: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;

  /* 结构 Token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;
  --line-h: 1.75;
}

/* --- 基础重置与排版 --- */
*, *::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: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: var(--line-h);
  color: var(--color-text);
  background-color: var(--color-paper);
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* --- 表面层颜色控制 --- */
.paper-surface {
  --bg: var(--color-paper);
  --fg: var(--color-text);
  --link: var(--color-brand);
  --hl: var(--color-brand);
  background-color: var(--bg);
  color: var(--fg);
}

.dark-surface {
  --bg: var(--color-dark);
  --fg: var(--color-paper);
  --link: var(--color-accent);
  --hl: var(--color-accent);
  background-color: var(--bg);
  color: var(--fg);
}

/* 通用容器 */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.section {
  padding-block: var(--section-y);
  position: relative;
}

.section + .section {
  border-top: 1px solid rgba(128, 128, 128, 0.2);
}

/* --- 排版层级 --- */
.megamark {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5em;
  color: var(--link);
}

h1, h2, h3 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  margin-bottom: 1.5em;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 1.25em;
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75em;
}

p {
  margin-bottom: 1em;
  max-width: 38em;
}

.hl {
  color: var(--hl);
}

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(245, 243, 247, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  transition: background-color 0.3s;
}

.dark-surface ~ .site-header,
body:not(.has-hero) .site-header {
  background-color: rgba(245, 243, 247, 0.95);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
}

.brand img {
  height: 32px;
  width: auto;
}

.nav-list {
  display: flex;
  gap: 24px;
}

.nav-link {
  font-weight: 500;
  color: var(--color-text);
  padding: 6px 0;
  position: relative;
}

.nav-link:hover,
.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: var(--color-brand);
  border-radius: 2px;
}

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.btn:focus-visible {
  outline: 3px solid var(--color-brand);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--color-text);
  color: var(--color-text);
}

.dark-surface .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}

.btn-secondary:hover {
  background-color: rgba(0,0,0,0.04);
}

.dark-surface .btn-secondary:hover {
  background-color: rgba(255,255,255,0.08);
}

.btn-icon {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

/* --- 卡片与面板 --- */
.card {
  background-color: rgba(255, 255, 255, 0.6);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 24px;
  transition: transform 0.2s ease;
}

.paper-surface .card {
  background-color: #FFFFFF;
  border: 1px solid rgba(0,0,0,0.06);
}

.dark-surface .card {
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.card:hover {
  transform: translateY(-2px);
}

.visual-panel {
  background-color: var(--color-dark);
  border-radius: var(--radius-card);
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  position: relative;
}

.paper-surface .visual-panel {
  background-color: #EAE7EF;
}

.dark-surface .visual-panel {
  background-color: #1A0E2B;
}

/* --- 表格 --- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-card);
  border: 1px solid rgba(0,0,0,0.08);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.data-table th {
  font-weight: 700;
  background-color: rgba(0,0,0,0.03);
}

.dark-surface .data-table th {
  background-color: rgba(255,255,255,0.05);
  border-bottom-color: rgba(255,255,255,0.1);
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* --- FAQ --- */
.faq-item {
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.paper-surface .faq-item {
  border-color: rgba(0,0,0,0.06);
}

.dark-surface .faq-item {
  border-color: rgba(255,255,255,0.1);
}

details summary {
  padding: 20px 0;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::after {
  content: "+";
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

details[open] summary::after {
  transform: rotate(45deg);
}

details p {
  padding-bottom: 20px;
  opacity: 0.9;
}

/* --- 网格布局 --- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

.flex-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  align-items: center;
}

.text-col {
  flex: 1 1 300px;
}

.visual-col {
  flex: 1 1 300px;
}

/* --- 页脚 --- */
.site-footer {
  padding-block: 48px;
  border-top: 1px solid rgba(0,0,0,0.08);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

/* =========================================
   SVG 动效系统
   ========================================= */

/* 描边绘制动画 */
.path-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.anim-draw {
  animation: drawLine 3s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

@keyframes drawLine {
  0% { stroke-dashoffset: 1; opacity: 0.6; }
  40%, 70% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0.8; }
}

/* 呼吸缩放 */
.anim-breathe {
  animation: breathe 4s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes breathe {
  0% { transform: scale(0.96); opacity: 0.7; }
  100% { transform: scale(1.04); opacity: 1; }
}

/* 悬浮位移 */
.anim-float {
  animation: floatY 5s ease-in-out infinite alternate;
}

@keyframes floatY {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}

/* 输入点闪烁 */
.input-dot {
  animation: blink 1.5s step-end infinite;
}

.input-dot:nth-child(2) { animation-delay: 0.2s; }
.input-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

/* 轨道旋转 */
.anim-spin-slow {
  animation: spinSlow 12s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 减少动态效果 */
@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;
  }
  .path-draw {
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

/* =========================================
   响应式调整
   ========================================= */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    height: auto;
    padding: 16px 0;
    gap: 12px;
  }
  
  .nav-list {
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .flex-row {
    flex-direction: column;
  }
  
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* 兜底：裁掉横向溢出 */
div.card.product-table {
  overflow-x: clip;
}
