:root {
  --c-dark: #1B1231;
  --c-paper: #F4F3F7;
  --c-text: #191523;
  --c-brand: #5214EB;
  --c-accent: #9977EE;
  --c-text-on-dark: #ECECF2;
  --c-accent-on-dark: #9977EE;

  --r-card: 24px;
  --r-btn: 999px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;

  --font-base: system-ui, -apple-system, "PingFang SC", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --leading-body: 1.55;
  --leading-tight: 1.1;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-base);
  font-size: 16px;
  line-height: var(--leading-body);
  color: var(--c-text);
  background: var(--c-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { padding-left: 0; list-style: none; }

/* Layout */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.section {
  padding-block: var(--section-y);
  position: relative;
}
.section + .section { border-bottom: 1px solid rgba(25,21,35,0.08); }
.section:last-child { border-bottom: none; }

/* Face Modifiers */
.face-dark {
  background: var(--c-dark);
  color: var(--c-text-on-dark);
}
.face-dark .hl { color: var(--c-accent-on-dark); }
.face-dark a.link-accent { color: var(--c-accent-on-dark); }

.face-paper {
  background: var(--c-paper);
  color: var(--c-text);
}
.face-paper .hl { color: var(--c-brand); }
.face-paper a.link-accent { color: var(--c-brand); }

/* Typography */
h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: var(--leading-tight);
  margin-top: 0;
  margin-bottom: 0.6em;
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }
p { margin-bottom: 1em; }
.text-sm { font-size: 0.875rem; line-height: 1.6; }
.text-xs { font-size: 0.75rem; letter-spacing: 0.05em; font-weight: 700; text-transform: uppercase; }

/* Badge / Eyebrow */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.5em;
}
.face-paper .badge { color: var(--c-brand); }
.face-dark .badge { color: var(--c-accent-on-dark); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 48px;
  padding: 0 1.4em;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--r-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.btn-primary {
  background: var(--c-accent);
  color: var(--c-dark);
}
.btn-primary:hover { background: #8A66E0; }

.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--c-text);
  color: var(--c-text);
}
.face-dark .btn-secondary { border-color: var(--c-text-on-dark); color: var(--c-text-on-dark); }
.btn-secondary:hover { background: rgba(0,0,0,0.04); }
.face-dark .btn-secondary:hover { background: rgba(255,255,255,0.06); }

/* Cards & Panels */
.card {
  background: hsl(from var(--c-paper) h s calc(l - 3%));
  border-radius: var(--r-card);
  padding: var(--gap);
  transition: background 0.2s ease;
}
.face-dark .card { background: hsl(from var(--c-dark) h s calc(l + 6%)); }
.card-grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.8em 1em;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.face-dark th, .face-dark td { border-bottom-color: rgba(255,255,255,0.1); }
th { font-weight: 600; }

/* Details / FAQ */
details {
  border-radius: var(--r-card);
  background: hsl(from var(--c-paper) h s calc(l - 2%));
  margin-bottom: var(--gap);
  padding: 1em 1.2em;
}
.face-dark details { background: hsl(from var(--c-dark) h s calc(l + 5%)); }
summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 1.5em;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 400;
  transition: transform 0.2s;
}
details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
details p { margin-top: 0.8em; margin-bottom: 0; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(244,243,247,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(25,21,35,0.06);
  transition: box-shadow 0.2s;
}
.site-header.scrolled { box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-list { display: flex; gap: 1.5em; align-items: center; }
.nav-link { font-weight: 500; font-size: 0.95rem; position: relative; }
.nav-link[aria-current="page"] { color: var(--c-brand); font-weight: 600; }
.face-dark .nav-link[aria-current="page"] { color: var(--c-accent-on-dark); }

/* Footer */
.site-footer {
  padding-block: var(--section-y);
  border-top: 1px solid rgba(25,21,35,0.08);
  font-size: 0.85rem;
  color: rgba(25,21,35,0.7);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--gap);
}
.footer-links { display: flex; gap: 1.2em; flex-wrap: wrap; }

/* SVG Visuals */
.svg-visual { width: 100%; height: auto; max-width: 520px; margin-inline: auto; }
svg { width: 100%; height: auto; display: block; }

/* Animation Classes */
.anim-rotate { animation: geo-rotate 12s linear infinite; transform-box: fill-box; transform-origin: center; }
.anim-align { animation: geo-align 10s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.anim-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: dash-flow 4s ease-in-out infinite alternate; }
.anim-float { animation: soft-float 6s ease-in-out infinite; }
.anim-breathe { animation: breath-opacity 3s ease-in-out infinite alternate; }

@keyframes geo-rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes geo-align {
  0% { transform: translateX(-4px) rotate(-3deg); }
  100% { transform: translateX(4px) rotate(3deg); }
}
@keyframes dash-flow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes soft-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes breath-opacity {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Responsive tweaks */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
  .hero-layout { flex-direction: column-reverse !important; }
  .hero-text { text-align: center; }
  .header-nav-desktop { display: none; }
}
.grid-2 { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.hero-layout { display: flex; align-items: center; gap: var(--gap); }
.hero-text { flex: 1; min-width: 0; }
.hero-visual { flex: 1; min-width: 0; }
.hl { font-weight: inherit; }
.link-accent { text-decoration-thickness: 1px; text-underline-offset: 3px; }
