/* =========================================
   SafeW 全局样式 / Design Tokens & Base
   ========================================= */
:root {
  /* 色板 */
  --color-dark: #121531;
  --color-paper: #E8E9EA;
  --color-text: #151723;
  --color-brand: #142CEB;
  --color-accent: #ED7D6E;
  --color-white: #ffffff;

  /* 圆角与阴影 */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);

  /* 节奏与密度 */
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;
  --line-height-base: 1.75;

  /* 字体 */
  --font-sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background: var(--color-paper);
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* =========================================
   布局系统 / Layout
   ========================================= */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--color-paper);
  border-right: 1px solid rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  z-index: 10;
}
.sidebar-logo { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 2rem; }
.sidebar-logo img { width: 32px; height: 32px; object-fit: contain; }
.sidebar-logo span { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em; }
.nav-list { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.nav-item a {
  display: block; padding: 0.6rem 0.8rem; border-radius: 12px; font-size: 0.95rem; font-weight: 500; color: var(--color-text); transition: background 0.2s;
}
.nav-item a:hover, .nav-item a[aria-current="page"] { background: rgba(0,0,0,0.04); }
.nav-item a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
.sidebar-footer { font-size: 0.8rem; color: rgba(0,0,0,0.4); margin-top: auto; }

.content-area {
  padding: 0 2rem 4rem;
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
  overflow-x: hidden;
}

/* 移动端顶部导航 */
.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--color-paper);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 0.75rem 1rem;
  justify-content: space-between;
  align-items: center;
}
.mobile-menu-btn { background: none; border: none; cursor: pointer; padding: 0.5rem; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-header { display: flex; }
  .content-area { padding: 0 1rem 3rem; }
  .nav-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 30;
  }
  .nav-overlay.open { display: flex; align-items: flex-start; justify-content: flex-end; padding: 1rem; }
  .mobile-nav-panel {
    background: var(--color-paper); width: 280px; max-height: 80vh; overflow-y: auto; border-radius: 16px; padding: 1.5rem; box-shadow: var(--card-shadow);
  }
}

/* =========================================
   色彩面系统 / Surface Layers
   ========================================= */
.paper-surface { background: var(--color-paper); color: var(--color-text); }
.paper-surface h1, .paper-surface h2, .paper-surface h3, .paper-surface p, .paper-surface li, .paper-surface td, .paper-surface th { color: var(--color-text); }
.paper-surface .hl, .paper-surface .micro-tag, .paper-surface a:not(.btn) { color: var(--color-brand); }
.paper-surface .btn-primary { background: var(--color-accent); color: var(--color-dark); }
.paper-surface .btn-secondary { border: 2px solid var(--color-text); color: var(--color-text); }

.dark-surface { background: var(--color-dark); color: var(--color-paper); }
.dark-surface h1, .dark-surface h2, .dark-surface h3, .dark-surface p, .dark-surface li, .dark-surface td, .dark-surface th { color: var(--color-paper); }
.dark-surface .hl, .dark-surface .micro-tag, .dark-surface a:not(.btn) { color: var(--color-accent); }
.dark-surface .btn-primary { background: var(--color-accent); color: var(--color-dark); }
.dark-surface .btn-secondary { border: 2px solid var(--color-paper); color: var(--color-paper); }
.dark-surface .card-light { background: var(--color-paper); color: var(--color-text); border: var(--card-border); box-shadow: var(--card-shadow); }
.dark-surface .card-light h1, .dark-surface .card-light h2, .dark-surface .card-light h3, .dark-surface .card-light p, .dark-surface .card-light li { color: var(--color-text); }
.dark-surface .card-light .hl, .dark-surface .card-light .micro-tag, .dark-surface .card-light a { color: var(--color-brand); }

/* =========================================
   排版 / Typography
   ========================================= */
.micro-tag {
  display: inline-block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.75rem;
}
.section-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 500; line-height: 1.25; margin-bottom: var(--gap); letter-spacing: -0.01em;
}
.hero-title {
  font-size: clamp(2.6rem, 6.4vw, 5rem); font-weight: 500; line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 1rem;
  text-wrap: balance;
}
.hero-subtitle {
  font-size: clamp(1rem, 1.2vw, 1.15rem); line-height: 1.7; max-width: 600px; margin-bottom: 2rem; opacity: 0.9;
}
p { margin-bottom: 1.25rem; max-width: 38em; }
h3 { font-size: 1.25rem; font-weight: 600; margin: 1.5rem 0 0.75rem; line-height: 1.3; }
ul.styled-list { padding-left: 1.25rem; margin-bottom: 1.5rem; }
ul.styled-list li { position: relative; padding-left: 0.5rem; margin-bottom: 0.5rem; }
ul.styled-list li::before { content: ""; position: absolute; left: -1.25rem; top: 0.6em; width: 6px; height: 6px; background: var(--color-brand); border-radius: 50%; }
.dark-surface ul.styled-list li::before { background: var(--color-accent); }

/* =========================================
   组件 / Components
   ========================================= */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.85rem 1.75rem; font-size: 1rem; font-weight: 600; border-radius: var(--radius-btn); cursor: pointer; transition: transform 0.2s, opacity 0.2s; border: none;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.btn-icon { width: 20px; height: 20px; stroke-width: 2; }

.card {
  background: var(--color-paper); border: var(--card-border); border-radius: var(--radius-card); padding: 1.5rem; box-shadow: var(--card-shadow); margin-bottom: var(--gap);
}
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--gap); }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 1.5rem; }
table { width: 100%; border-collapse: collapse; min-width: 400px; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.1); }
th { font-weight: 600; }
.dark-surface th, .dark-surface td { border-bottom-color: rgba(255,255,255,0.15); }

details { border: var(--card-border); border-radius: var(--radius-card); margin-bottom: 1rem; overflow: hidden; }
summary { padding: 1rem 1.25rem; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.2rem; font-weight: 400; }
details[open] summary::after { content: "−"; }
details > div { padding: 0 1.25rem 1.25rem; line-height: 1.7; }

.step-row { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.25rem; }
.step-num { flex-shrink: 0; width: 32px; height: 32px; background: var(--color-accent); color: var(--color-dark); font-weight: 700; display: grid; place-items: center; border-radius: 8px; font-size: 0.9rem; }
.dark-surface .step-num { background: var(--color-accent); color: var(--color-dark); }

.news-card { display: flex; flex-direction: column; gap: 0.75rem; }
.news-date { font-size: 0.8rem; font-weight: 600; opacity: 0.7; }

/* =========================================
   SVG 动效 / Animations
   ========================================= */
.svg-container { width: 100%; height: auto; max-width: 100%; }
.svg-container svg { width: 100%; height: auto; }

@keyframes orbit-breathe {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.04); opacity: 1; }
}
@keyframes dash-flow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes float-up {
  0%, 100% { transform: translateY(0); opacity: 0.8; }
  50% { transform: translateY(-6px); opacity: 1; }
}

.orbit-ring { animation: orbit-breathe 6s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.orbit-ring.delay-1 { animation-delay: 1s; }
.orbit-ring.delay-2 { animation-delay: 2s; }
.draw-path { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: dash-flow 4s ease-in-out infinite alternate; }
.float-bubble { animation: float-up 5s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }

@media (prefers-reduced-motion: reduce) {
  .orbit-ring, .draw-path, .float-bubble, [class*="svg-anim"], [class*="orbit-"], [class*="draw-"], [class*="float-"] { animation: none !important; }
}
