/* ========================================
   SafeW 全站共享样式
   ======================================== */

/* --- 设计 Token --- */
:root {
  /* 配色 */
  --color-dark: #17203F;
  --color-paper: #FCFCFD;
  --color-body: #151823;
  --color-brand: #1441EB;
  --color-accent: #6EEDBD;
  --color-body-rgb: 21, 24, 35;

  /* 边界与圆角 */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 1px solid rgba(var(--color-body-rgb), 0.16);
  --card-shadow: none;

  /* 节奏与密度 */
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;
  --line-height-base: 1.65;

  /* 字体 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- 基础重置 --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--line-height-base);
  color: var(--color-body);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* --- 上下文取色变量 --- */
.surface-light {
  background: var(--color-paper);
  color: var(--color-body);
}
.surface-light .hl { color: var(--color-brand); }
.surface-light .label-tag { color: var(--color-brand); }
.surface-light .link-accent { color: var(--color-brand); }

.surface-dark {
  background: var(--color-dark);
  color: var(--color-paper);
}
.surface-dark .hl { color: var(--color-accent); }
.surface-dark .label-tag { color: var(--color-accent); }
.surface-dark .link-accent { color: var(--color-accent); }

/* 浅色卡片在深色面上恢复纸面取色 */
.surface-dark .card {
  background: var(--color-paper);
  color: var(--color-body);
  border: var(--card-border);
  border-radius: var(--radius-card);
}
.surface-dark .card .hl { color: var(--color-brand); }
.surface-dark .card .label-tag { color: var(--color-brand); }

/* --- 排版系统 --- */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.section {
  padding-block: var(--section-y);
}

.label-tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 1.25rem;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
  max-width: 38em;
}

.text-balance {
  text-wrap: balance;
}

/* --- 布局网格 --- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
  align-items: center;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

/* --- 组件：按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 52px;
  padding-inline: 1.5rem;
  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;
}

.btn:focus-visible {
  outline: 3px solid var(--color-brand);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border: none;
}
.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(0.95);
}

.btn-secondary {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
}
.btn-secondary:hover {
  background: rgba(var(--color-body-rgb), 0.05);
  transform: translateY(-1px);
}
.surface-dark .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}
.surface-dark .btn-secondary:hover {
  background: rgba(252, 252, 253, 0.1);
}

/* --- 组件：卡片 --- */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
}

/* --- 组件：表格 --- */
.table-wrap {
  overflow-x: auto;
  border: var(--card-border);
  border-radius: var(--radius-card);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(var(--color-body-rgb), 0.12);
}
th {
  font-weight: 600;
  background: rgba(var(--color-body-rgb), 0.04);
}
tr:last-child td {
  border-bottom: none;
}

/* --- 组件：FAQ Details --- */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 0.75rem;
  background: var(--color-paper);
}
summary {
  padding: 1rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-left: 1.5rem;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
}
details[open] summary::after {
  content: "−";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
}
details p {
  padding: 0 1rem 1rem 1.5rem;
  margin: 0;
  color: inherit;
}

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252, 252, 253, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(var(--color-body-rgb), 0.1);
}
.surface-dark .site-header {
  background: rgba(23, 32, 63, 0.9);
  border-bottom-color: rgba(252, 252, 253, 0.1);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.1rem;
}
.logo img {
  width: 28px;
  height: 28px;
}
.nav-list {
  display: flex;
  gap: 1.5rem;
}
.nav-link {
  font-weight: 500;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.nav-link:hover, .nav-link[aria-current="page"] {
  opacity: 1;
}
.nav-link[aria-current="page"] {
  border-bottom: 2px solid currentColor;
}

.site-footer {
  padding: 3rem 0;
  border-top: 1px solid rgba(var(--color-body-rgb), 0.1);
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.85;
}

/* --- SVG 基础与动效 --- */
.svg-icon {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-visual, .panel-visual {
  width: 100%;
  height: auto;
}

/* 描边自绘 */
@keyframes draw-line {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}
.anim-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 6s ease-in-out infinite;
}

/* 呼吸 */
@keyframes breathe {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
.anim-breathe {
  animation: breathe 4s ease-in-out infinite;
}

/* 漂浮 */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.anim-float {
  animation: float 5s ease-in-out infinite;
}

/* 滑入 */
@keyframes slide-in {
  0%, 100% { transform: translateX(0); opacity: 0.85; }
  50% { transform: translateX(4px); opacity: 1; }
}
.anim-slide {
  animation: slide-in 7s ease-in-out infinite;
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- 响应式适配 --- */
@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .nav-list { display: none; }
  h1 { font-size: clamp(1.8rem, 6vw, 2.8rem); }
}
