/* The rules of the whole site: theme, typography, the layout Kobweb renders and the Markdown of the documentation. Components keep their own styles. */

/* Geist and Geist Mono (SIL OFL 1.1, fonts/OFL.txt), variable and subset to Latin: 25.6 KB and 20.3 KB for every weight, against 69 KB and 71 KB whole. */
@font-face { font-family: Geist; src: url("/fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/fonts/geist-mono.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

/* Dark is the theme the site is designed in, light follows it with a darker accent, since turquoise on white is too pale for text. */
:root {
	color-scheme: dark light;
	--paper: light-dark(#f7f7f6, #0b0c0d);
	--paper-raised: light-dark(#ffffff, #111214);
	--paper-sunk: light-dark(#eeefee, #070808);
	--ink: light-dark(#121415, #ececea);
	--ink-muted: light-dark(#5a5f63, #8b8f92);
	--rule: light-dark(#e1e3e3, #1e2022);
	--rule-strong: light-dark(#c3c7c9, #34373a);
	--grid: light-dark(#e2e4e4, #161819);
	--accent: light-dark(#08776f, #3ddcc8);
	--accent-soft: light-dark(#08776f14, #3ddcc81a);
	--on-accent: light-dark(#ffffff, #03191a);
	/* Filled parts take the gradient: buttons, highlights, bars, the current link. Text stays in the plain accent, which reads better small. */
	--grad-from: light-dark(#12c2a4, #2ee6c5);
	--grad-to: light-dark(#2ba6de, #4cc9f0);
	--grad: linear-gradient(120deg, var(--grad-from), var(--grad-to));
	--on-grad: #03191a;
	--good: light-dark(#2f7a3a, #8fd19e);
	--bad: light-dark(#b3261e, #ff8a80);
	--sans: Geist, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--mono: "Geist Mono", ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
	--radius: 6px;
	--wide: 1280px;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }

html {
	background: var(--paper);
	color: var(--ink);
	font: 16px/1.65 var(--sans);
	-webkit-text-size-adjust: none;
	text-size-adjust: none;
	scroll-padding-top: 5rem;
}

body { margin: 0; min-height: 100vh; }

#root { display: flex; flex-direction: column; min-height: 100vh; }

::selection { background: color-mix(in srgb, var(--grad-from) 30%, transparent); }

a { color: inherit; text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3, h4 { font-weight: 600; line-height: 1.15; letter-spacing: -0.025em; text-wrap: balance; }

code, kbd, pre { font-family: var(--mono); font-size: 0.88em; }

kbd {
	display: inline-block; min-width: 1.5em; padding: 0.05em 0.4em; border: 1px solid var(--rule-strong); border-bottom-width: 2px; border-radius: 4px;
	font-size: 0.75em; line-height: 1.5; text-align: center; color: var(--ink-muted);
}

button, input, select, textarea { font: inherit; color: inherit; }

/* A Lucide icon of components/Lucide.kt: as tall as the text, in its color. */
.icon { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.18em; }
.icon-host { display: inline-flex; }
/* A mark of components/Brands.kt, a little smaller than an icon since marks are filled. */
.brand-mark { width: 1em; height: 1em; flex: none; vertical-align: -0.14em; }
/* FrameworkLabel, the cells of the documentation tables that name a framework. */
.framework-label { display: inline-flex; align-items: center; gap: 0.5em; }
.framework-label .mark { display: inline-flex; font-size: 1.15em; }
.framework-label .logo { width: 1em; height: 1em; }.love { color: #ef4444; }
.love .icon { fill: currentColor; }
.docs-head .actions a { display: inline-flex; align-items: center; gap: 0.4rem; }
.docs-filter .icon-host { position: absolute; top: 50%; left: 0.6rem; translate: 0 -50%; color: var(--ink-muted); font-size: 0.86rem; pointer-events: none; }

.visually-hidden {
	position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* A faint dot grid, the backdrop of the pages that aren't reading pages. */
.grid-paper { background: radial-gradient(var(--grid) 1px, transparent 1px) 0 0 / 22px 22px; }

.eyebrow { margin: 0; font: 500 0.75rem/1.2 var(--mono); color: var(--accent); }
.eyebrow::before { content: "// "; color: var(--ink-muted); }

.button {
	display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1.1rem; border: 1px solid var(--rule-strong); border-radius: var(--radius);
	font-weight: 500; font-size: 0.93rem; text-decoration: none; transition: border-color 0.15s, filter 0.15s;
}
.button:hover { color: inherit; border-color: var(--ink-muted); }
.button.primary { border-color: transparent; background: var(--grad); color: var(--on-grad); }
.button.primary:hover { filter: brightness(1.08); }

/* Header and footer of SiteLayout. */

.site-header {
	position: sticky; top: 0; z-index: 20;
	background: color-mix(in srgb, var(--paper) 85%, transparent);
	backdrop-filter: blur(12px) saturate(1.3);
	border-bottom: 1px solid var(--rule);
}

.site-header .bar {
	max-width: var(--wide); margin: 0 auto; padding: 0 1.5rem; height: 3.6rem;
	display: flex; align-items: center; gap: 2rem;
}

.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; font: 500 1.05rem/1 var(--mono); letter-spacing: -0.01em; }
.brand:hover { color: inherit; }
.brand .mark { display: flex; }
.brand svg { width: 26px; height: 26px; }

.site-nav { display: flex; gap: 1.4rem; align-self: stretch; }
.site-nav a { display: flex; align-items: center; text-decoration: none; color: var(--ink-muted); font-size: 0.92rem; }
.site-nav a:hover { color: var(--ink); }
.site-nav .soon { display: flex; align-items: center; gap: 0.4rem; color: var(--ink-muted); font-size: 0.92rem; opacity: 0.55; cursor: not-allowed; }
.site-nav .badge { padding: 0.05rem 0.4rem; border: 1px solid currentColor; border-radius: 999px; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.06em; }
.site-footer .soon { opacity: 0.55; cursor: not-allowed; }
.button:disabled { opacity: 0.55; cursor: not-allowed; }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--grad) bottom / 100% 2px no-repeat; }

.site-header .tools { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }

.site-main { flex: 1; width: 100%; }

.site-footer { border-top: 1px solid var(--rule); color: var(--ink-muted); font-size: 0.88rem; }
.site-footer .bar {
	max-width: var(--wide); margin: 0 auto; padding: 2.5rem 1.5rem 3rem;
	display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 2rem;
}
.site-footer .about p { max-width: 22rem; margin: 0.9rem 0 0; }
.site-footer .credit { font: 0.78rem var(--mono); }
.site-footer .credit a { color: var(--accent); }
.site-footer nav { display: flex; flex-direction: column; gap: 0.45rem; }
.site-footer nav b { margin-bottom: 0.3rem; font: 500 0.75rem var(--mono); color: var(--ink); }
.site-footer nav a { text-decoration: none; }

@media (width < 860px) {
	.site-header .bar { flex-wrap: wrap; height: auto; gap: 0.5rem 1rem; padding: 0.6rem 1rem 0; }
	.site-nav { order: 3; width: 100%; overflow-x: auto; height: 2.4rem; }
	.site-header .tools { gap: 0.4rem; }
	.site-footer .bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.site-footer .about { grid-column: 1 / -1; }
}

/* Pages that aren't the documentation: a centered column with room for wide parts. */

.page { max-width: var(--wide); margin: 0 auto; padding: 3.5rem 1.5rem 5rem; }
.page > header { margin-bottom: 2.5rem; }
.page > header h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); letter-spacing: -0.04em; margin: 0.7rem 0 0.7rem; }
.page > header p:not(.eyebrow) { color: var(--ink-muted); font-size: 1.1rem; max-width: 46rem; margin: 0; }

/* The documentation: DocsLayout and the HTML Kobweb writes for the Markdown. */

.docs {
	max-width: 1440px; margin: 0 auto; padding: 0 1.5rem;
	display: grid; grid-template-columns: 16rem minmax(0, 1fr) 14rem; gap: 3.5rem;
}

.docs-sidebar {
	position: sticky; top: 3.6rem; align-self: start; max-height: calc(100vh - 3.6rem); overflow-y: auto; padding: 1.8rem 0.5rem 3rem 0;
	scrollbar-width: thin; scrollbar-color: var(--rule) transparent;
}
.docs-menu { display: none; }
.docs-filter { position: relative; margin-bottom: 1.4rem; }
.docs-filter input {
	width: 100%; padding: 0.4rem 2rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-raised); font-size: 0.86rem;
}
.docs-filter input:focus { border-color: var(--accent); outline: none; }
.docs-filter kbd { position: absolute; top: 50%; right: 0.5rem; translate: 0 -50%; pointer-events: none; }
/* Group labels are not headings: the page's own <h1> comes first in the outline that search engines read. */
.docs-sidebar .group { font: 500 0.72rem/1 var(--mono); color: var(--ink-muted); margin: 1.5rem 0 0.5rem; }
.docs-sidebar .group:first-of-type { margin-top: 0; }
.docs-sidebar ul { list-style: none; margin: 0; padding: 0; }
.docs-sidebar a {
	display: block; padding: 0.3rem 0.7rem; border-radius: var(--radius); text-decoration: none; color: var(--ink-muted); font-size: 0.9rem; line-height: 1.35;
}
.docs-sidebar a:hover { color: var(--ink); }
/* The current page is marked by a small gradient square, like the steps of the home page, rather than a tinted box. */
.docs-sidebar a[aria-current="page"] { position: relative; color: var(--ink); font-weight: 500; }
.docs-sidebar a[aria-current="page"]::before {
	content: ""; position: absolute; left: 0; top: 50%; width: 5px; height: 5px; translate: 0 -50%; border-radius: 1px; background: var(--grad);
}
.docs-sidebar mark { background: none; color: var(--accent); }
.docs-sidebar .none { padding: 0 0.7rem; color: var(--ink-muted); font-size: 0.86rem; }

.docs-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; font: 0.78rem var(--mono); color: var(--ink-muted); }
.docs-head ol { display: flex; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
/* The breadcrumb is a list inside .prose, whose spacing between list items (.prose li + li) it cancels, hence the matching specificity. */
.prose .docs-head li { margin: 0; }
.docs-head li + li::before { content: "/"; margin-right: 0.5rem; color: var(--rule-strong); }
.docs-head a { text-decoration: none; }
.docs-head .actions { display: flex; align-items: center; gap: 1.2rem; }
.docs-head .hint { display: flex; align-items: center; gap: 0.3rem; }
.docs-head .copy { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0; border: 0; background: none; color: var(--ink-muted); cursor: pointer; }
.docs-head .copy:hover { color: var(--ink); }
.docs-sidebar a .icon-host { margin-right: 0.45rem; vertical-align: -0.12em; }

.docs-toc { position: sticky; top: 3.6rem; align-self: start; padding: 1.8rem 0; font-size: 0.85rem; }

.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 4rem; }
.docs-pager a { display: block; padding: 1rem 1.2rem; border: 1px solid var(--rule); border-radius: var(--radius); text-decoration: none; transition: border-color 0.15s; }
.docs-pager a:hover { border-color: var(--accent); color: inherit; }
.docs-pager span { display: flex; align-items: center; gap: 0.5rem; font: 0.76rem var(--mono); color: var(--ink-muted); }
.docs-pager b { display: block; margin-top: 0.3rem; font-weight: 600; font-size: 1.05rem; }
.docs-pager .next { text-align: right; grid-column: 2; }
.docs-pager .next span { justify-content: flex-end; }

@media (width < 1180px) {
	.docs { grid-template-columns: 15rem minmax(0, 1fr); gap: 2.5rem; }
	.docs-toc { display: contents; }
}

@media (width < 860px) {
	.docs { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 1rem; }
	.docs-sidebar { position: static; max-height: none; padding: 1rem 0 0; }
	.docs-menu {
		display: flex; width: 100%; justify-content: space-between; cursor: pointer; padding: 0.6rem 0.9rem; border: 1px solid var(--rule);
		border-radius: var(--radius); background: var(--paper-raised); font-weight: 600;
	}
	.docs-menu span { color: var(--ink-muted); font-weight: 400; }
	.docs-sidebar nav:not(.open) { display: none; }
	.docs-sidebar nav { padding: 1rem 0.2rem; }
	.docs-head .hint { display: none; }
}

.prose { padding: 1.8rem 0 5rem; min-width: 0; }
.prose > h1:first-of-type { font-size: clamp(2.1rem, 4.5vw, 2.8rem); letter-spacing: -0.035em; margin: 0 0 1rem; }
.prose h2 { font-size: 1.6rem; margin: 3.2rem 0 0.8rem; }
.prose h3 { font-size: 1.22rem; margin: 2.2rem 0 0.6rem; }
.prose h4 { font-size: 1.05rem; margin: 1.6rem 0 0.4rem; }
/* A click on a heading copies the link to it, which Toc handles: the sign shows where to click. */
.prose :is(h2, h3)[id] { position: relative; cursor: pointer; }
.prose :is(h2, h3)[id]::before {
	content: "#"; position: absolute; right: 100%; padding-right: 0.4em; color: var(--accent); font-weight: 400; opacity: 0; transition: opacity 0.15s;
}
.prose :is(h2, h3)[id]:hover::before { opacity: 1; }
.prose h2 a, .prose h3 a { text-decoration: none; }
.prose p, .prose li { max-width: 46rem; }
.prose li + li { margin-top: 0.35rem; }
.prose :not(pre) > code {
	background: var(--paper-raised); border-radius: 4px; padding: 0.1em 0.35em; white-space: break-spaces;
}
.prose img { display: block; max-width: 100%; height: auto; margin: 1.4rem 0 2rem; border-radius: var(--radius); border: 1px solid var(--rule); }
.prose blockquote {
	margin: 1.5rem 0; padding: 0.8rem 1.2rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-raised);
}
.prose blockquote p { margin: 0.3rem 0; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 3rem 0; }

/* A framed table: the table is itself the block that scrolls sideways, as wide as its content up to the column, and its radius clips the header row.
   The Markdown writes the alignment of a column as an inline style, which wins over the left alignment here and is how the numbers are found. */
.prose table {
	display: block; width: max-content; max-width: 100%; overflow-x: auto; margin: 1.4rem 0; border: 1px solid var(--rule); border-radius: var(--radius);
	border-collapse: separate; border-spacing: 0; font-size: 0.9rem; scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent;
}
.prose th, .prose td { padding: 0.65rem 1rem; border-bottom: 1px solid var(--rule); vertical-align: top; text-align: left; }
.prose thead th { background: var(--paper-raised); border-bottom-color: var(--rule-strong); font: 500 0.72rem/1.4 var(--mono); color: var(--ink-muted); white-space: nowrap; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td:first-child { color: var(--ink); font-weight: 500; }
.prose td[style*="text-align: right"] { font-family: var(--mono); font-size: 0.86em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prose tbody tr:hover td { background: var(--accent-soft); }

/* The frame of a live component, on the examples page and inside the documentation. */
.demo { padding: 1.2rem 1.3rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-raised); }
.demo p:last-child { margin-bottom: 0; }
.prose .demo { margin: 1.4rem 0 2rem; max-width: 40rem; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0s !important; }
}

/* The tokens of Highlighter.kt, in Material Darker like the code of the Kore website: code stays dark in both themes, as in an editor. */

:root {
	--code-paper: #181a1f;
	--code-bar: rgb(255 255 255 / 0.025);
	--code-rule: rgb(255 255 255 / 0.07);
	--code-ink: #dde3ea;
	--code-muted: #a7b5bd;
	--code-raised: #343a45;
	--code-line-number: #4b5263;
}

.t-k, .t-b { color: #c792ea; font-style: italic; }
.t-m { color: #c792ea; }
.t-a { color: #c792ea; font-style: italic; }
.t-s { color: #c3e88d; }
.t-e, .t-o, .t-p { color: #89ddff; }
.t-c { color: #6b737f; font-style: italic; }
.t-n, .t-g { color: #f78c6c; }
.t-i { color: #f78c6c; font-weight: 700; }
.t-t, .t-r { color: #f07178; }
.t-f { color: #82aaff; }
.t-l { color: #82aaff; font-style: italic; }
.t-y { color: #ffcb6b; }
.t-h { color: #ffcb6b; font-style: italic; }
.t-v { color: #b2ccd6; }
.t-x { color: var(--code-ink); font-style: italic; }
/* An inline block spans the whole line box, so the guides of consecutive lines join into one rule. */
.t-u { display: inline-block; box-shadow: inset 1px 0 rgb(255 255 255 / 0.09); }
/* A name of the Lithe API in a code block links to its page, underlined only on hover so the code keeps its look. */
a.t-doc { color: inherit; text-decoration: none; }
a.t-doc:hover { text-decoration: underline dotted; text-underline-offset: 3px; }
