/* =========================================
   SafeW 全站共享样式
   ========================================= */

:root {
  /* 色板 */
  --bg-dark: #21163C;
  --bg-paper: #E9E8EA;
  --text-main: #191523;
  --brand: #5214EB;
  --accent: #ED926E;

  /* 设计 Token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border-color: rgba(25, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;
  
  /* 排版 */
  --font-title-lh: 1.15;
  --font-body-lh: 1.55;
  --font-size-h1: clamp(2.6rem, 6.4vw, 5rem);
  --font-size-h2: clamp(1.6rem, 3vw, 2.2rem);
  --font-size-body: 1rem;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: var(--font-size-body);
  line-height: var(--font-body-lh);
  color: var(--text-main);
  background-color: var(--bg-paper);
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* =========================================
   布局容器
   ========================================= */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section {
  padding-block: var(--section-y);
  position: relative;
}

.section-divider {
  height: 1px;
  background-color: var(--card-border-color);
  margin-block: var(--section-y);
}

.surface-dark {
  background-color: var(--bg-dark);
  color: var(--bg-paper);
}

.surface-dark .hl {
  color: var(--accent);
}

.surface-dark .eyebrow {
  color: var(--accent);
}

.surface-dark a:not(.btn) {
  color: var(--bg-paper);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.surface-dark a:not(.btn):hover {
  color: var(--accent);
}

.surface-paper {
  background-color: var(--bg-paper);
  color: var(--text-main);
}

.surface-paper .hl {
  color: var(--brand);
}

.surface-paper .eyebrow {
  color: var(--brand);
}

.surface-paper a:not(.btn) {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* 浅色卡片在深色面上恢复纸面取色 */
.card-light {
  background-color: var(--bg-paper);
  color: var(--text-main);
  border-radius: var(--radius-card);
  border: var(--card-border-color);
  padding: var(--gap);
}

/* =========================================
   排版组件
   ========================================= */
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

h1 {
  font-size: var(--font-size-h1);
  font-weight: 500;
  line-height: var(--font-title-lh);
  letter-spacing: -0.02em;
  margin-bottom: var(--gap);
  text-wrap: balance;
}

h2 {
  font-size: var(--font-size-h2);
  font-weight: 500;
  line-height: var(--font-title-lh);
  margin-bottom: var(--gap);
  text-wrap: balance;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
  max-width: 38em;
}

.text-center { text-align: center; }
.text-left { text-align: left; }

.hl {
  font-weight: 600;
}

/* =========================================
   按钮
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 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, color 0.2s ease;
}

.btn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.btn-primary {
  background-color: var(--accent);
  color: var(--bg-dark);
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(0.95);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--text-main);
  color: var(--text-main);
}

.surface-dark .btn-secondary {
  border-color: var(--bg-paper);
  color: var(--bg-paper);
}

.btn-secondary:hover {
  transform: translateY(-1px);
  background-color: rgba(128, 128, 128, 0.1);
}

/* =========================================
   卡片与网格
   ========================================= */
.card {
  background-color: var(--bg-paper);
  color: var(--text-main);
  border-radius: var(--radius-card);
  border: var(--card-border-color);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
}

.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);
}

/* =========================================
   表格
   ========================================= */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--card-border-color);
}

th {
  font-weight: 600;
  background-color: rgba(0,0,0,0.03);
}

td strong {
  font-weight: 600;
}

/* =========================================
   FAQ (Details/Summary)
   ========================================= */
details {
  border-bottom: 1px solid var(--card-border-color);
  padding: 1rem 0;
}

summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 4px;
  background-color: var(--brand);
  color: white;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.surface-dark summary::before {
  background-color: var(--accent);
  color: var(--bg-dark);
}

details[open] summary::before {
  content: "−";
}

details p {
  margin-top: 0.75rem;
  margin-left: 1.75rem;
  color: var(--text-main);
}

.surface-dark details p {
  color: var(--bg-paper);
}

/* =========================================
   页头与页脚
   ========================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(233, 232, 234, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--card-border-color);
}

.surface-dark .site-header {
  background-color: rgba(33, 22, 60, 0.9);
  border-bottom-color: rgba(233, 232, 234, 0.15);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand img {
  height: 32px;
  width: auto;
}

nav ul {
  display: flex;
  gap: 1.5rem;
}

nav a {
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.25rem 0;
  position: relative;
}

nav a:hover, nav a[aria-current="page"] {
  color: var(--brand);
}

.surface-dark nav a:hover, .surface-dark nav a[aria-current="page"] {
  color: var(--accent);
}

.site-footer {
  background-color: var(--bg-dark);
  color: var(--bg-paper);
  padding: var(--section-y) 0;
  border-top: 1px solid rgba(233, 232, 234, 0.15);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  align-items: center;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: var(--bg-paper);
  opacity: 0.8;
  transition: opacity 0.2s;
}

.footer-links a:hover {
  opacity: 1;
  color: var(--accent);
}

/* =========================================
   SVG 动效基础
   ========================================= */
.svg-container {
  width: 100%;
  height: auto;
  max-width: 100%;
  overflow: visible;
}

svg {
  width: 100%;
  height: auto;
}

/* 旋转/缩放子元素中心对齐 */
svg g[class*="anim"], svg path[class*="anim"], svg rect[class*="anim"] {
  transform-box: fill-box;
  transform-origin: center;
}

/* 描边自绘路径默认状态 */
.draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

/* =========================================
   @keyframes 动画定义
   ========================================= */
/* 气泡浮现与漂浮 */
@keyframes float-bubble {
  0%, 100% { transform: translateY(0); opacity: 0.85; }
  50% { transform: translateY(-6px); opacity: 1; }
}

/* 输入三点呼吸 */
@keyframes breathe-dot {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* 通知卡片滑入 */
@keyframes slide-in-toast {
  0%, 100% { transform: translateX(10px); opacity: 0; }
  10%, 90% { transform: translateX(0); opacity: 1; }
}

/* 连接线流动 */
@keyframes dash-flow {
  to { stroke-dashoffset: -1; }
}

/* 同心轨道呼吸 */
@keyframes orbit-breathe {
  0%, 100% { transform: scale(0.95); opacity: 0.4; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

/* 应用类绑定 */
.anim-float { animation: float-bubble 4s ease-in-out infinite; }
.anim-float-delay-1 { animation: float-bubble 4s ease-in-out infinite 1.3s; }
.anim-float-delay-2 { animation: float-bubble 4s ease-in-out infinite 2.6s; }

.anim-breathe-1 { animation: breathe-dot 2.4s ease-in-out infinite; }
.anim-breathe-2 { animation: breathe-dot 2.4s ease-in-out infinite 0.8s; }
.anim-breathe-3 { animation: breathe-dot 2.4s ease-in-out infinite 1.6s; }

.anim-slide-in { animation: slide-in-toast 6s ease-in-out infinite; }

.anim-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: dash-flow 1.5s linear infinite;
}

.anim-orbit {
  animation: orbit-breathe 8s ease-in-out infinite;
}

/* =========================================
   响应式与无障碍
   ========================================= */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  nav { display: none; } /* 移动端简化导航，实际项目可加汉堡菜单，此处保持静态结构 */
  h1 { font-size: clamp(2rem, 8vw, 3.2rem); }
}

@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;
  }
  .draw { stroke-dashoffset: 0 !important; }
}
