/* Preview chrome only. Every component style still comes from the package
 * stylesheet; the few restated values below exist because the package keys
 * sizing off the host's `any-pointer: coarse`, and a simulated touch device
 * has to present a touch specimen inside a pointer host. */

@font-face {
  font-family: "Hanken Grotesk";
  src: url("./fonts/hanken-grotesk-400-800-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}
/* Metric-matched fallback. Hanken Grotesk is materially narrower than the
 * desktop sans the browser picks when it is absent (measured at 100px: Hanken
 * 2590 units, Arial 2562.7, DejaVu 2917.2). Until the real face arrives every
 * line is laid out against the fallback, so the swap re-wraps the document and
 * pushes everything below it down ~20px — a visible CLS spike at first paint.
 * Resizing the local face to Hanken's advance width turns that swap into a
 * repaint.
 *
 * DejaVu is the point: it is what `sans-serif` actually resolves to on this
 * platform, so it is the face the unstyled first frame already uses, and 91.5%
 * reproduces Hanken's line breaks across the whole static list (0 mismatched
 * sections, 0px total height delta — Arial-based fallbacks still re-wrap one
 * paragraph). The ascent/descent overrides match Hanken's own box (1.0 / 0.3
 * em); they matter only if line-height is ever left at `normal`. */
@font-face {
  font-family: "Hanken Grotesk Fallback";
  src: local("DejaVu Sans");
  size-adjust: 91.5%;
  ascent-override: 100%;
  descent-override: 30%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("./fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
/* Metric-matched fallback, same trick as the sans face above. IBM Plex Mono is
 * 600/1000 em per character; the generic monospace the browser picks in its
 * place is wider per character and, worse, some platforms resolve it to a
 * *proportional* face (measured at 100px: Plex 60.00 units, DejaVu Sans Mono
 * 88.92, the `ui-monospace` default 88.92). The install command is one line
 * in Plex and two lines in the fallback, so the late swap re-wraps the hero and
 * pushes the sizes and the stage below it down — a 0.2 CLS spike.
 *
 * The local faces below are the metric-compatible monospaces (Liberation Mono,
 * Courier New, Nimbus Mono PS all measure 60.01 units at 100px, i.e. Plex's
 * 60.00), so 99.83% makes the fallback advance exactly like Plex; the
 * ascent/descent overrides match Plex's own box (1025 / 275 per 1000 em). */
@font-face {
  font-family: "IBM Plex Mono Fallback";
  src: local("Liberation Mono"), local("Courier New"), local("Nimbus Mono PS");
  font-weight: 400;
  size-adjust: 99.83%;
  ascent-override: 102.5%;
  descent-override: 27.5%;
  line-gap-override: 0%;
}

/* The root carries the page colour, not just <body>. The UA gives `html` the
 * light canvas the document is written as, so in dark the overscroll gutter and
 * the rubber-band area are white while everything else is dark — a flash at the
 * top and bottom of every scroll on iOS, and a light strip under a shorter
 * document. Painting the root from the same token makes the page one colour
 * from the first frame, and follows the attribute the head script sets before
 * paint instead of after it. */
html { background: var(--kl-surface, #fbfbfa); }
body {
  --kprev-pad: 24px;
  /* The page's gutter belongs to the blocks, not to the body: the device frame
   * runs to the window edge, so a body padding would either clip it or leave a
   * seam down both sides of it. */
  --kprev-gutter: clamp(16px, 4vw, 40px);
  /* The content column every page-level block shares, so the hero, the toolbar
   * and the inventory all start and end on the same edge. */
  --kprev-col: 1400px;
  margin: 0;
  min-height: 100vh;
  padding: 0;
  box-sizing: border-box;
  background: var(--kl-surface, #fbfbfa);
  color: var(--kl-text, #37352f);
  font-family: "Hanken Grotesk", "Hanken Grotesk Fallback", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  /* The package owns --kl-font-mono; the preview only inserts its metric-matched
   * fallback ahead of the generic families, so the swap to the real face is a
   * repaint and not a re-wrap. */
  --kl-font-mono: "IBM Plex Mono", "IBM Plex Mono Fallback", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 14px;
  line-height: 1.4;
  overflow-x: hidden;
}
/* The section bar is published as body's first child, so it owns the top edge as
 * it does on every hosting route: hard against y=0 and full-bleed (its own list
 * carries the gutter), which is what makes its 45px identical to the other
 * routes'. The bottom margin is the gap the body's top padding used to give. */
body:has(> .sn) > .sn {
  margin: 0 0 var(--kprev-pad);
}

/* --- The hero ---------------------------------------------------------------
 * The page opens with what the package is, how to install it and what it
 * costs: one line each, in the page's own type, on the page's own surface. */
.kprev-hero {
  max-width: var(--kprev-col);
  margin-inline: auto;
  padding: 44px var(--kprev-gutter) 28px;
}
.kprev-hero h1 {
  margin: 0 0 10px;
  font-size: 34px;
  font-weight: 650;
  letter-spacing: -0.03em;
  color: var(--kl-text);
}
.kprev-lede {
  margin: 0 0 20px;
  max-width: 70ch;
  font-size: 15px;
  line-height: 1.5;
  color: var(--kl-text-2);
}
.kprev-lede code { font: 13px/1.5 var(--kl-font-mono); color: var(--kl-text); }
.kprev-install {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.kprev-install-command {
  font: 13px/1.5 var(--kl-font-mono);
  padding: 9px 12px;
  border: 1px solid var(--kl-border);
  border-radius: 10px;
  background: var(--kl-raised);
  color: var(--kl-text);
}
.kprev-sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 40px;
  margin: 24px 0 0;
}
.kprev-sizes > div { min-width: 0; }
.kprev-sizes dt {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--kl-muted);
}
.kprev-sizes dd { margin: 3px 0 0; font-size: 13px; color: var(--kl-text-2); }

/* --- The toolbar ------------------------------------------------------------
 * One compact row: the two controls that change the page, and the fact line
 * that says what they did. It is sticky under the section bar, because the
 * gallery is long and the device control has to stay reachable. */
.kprev-toolbar {
  position: sticky;
  top: calc(var(--sn-h, 44px) + 1px);
  z-index: 20;
  background: var(--kl-surface);
  border-top: 1px solid var(--kl-border);
  border-bottom: 1px solid var(--kl-border);
}
.kprev-toolbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  flex-wrap: wrap;
  max-width: var(--kprev-col);
  margin-inline: auto;
  padding: 8px var(--kprev-gutter);
}
.kprev-toolbar-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}
/* A one-option track (phone) must not stretch to the toolbar's width, but a
 * wide track must shrink and scroll itself rather than push the page sideways. */
.kprev-toolbar-controls .kseg-track { flex: 0 1 auto; min-width: 0; }
.kprev-note {
  margin: 0;
  font-size: 12px;
  color: var(--kl-muted, #6a6967);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.kprev-static { max-width: 900px; margin-inline: auto; }
.kprev-static section { padding-block: 12px; border-top: 1px solid var(--kl-border); }
.kprev-static h2 { margin: 0; }
.kprev-static a { color: var(--kl-accent); }
/* --- First paint: the static shell the module replaces ---------------------
 * The shell is real content, not a placeholder, so it must occupy the same
 * geometry the live document will. It reuses the live chrome's own classes and
 * order (.kprev-bar > .kprev-title > h1 + .kprev-links), so the header cannot
 * move when React takes over — the swap changes the bar's children, not its
 * box. Only the two controls and the device frame really are pending until
 * React mounts, so those are the only things drawn as placeholders.
 *
 * The stage wrapper is deliberately NOT clipped or fixed-height: the static
 * content below it is the indexable page, and it stays fully visible and its
 * natural height. Nothing follows the stage, so the frame's later height does
 * not move any element — which is why reserving the frame's height here would
 * buy nothing and cost a 3 kB block of guesswork.
 */
.kprev-skel {
  display: none;
  border-radius: 8px;
  background: var(--kl-sunken, #f3f2ef);
  box-shadow: inset 0 0 0 1px var(--kl-border, #e6e6e3);
}
/* A placeholder is only honest if something is actually coming. Without
 * JavaScript these two tracks never resolve, so they are hidden and the shell
 * is simply a static page; with JavaScript the head script below reveals them
 * before paint, so they are present in the first frame that has a bundle. */
.kprev-js .kprev-skel { display: block; }
/* The live track's own heights; a wrong one is the vertical jump this prevents. */
.kprev-skel-theme { flex: 0 1 auto; width: 101px; height: 34px; }
/* Widths are the live track's per-tier widths; it shrinks and wraps like the
 * live track or the shell is one row taller than the row it becomes. */
.kprev-skel-device { flex: 0 1 auto; width: 347px; height: 34px; min-width: 0; }
@media (any-pointer: coarse) {
  .kprev-skel-theme, .kprev-skel-device { height: 50px; }
  .kprev-skel-device { width: 247px; }
}
@media (any-pointer: coarse) and (max-width: 599px) {
  .kprev-skel-device { width: 83px; }
}
/* Same wrapping as the live row, or the stage sits one line higher. */
.kprev-controls-pending { gap: 8px; flex-wrap: wrap; }
/* The loading line only makes sense while a bundle is coming. Without one the
 * static list below is the whole page, so the note says that instead. */
.kprev-note-nojs { display: block; }
.kprev-js .kprev-note-nojs { display: none; }
.kprev-js .kprev-note-pending .kprev-note-js { display: block; }
.kprev-note-pending .kprev-note-js { display: none; }
/* Full-bleed like the live stage, but sized by its content and never clipped.
 * It inherits .kprev-stage's margin-inline and width, so those are not repeated
 * here. Padding goes on the inner block, not this one: padding on a content-box
 * element would widen the stage past the live one. `flow-root` contains the
 * first paragraph's top margin instead of letting it collapse out and shift the
 * whole stage down by the difference. */
.kprev-stage-pending { display: flow-root; overflow: visible; height: auto; }
.kprev-stage-pending .kprev-static {
  padding: 0 var(--kprev-pad) 24px;
  max-width: calc(900px + 2 * var(--kprev-pad));
}

/* --- Handoff: static shell -> live tree, one 180ms dissolve ----------------
 * Both trees are painted and only opacity animates, so nothing reflows.
 * 180ms sits between the 160ms page fade and the 240ms theme swap. */
#app { position: relative; }
/* Plain block: wrapping the shell in it changes no geometry. */
.kprev-shell { display: flow-root; }
#kit-live[data-handoff] {
  position: absolute;
  inset: 0 0 auto;
  animation: kprev-handoff-in var(--kprev-handoff, 180ms) cubic-bezier(0.2, 0, 0, 1) both;
}
@keyframes kprev-handoff-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  #kit-live[data-handoff] { animation-duration: 1ms; }
}

/* The stage holds the height the frame occupies, so the document never gets a
 * scrollbar from the frame's own 1440px width. It runs to the window edge
 * (full-bleed) so a frame the size of the screen fits exactly. It never
 * scrolls: a device that does not fit is scaled to fit, and the page is the
 * only thing that scrolls on this route. */
.kprev-stage {
  overflow: hidden;
  overflow: clip;
  margin-inline: 0;
  width: 100%;
}
/* Drawn inside, so the frame's own CSS width is its full footprint and a
 * 1180px frame fits a 1180px window. */
.kprev-frame {
  margin-inline: auto;
  transform-origin: top left;
  outline: 1px solid var(--kl-border, #e6e6e3);
  outline-offset: -1px;
  border-radius: 8px;
  overflow: hidden;
  overflow: clip;
  box-shadow: 0 18px 40px -28px rgb(0 0 0 / 45%);
}
/* The device screen is the specimen, drawn on the page's own surface and as
 * tall as its content: the frame grows to the specimen, the page scrolls, and
 * nothing inside the device scrolls on its own. */
.kprev-screen {
  position: relative;
  width: 100%;
  height: auto;
  overflow: visible;
  box-sizing: border-box;
  padding: 24px;
  background: var(--kl-surface, #fbfbfa);
  color: var(--kl-text, #37352f);
  font-size: 14px;
  line-height: 1.4;
  container-type: inline-size;
}
.kprev-screen:focus-visible { outline: 2px solid var(--kl-accent, #1a66b3); outline-offset: -2px; }

.kprev-catalog { max-width: 1320px; margin-inline: auto; }
.kprev-group + .kprev-group { margin-top: 24px; }
.kprev-group > h2 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
/* --- Specimen grid and card anatomy ----------------------------------------
 * Every card is the same shape: title, one-sentence purpose, a live stage that
 * never collapses, an optional readout, and the Usage disclosure at the foot.
 * Cards size to their content (`align-items: start`): a card with less to show
 * does not stretch to its neighbour's height, so no card carries an empty
 * area. Six columns at 1440 because that is the width the approved export
 * draws four 300px+ cards in; spans are per card, not per group. */
.kprev-specimen {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.kprev-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  border: 1px solid var(--kl-border);
  border-radius: 14px;
  background: var(--kl-raised);
}
.kprev-card > h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 650;
  color: var(--kl-text);
}
.kprev-purpose {
  margin: 0 0 12px;
  /* px, not em: a block sized in em re-measures when the webfont swaps in, and
   * two lines of purpose text would move every card below it. */
  min-height: 36px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--kl-text-2);
}
/* The live stage: the specimen sits on its own sunken band so two cards read
 * as the same thing at a glance, and it grows to fill the row's tallest card. */
.kprev-live {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  /* Hugs its content. `stretch` already makes every card in a row the same
   * height; letting the band grow too would paint a tall empty sunken panel
   * in whichever card has the least to show. The spare height lands between
   * the stage and the Usage disclosure, which reads as breathing room. */
  flex: 0 1 auto;
  /* One control in a short stage sits in the middle of its band rather than
   * hugging its top edge, so a row of short cards reads as one row. */
  align-content: center;
  padding: 14px;
  border-radius: 10px;
  background: var(--kl-sunken);
}
/* A stage holding a full pattern does its own padding; two nested bands would
 * read as a card inside a card. */
.kprev-live > .kpattern-shell,
.kprev-live > .kpattern-gate-review { border-radius: 8px; background: var(--kl-raised); }
.kprev-live > .kpattern-layouts { margin: 0; }
.kprev-sub {
  margin: 4px 0 8px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--kl-muted);
}
.kprev-live > .kprev-sub:first-child { margin-top: 0; }
.kprev-readout {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--kl-text-2);
  font-variant-numeric: tabular-nums;
}
.kprev-toast-stack { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.kprev-group-intro {
  max-width: 72ch;
  margin: 0 0 12px;
  color: var(--kl-text-2);
}
.kprev-badge-sizes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 10px 12px;
}
.kprev-badge-sample { display: grid; justify-items: start; gap: 4px; color: var(--kl-text-2); font-size: 12px; }
.kprev-badge-example { min-height: 28px; display: flex; align-items: center; }
.kprev-specimen .kinput-group { max-width: 100%; }

/* --- Usage disclosure -------------------------------------------------------
 * A Kira row, not a browser `<details>` triangle: the summary is a 24px
 * (44px on touch) target whose chevron points right closed and down open.
 * Colour comes from the text role, so it never reads as a blue link among
 * specimen content. */
.kprev-guide { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--kl-border); }
.kprev-guide summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  margin-inline-start: -4px;
  padding-inline: 4px;
  border-radius: 6px;
  color: var(--kl-text-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.kprev-guide summary::-webkit-details-marker { display: none; }
.kprev-guide summary::marker { content: ""; }
.kprev-guide summary:hover { color: var(--kl-text); background: var(--kl-selected); }
.kprev-guide summary svg { flex: none; transition: transform 140ms cubic-bezier(0.2, 0, 0, 1); }
.kprev-guide details[open] > summary svg { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .kprev-guide summary svg { transition: none; } }
@media (any-pointer: coarse) { .kprev-guide summary { min-height: 44px; } }
.kprev-guide summary:focus-visible { outline: 2px solid var(--kl-accent); outline-offset: 2px; }
.kprev-guide details[open] > summary { margin-bottom: 8px; }
.kprev-guide details > :not(summary) { margin-block: 8px; font-size: 12.5px; }
.kprev-guide pre {
  padding: 8px;
  border-radius: 8px;
  background: var(--kl-sunken);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.kprev-guide code { font: 12px/1.5 var(--kl-font-mono); }
.kprev-guide ul { padding-inline-start: 20px; }
.kprev-guide li + li { margin-top: 6px; }
.kprev-guide a { color: var(--kl-accent); }
.kprev-composer-states {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 10px;
}
.kprev-composer-states > * { min-width: 0; }
.kprev-state-name { display: block; margin: 0 0 5px; font-size: 12px; color: var(--kl-text-2); }
.kprev-screen .row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
/* The showcase trigger sits near its card's leading edge, including in the
 * narrow device frames. Grow inward from that edge instead of across it. */
.kprev-screen .kmenu-popover { --kmenu-left: anchor(left); }
.kprev-screen .kprev-long-labels .row { flex-direction: column; align-items: flex-start; }
.kprev-long-labels .kbtn { line-height: 1.3; padding-block: 6px; }
.kprev-long-labels .kbadge { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.kprev-long-labels .kbadge-code { padding-inline: 6px; text-align: left; }
.kpattern-guide p { max-width: 72ch; }
.kpattern-example { scroll-margin-top: 12px; }
.kpattern-example > h3 { margin: 0 0 4px; font-size: 15px; font-weight: 650; }
.kpattern-shell,
.kpattern-gate-review {
  display: grid;
  min-width: 0;
  border: 1px solid var(--kl-border);
  border-radius: 14px;
  background: var(--kl-raised);
}
.kpattern-nav {
  display: flex;
  justify-content: space-between;
  padding: 4px;
  grid-row: 2;
  border-top: 1px solid var(--kl-border);
}
.kpattern-nav .kbtn {
  min-width: 0;
  min-height: 44px;
  flex: 1 1 0;
  padding: 4px;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.kpattern-nav svg { flex-shrink: 0; }
.kpattern-nav .kbtn[aria-current] { background: var(--kl-selected); color: var(--kl-text); }
.kpattern-page,
.kpattern-transcript,
.kpattern-details { min-width: 0; padding: 16px; }
.kpattern-example h4 { margin: 0; font-size: 18px; }
.kpattern-example h5 { margin: 0; font-size: 14px; }
.kpattern-dashboard { display: grid; gap: 14px; margin-top: 10px; }
.kpattern-line { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--kl-border); }
.kpattern-line a { color: var(--kl-accent); }
.kpattern-board {
  --lane-width: 100%;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--lane-width);
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}
.kpattern-lane-picker { margin: 12px 0; }
.kpattern-lane { min-width: 0; padding: 12px; border: 1px solid var(--kl-border); }
.kpattern-lane:not([data-active="true"]) { display: none; }
.kpattern-gates {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-x: auto;
  min-width: 0;
  border-bottom: 1px solid var(--kl-border);
}
.kpattern-gates li { flex: 1 0 62px; display: grid; gap: 2px; padding: 6px; border-radius: 8px; }
.kpattern-gates li[aria-current] { background: var(--kl-selected); }
.kpattern-gates span { font-size: 12px; color: var(--kl-text-2); }
.kpattern-history { max-height: 224px; overflow-y: auto; padding-left: 24px; overscroll-behavior: contain; }
.kpattern-history li { padding-block: 6px; border-bottom: 1px solid var(--kl-border); }
.kpattern-history p { margin: 3px 0 0; }
.kpattern-details { display: none; }
[data-preview-device="phone"] .kpattern-run-sheet.ksheet { width: min(100%, 390px); }
.kpattern-layouts { display: grid; gap: 8px; margin-block: 10px; }
.kpattern-layouts div { padding: 10px 12px; border: 1px solid var(--kl-border); border-radius: 8px; }
.kpattern-layouts dt { font-weight: 650; }
.kpattern-layouts dd { margin: 4px 0 0; color: var(--kl-text-2); }
.kprev-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

@container (min-width: 600px) {
  .kpattern-nav {
    grid-row: auto;
    flex-direction: column;
    justify-content: flex-start;
    border-top: 0;
    border-right: 1px solid var(--kl-border);
  }
  .kpattern-nav .kbtn { flex: 0 0 auto; }
  .kpattern-nav .kbtn > span { display: none; }
  .kpattern-shell { grid-template-columns: 56px minmax(0, 1fr); }
  .kpattern-board { --lane-width: 310px; gap: 8px; }
  .kpattern-lane-picker { display: none; }
  .kpattern-lane:not([data-active="true"]) { display: block; }
  .kpattern-layouts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (min-width: 1000px) {
  .kpattern-board { --lane-width: 330px; }
  .kpattern-dashboard { grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; }
  .kpattern-gate-review { grid-template-columns: 152px minmax(0, 1fr); }
  .kpattern-gates { flex-direction: column; border-bottom: 0; border-right: 1px solid var(--kl-border); }
  .kpattern-gates li { flex: 0 0 auto; }
  .kpattern-run-sheet.ksheet {
    inset: 0 0 0 auto;
    height: 100%;
    max-height: none;
    width: min(340px, 100%);
    margin: 0;
    border-radius: 22px 0 0 22px;
    animation: none;
  }
}
@container (min-width: 1300px) {
  .kpattern-board { --lane-width: 340px; }
  .kpattern-shell { grid-template-columns: 180px minmax(0, 1fr); }
  .kpattern-nav .kbtn { flex-direction: row; justify-content: flex-start; gap: 8px; padding: 6px 12px; font-size: 14px; }
  .kpattern-nav .kbtn > span { display: inline; }
  .kpattern-gate-review { grid-template-columns: 152px minmax(0, 1fr) 240px; }
  .kpattern-details { display: block; border-left: 1px solid var(--kl-border); }
  .kpattern-details-trigger.kbtn { display: none; }
}

#app:empty::after {
  content: "bundle missing — run node preview/build-fixture.mjs";
  display: block;
  padding: 12px;
  border: 1px solid #bc3b37;
  border-radius: 6px;
  color: #bc3b37;
  font-weight: 600;
}

@container (min-width: 616px) {
  .kprev-specimen { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kprev-span-2, .kprev-span-3, .kprev-span-4, .kprev-span-6 { grid-column: span 2; }
}
@container (min-width: 1000px) {
  .kprev-specimen { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kprev-span-3 { grid-column: span 3; }
  .kprev-span-4, .kprev-span-6 { grid-column: span 3; }
}
@container (min-width: 1248px) {
  .kprev-specimen { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kprev-span-2 { grid-column: span 2; }
  .kprev-span-3 { grid-column: span 3; }
  .kprev-span-4 { grid-column: span 4; }
  .kprev-span-6 { grid-column: span 6; }
}
@container (max-width: 480px) {
  .kprev-specimen { gap: 12px; }
  .kprev-card { padding: 12px; }
  .kprev-live { padding: 12px; }
}

/* Touch specimen: the package's own touch sizes, restated for the simulated
 * frame. Values mirror styles.css @media (any-pointer: coarse); the host may
 * have raised them too, and these win by being the frame's own. */
[data-preview-pointer="coarse"] .kbtn { --kbtn-h: 44px; --kbtn-r: 10px; }
[data-preview-pointer="coarse"] .kbtn.kbtn-sm { --kbtn-h: 36px; --kbtn-r: 6px; }
[data-preview-pointer="coarse"] .kbtn.kbtn-lg { --kbtn-h: 48px; }
/* The frame mirrors the package's coarse-pointer sizes, but must not overrule a
 * component that sizes itself: the Menu's word trigger sets its own width and
 * would be clamped back to the 44px square here, spilling its label. */
[data-preview-pointer="coarse"] .kbtn.kbtn-icon:not(.kmenu-trigger) { --kbtn-w: 44px; }
[data-preview-pointer="coarse"] .kbtn.kbtn-icon-sm { --kbtn-h: 36px; --kbtn-w: 36px; --kbtn-r: 6px; }
[data-preview-pointer="coarse"] .kbadge:is(.kbadge-status, .kbadge-count):not(.kbadge-sm, .kbadge-md, .kbadge-xl) {
  --kbadge-fs: 12.5px;
}
[data-preview-pointer="coarse"] .kseg-seg,
[data-preview-pointer="coarse"] .kseg-seg-sm { --kseg-h: 44px; }
/* sm/icon-sm keep their visual box; pad the hit area to 44px like the sheet. */
[data-preview-pointer="coarse"] .kbtn.kbtn-sm,
[data-preview-pointer="coarse"] .kbtn.kbtn-icon-sm { position: relative; }
[data-preview-pointer="coarse"] .kbtn.kbtn-sm::after,
[data-preview-pointer="coarse"] .kbtn.kbtn-icon-sm::after {
  content: "";
  position: absolute;
  inset: calc((var(--kbtn-h) - 44px) / 2);
}

@media (max-width: 480px) { body { --kprev-pad: 14px; } }
/* The theme attribute is the one source of truth; native scrollbars and
 * form-control chrome follow it instead of staying light on a dark page. */
:root[data-kira-theme="light"] { color-scheme: light; }
:root[data-kira-theme="dark"] { color-scheme: dark; }
/* Two transitions, one shared vocabulary with the hosted catalog.
 *
 * 1. Page to page (`navigation: auto`): every cross-document arrival fades over
 *    160ms, like /devices/ and the catalog, so a hop Home -> Kit reads as one
 *    move. Both pages opt in, which is what makes the fade apply at all.
 * 2. Day/night (`html[data-kira-theme-tween]`): scoped to a transient root flag
 *    that main.tsx sets for exactly one transition and removes when it settles.
 *    At rest these rules do nothing, so a first paint, a restored preference, a
 *    resize or a navigation never picks up the theme fade — including the /kit/
 *    entry this file's pre-paint adoption exists to keep still. 240ms, the
 *    hosted duration: new snapshot in over the old, transform/opacity only.
 *
 * Reduced motion stands the whole block down; the JS also refuses to start a
 * transition, so the swap is instant there twice over. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }

  ::view-transition-old(root), ::view-transition-new(root) {
    animation-duration: 160ms;
  }

  /* The section bar is the one band that must not move between routes: it is
   * the same 45px of chrome on every route, painted as static HTML before the
   * first frame. Naming it lifts it out of the root cross-fade, so the bar is
   * stepped rather than blended — the same rule the hosting site's own shell
   * applies (host/theme-shim.css), so a hop between routes behaves the same
   * whichever way it is taken. */
  .sn { view-transition-name: kira-section-bar; }
  ::view-transition-group(kira-section-bar),
  ::view-transition-image-pair(kira-section-bar),
  ::view-transition-old(kira-section-bar),
  ::view-transition-new(kira-section-bar) {
    animation: none !important;
  }
  /* The old image is dropped: the selected pill genuinely moves between
   * routes, and two stacked bars would show two pills pressed at once. */
  ::view-transition-old(kira-section-bar) { opacity: 0; }
  /* The bar's own colour, so a translucent fill composites over paper exactly
   * as it does at rest, whatever the root cross-fade paints in that region. */
  ::view-transition-group(kira-section-bar) { background: #fbfbfa; }
  html[data-kira-theme="dark"]::view-transition-group(kira-section-bar) { background: #191919; }
}
/* The old snapshot stays opaque underneath while the new one fades in over it.
 * Both fading at once would let the page backdrop through at the midpoint and
 * flash mid-grey between the palettes. */
html[data-kira-theme-tween]::view-transition-old(root) { animation: none; }
html[data-kira-theme-tween]::view-transition-new(root) {
  animation: kprev-theme-in 240ms cubic-bezier(0.2, 0, 0, 1);
}
@keyframes kprev-theme-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  html[data-kira-theme-tween]::view-transition-new(root) { animation: none !important; }
}
