:root {
  --color-dark: #251943;
  --color-paper: #DBD4ED;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED6E89;
  --color-lighter-paper: #EDE8F7;
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.3);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 960px;
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-main);
  background: var(--color-paper);
  color: var(--color-text);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section {
  padding-block: var(--section-y);
}

.paper-surface { background: var(--color-paper); }
.lighter-paper { background: var(--color-lighter-paper); }
.dark-surface { background: var(--color-dark); color: var(--color-paper); }
.card-surface { background: var(--color-paper); color: var(--color-text); }

/* Typography */
h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: var(--gap);
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: var(--gap);
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: var(--gap);
}
p {
  margin-bottom: var(--gap);
  max-width: 38em;
}
.hl {
  color: var(--color-brand);
}
.dark-surface .hl {
  color: var(--color-accent);
}
.macro-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.5em;
  color: var(--color-brand);
}
.dark-surface .macro-label {
  color: var(--color-accent);
}

/* Components */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.8em 1.6em;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  border-radius: var(--radius-btn);
}
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-text);
}
.dark-surface .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}
.btn:hover {
  transform: translateY(-2px);
}
.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  transition: box-shadow 0.2s ease;
  border-radius: var(--radius-card);
}
.dark-surface .card {
  background: var(--color-lighter-paper);
}
.card-surface {
  background: var(--color-paper);
  color: var(--color-text);
}
.card:hover {
  box-shadow: 0 14px 32px -12px rgba(25, 21, 35, 0.35);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--gap);
}
th, td {
  padding: 0.75em 1em;
  text-align: left;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  vertical-align: top;
}
.dark-surface th, .dark-surface td {
  border-bottom-color: rgba(219, 212, 237, 0.15);
}
th {
  font-weight: 600;
}

details {
  margin-bottom: var(--gap);
  border: 1px solid rgba(25, 21, 35, 0.1);
  border-radius: var(--radius-card);
}
.dark-surface details {
  border-color: rgba(219, 212, 237, 0.2);
}
summary {
  padding: 1em;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
summary::-webkit-details-marker { display: none; }
details[open] summary {
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}
.dark-surface details[open] summary {
  border-bottom-color: rgba(219, 212, 237, 0.2);
}
.faq-body {
  padding: 1em;
  font-size: 0.95rem;
}

/* Header & Footer */
.site-header {
  position: sticky;
  top: 0;
  background: rgba(219, 212, 237, 0.95);
  backdrop-filter: blur(8px);
  z-index: 100;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  padding: 1em 0;
}
.dark-surface .site-header {
  background: rgba(37, 25, 67, 0.95);
  border-bottom-color: rgba(219, 212, 237, 0.15);
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav-links {
  display: flex;
  gap: 1.5em;
  list-style: none;
}
.nav-links a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}
.dark-surface .nav-links a {
  color: var(--color-paper);
}
.nav-links a:hover, .nav-links [aria-current="page"] {
  color: var(--color-brand);
}
.dark-surface .nav-links a:hover, .dark-surface .nav-links [aria-current="page"] {
  color: var(--color-accent);
}
.site-footer {
  background: var(--color-dark);
  color: var(--color-paper);
  padding: 3em 0;
  margin-top: var(--section-y);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
}
.footer-grid a {
  color: var(--color-paper);
  text-decoration: none;
  display: block;
  margin-bottom: 0.5em;
  transition: color 0.2s ease;
}
.footer-grid a:hover {
  color: var(--color-accent);
}

/* SVG & Animations */
.svg-panel {
  width: 100%;
  height: auto;
  max-width: 100%;
  overflow: hidden;
}
.star { animation: twinkle 4s ease-in-out infinite; }
.star:nth-child(even) { animation-delay: 1.5s; }
.line-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 3s ease forwards;
}
.float-anim {
  animation: float 6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.pulse-dot {
  animation: pulse 2.5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes pulse {
  0%, 100% { r: 3; opacity: 0.8; }
  50% { r: 5; 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;
  }
}

@media (max-width: 768px) {
  .hero-grid { grid-template-columns: 1fr !important; }
  .feature-grid { grid-template-columns: 1fr !important; }
  .split-row { flex-direction: column !important; }
  .nav-links { display: none; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  th, td { white-space: normal; word-break: break-word; }
}
