/* SafeW 全站共享样式 */
:root {
  --color-dark: #10112D;
  --color-paper: #F5F0E5;
  --color-text: #151523;
  --color-brand: #1416EB;
  --color-accent: #89ED6E;
  --color-white: #F5F0E5;
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(21, 21, 35, 0.3);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;
  --fw-title: 500;
  --lh-title: 1.15;
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background-color: var(--color-paper);
  color: var(--color-text);
  line-height: 1.75;
  font-size: 16px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: color var(--transition); }
ul, ol { list-style: none; }

/* 基础排版 */
h1, h2, h3, h4 { font-weight: var(--fw-title); line-height: var(--lh-title); letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); margin-bottom: var(--gap); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: calc(var(--gap) * 0.75); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: calc(var(--gap) * 0.5); }
p { margin-bottom: var(--gap); max-width: 38em; }
.hl { color: var(--color-brand); font-weight: 600; }
.badge { display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; margin-bottom: 8px; }
.badge-light { color: var(--color-brand); }
.badge-dark { color: var(--color-accent); }

/* 布局容器 */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
section { padding-top: var(--section-y); padding-bottom: var(--section-y); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); align-items: center; }
.checkerboard { display: flex; flex-wrap: wrap; }
.checkerboard > div { width: 100%; }
@media (min-width: 768px) {
  .checkerboard > div { width: 50%; }
  .checkerboard > div:nth-child(even) { flex-direction: row-reverse; }
}

/* 页头与页脚 */
header { position: sticky; top: 0; z-index: 100; background: var(--color-paper); border-bottom: 1px solid rgba(21,21,35,0.1); backdrop-filter: blur(8px); }
.nav-inner { display: flex; justify-content: space-between; align-items: center; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.logo img { height: 32px; width: auto; }
nav ul { display: flex; gap: 24px; }
nav a { font-weight: 500; font-size: 0.95rem; }
nav a:hover, nav a[aria-current="page"] { color: var(--color-brand); }
footer { background: var(--color-dark); color: var(--color-white); padding: var(--section-y) 0; margin-top: var(--section-y); }
footer .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--gap); }
footer a { color: var(--color-accent); }

/* 按钮组件 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 28px; border-radius: var(--radius-btn);
  font-weight: 600; font-size: 1rem; cursor: pointer; border: none;
  transition: transform var(--transition), box-shadow var(--transition), background-color var(--transition);
}
.btn-primary { background: var(--color-accent); color: var(--color-dark); }
.btn-primary:hover { background: #7ce060; transform: translateY(-2px); box-shadow: var(--card-shadow); }
.btn-secondary { background: transparent; border: 1px solid var(--color-text); color: var(--color-text); }
.btn-secondary:hover { background: rgba(21,21,35,0.05); transform: translateY(-2px); }
.btn:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 3px; }

/* 卡片与面板 */
.card { background: var(--color-paper); border-radius: var(--radius-card); box-shadow: var(--card-shadow); padding: var(--gap); border: var(--card-border); transition: box-shadow var(--transition); }
.card:hover { box-shadow: 0 14px 32px -12px rgba(21, 21, 35, 0.35); }
.panel { background: var(--color-dark); border-radius: var(--radius-card); overflow: hidden; position: relative; aspect-ratio: 4/3; }

/* 表格组件 */
table { width: 100%; border-collapse: collapse; margin-bottom: var(--gap); }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid rgba(21,21,35,0.1); }
th { font-weight: 600; }
td:first-child { font-weight: 500; color: var(--color-brand); }
@media (max-width: 600px) {
  th, td { display: block; width: 100%; padding: 8px 0; }
  tr { display: block; margin-bottom: 16px; border-bottom: 1px solid rgba(21,21,35,0.1); }
  td::before { content: attr(data-label); font-weight: 600; display: block; margin-bottom: 4px; }
}

/* FAQ 组件 */
details { margin-bottom: 16px; border: 1px solid rgba(21,21,35,0.1); border-radius: 12px; padding: 16px; background: var(--color-paper); }
summary { 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; transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details p { margin-top: 12px; margin-bottom: 0; line-height: 1.7; }

/* 深色面覆盖规则 */
.bg-dark { background-color: var(--color-dark); color: var(--color-white); }
.bg-dark h1, .bg-dark h2, .bg-dark h3, .bg-dark p { color: var(--color-white); }
.bg-dark .hl { color: var(--color-accent); }
.bg-dark .badge-dark { color: var(--color-accent); }
.bg-dark .card { background: #1a1b3a; border: 1px solid rgba(255,255,255,0.08); }
.bg-dark .card h3, .bg-dark .card p { color: var(--color-white); }
.bg-dark .btn-secondary { border-color: var(--color-white); color: var(--color-white); }
.bg-dark .btn-secondary:hover { background: rgba(255,255,255,0.1); }

/* SVG 动效工具类 */
.svg-anim { width: 100%; height: auto; max-width: 100%; }
.star { animation: twinkle 4s ease-in-out infinite alternate; }
.star:nth-child(odd) { animation-delay: 1s; animation-duration: 5s; }
.star:nth-child(even) { animation-delay: 2.5s; animation-duration: 6s; }
.line { stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawLine 8s linear infinite; }
.bubble { animation: float 6s ease-in-out infinite; }
.input-dots span { animation: breathe 2s ease-in-out infinite; }
.input-dots span:nth-child(2) { animation-delay: 0.3s; }
.input-dots span:nth-child(3) { animation-delay: 0.6s; }

@keyframes twinkle { 0% { opacity: 0.2; } 100% { opacity: 1; } }
@keyframes drawLine { 0% { stroke-dashoffset: 1; } 50% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 1; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes breathe { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

@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; }
}
