/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 1. 设计变量与基础重置 */
:root {
  /* 色板 */
  --color-dark: #271231;
  --color-paper: #F6F3F7;
  --color-text: #1F1523;
  --color-brand: #9E13DD;
  --color-accent: #ED6EC0;
  --color-white: #ffffff;

  /* 结构性 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(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;

  /* 排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --text-base: 16px;
  --line-height-base: 1.75;
  --line-height-tight: 1.15;
  --font-weight-title: 500;
  --font-weight-body: 400;

  /* 间距与层级 */
  --z-header: 100;
  --z-modal: 200;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

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);
  position: relative;
}

.section--paper {
  background-color: var(--color-paper);
  border-bottom: 1px solid rgba(var(--color-text-rgb, 31, 21, 35), 0.12);
}

.section--dark {
  background-color: var(--color-dark);
  color: var(--color-white);
}

/* 深色面文本覆盖规则 */
.section--dark .hl,
.section--dark a {
  color: var(--color-accent);
}
.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark p,
.section--dark li {
  color: var(--color-white);
}

/* 浅色卡片在深色面上的取色还原 */
.card--light-in-dark {
  background-color: var(--color-paper);
  color: var(--color-text);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}
.card--light-in-dark .hl {
  color: var(--color-brand);
}
.card--light-in-dark a {
  color: var(--color-brand);
}

/* 3. 排版系统 */
.heading {
  font-weight: var(--font-weight-title);
  line-height: var(--line-height-tight);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); }
.h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-block-end: var(--gap); }
.h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); margin-block-end: 1rem; }

.para {
  max-width: 38em;
  margin-block-end: 1.25em;
}

.hl {
  color: var(--color-brand);
  font-weight: 600;
}

.masthead {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-block-end: 0.6em;
  color: var(--color-brand);
}
.section--dark .masthead {
  color: var(--color-accent);
}

/* 4. 组件：按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: 52px;
  padding-inline: 1.5em;
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}
.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border-color: var(--color-accent);
}
.btn--primary:hover {
  transform: translateY(-2px);
  background-color: #d95aae;
  border-color: #d95aae;
}
.btn--secondary {
  background-color: transparent;
  color: var(--color-text);
  border-color: var(--color-text);
}
.section--dark .btn--secondary {
  color: var(--color-white);
  border-color: var(--color-white);
}
.btn--secondary:hover {
  transform: translateY(-2px);
  background-color: rgba(31, 21, 35, 0.06);
}
.section--dark .btn--secondary:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

/* 图标尺寸 */
.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* 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)); }

.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  transition: box-shadow 0.3s ease;
}
.card:hover {
  box-shadow: 0 14px 32px -12px rgba(31, 21, 35, 0.4);
}

/* 6. 组件：表格 */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.8em 1em;
  text-align: left;
  border-bottom: 1px solid rgba(31, 21, 35, 0.15);
}
th {
  font-weight: 600;
  background-color: rgba(31, 21, 35, 0.04);
}
td strong {
  font-weight: 600;
  color: var(--color-text);
}
.section--dark th,
.section--dark td {
  border-bottom-color: rgba(255, 255, 255, 0.15);
}
.section--dark td strong {
  color: var(--color-white);
}

/* 7. 组件：FAQ (Details/Summary) */
.faq-item {
  border-bottom: 1px solid rgba(31, 21, 35, 0.15);
}
.faq-item summary {
  padding: 1.2em 0;
  cursor: pointer;
  font-weight: 600;
  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.2rem;
  transition: transform 0.2s ease;
}
.faq-item[open] summary::after {
  transform: rotate(45deg);
}
.faq-item p {
  padding-bottom: 1.2em;
  color: var(--color-text);
  opacity: 0.9;
}
.section--dark .faq-item {
  border-bottom-color: rgba(255, 255, 255, 0.15);
}
.section--dark .faq-item summary,
.section--dark .faq-item p {
  color: var(--color-white);
}

/* 8. 组件：步骤条 */
.steps {
  display: flex;
  gap: var(--gap);
  counter-reset: step-counter;
}
.step {
  flex: 1;
  min-width: 0;
  position: relative;
  padding-top: 2.5em;
}
.step__num {
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  background-color: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step__title {
  font-weight: 600;
  margin-block-end: 0.4em;
}

/* 9. 定义列表 */
.dl {
  display: grid;
  grid-template-columns: minmax(0, 200px) 1fr;
  gap: 0.8em 1.5em;
  row-gap: 1.5em;
}
.dl dt {
  font-weight: 600;
  color: var(--color-brand);
}
.dl dd {
  margin: 0;
}
.section--dark .dl dt {
  color: var(--color-accent);
}

/* 10. 页头与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background-color: var(--color-paper);
  border-bottom: 1px solid rgba(31, 21, 35, 0.1);
  transition: box-shadow 0.2s ease;
}
.site-header.scrolled {
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-weight: 700;
  font-size: 1.1rem;
}
.brand img {
  width: 28px;
  height: 28px;
}
.nav {
  display: flex;
  gap: 1.5em;
}
.nav a {
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
}
.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--color-brand);
}
.section--dark .nav a {
  color: var(--color-white);
}
.section--dark .nav a:hover,
.section--dark .nav a[aria-current="page"] {
  color: var(--color-accent);
}

.site-footer {
  background-color: var(--color-dark);
  color: var(--color-white);
  padding-block: var(--section-y);
  text-align: center;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 2em;
  margin-block-start: 2em;
  flex-wrap: wrap;
}
.footer-links a {
  font-size: 0.9rem;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.footer-links a:hover { opacity: 1; }
.copyright {
  margin-block-start: 2em;
  font-size: 0.85rem;
  opacity: 0.6;
}

/* 11. SVG 动效系统 */
.svg-panel {
  width: 100%;
  height: auto;
  max-width: 100%;
}
.svg-bg {
  fill: var(--color-dark);
}
.svg-frame {
  fill: var(--color-paper);
  stroke: rgba(31, 21, 35, 0.15);
  stroke-width: 1.5;
}
.svg-ui-fill {
  fill: rgba(31, 21, 35, 0.06);
}
.svg-ui-stroke {
  stroke: var(--color-text);
  stroke-width: 1.5;
  fill: none;
}
.svg-accent {
  stroke: var(--color-accent);
  stroke-width: 1.5;
  fill: none;
}
.svg-brand {
  stroke: var(--color-brand);
  stroke-width: 1.5;
  fill: none;
}

/* 路径自绘与呼吸动画 */
.draw-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 6s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}
.float-element {
  animation: gentleFloat 5s ease-in-out infinite alternate;
}
.breathe-dot {
  animation: breathe 4s ease-in-out infinite;
}

@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  20% { stroke-dashoffset: 0; }
  80% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
@keyframes gentleFloat {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* 变换中心设置 */
.animate-center {
  transform-box: fill-box;
  transform-origin: center;
}

/* 12. 响应式适配 */
@media (max-width: 768px) {
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
  .steps { flex-direction: column; }
  .dl { grid-template-columns: 1fr; gap: 0.4em 0; }
  .nav { display: none; } /* 移动端简化处理，实际项目可加汉堡菜单，此处保持静态结构 */
  .header-inner { padding: 0.5em 0; }
}

/* 13. 减少动态效果 */
@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;
  }
  .draw-path, .float-element, .breathe-dot {
    animation: none !important;
    stroke-dashoffset: 0 !important;
    opacity: 1 !important;
  }
}
