/* Intellica kit: shell and components. Shared by every site; do not edit per product. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--text-md) / 1.6 var(--font-sans);
}
main { flex: 1; padding-block: var(--s6) var(--s8); }
h1, h2, h3 { color: var(--text-hi); line-height: 1.2; margin: 0 0 var(--s3); }
h1 { font-size: var(--text-2xl); letter-spacing: -0.02em; }
h2 { font-size: var(--text-xl); letter-spacing: -0.01em; }
h3 { font-size: var(--text-lg); }
p { margin: 0 0 var(--s4); }
a { color: var(--accent-ink); text-underline-offset: 0.18em; }
a:hover { color: var(--text-hi); }
code, pre { font-family: var(--font-mono); font-size: 0.9em; }
:focus-visible { outline: 3px solid var(--accent-ink); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }

.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; padding: var(--s3) var(--s4); border-radius: var(--r); background: var(--card-hi); color: var(--text-hi); }
.skip-link:focus { left: 8px; }
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--s5); }

/* ---------- header, tabs, status ---------- */
#shell-header { min-height: 114px; }
.shell-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: 64px; }
.bar-right { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2) var(--s3); min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: var(--s3); color: var(--text-hi); text-decoration: none; font-weight: 650; font-size: var(--text-lg); min-height: 44px; }
.brand:hover { color: var(--text-hi); }
.brand-mark { width: 14px; height: 14px; border-radius: 4px; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }

.family { position: relative; }
.family summary { cursor: pointer; list-style: none; min-height: 44px; display: inline-flex; align-items: center; padding: 0 var(--s4); border: 1px solid var(--line-hi); border-radius: var(--r); color: var(--text); font-size: var(--text-sm); }
.family summary::-webkit-details-marker { display: none; }
.family summary::after { content: "\25BE"; margin-left: var(--s2); }
.family ul { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; margin: 0; padding: var(--s2); list-style: none; min-width: 230px; background: var(--card-hi); border: 1px solid var(--line-hi); border-radius: var(--r); }
.family li a { display: flex; align-items: center; min-height: 44px; padding: 0 var(--s3); border-radius: 6px; text-decoration: none; color: var(--text); }
.family li a:hover { background: var(--card); color: var(--text-hi); }
.family li a[aria-current="page"] { color: var(--accent-ink); font-weight: 600; }

.tabs { background: var(--surface); border-bottom: 1px solid var(--line); }
.tabs ul { display: flex; gap: var(--s1); margin: 0; padding: 0; list-style: none; overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 var(--s4); text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text-hi); }
.tabs a[aria-current="page"] { color: var(--text-hi); border-bottom-color: var(--accent); font-weight: 600; }
.status-strip { background: var(--bg); border-bottom: 1px solid var(--line); font-size: var(--text-sm); }
.status-strip .container { display: flex; flex-wrap: wrap; gap: var(--s4); align-items: center; padding-block: var(--s2); }

.badge { display: inline-block; padding: 2px var(--s3); border-radius: 999px; font-size: var(--text-xs); border: 1px solid var(--line-hi); color: var(--text); background: var(--card); }
.badge[data-engine="wasm"] { border-color: var(--good); }
.badge[data-engine="placeholder"] { border-color: var(--warn); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 var(--s5); border-radius: var(--r); border: 1px solid var(--line-hi); font: inherit; font-size: var(--text-sm); font-weight: 600; text-decoration: none; cursor: pointer; color: var(--text-hi); background: transparent; }
.btn:hover { background: var(--card-hi); color: var(--text-hi); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, white); color: var(--on-accent); }
.btn-small { min-height: 32px; padding: 0 var(--s3); }
.theme-btn { font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s4); }

/* ---------- layout blocks ---------- */
.hero { padding-block: var(--s7) var(--s6); max-width: 820px; }
.eyebrow { margin: 0 0 var(--s3); color: var(--accent-ink); font-size: var(--text-sm); letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; }
.lead { font-size: var(--text-lg); color: var(--text); max-width: 68ch; }
.block { margin-top: var(--s7); }
.grid { display: grid; gap: var(--s4); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s5); }
.card h3 { margin-bottom: var(--s2); }
.card p:last-child { margin-bottom: 0; }
.card.product { border-top: 3px solid var(--card-accent, var(--accent)); }
.card.product h3 a { color: var(--text-hi); text-decoration: none; }
.card.product h3 a:hover { text-decoration: underline; }
.link-list, .chip-links { margin: var(--s3) 0 0; padding: 0; list-style: none; }
.link-list li a { display: inline-flex; align-items: center; min-height: 32px; }
.chip-links { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip-links a { display: inline-flex; align-items: center; min-height: 32px; padding: 0 var(--s3); border: 1px solid var(--line-hi); border-radius: 999px; text-decoration: none; font-size: var(--text-sm); color: var(--text); }
.chip-links a:hover { background: var(--card-hi); color: var(--text-hi); }

.callout { padding: var(--s5); border: 1px solid var(--line-hi); border-left: 4px solid var(--accent); border-radius: var(--r); background: var(--card); }
.callout.verify { margin-top: var(--s7); }
.callout.bad { border-left-color: var(--bad); }
.callout.good { border-left-color: var(--good); }
.callout h2 { margin-bottom: var(--s2); }
.callout p:last-of-type { margin-bottom: 0; }

.inline-list { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin: 0; padding: 0; list-style: none; }
.inline-list.pills li { padding: var(--s1) var(--s3); border: 1px solid var(--line-hi); border-radius: 999px; font-size: var(--text-sm); }

/* ---------- demo frame ---------- */
.demo-strip { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; margin-bottom: var(--s4); font-size: var(--text-sm); }
.demo-frame { background: var(--card); border: 1px solid var(--line-hi); border-radius: var(--r); padding: var(--s5); }
.demo-mount { min-height: 240px; }
.demo-intro { color: var(--muted); }
.chain { display: grid; gap: var(--s3); margin: var(--s4) 0; }
.chain-row { display: grid; grid-template-columns: 80px minmax(0, 1fr) minmax(0, 1fr); gap: var(--s3); align-items: center; }
.chain-label { color: var(--muted); font-size: var(--text-sm); }
.chain-input { width: 100%; min-height: 44px; padding: 0 var(--s3); border-radius: 8px; border: 1px solid var(--line-hi); background: var(--bg); color: var(--text-hi); font: inherit; font-size: var(--text-sm); }
.chain-hash { color: var(--muted); overflow-wrap: anywhere; }
.chain-hash[data-changed="true"] { color: var(--bad); }
.demo-result { margin: var(--s4) 0 0; padding: var(--s3) var(--s4); border-radius: 8px; border: 1px solid var(--line); }
.demo-result[data-state="ok"] { border-color: var(--good); }
.demo-result[data-state="fail"] { border-color: var(--bad); }

/* ---------- tables and code ---------- */
.table-wrap { overflow-x: auto; margin: var(--s4) 0; border: 1px solid var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th, td { padding: var(--s3) var(--s4); text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { color: var(--text-hi); background: var(--card-hi); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td code.hash { overflow-wrap: anywhere; }
pre { margin: var(--s4) 0; padding: var(--s4); overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--text-hi); }
:not(pre) > code { padding: 1px 6px; border-radius: 5px; background: var(--card-hi); color: var(--text-hi); }

/* ---------- docs and markdown ---------- */
.docs-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--s6); align-items: start; }
.docs-nav { position: sticky; top: var(--s4); }
.docs-group h2 { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: var(--s4) 0 var(--s2); }
.docs-group ul { margin: 0; padding: 0; list-style: none; }
.docs-group a { display: flex; align-items: center; min-height: 36px; padding: 0 var(--s3); border-radius: 6px; text-decoration: none; color: var(--text); }
.docs-group a:hover { background: var(--card-hi); }
.docs-group a[aria-current="page"] { background: var(--card-hi); color: var(--text-hi); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.prose { max-width: 78ch; min-width: 0; }
.prose h1 { font-size: var(--text-xl); }
.prose h2 { font-size: var(--text-lg); margin-top: var(--s6); padding-top: var(--s4); border-top: 1px solid var(--line); }
.prose h3 { font-size: var(--text-md); margin-top: var(--s5); }
.prose ul, .prose ol { padding-left: var(--s5); margin: 0 0 var(--s4); }
.prose li { margin-bottom: var(--s1); }
.prose blockquote { margin: var(--s4) 0; padding: var(--s2) var(--s4); border-left: 4px solid var(--line-hi); color: var(--muted); }
.prose img { max-width: 100%; height: auto; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: var(--s6) 0; }
.toc { margin-bottom: var(--s5); padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
.toc summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.toc ul { list-style: none; padding-left: 0; margin: var(--s2) 0 0; }
.toc li.sub { padding-left: var(--s4); }

/* ---------- footer ---------- */
.shell-footer { border-top: 1px solid var(--line); background: var(--surface); padding-block: var(--s5); font-size: var(--text-sm); }
.shell-footer p { margin: 0 0 var(--s2); }

@media (max-width: 760px) {
  .container { padding-inline: var(--s4); }
  #shell-header { min-height: 124px; }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-nav { position: static; }
  .chain-row { grid-template-columns: 1fr; }
  .bar { flex-wrap: wrap; padding-block: var(--s2); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* FAQ */
.faq-item { border: 1px solid var(--line); border-radius: var(--r); padding: 0 var(--s4); margin-block: var(--s2); background: var(--card); }
.faq-item summary { cursor: pointer; padding-block: var(--s3); min-height: 44px; font-weight: 600; }
.faq-item p { margin-top: 0; }

/* Print: plain pages, no chrome, links shown */
@media print {
  .skip-link, #shell-header, .theme-btn, .tabs, .status-strip, .btn, .shell-footer nav { display: none !important; }
  body { background: #fff; color: #000; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
  pre, .card, table { break-inside: avoid; }
}

.limits { padding-left: 1.2em; }
.limits li { margin-block: var(--s2); color: var(--text); }

/* docs search and code copy */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.docs-search { width: 100%; min-height: 44px; padding: 0 var(--s3); border: 1px solid var(--line-hi); border-radius: var(--r); background: var(--card); color: var(--text); font: inherit; }
.docs-results ul { list-style: none; padding: 0; margin: var(--s3) 0; font-size: 0.9rem; }
.docs-results li { margin-block: var(--s2); }
.docs-results a { display: block; font-weight: 600; }
.docs-searchbox { margin-bottom: var(--s4); }
.code-block { position: relative; }
.code-copy { position: absolute; top: var(--s2); right: var(--s2); min-height: 32px; min-width: 56px; padding: 0 var(--s3); border: 1px solid var(--line-hi); border-radius: var(--r); background: var(--card); color: var(--text); font: inherit; font-size: 0.8rem; cursor: pointer; }
@media print { .code-copy, .docs-searchbox { display: none !important; } }

/* No layout shift while the shell builds the header: the page body is not painted until the header exists,
   and the footer waits until the page is hydrated. Both have a time limit so a failure never leaves a blank page.
   Without JavaScript this rule does not apply. */
@media (scripting: enabled) {
  html:not([data-shell]) main { visibility: hidden; animation: iw-reveal 0s 2.5s forwards; }
  html:not([data-ready]) #shell-footer { visibility: hidden; animation: iw-reveal 0s 4s forwards; }
}
@keyframes iw-reveal { to { visibility: visible; } }

/* primary links in the header (home only) */
.bar-nav ul { display: flex; gap: var(--s1); margin: 0; padding: 0; list-style: none; }
.bar-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s3); color: var(--text); text-decoration: none; border-bottom: 3px solid transparent; }
.bar-nav a:hover { color: var(--text-hi); }
.bar-nav a[aria-current="page"] { color: var(--text-hi); border-bottom-color: var(--accent); font-weight: 600; }

/* ======================================================================
   Kit 0.6: engineering-grade identity. Square corners, hairlines, mono labels,
   a drafting grid, and motion that only runs where the browser supports it.
   ====================================================================== */
:root { --grid: color-mix(in srgb, var(--line-hi) 38%, transparent); }
h1, h2, h3 { font-weight: 600; }
h1 { letter-spacing: -0.025em; }

/* brand */
.brand { font-weight: 600; letter-spacing: 0.02em; gap: var(--s2); }
.brand-mark { width: 26px; height: 26px; border-radius: 0; background: none; box-shadow: none; flex: none; }
.bm-beam { fill: var(--text-hi); }
.bm-node { fill: var(--accent); }
.brand-name { letter-spacing: 0.04em; }

/* header */
.shell-header { background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(140%) blur(10px); position: sticky; top: 0; z-index: 30; }
.btn { border-radius: var(--r); }
.contact-btn { gap: var(--s2); min-height: 44px; }
.wa-icon, .theme-icon { width: 20px; height: 20px; flex: none; }
.theme-btn { padding-inline: var(--s3); min-width: 44px; }
.theme-btn[data-mode="light"] .theme-icon { transform: scaleX(-1); }
@media (max-width: 760px) { .contact-btn .contact-label { display: none; } .contact-btn { padding-inline: var(--s3); } .shell-header { position: static; } }

/* footer */
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: var(--s6); padding-bottom: var(--s5); }
.foot-h { font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--s3); }
.foot-grid ul { list-style: none; margin: 0; padding: 0; }
.foot-grid li a { display: inline-flex; align-items: center; min-height: 36px; color: var(--text); text-decoration: none; }
.foot-grid li a:hover { color: var(--text-hi); text-decoration: underline; }
.foot-note { border-top: 1px solid var(--line); padding-top: var(--s3); font-family: var(--font-mono); font-size: var(--text-xs); }
@media (max-width: 860px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .foot-grid { grid-template-columns: 1fr; } }

/* systems menu */
.family summary { border-radius: var(--r); font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.08em; text-transform: uppercase; }
.family ul, .family li a { border-radius: var(--r); }

/* home hero: drafting grid, split layout */
body[data-tab="home"] .hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--s6); align-items: center; padding-block: var(--s7) var(--s6); }
body[data-tab="home"] .hero::before { content: ""; position: absolute; inset: 0 -50vw; z-index: -1; background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 48px 48px; -webkit-mask-image: radial-gradient(ellipse at 70% 40%, #000 20%, transparent 72%); mask-image: radial-gradient(ellipse at 70% 40%, #000 20%, transparent 72%); }
.eyebrow, .t-home-k { font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-ink); }
.hero h1 { font-size: clamp(2rem, 4vw, 3.3rem); line-height: 1.08; max-width: 18ch; }
.hero .lead { max-width: 54ch; color: var(--text); font-size: var(--text-md); line-height: 1.6; }
.hero-copy .actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s5); }
.hero-visual { display: grid; gap: var(--s4); min-width: 0; }
@media (max-width: 960px) { body[data-tab="home"] .hero { grid-template-columns: minmax(0, 1fr); padding-block: var(--s5); } }

/* system map */
.sysmap { border: 1px solid var(--line-hi); background: color-mix(in srgb, var(--card) 80%, transparent); padding: var(--s3); }
.sysmap-svg { display: block; width: 100%; height: auto; }
.sm-box { fill: var(--card-hi); stroke: var(--line-hi); }
.sm-node { cursor: pointer; }
.sm-node:hover .sm-box, .sm-node:focus-visible .sm-box { stroke: var(--accent); }
.sm-node:focus-visible { outline: none; }
.sm-node:focus-visible .sm-box { stroke-width: 3; }
.sm-name { fill: var(--text-hi); font: 600 15px var(--font-sans); }
.sm-sub { fill: var(--muted); font: 400 10.5px var(--font-mono); }
.sm-spine { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 4; }
.sm-core-name { fill: var(--accent-ink); font: 600 16px var(--font-sans); }
.sm-edge { fill: none; stroke: var(--line-hi); stroke-width: 1.5; }
.sm-flow { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 3 18; animation: sm-run 2.4s linear infinite; }
@keyframes sm-run { to { stroke-dashoffset: -42; } }

/* live proof */
.proof { border: 1px solid var(--line-hi); background: var(--card); padding: var(--s4); font-size: var(--text-sm); }
.proof-h { display: flex; align-items: center; gap: var(--s2); font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--s3); }
.proof-dot { width: 8px; height: 8px; background: var(--warn); animation: pr-pulse 1.2s ease-in-out infinite; }
.proof[data-state="ok"] .proof-dot { background: var(--good); animation: none; }
.proof[data-state="fail"] .proof-dot { background: var(--bad); animation: none; }
@keyframes pr-pulse { 50% { opacity: .3; } }
.pr-list { list-style: none; margin: 0 0 var(--s3); padding: 0; font-family: var(--font-mono); font-size: var(--text-xs); }
.pr-row { display: grid; grid-template-columns: 1.4em 1fr auto; gap: var(--s2); padding: 3px 0; border-bottom: 1px solid var(--line); }
.pr-row[data-ok="true"] .pr-mark { color: var(--good); }
.pr-row[data-ok="false"] .pr-mark { color: var(--bad); }
.pr-hash { color: var(--muted); }
#proof-summary { margin: 0; color: var(--text); }
#proof-summary code { overflow-wrap: anywhere; }

/* sections */
.block { padding-block: var(--s6); border-top: 1px solid var(--line); }
.block > h2, .callout > h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.callout.verify { border: 1px solid var(--line-hi); border-left: 3px solid var(--accent); border-radius: 0; background: var(--card); padding: var(--s5); }
.card, .t-home-card { border-radius: var(--r); }
.card:hover, .t-home-card:hover { border-color: var(--accent); }
.pills li { border-radius: var(--r); font-family: var(--font-mono); font-size: var(--text-xs); }

/* motion: progressive enhancement, never required to read the page */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  @supports (animation-timeline: view()) {
    .block, .callout.verify, .sysmap, .proof { animation: iw-rise linear both; animation-timeline: view(); animation-range: entry 0% entry 32%; }
    @keyframes iw-rise { from { opacity: 0.45; transform: translateY(12px); } to { opacity: 1; transform: none; } }
  }
}
@media (prefers-reduced-motion: reduce) { .sm-flow { animation: none; stroke-dasharray: none; opacity: .5; } }
@media print { .hero::before, .sysmap { display: none; } }
.hero-copy, .hero-visual, .proof, .sysmap { min-width: 0; }
.proof, .pr-row > * { overflow-wrap: anywhere; }
main { overflow-x: clip; }

/* fonts:start (written by tools/install-fonts.mjs) */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: optional; src: url("/assets/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: optional; src: url("/assets/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: optional; src: url("/assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
:root { --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
/* fonts:end */
