/* Keyline 3D website: everything shared. Tokens, type, the layout grid, the plate with its crop marks, captions,
   buttons and the nav. Sections add their own CSS in sections/<name>.css. */
:root {
  --bg: #f7f7f8; --ink: #18181b; --soft: #5f5f68; --faint: #6a6a73; --rule: #e4e4e8; --rule-2: #d0d0d6;
  --hover: rgba(24, 24, 27, .05); --scrim: rgba(247, 247, 248, .72);
  --glass: rgba(255, 255, 255, .86); --glass-edge: color-mix(in srgb, var(--ink) 10%, transparent);
  --glass-shadow: 0 18px 50px rgba(24, 24, 27, .10), 0 1px 3px rgba(24, 24, 27, .06);
  --sans: 'IBM Plex Sans', system-ui, sans-serif; --mono: 'IBM Plex Mono', ui-monospace, monospace;
  /* layout: a 12-column grid, 1360 px wide; 8 px rhythm; sections sit --sec-gap apart */
  --page: 1360px; --gutter: 32px; --col-gap: 24px; --sec-gap: 96px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #111111; --ink: #ececef; --soft: #a2a2ab; --faint: #919199; --rule: #232327; --rule-2: #34343a;
    --hover: rgba(255, 255, 255, .07); --scrim: rgba(17, 17, 17, .72);
    --glass: rgba(24, 24, 26, .9);
    --glass-shadow: 0 18px 50px rgba(0, 0, 0, .45), 0 1px 3px rgba(0, 0, 0, .3); color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #111111; --ink: #ececef; --soft: #a2a2ab; --faint: #919199; --rule: #232327; --rule-2: #34343a;
  --hover: rgba(255, 255, 255, .07); --scrim: rgba(17, 17, 17, .72);
  --glass: rgba(24, 24, 26, .9);
  --glass-shadow: 0 18px 50px rgba(0, 0, 0, .45), 0 1px 3px rgba(0, 0, 0, .3); color-scheme: dark; }
@media (max-width: 900px) { :root { --gutter: 20px; --sec-gap: 72px; } }

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.6 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* layout: a section's box, and the 12-column grid inside it */
.wrap { max-width: var(--page); margin: 0 auto; padding-inline: var(--gutter); }
.grid12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--col-gap); }

/* type scale: h1 46 (hero only), section titles 28, lines 16, captions 14 and 13, labels and mono 12 */
/* no lone last words: headings balance their lines, running text pulls a word down beside a widow */
h1, h2, h3 { text-wrap: balance; }
p, li, dd, figcaption { text-wrap: pretty; }
.sec-title { font-weight: 500; font-size: 28px; line-height: 1.15; letter-spacing: -0.03em; }
.sec-sub { margin-top: 16px; font-size: 16px; line-height: 1.55; color: var(--soft); max-width: 44ch; }
@media (max-width: 900px) { .sec-title { font-size: 24px; } }

/* nav: slim, no rule; the page is one surface */
.nav { height: 56px; max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); display: flex; align-items: center; gap: 24px; }
.word { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; margin-right: auto; }
.nav a:not(.word), .nav button { font-size: 13px; color: var(--soft); background: none; border: 0; cursor: pointer; }
.nav a:not(.word):hover, .nav button:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); }
/* the theme icon is 16 px; its button is a 40 px hit area, pulled into the gap so the bar keeps its rhythm */
.theme { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; margin: 0 -12px 0 -14px; }
.theme i { font-size: 16px; }
@media (max-width: 900px) { .nav { gap: 18px; } }
/* a phone keeps three links: Examples waits in the footer */
@media (max-width: 480px) { .nav { gap: 16px; } .nav [data-wide] { display: none; } }

/* buttons */
.btn { height: 38px; padding: 0 15px; border-radius: 8px; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500;
  cursor: pointer; white-space: nowrap; border: 1px solid var(--rule-2); background: transparent; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { background: var(--soft); border-color: var(--soft); }
.btn i { font-size: 15px; }

/* the plate: no card, the page colour, grey crop marks at the corners (.light for the quieter ones) */
.tick { position: absolute; width: 14px; height: 14px; pointer-events: none; border-color: var(--rule-2); border-style: solid; border-width: 0; }
.tick.tl { top: 0; left: 0; border-top-width: 1px; border-left-width: 1px; }
.tick.tr { top: 0; right: 0; border-top-width: 1px; border-right-width: 1px; }
.tick.bl { bottom: 0; left: 0; border-bottom-width: 1px; border-left-width: 1px; }
.tick.br { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; }
.light .tick, .tick.light { border-color: var(--rule); }
/* .win clips an oversized figure page: the kernel fits the whole pose with margin, so 140% brings the object to
   about 70% of the plate without scaling the canvas. .win.fit shows the page at its own size. */
.win { position: absolute; inset: 14px; overflow: hidden; }
.win :is(iframe, .kl-svg) { position: absolute; left: -20%; top: -20%; width: 140%; height: 140%; border: 0; display: block; opacity: 0; transition: opacity .2s; }
.win.fit :is(iframe, .kl-svg) { left: 0; top: 0; width: 100%; height: 100%; }
.win :is(iframe, .kl-svg).on { opacity: 1; }
/* a figure's SVG stand-in (figure.js still()): placed as its page, under nothing it could catch */
.kl-svg { pointer-events: none; user-select: none; }

/* captions */
.cap-name { font-size: 14px; font-weight: 500; letter-spacing: -0.01em; }
.cap-line { font-size: 13px; color: var(--soft); }
.cap-hint { margin-top: 6px; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); }
.cap-hint i { font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  .win :is(iframe, .kl-svg) { transition: none; }
}

/* the section opener, the same everywhere (after illos.dev's rhythm): a heading, a short grey intro, then the content;
   each section ends on one quiet text link (.sec-end). Use: <header class="opener"><h2>…</h2><p>…</p></header> */
.opener { max-width: 520px; margin: 0 0 40px; }
.opener h2 { font-size: 28px; line-height: 1.15; font-weight: 500; letter-spacing: -0.02em; color: var(--ink); margin: 0; }
.opener p { margin: 10px 0 0; max-width: 420px; font-size: 15px; line-height: 1.55; color: var(--soft); }
.sec-end { display: inline-flex; gap: 6px; align-items: center; margin-top: 32px; font-size: 14px; color: var(--soft); text-decoration: none; }
.sec-end:hover { color: var(--ink); }
/* the uniform card: a lifted well with the figure, a title and one grey meta line */
.card-k { display: block; text-decoration: none; color: inherit; }
.card-k .well { position: relative; aspect-ratio: 5 / 4; border-radius: 12px; overflow: hidden; background: var(--well, color-mix(in srgb, var(--ink) 4%, var(--bg))); }
.card-k .t { margin: 10px 2px 0; font-size: 13px; font-weight: 500; color: var(--ink); }
.card-k .m { margin: 2px 2px 0; font-size: 13px; color: var(--faint); }
/* small pill segments (filters, options) */
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills button { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--rule-2); background: transparent; color: var(--soft); font: 500 13px/1 var(--sans, inherit); cursor: pointer; }
.pills button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* a figure inside a tile paints its plate in the well's own off-white, so there is no lighter box inside the tile.
   Hex, not color-mix: the kernel reads --plate as a three.js colour. */
:root { --well: #eeeeef; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --well: #1a1a1b; } }
:root[data-theme="dark"] { --well: #1a1a1b; }
.card-k .well .kl-plate, .card-k .well .kl-plate[data-theme] { --plate: var(--well); }

/* the site footer, the same on every page: the wordmark and one line (on home the studio line and its button), then the
   link columns, then the credit. Set off by space alone, no rules. Columns stack under the lead below 1000px; on a phone
   Product and Studio sit 2-up and By use runs in two columns below them. */
.site-foot { margin-top: var(--sec-gap); padding-block: 48px 40px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2.8fr);
  gap: 40px 32px; font-size: 13px; line-height: 1.4; color: var(--faint); }
.site-foot .lead { display: flex; flex-direction: column; align-items: start; gap: 12px; }
.site-foot .lead p { max-width: 34ch; color: var(--soft); line-height: 1.55; text-wrap: pretty; }
.site-foot .studio p { max-width: 44ch; font-size: 15px; }
.site-foot .studio .btn { margin-top: 8px; }
.foot-word { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; letter-spacing: -0.01em; color: var(--ink); }
.foot-word .logo { flex: none; }
.site-foot nav { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 32px; }
.site-foot nav a { display: block; width: fit-content; margin-bottom: 10px; break-inside: avoid; }
.site-foot nav div:nth-child(2) { columns: 2; column-gap: 32px; }
.site-foot h2 { margin: 0 0 14px; column-span: all; font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--ink); }
.site-foot nav a { color: var(--soft); }
.site-foot a:hover { color: var(--ink); }
.site-foot > p, .site-foot > nav:first-child { grid-column: 1 / -1; }
.site-foot > p { margin-top: 16px; }
.site-foot > p a { color: var(--soft); text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 3px; }
@media (max-width: 1000px) { .site-foot { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) {
  .site-foot { padding-top: 24px; }
  .site-foot nav { grid-template-columns: 1fr 1fr; gap: 32px 24px; }
  .site-foot nav div:nth-child(2) { grid-column: 1 / -1; order: 1; column-gap: 24px; }
}

/* page transitions: going between pages the nav holds still and the page fades up a few pixels (browsers without
   cross-document view transitions just navigate) */
@view-transition { navigation: auto; }
.nav { view-transition-name: site-nav; }
::view-transition-old(root) { animation: kl-page-out .16s ease-in both; }
::view-transition-new(root) { animation: kl-page-in .32s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes kl-page-out { to { opacity: 0; } }
@keyframes kl-page-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
