/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 设计变量与基础重置 --- */
:root {
  /* 色板 */
  --color-dark: #141838;
  --color-paper: #F7F5F3;
  --color-body: #151723;
  --color-brand: #142CEB;
  --color-accent: #6EAFED;
  
  /* 结构 Token */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 2px solid var(--color-body);
  --card-shadow: 4px 4px 0 var(--color-body);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;
  
  /* 排版 Token */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--color-body);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: block;
  max-width: 100%;
}

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);
}

.grid-auto {
  display: grid;
  gap: var(--gap);
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- 排版系统 --- */
h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--color-body);
}

.dark-bg h1, .dark-bg h2, .dark-bg h3, .dark-bg h4 {
  color: var(--color-paper);
}

h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); }
h3 { font-size: 1.25rem; line-height: 1.2; margin-bottom: 0.5rem; }

p {
  max-width: 38em;
  margin-bottom: 1rem;
}

.dark-bg p {
  color: var(--color-paper);
}

.hl {
  color: var(--color-brand);
}

.dark-bg .hl {
  color: var(--color-accent);
}

.mega-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  color: var(--color-brand);
}

.dark-bg .mega-label {
  color: var(--color-accent);
}

strong {
  font-weight: 700;
}

/* --- 按钮组件 --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: none;
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(0.95);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-body);
  border: 1px solid var(--color-body);
}

.dark-bg .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.btn-secondary:hover {
  transform: translateY(-1px);
  background-color: rgba(0,0,0,0.04);
}

.dark-bg .btn-secondary:hover {
  background-color: rgba(255,255,255,0.08);
}

.btn-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* --- 卡片与面板 --- */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  position: relative;
}

.panel {
  background: var(--color-dark);
  border-radius: 12px;
  padding: 1.5rem;
  overflow: hidden;
  position: relative;
  min-width: 0;
}

.dark-panel {
  background: var(--color-dark);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- 表格 --- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 400px;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(21, 23, 35, 0.15);
}

th {
  font-weight: 700;
  color: var(--color-body);
}

.dark-bg th, .dark-bg td {
  border-bottom-color: rgba(247, 245, 243, 0.15);
  color: #151723;
}

tr:last-child th, tr:last-child td {
  border-bottom: none;
}

/* --- FAQ (Details/Summary) --- */
.faq-list {
  display: grid;
  gap: var(--gap);
}

details {
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1rem 1.25rem;
  background: var(--color-paper);
  transition: background-color 0.2s;
}

details[open] {
  background: rgba(20, 44, 235, 0.04);
}

summary {
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--color-brand);
  border-radius: 50%;
  flex-shrink: 0;
}

details p {
  margin-top: 0.75rem;
  margin-bottom: 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-paper);
  border-bottom: 1px solid rgba(21, 23, 35, 0.1);
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
}

.nav-link[aria-current="page"] {
  color: var(--color-brand);
  font-weight: 700;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-brand);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.nav-link:hover::after,
.nav-link[aria-current="page"]::after {
  transform: scaleX(1);
}

.footer {
  background: var(--color-dark);
  color: var(--color-paper);
  padding: var(--section-y) 0;
  margin-top: var(--section-y);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.footer-col h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--color-accent);
}

.footer-col ul li {
  margin-bottom: 0.5rem;
}

.footer-col a:hover {
  color: var(--color-accent);
}

.footer-copy {
  border-top: 1px solid rgba(247, 245, 243, 0.15);
  padding-top: 1.5rem;
  font-size: 0.85rem;
  color: rgba(247, 245, 243, 0.6);
  text-align: center;
}

/* --- SVG 动效核心规则 --- */
svg.animated-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

svg.animated-svg path,
svg.animated-svg line,
svg.animated-svg polyline {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.anim-draw {
  animation: animDraw 4s ease-in-out infinite;
}

.anim-float {
  animation: animFloat 5s ease-in-out infinite;
}

.anim-type {
  animation: animType 2.5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.anim-slide {
  animation: animSlide 6s ease-in-out infinite;
}

.anim-orbit {
  animation: animOrbit 7s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes animDraw {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}

@keyframes animFloat {
  0%, 100% { transform: translateY(0); opacity: 0.85; }
  50% { transform: translateY(-6px); opacity: 1; }
}

@keyframes animType {
  0%, 100% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1); opacity: 1; }
}

@keyframes animSlide {
  0%, 100% { transform: translateX(0); opacity: 0.9; }
  50% { transform: translateX(4px); opacity: 1; }
}

@keyframes animOrbit {
  0%, 100% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.05); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .anim-draw, .anim-float, .anim-type, .anim-slide, .anim-orbit {
    animation: none !important;
  }
}

/* --- 响应式适配 --- */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .magazine-layout { grid-template-columns: 1fr !important; }
  .feature-row { flex-direction: column !important; }
  .scene-split { grid-template-columns: 1fr !important; }
}

@media (min-width: 901px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* 兜底：裁掉横向溢出 */
div.download-grid {
  overflow-x: clip;
}
