/* The docs site wears the design language it documents: lotusui's
   DefaultPalette tokens, white cards floating on the tinted page,
   the soft-lavender accent. */
:root {
  --page: #F3F4FA;
  --card: #FFFFFF;
  --surface2: #F4F5FB;
  --hairline: #ECEEF6;
  --card-border: #E6E8F2;
  --text-prim: #23242F;
  --text-body: #474A5A;
  --text-sec: #6F7288;
  --text-dim: #AFB2C6;
  --brand: #E0D9FF;
  --brand-subtle: #ECE9FC;
  --brand-ink: #4C3FD6;
  --on-brand: #2F2566;
  --healthy: #117A3D;
  --attention: #B07700;
  --danger: #C82E2E;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-body: "DM Sans";
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-body);
  font: 15px/1.65 var(--font-body), -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  background: var(--surface2);
  border: 1px solid var(--hairline);
  border-radius: 5px;
  padding: 1px 5px;
  font: 0.88em/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text-prim);
}

/* ---- top bar ---- */

.topbar {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.wordmark { font-weight: 700; font-size: 17px; color: var(--text-prim); }
.wordmark:hover { text-decoration: none; color: var(--brand-ink); }
.tag { color: var(--text-sec); font-size: 13px; flex: 1; }
.repo { font-size: 13px; }

/* ---- palette picker ---- */

.palpick { position: relative; align-self: center; }
.palbtn {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 22px;
  height: 22px;
  padding: 2px;
  gap: 1px;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  background: var(--card);
  cursor: pointer;
}
.palbtn:hover { border-color: var(--brand-ink); }
.palbtn span { border-radius: 2px; }
.palmenu {
  display: none;
  position: absolute;
  right: 0;
  top: 30px;
  z-index: 30;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(35, 36, 47, 0.10);
  padding: 6px;
  min-width: 150px;
}
.palmenu.open { display: block; }
.palmenu > button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  font: 500 13px/1 "DM Sans", -apple-system, sans-serif;
  color: var(--text-body);
  cursor: pointer;
  text-align: left;
}
.palmenu > button:hover { background: var(--surface2); }
.palsw {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 16px;
  height: 16px;
  gap: 1px;
  flex-shrink: 0;
}
.palsw i { border-radius: 2px; }

.lookbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 22px;
  padding: 0 5px;
  font: 700 12px/1 var(--font-body), sans-serif;
  color: var(--text-sec);
}
.lookbtn:hover { color: var(--brand-ink); }
.looksw {
  width: 16px;
  text-align: center;
  font-weight: 700;
  color: var(--brand-ink);
  flex-shrink: 0;
}
.lookname { display: flex; flex-direction: column; gap: 1px; }
.lookname em { font-style: normal; font-size: 11px; color: var(--text-dim); }

.verbtn {
  width: auto;
  padding: 0 7px;
  font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-sec);
  display: inline-flex;
  align-items: center;
}
.verbtn:hover { color: var(--brand-ink); }
.verlink {
  display: block;
  padding: 6px 8px;
  border-radius: 8px;
  font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-body);
}
.verlink:hover { background: var(--surface2); text-decoration: none; }

/* Rendered-markdown pages (the changelog) */
.mdpage { max-width: 72ch; }
.mdpage h1 { display: none; } /* the page template already renders the title */
.mdpage h2 { font-size: 22px; margin-top: 40px; }
.mdpage h3 { color: var(--text-prim); font-size: 16px; margin: 26px 0 8px; }
.mdpage table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  margin: 10px 0;
}
.mdpage th, .mdpage td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
.mdpage th {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-sec);
  background: var(--surface2);
}
.mdpage tr:last-child td { border-bottom: 0; }
.mdpage li { margin: 3px 0; }

/* ---- shell: sidebar + content + toc ---- */

.shell {
  display: flex;
  max-width: 1240px;
  margin: 0 auto;
  gap: 40px;
  padding: 28px 24px 64px;
}

.sidebar {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: 76px;
  align-self: flex-start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 4px 2px;
}
.navgroup + .navgroup { margin-top: 22px; }
.navtitle {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-prim);
  padding: 0 10px 6px;
}
.sidebar a {
  display: block;
  padding: 4px 10px;
  border-radius: 8px;
  color: var(--text-sec);
  font-size: 14px;
}
.sidebar a:hover { background: var(--surface2); color: var(--text-prim); text-decoration: none; }
.sidebar a.active { background: var(--brand); color: var(--on-brand); font-weight: 600; }

.toc {
  width: 170px;
  flex-shrink: 0;
  position: sticky;
  top: 76px;
  align-self: flex-start;
  font-size: 13px;
  padding-top: 42px;
}
.toctitle {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-prim);
  margin-bottom: 8px;
}
.toc a {
  display: block;
  padding: 3px 0 3px 10px;
  color: var(--text-sec);
  border-left: 2px solid var(--hairline);
}
.toc a:hover { color: var(--brand-ink); border-left-color: var(--brand-ink); text-decoration: none; }

/* ---- content ---- */

.content { flex: 1; min-width: 0; max-width: 720px; position: relative; }

.breadcrumb { font-size: 13px; color: var(--text-dim); margin-bottom: 10px; }
.breadcrumb span { margin: 0 4px; }

h1 { color: var(--text-prim); font-size: 30px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -0.015em; }
.kicker { color: var(--text-sec); font-size: 16px; margin: 0 0 18px; }
h2 { color: var(--text-prim); font-size: 20px; margin: 44px 0 10px; letter-spacing: -0.01em; }
h2 .anchor { color: inherit; }
h2 .anchor:hover { text-decoration: none; }
h2 .anchor:hover::after { content: " #"; color: var(--text-dim); }
.intro, .prose { max-width: 66ch; }
.intro p:first-child { margin-top: 0; }

section { scroll-margin-top: 80px; }

.hero { margin-bottom: 8px; }
.hero h1 { font-size: 34px; margin-bottom: 2px; }
.herotag { color: var(--text-sec); font-size: 16px; margin-top: 0; }
.cta {
  display: inline-block;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 8px;
}
.cta:hover { text-decoration: none; filter: brightness(0.97); }

/* ---- code blocks ---- */

.codeblock {
  margin: 14px 0 0;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--card);
  overflow: hidden;
}
.codeblock figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface2);
}
.codeblock .lang {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.codeblock .copy {
  font: 600 12px/1 "DM Sans", -apple-system, sans-serif;
  color: var(--text-sec);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}
.codeblock .copy:hover { color: var(--brand-ink); border-color: var(--brand-ink); }
.codeblock pre {
  margin: 0;
  padding: 14px 18px;
  overflow-x: auto;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text-prim);
  background: var(--card) !important;
}
/* the inline-code pill styling must not leak into highlighted blocks */
.codeblock pre code, .chroma code, .chroma span {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
}

/* chroma token classes → palette */
.chroma .k, .chroma .kd, .chroma .kn, .chroma .kr { color: var(--brand-ink); font-weight: 600; } /* keywords */
.chroma .kt { color: var(--brand-ink); }                       /* builtin types */
.chroma .s, .chroma .s1, .chroma .s2, .chroma .sb { color: var(--healthy); } /* strings */
.chroma .m, .chroma .mi, .chroma .mf, .chroma .mh { color: var(--attention); } /* numbers */
.chroma .c, .chroma .c1, .chroma .cm { color: var(--text-dim); font-style: italic; } /* comments */
.chroma .nf { color: #8250df; }                                /* function names */
.chroma .nx { color: var(--text-prim); }                       /* identifiers */
.chroma .o { color: var(--text-sec); }                         /* operators */
.chroma .p { color: var(--text-sec); }                         /* punctuation */
.chroma .nb { color: var(--danger); }                          /* builtins */

/* ---- live demos ---- */

.demo {
  position: relative;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--card);
  margin: 14px 0 0;
}
.demo iframe {
  width: 100%;
  border: 0;
  display: block;
}
.demolink {
  position: absolute;
  right: 10px;
  bottom: 8px;
  z-index: 6;
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.8);
  padding: 2px 8px;
  border-radius: 6px;
}

/* ---- platform chips ---- */

.platforms { margin: -8px 0 14px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-sec);
  background: var(--surface2);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 2px 9px;
  vertical-align: 3px;
}
h2 .chip { margin-left: 4px; }
.chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
}
.chip-desktop::before, .chip-macos::before, .chip-windows::before, .chip-linux::before { background: var(--brand-ink); }
.chip-mobile::before, .chip-android::before, .chip-ios::before { background: var(--healthy); }
.chip-web::before, .chip-wasm::before { background: #2A62B5; }

/* ---- performance stats ---- */

.statgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin: 22px 0 6px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px 18px 14px;
}
.statnum {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brand-ink);
  line-height: 1.1;
}
.statnum span {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dim);
  margin-left: 2px;
}
.statlabel { font-weight: 600; color: var(--text-prim); font-size: 14px; margin-top: 4px; }
.statnote { font-size: 12.5px; color: var(--text-sec); margin-top: 2px; line-height: 1.45; }

.perfbars {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin: 14px 0 0;
}
.perfrow { display: flex; align-items: center; gap: 10px; }
.perfrow + .perfrow { margin-top: 10px; }
.perfname { width: 90px; flex-shrink: 0; font-size: 13px; font-weight: 600; color: var(--text-prim); }
.perfbar {
  display: block;
  height: 16px;
  min-width: 4px;
  border-radius: 4px;
  background: var(--brand);
}
.perfbar.warn { background: #F3C9C9; }
.perfval { font-size: 12.5px; color: var(--text-sec); font-variant-numeric: tabular-nums; }
.perfnote { font-size: 12.5px; color: var(--text-dim); margin-top: 8px; }

.demooverlay {
  /* The strip window: the iframe renders every demo stacked in one
     static strip; the controller positions it inside the article and
     clip-paths it to exactly the box under the pointer. In-flow =
     native scrolling; the clip also bounds hit-testing, so the page
     around it stays untouched. */
  position: absolute;
  border: 0;
  z-index: 5;
}
.demosnap {
  /* A live snapshot of one strip slot, blitted from the shared canvas
     for every box the pointer is NOT over. */
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---- props table ---- */

.proptable-wrap { overflow-x: auto; }
.proptable {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
}
.proptable th, .proptable td {
  text-align: left;
  padding: 9px 14px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
.proptable th {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-sec);
  background: var(--surface2);
}
.proptable tr:last-child td { border-bottom: 0; }
.proptable code.type { color: var(--brand-ink); background: none; border: none; padding: 0; }

/* ---- prev / next ---- */

.prevnext {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 52px;
}
.pn {
  flex: 1;
  max-width: 48%;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pn:hover { text-decoration: none; border-color: var(--brand-ink); }
.pn span { font-size: 12px; color: var(--text-dim); }
.pn strong { color: var(--brand-ink); font-size: 15px; }
.pn.next { text-align: right; margin-left: auto; }

/* ---- index cards ---- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.pagecard {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  color: inherit;
}
.pagecard:hover { text-decoration: none; border-color: var(--brand-ink); }
.cardtitle { font-weight: 600; color: var(--text-prim); margin-bottom: 4px; }
.cardmeta { font-size: 13px; color: var(--text-sec); }

.footer {
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
  color: var(--text-dim);
  font-size: 13px;
  max-width: 68ch;
}

@media (max-width: 1100px) {
  .toc { display: none; }
}
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; position: static; max-height: none; }
}

/* ---- homepage showcase ---- */
.heroshots { display: grid; gap: 18px; margin: 8px 0 28px; }
.heroshot {
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  box-shadow: 0 12px 40px rgba(35, 36, 47, 0.10);
}

/* generated palette presets */
:root[data-palette="lavender"] { --brand: #E0D9FF; --brand-subtle: #ECE9FC; --brand-ink: #4C3FD6; --on-brand: #2F2566; --page: #F3F4FA; }
:root[data-palette="midnight"] { --brand: #E0D9FF; --brand-subtle: #2A2745; --brand-ink: #B7A9FF; --on-brand: #2F2566; --page: #16171E; }
:root[data-palette="deep-harbor"] { --brand: #00ADB5; --brand-subtle: #D7FDFF; --brand-ink: #007E84; --on-brand: #222831; --page: #F3F4FA; }
:root[data-palette="summer-sunset"] { --brand: #B83B5E; --brand-subtle: #F6E4E9; --brand-ink: #7E2840; --on-brand: #FFFFFF; --page: #F3F4FA; }
:root[data-palette="neon-arcade"] { --brand: #FF2E63; --brand-subtle: #FFE0E8; --brand-ink: #C60032; --on-brand: #FFFFFF; --page: #F3F4FA; }
:root[data-palette="cotton-candy"] { --brand: #AA96DA; --brand-subtle: #F0ECF8; --brand-ink: #5E3DAD; --on-brand: #462E82; --page: #F3F4FA; }
:root[data-palette="mint-lagoon"] { --brand: #11999E; --brand-subtle: #DAFAFB; --brand-ink: #0C7074; --on-brand: #FFFFFF; --page: #F3F4FA; }
:root[data-palette="arctic-frost"] { --brand: #71C9CE; --brand-subtle: #E9F7F7; --brand-ink: #35959A; --on-brand: #297176; --page: #F3F4FA; }
:root[data-palette="tropical-punch"] { --brand: #00B8A9; --brand-subtle: #D7FFFC; --brand-ink: #00857A; --on-brand: #006F66; --page: #F3F4FA; }
:root[data-palette="ocean-drift"] { --brand: #3D84A8; --brand-subtle: #E4F0F5; --brand-ink: #2A5B74; --on-brand: #FFFFFF; --page: #F3F4FA; }
:root[data-palette="cherry-noir"] { --brand: #E84545; --brand-subtle: #FCE4E4; --brand-ink: #B01616; --on-brand: #FFFFFF; --page: #F3F4FA; }
:root[data-palette="berry-wine"] { --brand: #E23E57; --brand-subtle: #FBE3E7; --brand-ink: #A6192E; --on-brand: #FFFFFF; --page: #F3F4FA; }

/* generated look presets */
:root[data-style="lotus"] { --font-body: "DM Sans"; --radius-md: 10px; --radius-lg: 16px; }
@font-face { font-family: "Lora"; src: url("fonts/lora.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
:root[data-style="editorial"] { --font-body: "Lora"; --radius-md: 4px; --radius-lg: 8px; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
:root[data-style="coast"] { --font-body: "Nunito"; --radius-md: 16px; --radius-lg: 24px; }
@font-face { font-family: "Inter"; src: url("fonts/inter.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
:root[data-style="console"] { --font-body: "Inter"; --radius-md: 6px; --radius-lg: 10px; }
@font-face { font-family: "Baloo 2"; src: url("fonts/baloo2.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
:root[data-style="playful"] { --font-body: "Baloo 2"; --radius-md: 18px; --radius-lg: 28px; }
