/* SafeW 全站共享样式 */
:root {
  /* 色板 */
  --color-dark: #19102D;
  --color-paper: #F4F3F7;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #D66EED;

  /* 结构性约束 Token */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;

  /* 排版变量 */
  --h1-size: clamp(2.2rem, 5vw, 3.8rem);
  --h2-size: clamp(1.6rem, 3vw, 2.4rem);
  --body-size: clamp(1rem, 1.1vw, 1.125rem);
  --label-size: 0.8rem;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  background-color: var(--color-paper);
  color: var(--color-text);
  line-height: 1.55;
  font-size: var(--body-size);
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

/* 布局容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section-wrapper {
  padding-block: var(--section-y);
  position: relative;
}

.surface-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}

.surface-dark .label {
  color: var(--color-accent);
}

.surface-dark .hl {
  color: var(--color-accent);
}

.surface-dark .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.surface-dark .card {
  background-color: var(--color-paper);
  color: var(--color-text);
  border-color: var(--color-text);
  box-shadow: var(--card-shadow);
}

.surface-dark .divider {
  border-color: rgba(244, 243, 247, 0.15);
}

.divider {
  border: none;
  border-top: 1px solid rgba(25, 21, 35, 0.12);
  margin: var(--section-y) 0;
}

/* 排版组件 */
.label {
  display: inline-block;
  font-size: var(--label-size);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: 0.75rem;
}

h1 {
  font-size: var(--h1-size);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  text-wrap: balance;
}

h2 {
  font-size: var(--h2-size);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
  margin-top: var(--section-y);
  margin-bottom: 1.5rem;
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

p {
  max-width: 38em;
  margin-bottom: 1rem;
}

.hl {
  color: var(--color-brand);
}

/* 按钮系统 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  height: 52px;
  padding: 0 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: 2px solid var(--color-accent);
}

.btn-primary:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text);
  border: 2px solid var(--color-text);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  background-color: rgba(25, 21, 35, 0.05);
}

.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* 卡片与面板 */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  margin-bottom: var(--gap);
  border-radius: var(--radius-card);
}

.panel {
  background-color: var(--color-dark);
  border-radius: var(--radius-card);
  padding: var(--gap);
  margin-bottom: var(--gap);
}

/* 表格 */
.table-wrapper {
  overflow-x: auto;
  margin-bottom: var(--gap);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--color-text);
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: 700;
  background-color: rgba(25, 21, 35, 0.04);
}

td a {
  color: var(--color-brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 列表与步骤 */
.step-list {
  list-style: none;
  counter-reset: step-counter;
}

.step-item {
  counter-increment: step-counter;
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: flex-start;
}

.step-num {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-accent);
  color: var(--color-dark);
  font-weight: 800;
  font-size: 1rem;
  border-radius: var(--radius-card);
}

.tip-list {
  list-style: none;
  counter-reset: tip-counter;
}

.tip-item {
  counter-increment: tip-counter;
  margin-bottom: 1rem;
  padding-left: 2rem;
  position: relative;
}

.tip-item::before {
  content: counter(tip-counter) ".";
  position: absolute;
  left: 0;
  font-weight: 700;
  color: var(--color-brand);
}

/* FAQ */
.faq-item {
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  margin-bottom: var(--gap);
  border-radius: var(--radius-card);
  overflow: hidden;
}

details {
  width: 100%;
  border: none;
  box-shadow: none;
  margin: 0;
  padding: 0;
}

summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  font-size: 1.25rem;
  font-weight: 400;
  transition: transform 0.2s;
}

details[open] summary::after {
  transform: rotate(45deg);
}

details[open] summary {
  border-bottom: 1px solid var(--color-text);
}

.faq-answer {
  padding: 1rem 1.25rem;
  line-height: 1.6;
}

/* 网格布局 */
.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: stretch;
}

.flex-col {
  flex: 1 1 0;
  min-width: 0;
}

/* 导航与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  transition: background-color 0.2s, border-color 0.2s;
}

.site-header.scrolled {
  background-color: rgba(244, 243, 247, 0.95);
  backdrop-filter: blur(8px);
  border-bottom-color: rgba(25, 21, 35, 0.2);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}

.logo img {
  width: 32px;
  height: 32px;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
}

.nav-links a:hover {
  color: var(--color-brand);
}

.nav-links a[aria-current="page"] {
  color: var(--color-brand);
  font-weight: 700;
}

.nav-links a[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--color-brand);
}

.site-footer {
  background-color: var(--color-dark);
  color: var(--color-paper);
  padding: 3rem 0;
  margin-top: var(--section-y);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.footer-nav {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-nav a {
  opacity: 0.8;
  transition: opacity 0.2s;
}

.footer-nav a:hover {
  opacity: 1;
}

.copyright {
  font-size: 0.875rem;
  opacity: 0.6;
}

/* SVG 动效核心 */
.svg-container {
  width: 100%;
  height: auto;
  max-width: 100%;
}

.anim-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawPath 4s ease-in-out infinite alternate;
}

.anim-float {
  animation: floatBubble 5s ease-in-out infinite;
}

.anim-pulse {
  animation: pulseDot 3s ease-in-out infinite;
}

.anim-slide-in {
  animation: slideInCard 6s ease-in-out infinite alternate;
}

@keyframes drawPath {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

@keyframes floatBubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}

@keyframes slideInCard {
  0% { transform: translateX(-10px); opacity: 0.8; }
  100% { transform: translateX(0); opacity: 1; }
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  .anim-draw, .anim-float, .anim-pulse, .anim-slide-in {
    animation: none !important;
  }
  html { scroll-behavior: auto; }
}

/* 响应式适配 */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .flex-row { flex-direction: column; }
  h1 { font-size: clamp(1.8rem, 6vw, 2.8rem); }
  h2 { font-size: clamp(1.4rem, 4vw, 2rem); }
}
