/* =========================================
   1. Design Tokens & Reset
   ========================================= */
:root {
  /* Colors */
  --color-dark: #21163C;
  --color-paper: #E9E8EA;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED926E;

  /* Radii */
  --radius-card: 20px;
  --radius-btn: 12px;

  /* Borders */
  --card-border: 1px solid rgba(25, 21, 35, 0.16);
  --card-shadow: none;

  /* Spacing & Layout */
  --content-max: 1280px;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);

  /* Typography */
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* =========================================
   2. Layout Utilities
   ========================================= */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

.bg-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}

.bg-paper {
  background-color: var(--color-paper);
  color: var(--color-text);
}

/* =========================================
   3. Typography
   ========================================= */
h1, h2, h3, h4 {
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  margin-bottom: var(--gap);
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-bottom: var(--gap);
  text-wrap: balance;
}

h3 {
  font-size: clamp(1.3rem, 2vw, 1.6rem);
  margin-bottom: 0.75rem;
  text-wrap: balance;
}

p {
  margin-bottom: var(--gap);
  max-width: 38em;
}

.text-accent {
  color: var(--color-accent);
}

.text-brand {
  color: var(--color-brand);
}

/* =========================================
   4. Components: Buttons
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: none;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-text);
}

.bg-dark .btn-outline {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

/* =========================================
   5. Components: Cards
   ========================================= */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease;
}

.bg-dark .card {
  background: rgba(233, 232, 234, 0.05);
  border-color: rgba(233, 232, 234, 0.15);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}

/* =========================================
   6. Components: Tables
   ========================================= */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-card);
  border: var(--card-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

th {
  font-weight: 600;
  background: rgba(25, 21, 35, 0.04);
}

.bg-dark th {
  background: rgba(233, 232, 234, 0.08);
  border-bottom-color: rgba(233, 232, 234, 0.1);
}

.bg-dark td {
  border-bottom-color: rgba(233, 232, 234, 0.1);
}

tr:last-child th, tr:last-child td {
  border-bottom: none;
}

/* =========================================
   7. Components: FAQ (Details/Summary)
   ========================================= */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  overflow: hidden;
}

details summary {
  padding: 20px 24px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 48px;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::after {
  content: '+';
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

details[open] summary::after {
  transform: translateY(-50%) rotate(45deg);
}

details p {
  padding: 0 24px 20px;
  margin-bottom: 0;
}

/* =========================================
   8. Components: Timeline
   ========================================= */
.timeline {
  position: relative;
  padding-left: 2rem;
  border-left: 2px solid var(--color-accent);
}

.timeline-item {
  position: relative;
  margin-bottom: 3rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -2.55rem;
  top: 0;
  width: 1.2rem;
  height: 1.2rem;
  background: var(--color-accent);
  border-radius: 50%;
  border: 4px solid var(--color-dark);
}

.timeline-time {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
  display: block;
}

/* =========================================
   9. Components: Checklist
   ========================================= */
.checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--gap);
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.check-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: var(--color-accent);
}

/* =========================================
   10. Header & Footer
   ========================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(233, 232, 234, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
  padding: 16px 0;
}

.bg-dark .site-header {
  background: rgba(33, 22, 60, 0.85);
  border-bottom-color: rgba(233, 232, 234, 0.1);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-links a {
  font-weight: 500;
  font-size: 0.95rem;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  opacity: 1;
  color: var(--color-accent);
}

@media (max-width: 768px) {
  .nav-links { display: none; }
}

.site-footer {
  border-top: 1px solid rgba(25, 21, 35, 0.1);
  padding: 48px 0;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.8;
}

.bg-dark .site-footer {
  border-top-color: rgba(233, 232, 234, 0.1);
}

/* =========================================
   11. SVG Animations
   ========================================= */
.svg-container {
  width: 100%;
  height: auto;
  max-width: 100%;
}

/* Twinkling Stars */
@keyframes twinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

.star {
  animation: twinkle 4s ease-in-out infinite;
}

.star:nth-child(odd) {
  animation-delay: 1s;
  animation-duration: 5s;
}

.star:nth-child(3n) {
  animation-delay: 2s;
  animation-duration: 6s;
}

/* Connecting Lines */
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

.connect-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 8s linear infinite;
}

.connect-line:nth-child(2) {
  animation-delay: 2s;
}

.connect-line:nth-child(3) {
  animation-delay: 4s;
}

/* Floating Elements */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.float-anim {
  animation: float 6s ease-in-out infinite;
}

.float-anim-delayed {
  animation: float 6s ease-in-out infinite;
  animation-delay: 3s;
}

/* Breathing Dots */
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.dot-breathe {
  animation: breathe 2s ease-in-out infinite;
}

.dot-breathe:nth-child(2) { animation-delay: 0.3s; }
.dot-breathe:nth-child(3) { animation-delay: 0.6s; }

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
