/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 1. 设计变量与基础重置 */
:root {
  /* 色板 */
  --color-dark: #13102D;
  --color-paper: #F7F5F3;
  --color-text: #171523;
  --color-brand: #2714EB;
  --color-accent: #89ED6E;

  /* 结构性 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 1px solid rgba(23, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;

  /* 排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --lh-body: 1.55;
  --lh-title: 1.25;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-paper);
  color: var(--color-text);
  line-height: var(--lh-body);
  font-size: 16px;
  -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;
}

/* 2. 布局容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.section {
  padding-block: 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--dark .hl,
.section--dark a:not(.btn) {
  color: var(--color-accent);
}

.section--paper .hl,
.section--paper a:not(.btn) {
  color: var(--color-brand);
}

/* 卡片继承纸面取色 */
.card--light-on-dark {
  background-color: var(--color-paper);
  color: var(--color-text);
}

.card--light-on-dark .hl,
.card--light-on-dark a:not(.btn) {
  color: var(--color-brand);
}

/* 3. 排版组件 */
.mega-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--gap);
}

.section--paper .mega-label { color: var(--color-brand); }
.section--dark .mega-label { color: var(--color-accent); }

.mega-label::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: currentColor;
  border-radius: 2px;
}

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: var(--lh-title);
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  margin-bottom: var(--gap);
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: var(--gap);
  text-wrap: balance;
}

h3 {
  font-size: 1.25rem;
  margin-top: var(--gap);
  margin-bottom: calc(var(--gap) * 0.5);
}

p, li {
  max-width: 38em;
  margin-bottom: var(--gap);
}

.hl {
  font-weight: 600;
}

/* 4. 按钮系统 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding-inline: 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 3px solid var(--color-brand);
  outline-offset: 2px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.btn--primary:hover {
  filter: brightness(1.05);
}

.btn--secondary {
  background-color: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-text);
}

.section--dark .btn--secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

/* 5. 卡片与网格 */
.grid {
  display: grid;
  gap: var(--gap);
}

.grid--2 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.grid--kanban { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.card__header {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.1rem;
}

.card__icon {
  width: 24px;
  height: 24px;
  stroke-width: 1.8;
  flex-shrink: 0;
}

/* 6. 表格 */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.spec-table th,
.spec-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(23, 21, 35, 0.1);
}

.spec-table th {
  font-weight: 700;
  color: var(--color-brand);
  width: 35%;
}

.section--dark .spec-table th {
  color: var(--color-accent);
}

/* 7. FAQ (details/summary) */
.faq-item {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  overflow: hidden;
}

.faq-item summary {
  padding: 16px 24px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 48px;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  transform: translateY(-50%) rotate(45deg);
}

.faq-item p {
  padding: 0 24px 16px;
  margin: 0;
  color: var(--color-text);
  opacity: 0.9;
}

/* 8. 步骤条 */
.steps {
  display: flex;
  gap: var(--gap);
  counter-reset: step;
}

.step {
  flex: 1;
  min-width: 0;
  counter-increment: step;
  position: relative;
  padding-top: 48px;
}

.step::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 32px;
  background-color: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.step__title {
  font-weight: 700;
  margin-bottom: 8px;
}

/* 9. 眉标与标签 */
.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background-color: rgba(39, 20, 235, 0.1);
  color: var(--color-brand);
  margin-bottom: 8px;
}

.section--dark .tag {
  background-color: rgba(137, 237, 110, 0.15);
  color: var(--color-accent);
}

/* 10. 页头与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(247, 245, 243, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(23, 21, 35, 0.08);
  padding-block: 12px;
}

.section--dark .site-header {
  background-color: rgba(19, 16, 45, 0.9);
  border-bottom-color: rgba(247, 245, 243, 0.1);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.2rem;
}

.brand img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.nav-list {
  display: flex;
  gap: 24px;
  align-items: center;
}

.nav-link {
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
}

.nav-link[aria-current="page"] {
  font-weight: 700;
  color: var(--color-brand);
}

.section--dark .nav-link[aria-current="page"] {
  color: var(--color-accent);
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: currentColor;
  transition: width 0.2s ease;
}

.nav-link:hover::after,
.nav-link:focus-visible::after {
  width: 100%;
}

.site-footer {
  padding-block: var(--section-y);
  border-top: 1px solid rgba(23, 21, 35, 0.1);
  text-align: center;
  font-size: 0.9rem;
  color: rgba(23, 21, 35, 0.7);
}

.section--dark .site-footer {
  border-top-color: rgba(247, 245, 243, 0.1);
  color: rgba(247, 245, 243, 0.6);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 16px;
}

/* 11. SVG 动效 Keyframes */
.svg-orbit-ring {
  transform-box: fill-box;
  transform-origin: center;
  animation: orbit-breathe 6s ease-in-out infinite alternate;
}

.svg-orbit-ring:nth-child(2) { animation-delay: -2s; animation-duration: 7s; }
.svg-orbit-ring:nth-child(3) { animation-delay: -4s; animation-duration: 8s; }

.svg-draw-path {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 4s ease-in-out infinite alternate;
}

.svg-float-bubble {
  transform-box: fill-box;
  transform-origin: center;
  animation: float-up 5s ease-in-out infinite alternate;
}

@keyframes orbit-breathe {
  0% { transform: scale(0.98); opacity: 0.6; }
  100% { transform: scale(1.02); opacity: 1; }
}

@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}

@keyframes float-up {
  0% { transform: translateY(0); opacity: 0.7; }
  100% { transform: translateY(-6px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .svg-orbit-ring, .svg-draw-path, .svg-float-bubble {
    animation: none !important;
  }
}

/* 12. 响应式适配 */
@media (max-width: 768px) {
  .steps { flex-direction: column; }
  .step { padding-top: 0; padding-left: 48px; margin-bottom: 24px; }
  .step::before { left: 0; top: 4px; }
  .grid--kanban { grid-template-columns: 1fr; }
  .nav-list { gap: 16px; }
}
