/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 1. 设计变量 (Design Tokens) --- */
:root {
  /* 色板：严格取自品牌指定颜色 */
  --color-dark: #231334;
  --color-paper: #E9E8EA;
  --color-body: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;

  /* 圆角 */
  --radius-card: 20px;
  --radius-btn: 12px;
  --radius-badge: 6px;

  /* 卡片边界与阴影（硬阴影风格） */
  --card-border: 2px solid var(--color-body);
  --card-shadow: 4px 4px 0 var(--color-body);

  /* 节奏与密度 */
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;

  /* 字体 */
  --font-sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

/* --- 2. 面与取色系统 (Faces & Color Context) --- */
/* 纸面取色（默认） */
body {
  background-color: var(--color-paper);
  color: var(--color-body);
}

/* 深色面覆盖 */
.dark-face {
  background-color: var(--color-dark);
  color: var(--color-paper);
}

/* 深色面上的链接、强调词使用强调色 */
.dark-face .hl,
.dark-face a:not(.btn) {
  color: var(--color-accent);
}

/* 纸面上的强调词使用品牌色 */
.paper-face .hl,
.paper-face a:not(.btn) {
  color: var(--color-brand);
}

/* 眉标统一样式 */
.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  padding-left: 0.5rem;
  border-left: 3px solid;
}
.paper-face .section-label {
  color: var(--color-brand);
  border-color: var(--color-brand);
}
.dark-face .section-label {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* --- 3. 基础排版 (Typography) --- */
html {
  box-sizing: border-box;
  scroll-behavior: smooth;
}
*, *::before, *::after {
  box-sizing: inherit;
}
body {
  font-family: var(--font-sans);
  line-height: 1.75;
  font-size: 16px;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

/* 标题层级 */
h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0.5em 0 0.6em;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  margin-top: 0;
  margin-bottom: var(--gap);
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.6em;
  line-height: 1.3;
}
p {
  margin: 0 0 1em;
  max-width: 38em;
}
strong {
  font-weight: 700;
}

/* 容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gap);
  padding-right: var(--gap);
}

/* 区块间距 */
.section-wrapper {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

/* --- 4. 组件：按钮 (Buttons) --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  border: 2px solid transparent;
}
.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.btn:hover {
  transform: translateY(-2px);
}

/* 主按钮：强调色底 + 深色面色文字 */
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover {
  filter: brightness(1.05);
}

/* 次按钮：描边样式 */
.btn-secondary {
  background-color: transparent;
}
.paper-face .btn-secondary {
  color: var(--color-body);
  border-color: var(--color-body);
}
.dark-face .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}
.btn-secondary:hover {
  filter: brightness(0.9);
}

/* --- 5. 组件：卡片 (Cards) --- */
.card {
  background-color: var(--color-paper);
  color: var(--color-body);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  transition: transform 0.2s ease;
}
.dark-face .card {
  /* 深色面上的浅色卡片恢复纸面取色 */
  background-color: var(--color-paper);
  color: var(--color-body);
  border-color: var(--color-body);
  box-shadow: 4px 4px 0 var(--color-body);
}
.card:hover {
  transform: translateY(-4px);
}

/* --- 6. 组件：表格 (Tables) --- */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-card);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  background-color: var(--color-paper);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px; /* 防止表格过窄挤压 */
}
th, td {
  text-align: left;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-body);
}
th {
  font-weight: 700;
  background-color: rgba(0,0,0,0.03);
}
tr:last-child td {
  border-bottom: none;
}
.dark-face .table-responsive {
  background-color: var(--color-paper);
  border-color: var(--color-body);
  box-shadow: 4px 4px 0 var(--color-body);
}

/* --- 7. 组件：FAQ (Details/Summary) --- */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 1rem;
  background-color: var(--color-paper);
  color: var(--color-body);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}
details[open] {
  border-color: var(--color-brand);
}
.summary {
  padding: 1rem 1.25rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.summary::-webkit-details-marker {
  display: none;
}
.summary::after {
  content: "+";
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1;
  transition: transform 0.2s ease;
}
details[open] .summary::after {
  transform: rotate(45deg);
}
.details-content {
  padding: 0 1.25rem 1.25rem;
  line-height: 1.7;
}
.dark-face details {
  background-color: var(--color-paper);
  color: var(--color-body);
  border-color: var(--color-body);
  box-shadow: 4px 4px 0 var(--color-body);
}

/* --- 8. 页头与页脚 (Header & Footer) --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(233, 232, 234, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(28, 21, 35, 0.1);
  padding: 0.75rem 0;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--color-body);
  font-weight: 800;
  font-size: 1.1rem;
}
.brand-logo img {
  height: 32px;
  width: auto;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  text-decoration: none;
  color: var(--color-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.25rem 0;
  position: relative;
}
.nav-links a:hover,
.nav-links [aria-current="page"] {
  color: var(--color-brand);
}
.nav-links [aria-current="page"]::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background-color: var(--color-brand);
}
@media (max-width: 768px) {
  .nav-links { display: none; } /* 移动端简化处理 */
}

.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;
  align-items: center;
  text-align: center;
}
.footer-nav {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-nav a {
  color: var(--color-paper);
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.8;
}
.footer-nav a:hover {
  opacity: 1;
  color: var(--color-accent);
}
.footer-copy {
  font-size: 0.85rem;
  opacity: 0.6;
  margin-top: 1rem;
}

/* --- 9. SVG 动效 (CSS Animations) --- */
/* 减少动态效果偏好 */
@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;
  }
}

/* 星点明灭 */
@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}
.anim-twinkle {
  animation: twinkle 4s ease-in-out infinite;
}
.anim-twinkle-delayed {
  animation: twinkle 4s ease-in-out infinite;
  animation-delay: 2s;
}

/* 气泡浮动 */
@keyframes floatBubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.anim-float {
  animation: floatBubble 5s ease-in-out infinite;
}
.anim-float-delayed {
  animation: floatBubble 5s ease-in-out infinite;
  animation-delay: 1.5s;
}

/* 输入框呼吸点 */
@keyframes breatheDot {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}
.anim-breathe {
  animation: breatheDot 2s ease-in-out infinite;
}
.anim-breathe-delayed {
  animation: breatheDot 2s ease-in-out infinite;
  animation-delay: 0.6s;
}
.anim-breathe-late {
  animation: breatheDot 2s ease-in-out infinite;
  animation-delay: 1.2s;
}

/* 连线绘制 */
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.anim-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 3s ease-out forwards;
}

/* 通知卡片滑入 */
@keyframes slideInCard {
  0% { transform: translateX(20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
.anim-slide-in {
  animation: slideInCard 4s ease-out infinite alternate;
}

/* --- 10. 工具类与布局辅助 --- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: var(--gap);
}
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.flex-col { display: flex; flex-direction: column; }
.gap-1 { gap: 1rem; }

/* 列表样式 */
ul.styled-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
ul.styled-list li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.5rem;
}
ul.styled-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 6px;
  background-color: var(--color-brand);
  border-radius: 50%;
}
.dark-face ul.styled-list li::before {
  background-color: var(--color-accent);
}

/* 步骤编号徽标 */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background-color: var(--color-accent);
  color: var(--color-dark);
  font-weight: 800;
  border-radius: var(--radius-badge);
  margin-right: 0.75rem;
  flex-shrink: 0;
}
.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* 提示框 */
.callout {
  border-left: 4px solid var(--color-brand);
  padding: 1rem 1.25rem;
  background-color: rgba(125, 20, 235, 0.05);
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
  margin: 1.5rem 0;
}
.dark-face .callout {
  border-left-color: var(--color-accent);
  background-color: rgba(237, 210, 110, 0.1);
}

/* SVG 尺寸控制 */
.svg-container {
  width: 100%;
  height: auto;
  max-width: 100%;
}
.svg-container svg {
  width: 100%;
  height: auto;
  display: block;
}
