/* Keyline 3D website: everything shared. Tokens, type, the layout grid, the plate with its crop marks, captions,
   buttons, the nav and the waitlist dialog. Sections add their own CSS in sections/<name>.css. */
:root {
  --bg: #f7f7f8; --ink: #18181b; --soft: #5f5f68; --faint: #8a8a93; --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: rgba(0, 0, 0, .1);
  --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: #75757e; --rule: #232327; --rule-2: #34343a;
    --hover: rgba(255, 255, 255, .07); --scrim: rgba(17, 17, 17, .72);
    --glass: rgba(24, 24, 26, .9); --glass-edge: rgba(255, 255, 255, .1);
    --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: #75757e; --rule: #232327; --rule-2: #34343a;
  --hover: rgba(255, 255, 255, .07); --scrim: rgba(17, 17, 17, .72);
  --glass: rgba(24, 24, 26, .9); --glass-edge: rgba(255, 255, 255, .1);
  --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 44 (hero only), section titles 28, lines 16, captions 14 and 13, labels 12, mono 11 */
.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); }
.theme { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; margin-left: -8px; }
.theme i { font-size: 16px; }
@media (max-width: 900px) { .nav { gap: 18px; } }
@media (max-width: 380px) { .nav .wl { 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; }

/* waitlist: a small calm dialog */
dialog { margin: auto; width: min(400px, calc(100% - 32px)); border: 1px solid var(--glass-edge); border-radius: 14px; background: var(--glass);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); color: var(--ink); box-shadow: var(--glass-shadow); padding: 24px; }
dialog::backdrop { background: var(--scrim); }
dialog[open] { animation: pop .22s cubic-bezier(.2, .7, .2, 1); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } }
.dlg-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
dialog h2 { font-size: 17px; font-weight: 500; letter-spacing: -0.015em; }
dialog .sub { margin-top: 4px; font-size: 13px; color: var(--soft); }
.x { width: 28px; height: 28px; margin: -4px -6px 0 0; display: grid; place-items: center; border-radius: 6px; border: 0; background: none; color: var(--soft); cursor: pointer; }
.x:hover { background: var(--hover); color: var(--ink); }
dialog form { margin-top: 20px; display: grid; gap: 14px; }
dialog label { display: grid; gap: 6px; font-size: 13px; color: var(--soft); }
dialog label span em { font-style: normal; color: var(--faint); }
dialog input, dialog textarea { width: 100%; border: 1px solid var(--rule-2); border-radius: 8px; background: transparent; padding: 8px 11px; font-size: 14px; color: var(--ink); }
dialog textarea { resize: vertical; min-height: 72px; line-height: 1.45; }
dialog input:focus, dialog textarea:focus { outline: none; border-color: var(--ink); }
dialog input[aria-invalid="true"] { border-color: var(--soft); }
.err { font-size: 12px; color: var(--soft); min-height: 0; }
dialog form .btn { justify-self: start; margin-top: 4px; }
.done { margin-top: 20px; font-size: 14px; color: var(--soft); }
.done strong { color: var(--ink); font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  .win :is(iframe, .kl-svg) { transition: none; }
  dialog[open] { animation: 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); }
