/* =========================================
   Design Tokens & Reset
   ========================================= */
:root {
  /* Colors */
  --color-dark-surface: #231334;
  --color-paper-surface: #F5F3F7;
  --color-text-body: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;
  
  /* Spacing & Rhythm */
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;
  --line-height-base: 1.55;
  
  /* Radius & Borders */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 2px solid var(--color-text-body);
  --card-shadow: 4px 4px 0 var(--color-text-body);
  
  /* Typography */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-main);
  line-height: var(--line-height-base);
  color: var(--color-text-body);
  background-color: var(--color-paper-surface);
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  min-width: 320px;
  max-width: 100%;
  overflow-x: visible;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* =========================================
   Layout & Container
   ========================================= */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

.section--dark {
  background-color: var(--color-dark-surface);
  color: var(--color-paper-surface);
}

.section--paper {
  background-color: var(--color-paper-surface);
  color: var(--color-text-body);
}

/* =========================================
   Typography
   ========================================= */
.text-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  display: inline-block;
}

.section--paper .text-label {
  color: var(--color-brand);
}

.section--dark .text-label {
  color: var(--color-accent);
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 1.5rem;
  letter-spacing: 0.02em;
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
  font-size: 1rem;
}

@media (min-width: 768px) {
  p {
    font-size: 1.125rem;
    max-width: 38em;
  }
}

.hl {
  font-weight: 800;
}

.section--paper .hl {
  color: var(--color-brand);
}

.section--dark .hl {
  color: var(--color-accent);
}

/* =========================================
   Components: Buttons
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 1.5rem;
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark-surface);
}

.btn-primary:hover {
  background-color: #f5e08a;
}

.btn-secondary {
  background-color: transparent;
  border: 2px solid currentColor;
  color: inherit;
}

.section--paper .btn-secondary {
  border-color: var(--color-text-body);
}

.section--dark .btn-secondary {
  border-color: var(--color-paper-surface);
}

.btn-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* =========================================
   Components: Cards & Panels
   ========================================= */
.card {
  background-color: var(--color-paper-surface);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  height: 100%;
}

.section--dark .card {
  background-color: var(--color-dark-surface);
  border-color: var(--color-paper-surface);
  box-shadow: 4px 4px 0 var(--color-paper-surface);
}

.panel {
  background-color: var(--color-dark-surface);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.section--paper .panel {
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}

.section--dark .panel {
  border: 2px solid var(--color-paper-surface);
  box-shadow: 4px 4px 0 var(--color-paper-surface);
}

/* =========================================
   Components: Lists & Tables
   ========================================= */
.list-check li {
  position: relative;
  padding-left: 1.75rem;
  margin-bottom: 0.75rem;
}

.list-check li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35rem;
  width: 10px;
  height: 10px;
  background-color: var(--color-brand);
  border-radius: 2px;
  transform: rotate(45deg);
}

.section--dark .list-check li::before {
  background-color: var(--color-accent);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(128, 128, 128, 0.3);
}

.data-table th {
  font-weight: 700;
}

/* =========================================
   Components: FAQ
   ========================================= */
.faq-item {
  border-bottom: 1px solid rgba(128, 128, 128, 0.3);
}

.faq-item summary {
  padding: 1rem 0;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.5rem;
  font-weight: 300;
}

.faq-item[open] summary::after {
  content: "-";
}

.faq-item p {
  padding-bottom: 1rem;
  margin-bottom: 0;
  opacity: 0.9;
}

/* =========================================
   Grid & Flex Utilities
   ========================================= */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.flex-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  align-items: center;
}

.flex-col {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

@media (min-width: 768px) {
  .flex-row-lg {
    flex-wrap: nowrap;
  }
}

/* =========================================
   Header & Footer
   ========================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-paper-surface);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding: 0.75rem 0;
}

.section--dark ~ .site-header,
.site-header.dark-mode {
  background-color: var(--color-dark-surface);
  border-bottom-color: rgba(255,255,255,0.1);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.25rem;
}

.logo img {
  height: 32px;
  width: auto;
}

.nav-list {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  font-weight: 500;
  font-size: 0.95rem;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.nav-link:hover, .nav-link[aria-current="page"] {
  opacity: 1;
}

.section--dark .nav-link {
  color: var(--color-paper-surface);
}

.site-footer {
  padding: 3rem 0;
  border-top: 1px solid rgba(128, 128, 128, 0.2);
  margin-top: var(--section-y);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.footer-links a {
  display: block;
  margin-bottom: 0.5rem;
  opacity: 0.8;
}

.footer-links a:hover {
  opacity: 1;
}

/* =========================================
   SVG Animations
   ========================================= */
.svg-grid-node {
  fill: transparent;
  stroke-width: 2;
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: grid-node-glow 4s infinite ease-in-out;
}

.svg-grid-node:nth-child(odd) {
  animation-delay: 0.5s;
}
.svg-grid-node:nth-child(even) {
  animation-delay: 1.5s;
}
.svg-grid-node:nth-child(3n) {
  animation-delay: 2.5s;
}

@keyframes grid-node-glow {
  0%, 100% {
    stroke-dashoffset: 1;
    opacity: 0.3;
  }
  50% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

@keyframes float-bubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.float-anim {
  animation: float-bubble 6s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.pulse-anim {
  animation: pulse-dot 2s infinite ease-in-out;
  transform-box: fill-box;
  transform-origin: center;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .svg-grid-node {
    stroke-dashoffset: 0;
    opacity: 1;
  }
  .float-anim, .pulse-anim {
    animation: none;
    transform: none;
    opacity: 1;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
