/* The site's shared look (every page loads it last): LimCore's neutral greys, pill controls,
   a floating header, cards on the surface ladder. Tokens follow the design system. */
:root {
  --primary: #e6e6e6; --on-primary: #1a1a1a;
  --background: #0d0d0d; --panel: #141414; --tile: #1b1b1b; --tile-high: #262626;
  --ink: #e6e6e6; --ink-muted: #a9a9a9; --line: #232323; --line-strong: #353535;
  --good: #79be85; --mid: #ffd54f; --bad: #e57373; --power: #81c784;
  --glass: rgba(24,24,24,.72);
  --shadow: 0 30px 80px rgba(0,0,0,.55);
  --font-sans: "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  --r-card: 24px; --r-tile: 16px; --r-ctl: 12px; --h-ctl: 44px;
  --arrive: cubic-bezier(.16,1,.3,1);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) {
  --primary: #1f1f1f; --on-primary: #ffffff;
  --background: #fafafa; --panel: #f3f3f3; --tile: #eeeeee; --tile-high: #e4e4e4;
  --ink: #1b1b1b; --ink-muted: #555555; --line: #e4e4e4; --line-strong: #cfcfcf;
  --good: #40854c; --mid: #a86500; --bad: #c62828; --power: #2e7d32;
  --glass: rgba(250,250,250,.78);
  --shadow: 0 30px 80px rgba(0,0,0,.14); color-scheme: light;
} }
:root[data-theme="light"] {
  --primary: #1f1f1f; --on-primary: #ffffff;
  --background: #fafafa; --panel: #f3f3f3; --tile: #eeeeee; --tile-high: #e4e4e4;
  --ink: #1b1b1b; --ink-muted: #555555; --line: #e4e4e4; --line-strong: #cfcfcf;
  --good: #40854c; --mid: #a86500; --bad: #c62828; --power: #2e7d32;
  --glass: rgba(250,250,250,.78);
  --shadow: 0 30px 80px rgba(0,0,0,.14); color-scheme: light;
}
html { background: var(--background); scroll-padding-top: 96px; }
body { margin: 0; background: var(--background); color: var(--ink); font: 15px/1.55 var(--font-sans); -webkit-font-smoothing: antialiased; }
.wrap { max-width: 1240px; margin-inline: auto; padding-inline: max(24px, env(safe-area-inset-left, 0px)) max(24px, env(safe-area-inset-right, 0px)); }
::selection { background: color-mix(in srgb, var(--ink) 22%, transparent); }

/* Controls: pills, one height */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--h-ctl); padding: 0 22px; border-radius: 999px; border: 1px solid transparent; font: 500 15px/1 var(--font-sans); cursor: pointer; white-space: nowrap; transition: filter 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 320ms var(--arrive); }
.btn:active { transform: scale(.97); }
.btn svg.i { width: 17px; height: 17px; }
.btn--primary { background: var(--primary); color: var(--on-primary); }
.btn--primary:hover { filter: brightness(.9); }
.btn--ghost { background: var(--tile); color: var(--ink); border-color: var(--line-strong); font-weight: 500; }
.btn--ghost:hover { background: var(--tile-high); }
@media (hover: hover) and (pointer: fine) { .btn:hover { transform: translateY(-1px); } .btn:active { transform: scale(.97); } }

/* Header: floating pills that stay with the page */
.site-header.top { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: 8px; height: auto; min-height: 0; padding-top: 14px; padding-bottom: 14px; border: 0; background: none; pointer-events: none; }
.site-header.top > * { pointer-events: auto; }
.site-header .brand { flex: none; display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 18px 0 7px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3); font-size: 16px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.site-header .brand svg { width: 34px; height: 34px; }
.site-header .nav { display: flex; gap: 2px; margin: 0; padding: 4px; height: 48px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3); }
.site-header .nav a { display: inline-flex; align-items: center; height: 38px; padding: 0 16px; border-radius: 999px; color: var(--ink-muted); font-size: 14px; font-weight: 500; white-space: nowrap; transition: color 160ms ease, background-color 160ms ease; }
.site-header .nav a:hover, .site-header .nav a[aria-current] { color: var(--ink); background: var(--tile-high); }
.site-header .top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.header-icon, .lang-switch { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; padding: 0; border-radius: 999px; border: 1px solid var(--line); background: var(--glass); -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3); color: var(--ink-muted); transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease; }
.header-icon:hover, .lang-switch:hover { color: var(--ink); background: var(--tile-high); border-color: var(--line-strong); }
.header-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.header-icon img { width: 22px; height: 22px; }
.lang-switch { font: 600 13px/1 var(--font-sans); }
.site-header .header-download { height: 48px; padding-inline: 22px; margin: 0; font-size: 14px; }
.site-header .header-download svg { display: block; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; order: -1; }
@media (max-width: 1000px) {
  .site-header.top { flex-wrap: wrap; row-gap: 8px; padding-top: 10px; padding-bottom: 8px; }
  .site-header .nav { order: 3; width: 100%; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; height: 44px; }
  .site-header .nav::-webkit-scrollbar { display: none; }
  .site-header .nav a { height: 34px; padding-inline: 14px; font-size: 13px; flex: 1 0 auto; justify-content: center; }
}
@media (max-width: 640px) {
  .wrap { padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); }
  .site-header .brand { height: 44px; padding: 0 14px 0 6px; font-size: 15px; gap: 8px; }
  .site-header .brand svg { width: 32px; height: 32px; }
  .site-header .top-actions { gap: 6px; }
  .header-icon, .lang-switch { width: 44px; height: 44px; }
  .site-header .header-download { height: 44px; padding-inline: 16px; font-size: 13px; }
}
@media (max-width: 430px) {
  .site-header .header-download { width: 44px; padding: 0; }
  .site-header .header-download span { display: none; }
}

/* Footer */
footer.site-footer.wrap { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 24px 48px; margin-top: 120px; padding-top: 36px; padding-bottom: 44px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-muted); }
.site-footer .brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 17px; font-weight: 600; }
.site-footer .brand svg { width: 30px; height: 30px; }
.footer-intro p { margin: 12px 0 0; font-size: 13px; max-width: 30em; }
.site-footer .footer-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 620px; }
.site-footer .footer-links a { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-muted); transition: color 160ms ease, background-color 160ms ease; }
.site-footer .footer-links a:hover { color: var(--ink); background: var(--tile); }
@media (max-width: 700px) { footer.site-footer.wrap { margin-top: 80px; } .site-footer .footer-links { justify-content: flex-start; } }

/* Text pages: documentation, legal, changelog */
.legal { max-width: 880px; padding-top: 40px; }
.legal article { font-size: 16px; line-height: 1.75; }
.legal h1 { font-size: clamp(34px, 5vw, 52px); line-height: 1.08; letter-spacing: -.035em; font-weight: 600; margin: 20px 0 24px; }
.legal h2 { margin: 52px 0 14px; font-size: 24px; line-height: 1.25; letter-spacing: -.02em; font-weight: 600; scroll-margin-top: 96px; }
.legal h3 { margin: 32px 0 10px; font-size: 18px; letter-spacing: -.01em; font-weight: 600; scroll-margin-top: 96px; }
.legal p, .legal li { color: color-mix(in srgb, var(--ink) 88%, var(--ink-muted)); }
.legal-back { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--tile); font-size: 13px; color: var(--ink-muted); text-decoration: none !important; transition: color 160ms ease, background-color 160ms ease; }
.legal-back:hover { color: var(--ink) !important; background: var(--tile-high); }
.legal code { background: var(--tile-high); border-radius: 6px; padding: 2px 6px; }
.legal pre { padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-tile); }
.legal pre code { background: none; padding: 0; }
.legal-toc { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--panel); padding: 18px 22px; }
.legal-table { border: 1px solid var(--line); border-radius: var(--r-tile); background: var(--panel); }
.legal-table table { border-collapse: collapse; }
.legal th, .legal td { border: 0; border-bottom: 1px solid var(--line); padding: 13px 16px; }
.legal tr:last-child td { border-bottom: 0; }
.legal th { background: var(--tile); font-weight: 600; font-size: 13px; }
.doc-card { border-radius: var(--r-card); background: var(--panel); border: 1px solid var(--line); transition: background-color 160ms ease, border-color 160ms ease, transform 320ms var(--arrive); }
.doc-card:hover { background: var(--tile); border-color: var(--line-strong); transform: translateY(-2px); }
.nf h1 { font-weight: 600; letter-spacing: -.03em; }

/* ───────── motion shared by every page ───────── */
/* The sliding pill behind menus and tabs (assets/site.js). */
.has-slide { position: relative; isolation: isolate; }
.slide-pill { position: absolute; left: 0; top: 0; z-index: -1; width: 0; height: 0; border-radius: 999px; background: var(--tile-high); opacity: 0; pointer-events: none;
  transition: transform 420ms var(--arrive), width 420ms var(--arrive), height 420ms var(--arrive), opacity 200ms ease; }
.site-header .nav.has-slide a:hover, .site-header .nav.has-slide a[aria-current] { background: transparent; }
.site-header .nav a[data-under] { color: var(--ink); }
.site-header .nav a { position: relative; transition: color 200ms ease, transform 120ms ease; }
.site-header .nav a:active { transform: scale(.96); }

/* Header: buttons lift a little, icons breathe; the glass firms up once the page scrolls. */
.site-header .brand, .site-header .nav, .header-icon, .lang-switch { transition: background-color 240ms ease, border-color 240ms ease, box-shadow 240ms ease, color 160ms ease, transform 320ms var(--arrive); }
.site-header.scrolled .brand, .site-header.scrolled .nav, .site-header.scrolled .header-icon, .site-header.scrolled .lang-switch { border-color: var(--line-strong); box-shadow: 0 10px 30px -12px rgba(0,0,0,.45); }
.site-header .brand svg { transition: transform 520ms var(--arrive); }
.site-header .brand:hover svg { transform: rotate(-8deg) scale(1.06); }
.header-icon img, .header-icon svg { transition: transform 320ms var(--arrive); }
@media (hover: hover) and (pointer: fine) {
  .header-icon:hover, .lang-switch:hover { transform: translateY(-2px); }
  .header-icon:hover img, .header-icon:hover svg { transform: scale(1.1); }
  .site-header .header-download:hover svg { animation: dl-nudge 700ms var(--arrive); }
}
.header-icon:active, .lang-switch:active { transform: scale(.94); }
@keyframes dl-nudge { 0% { transform: none; } 35% { transform: translateY(3px); } 100% { transform: none; } }

/* Footer links: the same pill feel. */
.site-footer .footer-links a { transition: color 160ms ease, background-color 200ms ease, border-color 200ms ease, transform 320ms var(--arrive); }
@media (hover: hover) and (pointer: fine) { .site-footer .footer-links a:hover { transform: translateY(-2px); border-color: var(--line-strong); } }

/* ───────── inner pages in the home page's style ───────── */
main.legal { position: relative; max-width: 880px; padding-top: 48px; }
main.legal::before { content: ""; position: absolute; z-index: -1; left: 50%; top: -140px; width: min(1200px, 120vw); height: 620px; translate: -50% 0; background: radial-gradient(closest-side, color-mix(in srgb, var(--ink) 6%, transparent), transparent 72%); pointer-events: none; }
body:has(> main.legal) { overflow-x: clip; }
.legal article > h1:first-of-type { font-size: clamp(38px, 5.6vw, 64px); line-height: 1.03; letter-spacing: -.045em; margin: 24px 0 18px; text-wrap: balance; }
.legal article > h1 + p, .legal .cl-lead { font-size: 17px; line-height: 1.65; color: var(--ink-muted); max-width: 40em; }
.legal h2 { padding-top: 28px; border-top: 1px solid var(--line); margin-top: 56px; }
.legal .legal-toc + h2, .legal .doc-card h2 { border-top: 0; padding-top: 0; }
.legal a:not(.legal-back):not(.doc-card):not(.btn):not(.cl-ver) { text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); transition: text-decoration-color 160ms ease, color 160ms ease; }
.legal a:not(.legal-back):not(.doc-card):not(.btn):not(.cl-ver):hover { text-decoration-color: currentColor; color: var(--ink); }
.legal-back { gap: 6px; transition: color 160ms ease, background-color 160ms ease, transform 320ms var(--arrive); }
@media (hover: hover) and (pointer: fine) { .legal-back:hover { transform: translateX(-3px); } }
.legal-toc { margin: 28px 0 36px; }
.legal-toc summary { list-style: none; display: flex; align-items: center; justify-content: space-between; font-size: 15px; }
.legal-toc summary::-webkit-details-marker { display: none; }
.legal-toc summary::after { content: "+"; font-size: 22px; font-weight: 400; color: var(--ink-muted); transition: transform 320ms var(--arrive); }
.legal-toc[open] summary::after { transform: rotate(45deg); }
.legal-toc ul { list-style: none; padding: 8px 0 0; margin: 0; }
.legal-toc li { margin: 2px 0; }
.legal-toc li a { display: block; padding: 6px 10px; border-radius: 10px; text-decoration: none !important; color: var(--ink-muted); }
.legal-toc li a:hover { background: var(--tile); color: var(--ink) !important; }

/* Long pages on wide screens: the contents become a sticky side panel (assets/site.js). */
.side-toc { display: none; }
@media (min-width: 1180px) {
  main.legal.has-side { max-width: 1240px; display: grid; grid-template-columns: minmax(0, 1fr) 260px; column-gap: 64px; align-items: start; }
  main.legal.has-side > .legal-back { grid-column: 1; grid-row: 1; justify-self: start; }
  main.legal.has-side > article { grid-column: 1; grid-row: 2; max-width: 820px; min-width: 0; }
  main.legal.has-side > .side-toc { display: block; grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow: auto; padding: 18px 10px 14px; border-radius: var(--r-card); border: 1px solid var(--line); background: var(--panel); scrollbar-width: thin; }
  main.legal.has-side .legal-toc { display: none; }
}
.side-toc p { margin: 0 0 8px; padding: 0 12px; font-size: 13px; font-weight: 600; color: var(--ink); }
.side-toc nav { display: flex; flex-direction: column; gap: 2px; }
.side-toc nav a { position: relative; display: block; padding: 7px 12px; border-radius: 12px; font-size: 13px; line-height: 1.4; color: var(--ink-muted); text-decoration: none !important; transition: color 200ms ease; }
.side-toc nav a[data-under] { color: var(--ink) !important; }
.side-toc .slide-pill { border-radius: 12px; }

/* Documentation cards: large, with an arrow that moves on hover. */
.doc-cards { gap: 16px; margin: 36px 0; }
.legal .doc-card { position: relative; display: flex; flex-direction: column; min-height: 220px; padding: 28px; text-decoration: none !important; overflow: hidden; isolation: isolate; }
.doc-card::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(70% 90% at 100% 0%, color-mix(in srgb, var(--ink) 8%, transparent), transparent 70%); opacity: 0; transition: opacity 400ms ease; }
.doc-card::after { content: "→"; margin-top: auto; align-self: flex-start; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--tile-high); font-size: 17px; color: var(--ink); transition: transform 420ms var(--arrive), background-color 200ms ease, color 200ms ease; }
.legal .doc-card h2 { margin: 0 0 10px; font-size: 22px; letter-spacing: -.02em; }
.legal .doc-card p { margin: 0 0 24px; color: var(--ink-muted); font-size: 15px; line-height: 1.6; }
.doc-card:hover::before { opacity: 1; }
.doc-card:hover::after { transform: translateX(6px); background: var(--primary); color: var(--on-primary); }

/* Changelog: tabs as one pill bar with the sliding pill on the chosen platform. */
.cl-bar { top: 70px; background: linear-gradient(var(--background) 70%, transparent); padding-bottom: 14px; }
.cl-tabs { border-radius: 999px; padding: 4px; background: var(--glass); -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3); box-shadow: none; }
.cl-tab { border-radius: 999px; transition: color 200ms ease; }
.cl-tabs.has-slide .cl-tab, .cl-tabs.has-slide .cl-tab[aria-selected="true"] { background: transparent; }
/* The labels stay light; the dark copy over them (.slide-ink, assets/site.js) shows only inside the pill. */
.cl-tabs .slide-pill { background: var(--primary); }
.cl-tabs .slide-ink { position: absolute; z-index: 1; margin: 0; box-sizing: border-box; pointer-events: none; background: none; border-color: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none;
  transition: clip-path 420ms var(--arrive); }
.cl-tabs .slide-ink .cl-tab, .cl-tabs .slide-ink .cl-tab:hover { color: var(--on-primary); background: transparent; transition: none; }
.cl-tab:hover { color: var(--ink); }
.cl-tabs.has-ink > .cl-tab, .cl-tabs.has-ink > .cl-tab[aria-selected="true"] { color: var(--ink-muted); }
.cl-tabs.has-ink > .cl-tab:hover { color: var(--ink); }
.cl-entry { transition: border-color 200ms ease, box-shadow 200ms ease, transform 420ms var(--arrive); }
@media (hover: hover) and (pointer: fine) { .cl-entry:hover { border-color: var(--line-strong); transform: translateX(2px); } }
.cl-entry--latest::before { background: var(--power); border-color: var(--power); box-shadow: 0 0 0 4px color-mix(in srgb, var(--power) 22%, transparent); }

.nf .btn { height: 48px; }

@media (max-width: 640px) {
  main.legal { padding-top: 28px; }
  .legal article > h1:first-of-type { font-size: clamp(34px, 10vw, 44px); }
  .cl-bar { top: 112px; }
  .legal .doc-card { min-height: 0; padding: 22px; }
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
