/* moonurl documentation — single page, several regions.
   Palette (weight 4 : 3 : 1.7 : 1.3):
     #9FA1FF  primary   (4)
     #B5BAFF  secondary (3)
     #AEE2FF  accent    (1.7)
     #D9F9DF  mint      (1.3)
   Theme: 简约 · 细致 · 整齐 · 整洁, now with ornamentation and
   finer, design-led finishing. Nav is a right-hand dot rail whose
   labels appear on hover only. */

:root {
  --c1: #9FA1FF;   /* primary   */
  --c2: #B5BAFF;   /* secondary */
  --c3: #AEE2FF;   /* accent    */
  --c4: #D9F9DF;   /* mint      */

  --bg: #FBFCFE;
  --surface: #FFFFFF;
  --surface-2: #F4F6FD;
  --ink: #1E2138;
  --ink-soft: #3A3F5C;
  --muted: #6A6F88;
  --line: color-mix(in srgb, var(--c1) 13%, transparent);
  --line-strong: color-mix(in srgb, var(--c1) 30%, transparent);

  --code-bg: #F1F4FE;
  --code-ink: #2A2E47;
  --code-k: #6A4BFF;
  --code-s: #1E9E6B;
  --code-n: #2E7FD6;

  --shadow-sm: 0 1px 2px rgba(30, 33, 56, 0.04), 0 2px 8px rgba(30, 33, 56, 0.05);
  --shadow-md: 0 2px 4px rgba(30, 33, 56, 0.04), 0 12px 30px rgba(30, 33, 56, 0.07);
  --shadow-lg: 0 6px 14px rgba(30, 33, 56, 0.06), 0 24px 50px rgba(30, 33, 56, 0.10);
  --glow: 0 10px 34px color-mix(in srgb, var(--c1) 26%, transparent);
  --glass: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  --glass-d: inset 0 1px 0 rgba(255, 255, 255, 0.05);

  --scroll-thumb: color-mix(in srgb, var(--c1) 48%, transparent);
  --scroll-track: transparent;

  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 22px;
  --rail-w: 76px;

  --sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Manual theme override: explicit choice beats the media query. */
html.dark { color-scheme: dark; }
html.dark {
  --c1: #B5BAFF;
  --c2: #9FA1FF;
  --c3: #8FD4FF;
  --c4: #8FE6AC;
  --bg: #0C0E1A;
  --surface: #151829;
  --surface-2: #1B2036;
  --ink: #ECEEFF;
  --ink-soft: #C9CDEC;
  --muted: #9BA1C6;
  --line: color-mix(in srgb, var(--c1) 16%, transparent);
  --line-strong: color-mix(in srgb, var(--c1) 36%, transparent);
  --code-bg: #11142A;
  --code-ink: #D7DBFF;
  --code-k: #B8B0FF;
  --code-s: #6FE0A8;
  --code-n: #7FB9FF;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30), 0 2px 10px rgba(0, 0, 0, 0.34);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.32), 0 14px 34px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 8px 18px rgba(0, 0, 0, 0.38), 0 26px 56px rgba(0, 0, 0, 0.46);
  --glow: 0 12px 38px color-mix(in srgb, var(--c1) 34%, transparent);
  --glass: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --scroll-thumb: color-mix(in srgb, var(--c1) 62%, transparent);
}
@media (prefers-color-scheme: dark) {
  html:not(.light) {
    --c1: #B5BAFF;
    --c2: #9FA1FF;
    --c3: #8FD4FF;
    --c4: #8FE6AC;
    --bg: #0C0E1A;
    --surface: #151829;
    --surface-2: #1B2036;
    --ink: #ECEEFF;
    --ink-soft: #C9CDEC;
    --muted: #9BA1C6;
    --line: color-mix(in srgb, var(--c1) 16%, transparent);
    --line-strong: color-mix(in srgb, var(--c1) 36%, transparent);
    --code-bg: #11142A;
    --code-ink: #D7DBFF;
    --code-k: #B8B0FF;
    --code-s: #6FE0A8;
    --code-n: #7FB9FF;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30), 0 2px 10px rgba(0, 0, 0, 0.34);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.32), 0 14px 34px rgba(0, 0, 0, 0.40);
    --shadow-lg: 0 8px 18px rgba(0, 0, 0, 0.38), 0 26px 56px rgba(0, 0, 0, 0.46);
  --glow: 0 12px 38px color-mix(in srgb, var(--c1) 34%, transparent);
  --glass: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --scroll-thumb: color-mix(in srgb, var(--c1) 62%, transparent);
  }
}

* { box-sizing: border-box; }
::selection { background: color-mix(in srgb, var(--c1) 28%, transparent); }

html, button, input, textarea, select {
  font-variant-ligatures: no-contextual;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-feature-settings: "ss01", "cv05";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

/* ---- Soft palette clouds + slow drifting orbs (ornament) ------------- */
.mesh {
  position: fixed;
  inset: -8% -8% -8% -8%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(42% 52% at 11% 16%, color-mix(in srgb, var(--c1) 16%, transparent), transparent 70%),
    radial-gradient(40% 48% at 89% 20%, color-mix(in srgb, var(--c3) 17%, transparent), transparent 70%),
    radial-gradient(48% 54% at 82% 90%, color-mix(in srgb, var(--c4) 19%, transparent), transparent 70%),
    radial-gradient(44% 50% at 18% 86%, color-mix(in srgb, var(--c2) 15%, transparent), transparent 70%);
  will-change: transform;
}
.mesh::before, .mesh::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.45;
}
.mesh::before {
  width: 44vw; height: 44vw;
  background: radial-gradient(circle, color-mix(in srgb, var(--c1) 42%, transparent), transparent 70%);
  top: -8%; left: 4%;
  animation: drift1 24s ease-in-out infinite;
}
.mesh::after {
  width: 38vw; height: 38vw;
  background: radial-gradient(circle, color-mix(in srgb, var(--c4) 48%, transparent), transparent 70%);
  bottom: -6%; right: 2%;
  animation: drift2 30s ease-in-out infinite;
}
@keyframes drift1 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(5vw, 4vh); } }
@keyframes drift2 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-5vw, -4vh); } }

/* ---- Scroll-progress hairline ---------------------------------------- */
.progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  z-index: 45;
  background: linear-gradient(90deg, var(--c1), var(--c3) 55%, var(--c4));
  border-radius: 0 999px 999px 0;
  transition: width 0.09s linear;
}

/* ---- Custom scrollbars (on-brand, thin, rounded) --------------------- */
/* Chrome drops an element's ::-webkit-scrollbar rules once it has a standard
   scrollbar property, and scrollbar-color is inherited, so the standard pair
   is only for engines without the WebKit pseudo-elements. */
@supports not selector(::-webkit-scrollbar) {
  .stage, .region, pre, .demo, .scroll, html, body {
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) var(--scroll-track);
  }
}
.stage::-webkit-scrollbar,
.region::-webkit-scrollbar,
pre::-webkit-scrollbar,
.demo::-webkit-scrollbar,
.scroll::-webkit-scrollbar,
html::-webkit-scrollbar,
body::-webkit-scrollbar { width: 11px; height: 11px; }
.stage::-webkit-scrollbar-track,
.region::-webkit-scrollbar-track,
pre::-webkit-scrollbar-track,
.demo::-webkit-scrollbar-track,
.scroll::-webkit-scrollbar-track,
html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track { background: transparent; }
.stage::-webkit-scrollbar-thumb,
.region::-webkit-scrollbar-thumb,
pre::-webkit-scrollbar-thumb,
.demo::-webkit-scrollbar-thumb,
.scroll::-webkit-scrollbar-thumb,
html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
  transition: background 0.25s ease;
}
.stage::-webkit-scrollbar-thumb:hover,
.region::-webkit-scrollbar-thumb:hover,
pre::-webkit-scrollbar-thumb:hover,
.demo::-webkit-scrollbar-thumb:hover,
.scroll::-webkit-scrollbar-thumb:hover,
html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
  background: var(--c1);
  background-clip: padding-box;
}

/* ---- Stage: single scrolling column with region snapping ------------- */
.stage {
  height: 100vh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

.region {
  min-height: 100vh;
  scroll-snap-align: start;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 78px calc(var(--rail-w) + clamp(20px, 4vw, 64px)) 78px clamp(20px, 4vw, 64px);
}
.wrap {
  position: relative;
  width: 100%;
  max-width: 940px;
  margin: auto 0;
}

/* ---- Right-hand navigation rail (dots; labels on hover) -------------- */
.rail {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: var(--rail-w);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(12px);
  border-left: 1px solid var(--line);
}
.rail .brand {
  position: absolute;
  top: 22px; left: 50%;
  transform: translateX(-50%);
  width: 30px; height: 30px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px; color: #fff;
  background: linear-gradient(135deg, var(--c1), var(--c3));
  box-shadow: var(--glow);
  letter-spacing: -0.02em;
}
.rail .rail-track {
  position: absolute;
  left: 50%; top: 64px; bottom: 64px;
  width: 2px; transform: translateX(-50%);
  background: var(--line);
  border-radius: 999px;
}
.rail .rail-thumb {
  position: absolute;
  left: 50%;
  width: 2px; height: 16px;
  transform: translate(-50%, 0);
  background: linear-gradient(180deg, var(--c1), var(--c3));
  border-radius: 999px;
  transition: top 0.45s var(--ease);
  box-shadow: 0 0 10px color-mix(in srgb, var(--c1) 65%, transparent);
}
.rail a {
  position: relative;
  width: 11px; height: 11px;
  border-radius: 999px;
  background: var(--line-strong);
  box-shadow: var(--glass);
  transition: transform 0.28s var(--ease), background 0.28s var(--ease), box-shadow 0.28s var(--ease);
  text-decoration: none;
}
.rail a:hover { transform: scale(1.35); background: var(--c2); }
.rail a:focus-visible { outline: none; transform: scale(1.35); background: var(--c2); }
.rail a.active {
  background: var(--c1);
  transform: scale(1.55);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c1) 24%, transparent),
              0 0 16px color-mix(in srgb, var(--c1) 60%, transparent);
}
.rail a .tip {
  position: absolute;
  right: 24px; top: 50%;
  transform: translateY(-50%) translateX(10px);
  white-space: nowrap;
  background: var(--ink);
  color: var(--bg);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  transition: opacity 0.2s ease, transform 0.2s var(--ease);
}
.rail a:hover .tip, .rail a:focus-visible .tip {
  opacity: 1; transform: translateY(-50%) translateX(0);
}

/* ---- Top-right cluster: theme toggle + GitHub ------------------------ */
.topbar {
  position: fixed;
  top: 16px; right: calc(var(--rail-w) + 16px);
  z-index: 44;
  display: flex;
  align-items: center;
  gap: 10px;
}
.theme-toggle, .gh {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm), var(--glass);
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s var(--ease), box-shadow 0.2s ease;
}
.theme-toggle { width: 38px; padding: 0; justify-content: center; }
.theme-toggle:hover, .gh:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), var(--glass);
}
.theme-toggle svg, .gh svg { width: 18px; height: 18px; }
.theme-toggle .ico { transition: transform 0.5s var(--ease); }
.theme-toggle.spin .ico { transform: rotate(180deg) scale(0.8); }
.gh svg { fill: currentColor; }
.theme-toggle .sun { display: none; }
html.dark .theme-toggle .moon { display: none; }
html.dark .theme-toggle .sun { display: block; }

/* ---- Typography ------------------------------------------------------ */
.kicker { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c1);
}
.eyebrow .idx {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 8px;
  font-size: 11px;
  letter-spacing: 0;
  color: var(--c1);
  background: color-mix(in srgb, var(--c1) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--c1) 32%, transparent);
}
.eyebrow::after {
  content: "";
  width: 18px; height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--c1), var(--c3));
}
.pill {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 11px;
  background: var(--surface);
  box-shadow: var(--glass);
}
h1.title {
  font-size: clamp(44px, 7.4vw, 86px);
  line-height: 1.0;
  letter-spacing: -0.035em;
  margin: 0;
  font-weight: 800;
  background: linear-gradient(118deg, var(--ink) 24%, var(--c1) 70%, var(--c3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
h1.title .dot {
  -webkit-text-fill-color: var(--c1); color: var(--c1);
  animation: dotpulse 3.4s ease-in-out infinite;
}
@keyframes dotpulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.title-rule {
  height: 3px; width: 86px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--c1), var(--c3) 60%, var(--c4));
  margin: 18px 0 22px;
  box-shadow: 0 0 12px color-mix(in srgb, var(--c1) 40%, transparent);
}
.lead {
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.62;
  color: var(--muted);
  max-width: 60ch;
  margin: 0 0 34px;
  font-weight: 500;
}
h2.sec {
  font-size: clamp(25px, 3.8vw, 36px);
  letter-spacing: -0.025em;
  margin: 0 0 8px;
  font-weight: 800;
}
.sec-sub { color: var(--muted); margin: 0 0 30px; font-size: 15.5px; font-weight: 500; line-height: 1.55; max-width: 64ch; }
.sub-h {
  font-size: 15px; font-weight: 800; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-soft);
  margin: 36px 0 16px;
  display: flex; align-items: center; gap: 10px;
}
.sub-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Hero halo ornament */
.halo {
  position: absolute;
  z-index: -1;
  width: 520px; height: 520px;
  top: -150px; left: -120px;
  background: radial-gradient(circle at 40% 40%,
    color-mix(in srgb, var(--c1) 26%, transparent),
    color-mix(in srgb, var(--c3) 12%, transparent) 45%, transparent 70%);
  filter: blur(20px);
  pointer-events: none;
}

/* ---- Home: stat row -------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 34px;
}
.stat {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  box-shadow: var(--shadow-sm), var(--glass);
  overflow: hidden;
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease), border-color 0.28s var(--ease);
}
.stat::before {
  content: "";
  position: absolute; left: 16px; right: 16px; top: 0;
  height: 3px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, var(--c1), var(--c3));
  opacity: 0.9;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md), var(--glass); border-color: var(--line-strong); }
.stat .n { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .n small { font-size: 14px; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.stat .k { font-size: 12px; color: var(--muted); margin-top: 5px; letter-spacing: 0.01em; line-height: 1.4; }

/* ---- Home: feature grid --------------------------------------------- */
.features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.feature {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm), var(--glass);
  transition: transform 0.28s var(--ease), border-color 0.28s var(--ease), box-shadow 0.28s var(--ease);
}
.feature:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: var(--shadow-md), var(--glass); }
.feature .ic {
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center;
  margin-bottom: 12px;
  font-weight: 800; font-size: 15px; color: #fff;
  box-shadow: var(--shadow-sm);
}
.feature:nth-child(6n+1) .ic { background: linear-gradient(135deg, var(--c1), var(--c3)); }
.feature:nth-child(6n+2) .ic { background: linear-gradient(135deg, var(--c2), var(--c1)); }
.feature:nth-child(6n+3) .ic { background: linear-gradient(135deg, var(--c3), var(--c4)); }
.feature:nth-child(6n+4) .ic { background: linear-gradient(135deg, var(--c1), var(--c2)); }
.feature:nth-child(6n+5) .ic { background: linear-gradient(135deg, var(--c3), var(--c1)); }
.feature:nth-child(6n+6) .ic { background: linear-gradient(135deg, var(--c4), var(--c3)); }
.feature h3 { margin: 0 0 6px; font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.feature p { margin: 0; font-size: 13.5px; line-height: 1.58; color: var(--muted); }

/* ---- Gradient hairline border (refined ornament) -------------------- */
.feature::after, .spot::after, .demo::after, .stat::after, .api-item::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c1) 55%, transparent), color-mix(in srgb, var(--c3) 35%, transparent) 55%, transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.feature:hover::after, .spot:hover::after, .demo:hover::after, .api-item[open]::after, .api-item:hover::after { opacity: 1; }

/* ---- Code blocks ----------------------------------------------------- */
pre {
  margin: 0;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 15px 17px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--code-ink);
  white-space: pre;
  tab-size: 2;
}
code { font-family: var(--mono); }
p code, li code, td code {
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
}
pre .c { color: var(--muted); font-style: italic; }
pre .k { color: var(--code-k); font-weight: 700; }
pre .s { color: var(--code-s); }
pre .n { color: var(--code-n); font-weight: 700; }

.codecard {
  position: relative;
  margin: 0 0 22px;
}
.codecard .label {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  margin: 0 0 8px; letter-spacing: 0.03em; text-transform: uppercase;
}
.codecard .label::before {
  content: ""; width: 7px; height: 7px; border-radius: 999px;
  background: linear-gradient(135deg, var(--c3), var(--c1));
}
.copy {
  position: absolute;
  top: 30px; right: 8px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s var(--ease);
}
.codecard:hover .copy, .copy:focus-visible { opacity: 1; }
.copy:hover { color: var(--c1); border-color: var(--line-strong); transform: translateY(-1px); }
.copy svg { width: 15px; height: 15px; }
.copy.copied { color: var(--code-s); border-color: color-mix(in srgb, var(--code-s) 40%, transparent); }

/* ---- Guide steps ----------------------------------------------------- */
.step { margin: 0 0 28px; }
.step .num {
  display: inline-grid; place-items: center;
  width: 25px; height: 25px; border-radius: 8px;
  background: color-mix(in srgb, var(--c1) 16%, var(--surface));
  color: var(--c1); font-weight: 800; font-size: 12.5px;
  margin-right: 10px; vertical-align: middle;
  border: 1px solid color-mix(in srgb, var(--c1) 30%, transparent);
}
.step h3 { display: inline; font-size: 17.5px; font-weight: 800; letter-spacing: -0.01em; }
.step p { color: var(--muted); margin: 10px 0 12px; line-height: 1.62; max-width: 70ch; font-weight: 500; }

/* ---- API reference --------------------------------------------------- */
.pkg { margin: 0 0 32px; }
.pkg > h3 {
  font-size: 15.5px; font-weight: 800; margin: 0 0 4px;
  display: flex; align-items: center; gap: 10px;
}
.pkg > h3 .tag {
  font-size: 11px; font-weight: 700; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px;
}
.pkg > .note { color: var(--muted); font-size: 13px; margin: 0 0 16px; font-weight: 500; line-height: 1.55; }
.api-item {
  position: relative;                 /* keep the gradient frame on THIS item */
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin: 0 0 11px;
  overflow: hidden;
  transition: box-shadow 0.2s ease, background 0.2s ease;
}
.api-item[open] { box-shadow: var(--shadow-sm); }
.api-item:not([open]):hover {
  background: color-mix(in srgb, var(--c1) 5%, var(--surface));
}
.api-item summary {
  cursor: pointer;
  list-style: none;
  padding: 15px 20px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  transition: color 0.2s ease;
}
.api-item summary:hover { color: var(--ink-soft); }
.api-item summary::-webkit-details-marker { display: none; }
.api-item summary .pm {
  flex: none;
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  color: var(--c1);
  font-size: 13px; font-weight: 700; line-height: 1;
  transition: transform 0.28s var(--ease), background 0.2s ease, color 0.2s ease;
}
.api-item[open] summary .pm { transform: rotate(45deg); background: var(--c1); color: #fff; border-color: var(--c1); }
.api-item::after { opacity: 0.85; }   /* single clean gradient frame at rest */
.api-item .desc {
  padding: 4px 20px 18px 49px;
  font-size: 13px; color: var(--muted); line-height: 1.62; font-weight: 500;
}
.api-item[open] .desc { animation: fadeSlide 0.3s var(--ease) both; }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---- API reference: the part scripts/gen_api.py writes ----------------- */
.api-stat {
  color: var(--muted); font-size: 12.5px; font-weight: 500; line-height: 1.6;
  margin: 0 0 6px; max-width: 70ch;
}
.api-group {
  display: flex; align-items: center; gap: 12px;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted);
  margin: 26px 0 12px;
}
.api-group::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--line); }
.pkg > .api-group:first-of-type { margin-top: 16px; }
.api-item summary { align-items: baseline; }
.api-item summary .decl { flex: 1 1 12ch; min-width: 0; overflow-wrap: anywhere; }
.api-item summary .badge {
  flex: none;
  font-family: var(--sans);
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 8px;
}
.api-item .desc { padding-top: 10px; }
.api-item .desc p { margin: 0 0 9px; overflow-wrap: anywhere; }
.api-item .desc p:last-child { margin-bottom: 0; }
.api-item .api-doc + .api-doc { margin-top: 10px; }
.api-fields {
  display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  gap: 7px 18px; margin: 14px 0 4px; padding-top: 13px;
  border-top: 1px solid var(--line);
  align-items: baseline;
}
.api-fields dt {
  font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--ink-soft);
  overflow-wrap: anywhere;
}
.api-fields dt .ty { font-weight: 400; color: var(--muted); margin-left: 9px; }
.api-fields dd { margin: 0; }
.api-fields dd p { margin: 0; }
pre.eg { margin: 12px 0 2px; padding: 12px 15px; font-size: 12px; line-height: 1.65; }
.derived {
  font-size: 11.5px; font-weight: 500; color: var(--muted);
  margin: -3px 0 14px; padding-left: 2px;
}
.derived code {
  font-size: 11px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 5px; padding: 0 5px; margin-right: 3px;
}

/* ---- Showcase -------------------------------------------------------- */
.spotlight {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 8px;
}
.spot {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm), var(--glass);
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease), border-color 0.28s var(--ease);
}
.spot:hover { transform: translateY(-4px); box-shadow: var(--shadow-md), var(--glass); border-color: var(--line-strong); }
.spot-h { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.spot-ic {
  width: 28px; height: 28px; border-radius: 9px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 14px; color: #fff;
  background: linear-gradient(135deg, var(--c1), var(--c3));
}
.spot-h h3 { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.spot-p { margin: 0 0 14px; font-size: 13px; line-height: 1.55; color: var(--muted); }
.versus { display: flex; flex-direction: column; gap: 8px; }
.vside {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.vside.vout { background: color-mix(in srgb, var(--c4) 26%, var(--surface)); border-color: color-mix(in srgb, var(--c4) 50%, transparent); }
.vlabel {
  flex: none;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted);
  width: 64px;
}
.vcode {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  word-break: break-all;
}

/* ---- Playground ------------------------------------------------------ */
.demo {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm), var(--glass);
  margin: 0 0 20px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.demo:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md), var(--glass); }
.demo h3 { margin: 0 0 4px; font-size: 16.5px; font-weight: 800; letter-spacing: -0.01em; }
.demo .hint { color: var(--muted); font-size: 13px; margin: 0 0 16px; font-weight: 500; line-height: 1.55; }
.field { margin: 0 0 12px; }
.field label {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--muted); margin-bottom: 6px; letter-spacing: 0.02em;
}
input[type="text"], textarea {
  width: 100%;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input[type="text"]:focus, textarea:focus {
  outline: none; border-color: var(--c1);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c1) 22%, transparent);
}
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }

/* segmented control */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 11px;
}
.seg-btn {
  font-family: var(--sans);
  font-size: 12.5px; font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 6px 13px;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.seg-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--c1), var(--c3));
  box-shadow: var(--shadow-sm);
}

button.act {
  position: relative;
  overflow: hidden;
  font-family: var(--sans);
  font-size: 13px; font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--c1), var(--c3));
  border: none; border-radius: 11px;
  padding: 9px 17px; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s var(--ease), filter 0.16s ease, box-shadow 0.16s ease;
}
button.act::before {
  content: "";
  position: absolute; top: 0; left: -130%;
  width: 60%; height: 100%;
  background: linear-gradient(115deg, transparent, rgba(255,255,255,0.5), transparent);
  transform: skewX(-18deg);
  transition: left 0.6s ease;
}
button.act:hover::before { left: 140%; }
button.act.ghost {
  background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--line);
}
button.act:hover { transform: translateY(-1px); filter: brightness(1.04); box-shadow: var(--shadow-md); }
button.act:active { transform: translateY(0); }

.out {
  margin-top: 4px;
  min-height: 22px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-all;
  padding: 11px 13px;
  border-radius: 11px;
  background: var(--code-bg);
  border: 1px solid var(--line);
}
.out.err { color: #D8546B; border-color: color-mix(in srgb, #D8546B 40%, transparent); }
.out .ok { color: var(--code-s); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.chip {
  font-size: 11.5px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--c4) 50%, var(--surface));
  color: #1c6b45; border: 1px solid color-mix(in srgb, var(--c4) 66%, transparent);
}

/* ---- Footer note inside each region ---------------------------------- */
.foot {
  margin-top: 38px; padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}
.foot a { font-weight: 700; color: var(--ink-soft); text-decoration: none; }
.foot a:hover { color: var(--c1); }

/* ---- Reveal animation (delicate, once per region) -------------------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.region.seen .wrap > * { animation: rise 0.7s var(--ease) both; }
.region.seen .wrap > .spotlight > * { animation: rise 0.7s var(--ease) both; }
.region.seen .wrap > *:nth-child(1) { animation-delay: 0.02s; }
.region.seen .wrap > *:nth-child(2) { animation-delay: 0.08s; }
.region.seen .wrap > *:nth-child(3) { animation-delay: 0.14s; }
.region.seen .wrap > *:nth-child(4) { animation-delay: 0.20s; }
.region.seen .wrap > *:nth-child(5) { animation-delay: 0.26s; }
.region.seen .wrap > *:nth-child(6) { animation-delay: 0.32s; }
.region.seen .wrap > *:nth-child(7) { animation-delay: 0.38s; }
.region.seen .wrap > *:nth-child(8) { animation-delay: 0.44s; }
.region.seen .wrap > .spotlight > *:nth-child(1) { animation-delay: 0.30s; }
.region.seen .wrap > .spotlight > *:nth-child(2) { animation-delay: 0.36s; }
.region.seen .wrap > .spotlight > *:nth-child(3) { animation-delay: 0.42s; }

/* ---- Focus visibility ------------------------------------------------ */
:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---- Responsive: tighten, don't hide --------------------------------- */
@media (width <= 860px) {
  :root { --rail-w: 0px; }
  .rail {
    left: 0; right: 0; top: auto; bottom: 0;
    width: auto; height: 56px;
    flex-direction: row; justify-content: space-around;
    border-left: none; border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    padding: 0 12px;
  }
  .rail .brand, .rail .rail-track, .rail .rail-thumb { display: none; }
  .rail a .tip { right: 50%; top: -32px; transform: translateX(50%) translateY(6px); }
  .rail a:hover .tip, .rail a:focus-visible .tip, .rail a.active .tip { transform: translateX(50%) translateY(0); }
  .region { padding: 64px 20px 76px 20px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .features { grid-template-columns: minmax(0, 1fr); }
  .spotlight { grid-template-columns: minmax(0, 1fr); }
  .gh span, .theme-toggle .tlabel { display: none; }
  .topbar { top: 12px; right: 12px; gap: 8px; }
  /* Two columns of a field list leave a phone three words to a line; the name
     and its type go above the sentence instead of beside it. */
  .api-fields { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .api-fields dt { margin-top: 11px; }
  .api-fields dt:first-of-type { margin-top: 0; }
}

/* ---- Motion preferences ---------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .stage { scroll-behavior: auto; }
  .mesh::before, .mesh::after, h1.title .dot { animation: none; }
  .region.seen .wrap > *, .region.seen .wrap > .spotlight > * { animation: none; opacity: 1; transform: none; }
}
