/* Kwark Design System — documentation site chrome. Components themselves live in ../kwark.css. */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&family=Raleway:wght@500;600&family=Courier+Prime:wght@400;700&display=swap');

:root {
  --ink: #1b221e;
  --coral: #f28b71;
  --mango: #fac374;
  --mint: #badfcf;
  --aqua: #83cfd3;

  --bg: #f2f5f3;
  --surface: #ffffff;
  --sunk: #e8eeea;
  --line: #d9e2dd;
  --text: #1b221e;
  --text-2: #4b5852;
  --link: #1b221e;
  --link-line: #e0705a;
  --code-bg: #1b221e;
  --code-text: #e7efe9;
  --group: var(--mint);
  --mast: #1b221e;
  --mast-text: #f2f5f3;
  --mast-2: #b9c6bf;

  --font: 'Poppins', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --nav-w: 264px;
  --toc-w: 216px;
  --top-h: 60px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
html[data-site-theme="dark"] {
  --bg: #161c19;
  --surface: #1e2622;
  --sunk: #222b26;
  --line: #2f3a34;
  --text: #edf2ee;
  --text-2: #a7b4ad;
  --link: #edf2ee;
  --link-line: #f28b71;
  --code-bg: #0f1411;
  --mast: #0f1411;
  color-scheme: dark;
}
[data-group="foundations"] { --group: var(--mint); }
[data-group="components"] { --group: var(--coral); }
[data-group="patterns"] { --group: var(--mango); }
[data-group="start"], [data-group="agents"] { --group: var(--aqua); }
[data-group="resources"] { --group: var(--mango); }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top-h) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.7 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: underline; text-decoration-color: var(--link-line); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 4px; }
img, svg { max-width: 100%; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; background: var(--ink); color: #fff; border-radius: 8px; }
.skip:focus { top: 10px; }
.pict { width: 1em; height: 1em; color: var(--ink); flex: none; }

/* ── Top bar ── */
.top { position: sticky; top: 0; z-index: 50; height: var(--top-h); display: flex; align-items: center; gap: 20px; padding: 0 20px; background: var(--ink); color: #f2f5f3; }
.top a { color: inherit; text-decoration: none; }
.brand { display: flex; align-items: baseline; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; white-space: nowrap; }
.brand small { font-weight: 500; font-size: 14px; letter-spacing: 0; color: #b9c6bf; }
.brand i { font-style: normal; color: var(--coral); }
.top-nav { display: flex; gap: 2px; margin-left: 8px; }
.top-nav a { white-space: nowrap; padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; color: #c9d4ce; }
.top-nav a:hover, .top-nav a[aria-current="true"] { color: #fff; background: rgba(255,255,255,.08); }
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tool { height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 9px; border: 1px solid rgba(255,255,255,.16); background: transparent; color: #e3ebe6; font: 500 13px/1 var(--font); cursor: pointer; text-decoration: none; }
.tool:hover { background: rgba(255,255,255,.08); }
.tool kbd { font: 500 11px/1 var(--font); color: #9fb0a7; border: 1px solid rgba(255,255,255,.18); border-radius: 4px; padding: 3px 5px; }
.tool svg { width: 16px; height: 16px; }
.tool--solid { background: var(--coral); border-color: var(--coral); color: var(--ink); font-weight: 600; }
.tool--solid:hover { background: #f5a08a; }
.reader { display: inline-flex; padding: 3px; border-radius: 10px; background: rgba(255,255,255,.08); }
.reader button { height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: none; color: #b9c6bf; font: 500 13px/1 var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.reader button[aria-pressed="true"] { background: var(--mint); color: var(--ink); }
.reader button svg { width: 14px; height: 14px; }
.menu-btn { display: none; }

/* ── Shell ── */
.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: calc(100vh - var(--top-h)); }
.side { position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow-y: auto; padding: 20px 14px 40px; border-right: 1px solid var(--line); background: var(--bg); }
.side h2 { margin: 20px 10px 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.side h2:first-child { margin-top: 4px; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side a { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; font-size: 14px; color: var(--text); text-decoration: none; line-height: 1.35; }
.side a:hover { background: var(--sunk); }
.side a[aria-current="page"] { background: var(--surface); box-shadow: inset 3px 0 0 var(--ink); font-weight: 600; }
html[data-site-theme="dark"] .side a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--mint); }
.side .count { margin-left: auto; font-size: 12px; color: var(--text-2); }
.side details summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; margin: 20px 10px 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.side details summary::-webkit-details-marker { display: none; }
.side details summary::after { content: '+'; font-size: 16px; font-weight: 400; }
.side details[open] summary::after { content: '–'; }

.main { min-width: 0; }
.page { display: grid; grid-template-columns: minmax(0, 1fr) var(--toc-w); gap: 48px; max-width: 1180px; padding: 0 48px 96px; }
.toc { position: sticky; top: calc(var(--top-h) + 24px); align-self: start; padding-top: 40px; font-size: 13px; }
.toc p { margin: 0 0 8px; font-weight: 600; color: var(--text-2); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; color: var(--text-2); text-decoration: none; border-left: 2px solid transparent; line-height: 1.4; }
.toc a:hover { color: var(--text); }
.toc a.on { color: var(--text); border-left-color: var(--text); font-weight: 500; }
.toc .agent-links { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.toc .agent-links a { padding: 0; border: 0; margin: 0; }

/* ── Masthead: the film-edge band every page opens with ── */
.mast { position: relative; background: var(--mast); color: var(--mast-text); padding: 56px 48px 72px; overflow: hidden; }
.mast .sprockets { position: absolute; left: 0; right: 0; bottom: 12px; height: 12px; display: flex; gap: 14px; padding: 0 14px; }
.mast .sprockets i { flex: none; width: 18px; height: 12px; border-radius: 3px; background: var(--bg); }
.mast-in { max-width: 1132px; display: grid; grid-template-columns: minmax(0, 1fr) min(41%, 440px); gap: 32px; align-items: end; }
.mast-in:not(:has(.plate)) { grid-template-columns: minmax(0, 1fr); }
.mast .crumbs { font-size: 13px; color: var(--mast-2); margin-bottom: 18px; display: flex; gap: 8px; flex-wrap: wrap; }
.mast .crumbs a { color: var(--mast-2); text-decoration: none; }
.mast .crumbs a:hover { color: #fff; }
.mast h1 { margin: 0; font-size: clamp(40px, 4.5vw, 66px); overflow-wrap: anywhere; line-height: 1.02; font-weight: 800; letter-spacing: -.035em; max-width: 14ch; }
.mast .lede { margin: 22px 0 0; max-width: 58ch; font-size: 18px; line-height: 1.6; color: #d3ddd7; }
.mast .plate { width: min(440px, 100%); padding: 28px; border-radius: 16px; background: var(--k-bg); color: var(--k-text); display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; min-height: 200px; }
.mast .plate.dark { background: var(--k-bg); }
.mast .status { display: inline-flex; gap: 8px; margin-top: 22px; flex-wrap: wrap; }
.mast .status span { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.2); color: #d3ddd7; }
.mast .status span.g { background: var(--group); color: var(--ink); border-color: var(--group); }
.mast .bar { position: absolute; left: 0; top: 0; width: 100%; height: 6px; background: var(--group); }

/* ── Tabs for component pages ── */
.page-tabs { position: sticky; top: var(--top-h); z-index: 20; display: flex; gap: 4px; padding: 0 48px; background: var(--bg); border-bottom: 1px solid var(--line); overflow-x: auto; }
.page-tabs button { height: 52px; padding: 0 14px; border: 0; background: none; font: 500 15px/1 var(--font); color: var(--text-2); cursor: pointer; box-shadow: inset 0 -3px 0 transparent; white-space: nowrap; }
.page-tabs button[aria-selected="true"] { color: var(--text); box-shadow: inset 0 -3px 0 var(--group); }
html.js [data-tab-panel][hidden] { display: none; }

/* ── Prose ── */
.prose { padding-top: 40px; max-width: 760px; }
.prose > :first-child { margin-top: 0; }
.prose h2:not(.kw-root *) { font-size: 30px; line-height: 1.2; letter-spacing: -.02em; font-weight: 700; margin: 64px 0 16px; }
.prose h3:not(.kw-root *) { font-size: 20px; line-height: 1.3; font-weight: 600; margin: 36px 0 10px; }
.prose h4:not(.kw-root *) { font-size: 16px; margin: 24px 0 6px; }
.prose p:not(.kw-root *), .prose li:not(.kw-root *) { color: var(--text); }
.prose p:not(.kw-root *) { margin: 0 0 16px; }
.prose ul:not(.kw-root *), .prose ol:not(.kw-root *) { padding-left: 22px; margin: 0 0 18px; }
.prose li:not(.kw-root *) { margin: 6px 0; }
.prose li:not(.kw-root *)::marker { color: var(--text-2); }
.prose strong:not(.kw-root *) { font-weight: 600; }
.prose blockquote:not(.kw-root *) { margin: 24px 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--group); font-size: 19px; line-height: 1.55; }
.prose hr:not(.kw-root *) { border: 0; height: 1px; background: var(--line); margin: 48px 0; }
.prose code:not(.kw-root *) { font: 500 .86em/1 var(--mono); padding: 3px 6px; border-radius: 5px; background: var(--sunk); }
.prose pre:not(.kw-root *) { position: relative; margin: 20px 0 24px; padding: 18px 20px; border-radius: 12px; background: var(--code-bg); color: var(--code-text); overflow-x: auto; font: 400 13.5px/1.65 var(--mono); }
.prose pre:not(.kw-root *) code { padding: 0; background: none; font: inherit; color: inherit; }
.copy { position: absolute; top: 10px; right: 10px; height: 28px; padding: 0 10px; border-radius: 7px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); color: #dce6e0; font: 500 12px/1 var(--font); cursor: pointer; }
.copy:hover { background: rgba(255,255,255,.14); }
.prose table:not(.kw-root *) { width: 100%; border-collapse: collapse; margin: 20px 0 28px; font-size: 14.5px; }
.prose th:not(.kw-root *) { text-align: left; font-weight: 600; padding: 10px 12px; border-bottom: 2px solid var(--text); }
.prose td:not(.kw-root *) { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-scroll { overflow-x: auto; }

/* highlight.js, Kwark colours */
.hljs-keyword, .hljs-selector-tag, .hljs-built_in { color: #f28b71; }
.hljs-string, .hljs-attr, .hljs-attribute { color: #badfcf; }
.hljs-number, .hljs-literal, .hljs-variable, .hljs-template-variable { color: #fac374; }
.hljs-title, .hljs-name, .hljs-selector-class, .hljs-tag { color: #83cfd3; }
.hljs-comment { color: #7f8f86; font-style: italic; }

/* ── Doc blocks ── */
.demo { margin: 24px 0 28px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.demo-stage { padding: 32px; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.demo-stage.col { flex-direction: column; align-items: stretch; }
.demo-bar { display: flex; align-items: center; gap: 4px; padding: 6px 10px; border-top: 1px solid var(--line); background: var(--sunk); }
.demo-bar button { height: 30px; padding: 0 10px; border: 0; border-radius: 7px; background: none; color: var(--text-2); font: 500 12.5px/1 var(--font); cursor: pointer; }
.demo-bar button:hover, .demo-bar button[aria-pressed="true"] { background: var(--surface); color: var(--text); }
.demo-bar .sp { flex: 1; }
.demo pre { margin: 0; border-radius: 0; }

.dd { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0 28px; }
.dd figure { margin: 0; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.dd figure > div { padding: 18px 20px; }
.dd figcaption { display: flex; align-items: center; gap: 8px; padding: 10px 20px; font-weight: 600; font-size: 14px; border-top: 4px solid; }
.dd .do figcaption { border-color: #3f7f6a; }
.dd .dont figcaption { border-color: #c44b37; }
.dd .do figcaption::before { content: ''; width: 16px; height: 16px; border-radius: 50%; background: #3f7f6a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.dd .dont figcaption::before { content: ''; width: 16px; height: 16px; border-radius: 50%; background: #c44b37 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 5l6 6M11 5l-6 6' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.dd figure > div > :last-child { margin-bottom: 0; }

.callout { margin: 24px 0; padding: 18px 20px 18px 22px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--group); }
.callout > :last-child { margin-bottom: 0; }
.callout.agent { border-left-color: var(--aqua); background: color-mix(in srgb, var(--aqua) 10%, var(--surface)); }
.callout.agent::before { content: 'For agents'; display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--text-2); }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin: 20px 0 28px; }
.swatch { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.swatch b { display: block; height: 72px; }
.swatch div { padding: 10px 12px; font-size: 13px; line-height: 1.4; }
.swatch code { font-size: 12px; }
.swatch span { display: block; color: var(--text-2); font-size: 12px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin: 24px 0 32px; }
.card { display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--text); transition: border-color .2s var(--ease), transform .2s var(--ease); }
.card:hover { border-color: var(--text); transform: translateY(-2px); }
.card .pict { width: 48px; height: 48px; }
.card strong { font-size: 17px; font-weight: 600; }
.card span { font-size: 14px; color: var(--text-2); line-height: 1.5; }

.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 20px 0 28px; }
.room { border-radius: 14px; padding: 16px; min-height: 190px; display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--k-line); }
.room .sheet { flex: 1; background: var(--k-page); border-radius: 4px; padding: 12px; font: 400 12px/1.5 var(--k-font-screenplay); }
.room b { font-weight: 600; font-size: 14px; }

.type-scale { margin: 20px 0 28px; border-top: 1px solid var(--line); }
.type-scale div { display: grid; grid-template-columns: 140px 1fr; gap: 16px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--line); }
.type-scale code { font-size: 12px; }

/* status table pills */
.st { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.st-stable { background: #e4f1eb; color: #2c6650; }
.st-new { background: #fdf0d8; color: #7a5413; }
.st-planned { background: var(--sunk); color: var(--text-2); }
html[data-site-theme="dark"] .st-stable { background: #1b2b25; color: #9fd4bf; }
html[data-site-theme="dark"] .st-new { background: #2e2615; color: #f0cb88; }

/* ── Agent view ── */
.agent-view { display: none; padding-top: 32px; }
html[data-reader="agent"] .human-view { display: none; }
html[data-reader="agent"] .agent-view { display: block; }
html[data-reader="agent"] .page-tabs { display: none; }
.agent-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.agent-head p { margin: 0; flex: 1 1 260px; color: var(--text-2); font-size: 14px; }
.agent-head a, .agent-head button { height: 34px; padding: 0 12px; display: inline-flex; align-items: center; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 500 13px/1 var(--font); cursor: pointer; text-decoration: none; }
.agent-md { margin: 0; padding: 24px; border-radius: 14px; background: var(--code-bg); color: var(--code-text); font: 400 13.5px/1.7 var(--mono); white-space: pre-wrap; word-break: break-word; max-height: none; }
.agent-md .h { color: var(--aqua); font-weight: 700; }
.agent-md .r { color: var(--mango); }

/* ── Search ── */
.search-dialog { width: min(640px, calc(100vw - 24px)); max-height: min(560px, calc(100vh - 80px)); margin-top: 10vh; padding: 0; border: 0; border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(0,0,0,.3); }
.search-dialog::backdrop { background: rgba(15, 20, 17, .55); }
.search-dialog input { width: 100%; height: 60px; padding: 0 20px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font: 500 18px/1 var(--font); outline: none; }
.search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; max-height: 470px; }
.search-results a { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--text); }
.search-results a[data-active="true"], .search-results a:hover { background: var(--sunk); }
.search-results .pict { width: 32px; height: 32px; }
.search-results small { display: block; color: var(--text-2); font-size: 13px; line-height: 1.4; }
.search-empty { padding: 20px; color: var(--text-2); }

/* ── Footer ── */
.foot { background: var(--ink); color: #c9d4ce; padding: 48px; font-size: 14px; }
.foot-in { max-width: 1132px; display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 32px; }
.foot a { color: #e8efea; text-decoration: none; display: block; padding: 3px 0; }
.foot a:hover { text-decoration: underline; }
.foot strong { color: #fff; display: block; margin-bottom: 8px; }
.foot p { margin: 0; max-width: 36ch; line-height: 1.6; }

/* ── Home ── */
.home .shell { display: block; }
.hero { position: relative; background: var(--ink); color: #f2f5f3; overflow: hidden; }
.hero-in { max-width: 1320px; margin: 0 auto; padding: 72px 48px 96px; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; align-items: center; }
.hero h1 { margin: 0; font-size: clamp(46px, 6.4vw, 96px); line-height: .94; font-weight: 800; letter-spacing: -.045em; }
.hero h1 span { display: block; color: var(--mint); }
.hero .lede { margin: 28px 0 0; font-size: 19px; line-height: 1.6; color: #cdd8d2; max-width: 44ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.btn { height: 48px; display: inline-flex; align-items: center; gap: 10px; padding: 0 22px; border-radius: 12px; font: 600 15px/1 var(--font); text-decoration: none; border: 1.5px solid transparent; cursor: pointer; }
.btn-coral { background: var(--coral); color: var(--ink); }
.btn-coral:hover { background: #f5a08a; }
.btn-line { border-color: rgba(255,255,255,.3); color: #f2f5f3; }
.btn-line:hover { border-color: #fff; }
.btn-ink { background: var(--ink); color: #f2f5f3; }
.hero .sprockets { position: absolute; left: 0; right: 0; height: 12px; display: flex; gap: 14px; padding: 0 14px; }
.hero .sprockets.t { top: 14px; } .hero .sprockets.b { bottom: 14px; }
.hero .sprockets i { flex: none; width: 18px; height: 12px; border-radius: 3px; background: #2b3530; }

/* The splice: one screen, two readers */
.splice { position: relative; border-radius: 18px; overflow: hidden; aspect-ratio: 7 / 5; background: #f2f5f3; user-select: none; touch-action: pan-y; }
.splice-layer { position: absolute; inset: 0; padding: 22px; display: grid; grid-template-rows: auto auto 1fr auto; gap: 14px; }
.splice-human { background: #f2f5f3; color: var(--ink); }
.splice-agent { background: #0f1411; color: #cfe1d8; font-family: var(--mono); clip-path: inset(0 0 0 var(--cut, 55%)); }
.splice-handle { position: absolute; top: 0; bottom: 0; left: var(--cut, 55%); width: 44px; margin-left: -22px; cursor: ew-resize; display: grid; place-items: center; border: 0; background: none; padding: 0; }
.splice-handle::before { content: ''; position: absolute; top: 0; bottom: 0; left: 21px; width: 2px; background: var(--coral); }
.splice-handle span { position: relative; width: 36px; height: 36px; border-radius: 50%; background: var(--coral); display: grid; place-items: center; color: var(--ink); }
.splice-handle span svg { width: 18px; height: 18px; }
.splice-tag { position: absolute; top: 12px; font: 600 11px/1 var(--font); padding: 5px 8px; border-radius: 6px; pointer-events: none; }
.splice-tag.l { left: 12px; background: var(--ink); color: #fff; }
.splice-tag.r { right: 12px; background: var(--mint); color: var(--ink); }
.quark { position: absolute; left: var(--cut, 55%); width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; pointer-events: none; }

/* The hero uses the same scene-card specimen as the catalogue. */
.hero-source-path { padding-top: 18px; font: 500 12px/1.5 var(--font); }
.hero-source-card { display: flex; align-items: center; background: none; }
.hero-source-card .kw-index-card { width: 280px; min-width: 240px; }
.hero-source-note { max-width: 30ch; font: 400 12px/1.5 var(--font); }
.splice-human { grid-template-rows: auto 1fr auto; }
.splice-agent { left: var(--cut, 55%); clip-path: none; padding: 48px 18px 18px; overflow: hidden; display: block; }
.hero-agent-source { margin: 0; color: var(--mint); font: 400 12px/1.65 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; min-width: 16ch; }
.sx-page { background: #fff; border-radius: 10px; border: 1px solid #d9e2dd; padding: 16px 18px; font: 400 12.5px/1.6 'Courier Prime', monospace; color: #1b221e; overflow: hidden; }
.sx-page .slug { font-weight: 700; }
.sx-page .chr { margin: 8px 0 0 34%; }
.sx-page .dia { margin: 0 18% 0 20%; }
.sx-page .sug { position: relative; background: #e4f1eb; box-shadow: inset 0 -1.5px 0 #8cc3ae; }
.sx-page .star { position: absolute; right: -14px; color: #3f7f6a; font-weight: 700; }
.band { padding: 96px 48px; }
.band-in { max-width: 1224px; margin: 0 auto; }
.band h2 { margin: 0 0 14px; font-size: clamp(32px, 4vw, 56px); line-height: 1.02; letter-spacing: -.035em; font-weight: 800; max-width: 18ch; }
.band .sub { margin: 0 0 40px; font-size: 18px; color: var(--text-2); max-width: 60ch; }
.doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.door { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 28px; min-height: 300px; border-radius: 20px; text-decoration: none; color: var(--ink); overflow: hidden; transition: transform .25s var(--ease); }
.door:hover { transform: translateY(-4px); }
.door .pict { width: 88px; height: 88px; }
.door h3 { margin: auto 0 0; font-size: 28px; line-height: 1.1; letter-spacing: -.02em; font-weight: 800; }
.door p { margin: 0; font-size: 15px; line-height: 1.55; max-width: 34ch; }
.door.d1 { background: var(--mint); } .door.d2 { background: var(--mango); } .door.d3 { background: var(--aqua); }

.claims { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; border-top: 2px solid var(--text); }
.claim { padding: 32px 32px 36px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 64px 1fr; gap: 20px; }
.claim:nth-child(odd) { border-right: 1px solid var(--line); }
.claim:nth-child(even) { padding-left: 32px; }
.claim .pict { width: 64px; height: 64px; }
.claim h3 { margin: 0 0 8px; font-size: 22px; letter-spacing: -.01em; }
.claim p { margin: 0; color: var(--text-2); line-height: 1.6; }

.index-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.index-grid a { background: var(--surface); padding: 22px; min-height: 150px; display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--text); transition: background .2s var(--ease); }
.index-grid a:hover { background: var(--sunk); }
.index-grid .pict { width: 44px; height: 44px; }
.index-grid strong { font-size: 16px; margin-top: auto; }
.index-grid span { font-size: 13px; color: var(--text-2); line-height: 1.45; }

.revdemo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.revdemo .sx-page { font-size: 15px; padding: 28px 32px; }
.revdemo .sx-page [contenteditable] { outline: none; }
.revdemo .sx-page [contenteditable]:focus { box-shadow: 0 0 0 2px var(--ink); border-radius: 2px; }
.revstate { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; }

.dark-band { background: var(--ink); color: #f2f5f3; }
.dark-band .sub { color: #b9c6bf; }
.dark-band h2 { color: #fff; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 8px; }
.stats div { border-top: 2px solid var(--mint); padding-top: 14px; }
.stats b { display: block; font-size: 44px; line-height: 1; font-weight: 800; letter-spacing: -.03em; }
.stats span { font-size: 14px; color: #b9c6bf; }

/* ── Responsive ── */
@media (max-width: 1180px) {
  .page { grid-template-columns: minmax(0, 1fr); padding: 0 32px 80px; }
  .toc { display: none; }
  .index-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 980px) {
  .top-nav { display: none; }
  .menu-btn { display: inline-flex; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: var(--top-h) auto 0 0; width: min(320px, 86vw); z-index: 40; transform: translateX(-102%); transition: transform .25s var(--ease); background: var(--bg); box-shadow: 0 0 0 100vmax transparent; }
  html.nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(15,20,17,.5); }
  .hero-in { grid-template-columns: 1fr; padding: 56px 24px 72px; gap: 40px; }
  .doors { grid-template-columns: 1fr; }
  .door { min-height: 220px; }
  .claims { grid-template-columns: 1fr; }
  .claim:nth-child(odd) { border-right: 0; }
  .claim:nth-child(even) { padding-left: 0; }
  .revdemo { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .foot-in { grid-template-columns: 1fr 1fr; }
  .mast-in { grid-template-columns: 1fr; }
  .mast .plate { width: 100%; min-height: 0; }
}
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .top { padding: 0 12px; gap: 8px; }
  .brand small, .tool .lbl, .tool kbd, .top-tools .tool--solid { display: none; }
  .reader button { padding: 0 9px; }
  .mast { padding: 40px 20px 60px; }
  .page { padding: 0 20px 64px; }
  .page-tabs { padding: 0 12px; }
  .band { padding: 64px 20px; }
  .dd { grid-template-columns: 1fr; }
  .demo-stage { padding: 20px; }
  .index-grid { grid-template-columns: 1fr; }
  .foot { padding: 40px 20px; }
  .foot-in { grid-template-columns: 1fr; }
  .stats b { font-size: 34px; }
  .splice { aspect-ratio: 4 / 5; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; scroll-behavior: auto !important; }
}

/* Basics row on the home page: each tile shows the thing itself */
.claim { grid-template-columns: 1fr; }
.basics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.basics a { display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; transition: border-color .2s var(--ease); }
.basics a:hover { border-color: var(--text); }
.basics strong { font-size: 18px; margin-top: 10px; }
.basics span { font-size: 14px; color: var(--text-2); line-height: 1.45; }
.spec { height: 84px; border-radius: 10px; background: var(--sunk); display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; color: var(--text); }
.spec-color i { width: 22px; height: 56px; border-radius: 5px; }
.spec-type { gap: 14px; }
.spec-type b { font: 800 40px/1 var(--font); }
.spec-type em { font: 600 34px/1 'Noto Sans Devanagari', var(--font); font-style: normal; }
.spec-type s { font: 700 18px/1 'Courier Prime', monospace; text-decoration: none; }
.spec-radius i { width: 34px; height: 34px; border: 2px solid var(--text); background: var(--surface); }
.spec-elev { position: relative; }
.spec-elev i { position: absolute; width: 70px; height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.spec-elev i:nth-child(1) { transform: translate(-22px, 8px); }
.spec-elev i:nth-child(2) { transform: translate(0, 0); background: var(--bg); }
.spec-elev i:nth-child(3) { transform: translate(22px, -8px); box-shadow: 0 10px 24px rgba(15,23,42,.18); }
.spec-space { align-items: flex-end; gap: 6px; }
.spec-space i { height: 44px; background: var(--coral); border-radius: 2px; }
.spec-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.spec-grid i { height: 56px; background: color-mix(in srgb, var(--aqua) 55%, transparent); border-radius: 3px; }
.spec-motion svg { width: 120px; height: 60px; }
.spec-icons svg { width: 28px; height: 28px; }
@media (max-width: 980px) { .basics { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .basics { grid-template-columns: 1fr; } }
.side .nav-cat { margin: 14px 10px 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }

/* Mobile navigation and the home Markdown reader. */
.home-side { display: none; }
.home .agent-view { max-width: 960px; padding: var(--k-space-6) var(--k-space-4); margin-inline: auto; }
html[data-reader="agent"] .home-person { display: none; }
.demo-bar { flex-wrap: wrap; }
.demo-stage > *, .plate > * { min-width: 0; max-width: 100%; }
.top :focus-visible { outline-color: var(--k-brand-mint); }
@media (max-width: 980px) {
  .js .home-side { display: block; }
  .side { visibility: hidden; height: auto; }
  html.nav-open .side { visibility: visible; }
  .top .tool, .reader button { min-height: var(--k-tap); min-width: var(--k-tap); justify-content: center; }
  .top .tool svg { flex: none; }
  html:not(.js) .side { position: static; visibility: visible; transform: none; width: 100%; max-height: 45vh; }
}

.component-index { columns: 2 13rem; }
.component-index li { break-inside: avoid; }
.kw-cover__art { text-decoration: none; }
.kw-native-video { display: block; width: 100%; aspect-ratio: 16 / 9; background: var(--k-brand-ink); }
nav.kw-crumb { height: auto; }
nav.kw-crumb [aria-current="page"] { padding: 0; }

.main--tabs .prose :is(h2, h3)[id] { scroll-margin-top: 52px; }

.mobile-nav-tools { display: none; }
@media (max-width: 640px) {
  .top { padding-inline: 8px; gap: 8px; }
  .top-tools { gap: 8px; }
  .top #theme { display: none; }
  .reader button { width: var(--k-tap); padding: 0; }
  .reader .lbl { display: none; }
  .reader button svg { width: var(--k-icon-md); height: var(--k-icon-md); }
  .mobile-nav-tools { display: block; padding: var(--k-space-4) var(--k-space-2); }
  .mobile-nav-tools .kw-button { min-height: var(--k-tap); }
}

.table-scroll { max-width: 100%; }

.prose { overflow-wrap: anywhere; }
.prose :not(pre) > code { white-space: normal; overflow-wrap: anywhere; }

@media (max-width: 1240px) { .top-nav { display: none; } .menu-btn { display: inline-flex; } }
@media (min-width: 981px) and (max-width: 1240px) { .menu-btn { display: none; } }
/* Header plate: specimens never spill out of it */
.mast .plate { overflow: hidden; }
.mast .plate > * { max-width: 100%; min-width: 0; }
.mast .plate .kw-card, .mast .plate [class*="kw-"] { box-sizing: border-box; }
.mast .plate > :only-child { width: 100%; }
@media (max-width: 1280px) { .mast-in { grid-template-columns: 1fr; } .mast .plate { width: 100%; max-width: 560px; } }

/* Contrast fixes (16 Nov). `.top a { color: inherit }` outranked the solid button, leaving white on coral (2.4:1). */
.top .tool--solid { color: var(--ink); }
/* kw-root wrappers that sit on site surfaces (not demo stages) take the site's text colour, so they follow the site theme. */
.swatches.kw-root, .type-scale.kw-root, .basics.kw-root { color: var(--text); }
.swatches.kw-root code, .type-scale.kw-root code { color: var(--text-2); }
