/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计变量 */
:root {
  /* 色板 */
  --color-dark: #1B1231;
  --color-paper: #DBD4ED;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;
  
  /* 结构 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 960px;
  
  /* 衍生变量 */
  --border-radius: var(--radius-card);
  --btn-height: 52px;
}

/* 基础重置与排版 */
*, *::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, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-text);
  background-color: 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;
}

/* 布局容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

section {
  padding-block: var(--section-y);
}

/* 背景与上下文取色 */
.bg-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}

.context-dark {
  color: var(--color-paper);
}

.context-dark .hl {
  color: var(--color-accent);
}

.context-dark .eyebrow {
  color: var(--color-accent);
}

.context-dark .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}

.context-paper {
  color: var(--color-text);
}

.context-paper .hl {
  color: var(--color-brand);
}

.context-paper .eyebrow {
  color: var(--color-brand);
}

.context-paper .btn-secondary {
  border-color: var(--color-text);
  color: var(--color-text);
}

/* 标题系统 */
.eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  display: block;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  text-wrap: balance;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
  max-width: 38em;
}

.hl {
  font-weight: 700;
}

/* 按钮组件 */
.btn-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: var(--btn-height);
  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, border-color 0.2s ease;
  border: 2px solid transparent;
}

.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.btn-secondary {
  background: transparent;
}

.btn-secondary:hover {
  transform: translateY(-2px);
  background-color: rgba(128, 128, 128, 0.08);
}

/* 卡片组件 */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  position: relative;
}

.context-dark .card {
  background-color: var(--color-paper);
  color: var(--color-text);
  border-color: var(--color-text);
  box-shadow: 4px 4px 0 var(--color-text);
}

/* 表格组件 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  text-align: left;
}

.data-table th {
  font-weight: 700;
  background-color: rgba(0,0,0,0.03);
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* FAQ 组件 */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 12px;
  overflow: hidden;
}

.faq-item summary {
  padding: 1rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item p {
  padding: 0 1rem 1rem;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* 页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(219, 212, 237, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.context-dark .site-header {
  background-color: rgba(27, 18, 49, 0.9);
  border-bottom-color: rgba(255,255,255,0.1);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
}

.logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--color-brand);
}

.context-dark .nav-links a:hover,
.context-dark .nav-links a[aria-current="page"] {
  color: var(--color-accent);
}

@media (max-width: 640px) {
  .nav-links { display: none; }
}

/* 页脚 */
.site-footer {
  padding-block: var(--section-y);
  border-top: 1px solid rgba(0,0,0,0.08);
  margin-top: var(--section-y);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 2rem;
}

.footer-col h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: 0.02em;
}

.footer-col ul li {
  margin-bottom: 0.4rem;
}

.footer-col a {
  font-size: 0.9rem;
  opacity: 0.85;
}

.footer-col a:hover {
  opacity: 1;
  text-decoration: underline;
}

.copyright {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* SVG 通用样式 */
.svg-panel {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  max-width: 100%;
}

/* SVG 动效 Keyframes */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes float-delay {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

@keyframes draw-line {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes pulse-opacity {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes slide-in-right {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.anim-float { animation: float 6s ease-in-out infinite; }
.anim-float-delay { animation: float-delay 7s ease-in-out infinite 1s; }
.anim-draw { 
  stroke-dasharray: 1; 
  stroke-dashoffset: 0; 
  animation: draw-line 4s linear infinite alternate; 
}
.anim-pulse { animation: pulse-opacity 3s ease-in-out infinite; }
.anim-slide { animation: slide-in-right 5s ease-out forwards; }

/* 减少动态效果偏好 */
@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;
  }
  .anim-float, .anim-float-delay, .anim-draw, .anim-pulse, .anim-slide {
    animation: none !important;
  }
}

/* 响应式网格辅助 */
.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);
}

@media (min-width: 768px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
    align-items: center;
  }
  .split-layout.reverse { direction: rtl; }
  .split-layout.reverse > * { direction: ltr; }
}
