/* ========================================
   SafeW 全站共享样式
   ======================================== */

/* --- 设计 Token 与色板 --- */
:root {
  /* 基础色板 */
  --bg-dark: #121531;
  --bg-paper: #E8E9EA;
  --text-body: #151723;
  --brand: #142CEB;
  --accent: #ED7D6E;

  /* 结构 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 2px solid var(--text-body);
  --card-shadow: 4px 4px 0 var(--text-body);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;

  /* 排版 Token */
  --font-main: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --line-height-body: 1.75;
}

/* --- 重置与基础 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: var(--line-height-body);
  color: var(--text-body);
  background: var(--bg-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* --- 页面背景上下文变量控制 --- */
.surface--paper {
  background: var(--bg-paper);
  color: var(--text-body);
}
.surface--dark {
  background: var(--bg-dark);
  color: var(--bg-paper);
}
/* 深色面上的浅色卡片恢复纸面取色 */
.surface--dark .card {
  border-color: var(--bg-paper);
  box-shadow: 4px 4px 0 var(--bg-paper);
  background: var(--bg-paper);
  color: var(--text-body);
}
/* 深色面上的强调词与眉标使用强调色 */
.surface--dark .hl { color: var(--accent); }
.surface--dark .badge { color: var(--accent); }
.surface--dark .link-accent { color: var(--accent); }

/* --- 布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

/* --- 排版组件 --- */
.badge {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5em;
  display: inline-block;
}
.hl { font-weight: 600; }
.link-accent { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin-bottom: 0.6em;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin-bottom: 0.5em;
}
h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0.4em;
}
p { margin-bottom: 1em; max-width: 38em; }
p:last-child { margin-bottom: 0; }

/* --- 按钮系统 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: 52px;
  padding: 0 1.8em;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
  border: none;
  white-space: nowrap;
}
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.btn:hover { transform: translateY(-2px); }

.btn--primary {
  background: var(--accent);
  color: var(--bg-dark);
}
.btn--primary:hover { background: #d96b5c; }

.btn--secondary {
  background: transparent;
  border: 2px solid var(--text-body);
  color: var(--text-body);
}
.btn--secondary:hover { background: rgba(0,0,0,0.05); }
.surface--dark .btn--secondary {
  border-color: var(--bg-paper);
  color: var(--bg-paper);
}
.surface--dark .btn--secondary:hover { background: rgba(255,255,255,0.08); }

/* --- 卡片系统 --- */
.card {
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  background: var(--bg-paper);
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-2px); }
.card-grid {
  display: grid;
  gap: var(--gap);
}
.card-grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); }
.card-grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }

/* --- 表格系统 --- */
.table-wrapper { overflow-x: auto; margin: var(--gap) 0; border: var(--card-border); border-radius: var(--radius-card); }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-paper);
  color: var(--text-body);
}
th, td {
  padding: 1rem 1.2rem;
  text-align: left;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
th { font-weight: 600; background: rgba(0,0,0,0.03); }
td:first-child { font-weight: 600; }

/* --- FAQ 系统 --- */
.faq-list { display: flex; flex-direction: column; gap: 0.8rem; }
.faq-item details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  background: var(--bg-paper);
  padding: 1.2rem 1.4rem;
  transition: box-shadow 0.2s ease;
}
.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 2rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 400;
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}
.faq-item details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq-item details[open] { box-shadow: var(--card-shadow); }
.faq-item p { margin-top: 0.8rem; font-size: 0.95rem; }

/* --- 步骤列表 --- */
.step-list { counter-reset: step; }
.step-list li {
  counter-increment: step;
  display: flex;
  gap: 1rem;
  margin-bottom: 1.2rem;
  align-items: flex-start;
}
.step-list li::before {
  content: "" counter(step);
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: var(--bg-dark);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

/* --- 新闻卡片 --- */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: var(--gap);
}
.news-card {
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  background: var(--bg-paper);
  display: flex;
  flex-direction: column;
  height: 100%;
}
.news-card time {
  font-size: 0.85rem;
  color: var(--brand);
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.news-card h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  line-height: 1.4;
}
.news-card p { font-size: 0.95rem; flex-grow: 1; }

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(232, 233, 234, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.surface--dark .site-header { background: rgba(18, 21, 49, 0.95); border-bottom-color: rgba(255,255,255,0.08); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.brand { display: flex; align-items: center; gap: 0.8rem; font-weight: 700; font-size: 1.2rem; }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.nav { display: flex; gap: 1.5rem; align-items: center; }
.nav a { font-weight: 500; font-size: 0.95rem; position: relative; }
.nav a[aria-current="page"] { color: var(--brand); }
.surface--dark .nav a[aria-current="page"] { color: var(--accent); }
.nav a:hover { opacity: 0.8; }
.nav__cta { margin-left: 0.5rem; }

.site-footer {
  padding: 3rem 0;
  border-top: 1px solid rgba(0,0,0,0.08);
  font-size: 0.9rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
}
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.footer-links a:hover { text-decoration: underline; }

/* --- SVG 动效 Keyframes --- */
@keyframes star-twinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}
@keyframes draw-line {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes float-bubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes typing-dot {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.9); }
  30% { opacity: 1; transform: scale(1.1); }
}
@keyframes slide-in-notif {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.6; }
  50% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.6; }
}

/* --- 动效类绑定 --- */
.anim-star { animation: star-twinkle 4s ease-in-out infinite alternate; }
.anim-star--delay1 { animation-delay: 1.2s; }
.anim-star--delay2 { animation-delay: 2.5s; }
.anim-line { stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw-line 6s linear infinite alternate; }
.anim-float { animation: float-bubble 5s ease-in-out infinite; }
.anim-float--slow { animation-duration: 7s; }
.anim-typing { animation: typing-dot 1.5s ease-in-out infinite; }
.anim-typing--2 { animation-delay: 0.2s; }
.anim-typing--3 { animation-delay: 0.4s; }
.anim-slide { animation: slide-in-notif 4s ease-out forwards; }
.anim-pulse { animation: pulse-ring 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

/* --- 响应式与无障碍 --- */
@media (max-width: 768px) {
  .nav { display: none; }
  .card-grid--2, .card-grid--3, .news-grid { grid-template-columns: 1fr; }
  .hero-layout { flex-direction: column; }
  .hero-text { max-width: 100%; }
  .hero-visual { width: 100%; max-width: 400px; margin-top: var(--gap); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}
