/* ==================== Design Tokens & Root ==================== */
:root {
  /* Colors */
  --color-dark: #1B1231;
  --color-paper: #DBD4ED;
  --color-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;

  /* Structural Tokens */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;

  /* Typography */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --lh-body: 1.75;
}

/* ==================== Reset & Base ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--lh-body);
  background: var(--color-paper);
  color: var(--color-body);
  -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; }

/* ==================== Layout Containers ==================== */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.section {
  padding-block: var(--section-y);
  position: relative;
}

/* ==================== Typography Scales ==================== */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}
h1, h2, h3 { line-height: 1.1; letter-spacing: -0.02em; font-weight: 800; }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.25; margin-bottom: 0.5rem; }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); line-height: 1.3; margin-bottom: 0.75rem; }
p { max-width: 38em; margin-bottom: 1rem; }
.text-muted { opacity: 0.85; }
.hl { font-weight: 800; }

/* ==================== Section Color Overrides ==================== */
.dark-section {
  background: var(--color-dark);
  color: var(--color-paper);
}
.dark-section h1, .dark-section h2, .dark-section h3, .dark-section p, .dark-section li { color: var(--color-paper); }
.dark-section .hl, .dark-section .badge, .dark-section a:not(.btn) { color: var(--color-accent); }
.dark-section .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }

.paper-section {
  background: var(--color-paper);
  color: var(--color-body);
}
.paper-section h1, .paper-section h2, .paper-section h3, .paper-section p, .paper-section li { color: var(--color-body); }
.paper-section .hl, .paper-section .badge, .paper-section a:not(.btn) { color: var(--color-brand); }
.paper-section .btn-secondary { border-color: var(--color-body); color: var(--color-body); }

.light-card {
  background: var(--color-paper);
  color: var(--color-body);
  border-radius: var(--radius-card);
  padding: var(--gap);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}
.light-card h1, .light-card h2, .light-card h3, .light-card p, .light-card li { color: var(--color-body); }
.light-card .hl, .light-card .badge, .light-card a:not(.btn) { color: var(--color-brand); }
.light-card .btn-secondary { border-color: var(--color-body); color: var(--color-body); }

/* ==================== Components: Buttons ==================== */
.btn-group { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1.5rem;
  height: 52px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  border: none;
  text-align: center;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 4px; }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
}
.btn-secondary:hover { background: rgba(0,0,0,0.05); }

/* ==================== Components: Cards & Grid ==================== */
.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); }
.card {
  background: rgba(255,255,255,0.4);
  border-radius: var(--radius-card);
  padding: var(--gap);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}
.paper-section .card { background: rgba(255,255,255,0.5); }
.dark-section .card { background: rgba(219,212,237,0.08); }

/* ==================== Components: Table ==================== */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.1); }
td:first-child { font-weight: 700; white-space: nowrap; }
.dark-section th, .dark-section td { border-bottom-color: rgba(219,212,237,0.2); }

/* ==================== Components: FAQ (Details) ==================== */
details {
  border-radius: var(--radius-card);
  border: var(--card-border);
  background: rgba(255,255,255,0.5);
  margin-bottom: 1rem;
  overflow: hidden;
}
.summary {
  padding: 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.25rem;
  font-weight: 400;
  transition: transform 0.2s;
}
details[open] .summary::after { transform: rotate(45deg); }
.details-content { padding: 0 1.25rem 1.25rem; }

/* ==================== Components: Timeline ==================== */
.timeline-item { display: flex; gap: 1.5rem; margin-bottom: 2rem; }
.step-num {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 800;
  border-radius: 12px;
  font-size: 1.1rem;
}
.timeline-text h3 { margin-top: 0.25rem; margin-bottom: 0.5rem; }

/* ==================== SVG Animation Base ==================== */
.svg-anim { width: 100%; height: auto; max-width: 100%; }
svg { overflow: visible; }
svg path, svg circle, svg rect, svg polygon, svg polyline {
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Draw Line */
.draw-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-flow 6s ease-in-out infinite;
}
@keyframes draw-flow {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}
/* Float */
.float-el {
  transform-box: fill-box;
  transform-origin: center;
  animation: float-move 5s ease-in-out infinite;
}
@keyframes float-move {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
/* Pulse Dot */
.pulse-dot {
  transform-box: fill-box;
  transform-origin: center;
  animation: pulse-scale 3s ease-in-out infinite;
}
@keyframes pulse-scale {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.6; }
}
/* Slide In */
.slide-up {
  animation: slide-in 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes slide-in {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==================== Header & Footer ==================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(219,212,237,0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.dark-section .site-header { background: rgba(27,18,49,0.9); border-bottom-color: rgba(219,212,237,0.1); }
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}
.logo { display: flex; align-items: center; gap: 0.75rem; font-weight: 800; font-size: 1.1rem; }
.logo img { height: 32px; width: auto; }
nav ul { display: flex; gap: 1.5rem; }
nav a { font-weight: 500; padding: 0.5rem 0; position: relative; }
nav a:hover, nav a[aria-current="page"] { color: var(--color-accent); }
nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-accent);
}
.site-footer {
  padding-block: var(--gap);
  border-top: 1px solid rgba(0,0,0,0.1);
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.8;
}
.dark-section .site-footer { border-top-color: rgba(219,212,237,0.15); }

/* ==================== Responsive & Reduced Motion ==================== */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .header-inner { flex-direction: column; height: auto; padding: 1rem 0; }
  nav ul { gap: 1rem; }
  .btn-group { flex-direction: column; width: 100%; }
  .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}
