/* Memspace engineering blog
   Light schematic look: dotted graph paper, icon tiles joined by right-angle traces,
   spectrum corner brackets on the figures that matter. One blue for links and actions. */

:root {
  color-scheme: light;
  --paper: #f4f6f9;
  --surface: #ffffff;
  --sunk: #eef1f5;
  --ink: #14161b;
  --text: #3a404d;
  --muted: #687082;
  --line: #e1e5ec;
  --line-strong: #c9d0db;
  --dot: #cdd4de;
  --blue: #1f5edb;
  --blue-deep: #1849ad;
  --blue-soft: #e9f0fe;
  --cyan: #12b0d8;
  --violet: #6b4cff;
  --amber: #f5873a;
  --neg: #cf3f57;
  --neg-soft: #fdecef;
  --prov: #b8740f;
  --prov-soft: #fdf3e2;
  --ok: #188a5a;
  --spectrum: linear-gradient(100deg, var(--cyan), var(--violet) 52%, var(--amber));
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --measure: 41rem;
  --wide: 66rem;
  --gutter: 1.25rem;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(20, 22, 27, 0.04), 0 8px 24px -12px rgba(20, 22, 27, 0.14);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 22px 22px;
  background-attachment: fixed;
  color: var(--text);
  font: 400 1.0625rem/1.72 var(--sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Film grain over the dot grid. Purely decorative. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img, svg, video { display: block; max-width: 100%; height: auto; }

a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--blue-deep); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 4px; }

::selection { background: #d6e3ff; color: var(--ink); }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 50;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(244, 246, 249, 0.82);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0.75rem var(--gutter);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand svg { width: 26px; height: 26px; flex: none; }

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-nav a {
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}
.site-nav a:hover { background: var(--sunk); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }

.site-nav .nav-cta {
  margin-left: 0.35rem;
  background: var(--ink);
  color: #fff;
}
.site-nav .nav-cta:hover { background: #2a2e37; color: #fff; }

.nav-hide-sm { display: none; }

/* ---------- Layout ---------- */

.page { padding: 0 var(--gutter); }

.prose {
  max-width: var(--measure);
  margin: 0 auto;
}

.wide {
  max-width: var(--wide);
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Hero ---------- */

.hero {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 3rem 0 2rem;
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

.hero h1 {
  margin: 0 0 1.1rem;
  color: var(--ink);
  font-size: clamp(2.35rem, 7vw, 4.25rem);
  line-height: 1.04;
  letter-spacing: -0.045em;
  font-weight: 600;
  text-wrap: balance;
}

.hero .dek {
  margin: 0 0 1.6rem;
  max-width: 34rem;
  font-size: clamp(1.08rem, 2.2vw, 1.26rem);
  line-height: 1.55;
  color: var(--text);
}

.byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.9rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.avatars { display: flex; }
.avatars span {
  width: 32px;
  height: 32px;
  margin-right: -8px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--paper);
  background: var(--ink);
  color: #fff;
  font: 600 0.72rem/1 var(--sans);
}
.avatars span:nth-child(2) { background: var(--blue); }
.avatars span:nth-child(3) { background: var(--violet); }

.byline strong { color: var(--ink); font-weight: 500; }

.hero-figure { position: relative; margin: 0; }

.hero-schematic { width: 100%; max-width: 560px; margin: 0 auto; }

/* ---------- Article typography ---------- */

.article { padding-bottom: 4rem; }

.article h2 {
  margin: 4.5rem 0 1rem;
  color: var(--ink);
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
  font-weight: 600;
  text-wrap: balance;
}

.article h3 {
  margin: 2.6rem 0 0.7rem;
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
  font-weight: 600;
}

/* Only plain prose paragraphs get article spacing, so components keep their own. */
.prose > p { margin: 0 0 1.15rem; }
.prose > p.lead { font-size: 1.16rem; color: var(--ink); }
.prose > ul, .prose > ol { margin: 0 0 1.25rem; padding-left: 1.3rem; }
.prose > ul > li, .prose > ol > li { margin: 0.35rem 0; }
.prose li::marker { color: var(--muted); }
.chat p, .story p, .extract p, .fact p, .converge p { margin: 0; }
.article strong { color: var(--ink); font-weight: 600; }

.chapter-num {
  display: inline-block;
  margin-right: 0.55rem;
  padding: 0.05rem 0.4rem;
  vertical-align: 0.3em;
  font: 500 0.78rem/1.6 var(--mono);
  color: var(--muted);
  position: relative;
}

.chapter-num::before,
.chapter-num::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
}
.chapter-num::before { top: 0; left: 0; border-top: 1.5px solid var(--cyan); border-left: 1.5px solid var(--violet); border-top-left-radius: 3px; }
.chapter-num::after { bottom: 0; right: 0; border-bottom: 1.5px solid var(--amber); border-right: 1.5px solid var(--violet); border-bottom-right-radius: 3px; }

code {
  font-family: var(--mono);
  font-size: 0.84em;
  padding: 0.05em 0.3em;
  border-radius: 5px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  overflow-wrap: anywhere;
}

kbd {
  font: 500 0.82em var(--mono);
  padding: 0.1em 0.4em;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
}

/* ---------- Figures ---------- */

.figure {
  margin: 2.2rem auto 2.6rem;
}

.figure.is-wide { max-width: var(--wide); }

.figure figcaption {
  max-width: var(--measure);
  margin: 0.85rem auto 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}
.figure.is-wide figcaption { text-align: center; }

/* Spectrum corner brackets, used on the figures we want you to look at. */
.bracketed { position: relative; }
.bracketed::before,
.bracketed::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  pointer-events: none;
}
.bracketed::before { top: -7px; left: -7px; border-top: 2px solid var(--cyan); border-left: 2px solid var(--violet); border-top-left-radius: 8px; }
.bracketed::after { bottom: -7px; right: -7px; border-bottom: 2px solid var(--amber); border-right: 2px solid var(--violet); border-bottom-right-radius: 8px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel--pad { padding: 1.4rem; }

.shot {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.shot img { width: 100%; }

.shot-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  font: 500 0.75rem/1 var(--mono);
  color: var(--muted);
}
.shot-bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.shot-bar span { margin-left: 0.4rem; }

/* ---------- Tiles, chips, traces ---------- */

.tile {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.tile__icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(180deg, #fff, #f3f5f9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.tile__icon img { width: 100%; height: 100%; object-fit: cover; }
.tile__icon.is-pad img { width: 70%; height: 70%; object-fit: contain; }
.tile__label { font: 500 0.72rem/1.2 var(--mono); color: var(--ink); text-align: center; }
.tile__sub { font: 400 0.68rem/1.2 var(--mono); color: var(--muted); }

.node {
  display: inline-flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(20, 22, 27, 0.03);
}
.node__type { font: 500 0.66rem/1.2 var(--mono); color: var(--muted); }
.node__type::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.35rem;
  border-radius: 50%;
  background: var(--type-color, var(--muted));
  vertical-align: 0.1em;
}
.node__name { color: var(--ink); font-weight: 500; font-size: 0.95rem; line-height: 1.3; }

.edge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font: 500 0.72rem/1.2 var(--mono);
  color: var(--blue);
  white-space: nowrap;
}
.edge::before,
.edge::after {
  content: "";
  height: 1.5px;
  width: 18px;
  background: currentColor;
  opacity: 0.55;
}
.edge::after {
  width: 0;
  height: 0;
  background: none;
  opacity: 1;
  border-left: 6px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}
.edge--neg { color: var(--neg); }
.edge--prov { color: var(--prov); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font: 500 0.72rem/1.3 var(--mono);
  color: var(--text);
  white-space: nowrap;
}
.chip--blue { background: var(--blue-soft); border-color: #cfdcfb; color: var(--blue-deep); }
.chip--neg { background: var(--neg-soft); border-color: #f6c9d1; color: var(--neg); }
.chip--prov { background: var(--prov-soft); border-color: #f1d9a9; color: var(--prov); }
.chip--ok { background: #e7f6ee; border-color: #bfe6d0; color: var(--ok); }

/* Type colours, matching the dashboard's dots closely enough to read as the same system. */
[data-type="person"] { --type-color: #7c5cff; }
[data-type="project"] { --type-color: #8a93a6; }
[data-type="task"] { --type-color: #3f9b5b; }
[data-type="goal"] { --type-color: #4f86b8; }
[data-type="event"] { --type-color: #c5803a; }
[data-type="decision"] { --type-color: #7a6fb0; }
[data-type="preference"] { --type-color: #b39233; }
[data-type="organization"] { --type-color: #3f73c9; }
[data-type="place"] { --type-color: #3a8f86; }
[data-type="topic"] { --type-color: #9aa1ae; }
[data-type="obligation"] { --type-color: #d25a4d; }
[data-type="item"] { --type-color: #c35b9b; }
[data-type="routine"] { --type-color: #5d9c3a; }

/* ---------- Hero schematic (SVG) ---------- */

.schematic text { font-family: var(--mono); }
.schematic .trace { fill: none; stroke: var(--line-strong); stroke-width: 1.5; }
.schematic .trace-live {
  fill: none;
  stroke: url(#spectrum);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 10 260;
  stroke-dashoffset: 270;
  animation: pulse-trace 3.2s cubic-bezier(.45, 0, .2, 1) infinite;
}
.schematic .trace-live:nth-of-type(2) { animation-delay: 0.35s; }
.schematic .trace-live:nth-of-type(3) { animation-delay: 0.7s; }
.schematic .label { font-size: 11px; fill: var(--muted); }
.schematic .label-ink { font-size: 12px; fill: var(--ink); font-weight: 500; }
.schematic .rel { font-size: 10px; fill: var(--blue); }
.schematic .node-box { fill: var(--surface); stroke: var(--line); }
.schematic .core { fill: var(--ink); }

@keyframes pulse-trace {
  0% { stroke-dashoffset: 270; opacity: 0; }
  10% { opacity: 1; }
  85% { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

/* ---------- Video ---------- */

.video {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.video { background: radial-gradient(120% 90% at 50% 20%, #ffffff, #eef1f5 70%); }
.poster {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.5rem;
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 18px 18px;
  text-align: center;
}
.poster__logos { display: flex; gap: clamp(0.5rem, 3vw, 1.4rem); margin-bottom: 0.4rem; }
.poster__logos img {
  width: clamp(40px, 9vw, 64px);
  height: clamp(40px, 9vw, 64px);
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  object-fit: cover;
}
.poster__logos img.is-pad { padding: 9px; object-fit: contain; }
.poster__title { max-width: 26ch; color: var(--ink); font-weight: 600; font-size: clamp(1rem, 3.2vw, 1.6rem); line-height: 1.15; letter-spacing: -0.03em; }
.poster__meta { color: var(--muted); font: 500 0.74rem/1.3 var(--mono); }
.video .video__play { top: auto; bottom: 1.2rem; translate: -50% 0; transition: transform 0.15s ease; }
.video:hover .video__play { transform: scale(1.04); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video__play {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.1rem 0.75rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font: 600 0.95rem/1 var(--sans);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.45);
}
.video__play svg { width: 22px; height: 22px; }

/* ---------- Steps (real sequences only) ---------- */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
}

.step {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.9rem;
  padding: 1.05rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.step__n {
  grid-row: span 2;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  font: 500 0.8rem/1 var(--mono);
}
.step__title { margin: 0; color: var(--ink); font-weight: 600; font-size: 1rem; line-height: 1.4; }
.step__body { margin: 0; color: var(--text); font-size: 0.94rem; line-height: 1.55; }

/* ---------- Chat mockups ---------- */

.chat {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.chat__head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--line);
}
.chat__head img { width: 30px; height: 30px; border-radius: 9px; }
.chat__head b { color: var(--ink); font-weight: 600; font-size: 0.95rem; }
.chat__head small { display: block; color: var(--muted); font: 400 0.72rem/1.3 var(--mono); }

.bubble {
  max-width: 88%;
  padding: 0.6rem 0.85rem;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.5;
}
.bubble--me { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.bubble--bot { align-self: flex-start; background: var(--sunk); color: var(--ink); border-bottom-left-radius: 4px; }

.receipt {
  align-self: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.task-card {
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfd;
}
.task-card b { display: block; color: var(--ink); font-weight: 600; font-size: 0.9rem; }
.task-card small { display: block; margin-top: 0.15rem; color: var(--muted); font: 400 0.74rem/1.4 var(--mono); }
.task-card .runs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.6rem; }

.story {
  display: grid;
  gap: 1rem;
  align-items: start;
}

.story__link {
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--muted);
  font: 500 0.74rem/1.3 var(--mono);
  text-align: center;
}
.story__link svg { width: 100%; max-width: 120px; height: 26px; }

/* ---------- Sentence to facts ---------- */

.extract {
  padding: 1.4rem;
}

.extract .extract__quote {
  margin: 0 0 1.2rem;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  background: var(--sunk);
  color: var(--ink);
  font-size: clamp(1.02rem, 2.4vw, 1.2rem);
  line-height: 1.6;
}
.extract__quote .who { display: block; margin-bottom: 0.35rem; color: var(--muted); font: 500 0.74rem/1.3 var(--mono); }

mark.span {
  padding: 0.05em 0.15em;
  border-radius: 4px;
  color: inherit;
  background: color-mix(in srgb, var(--mark) 16%, transparent);
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--mark) 70%, transparent);
}
mark.span sup { font: 600 0.62rem var(--mono); color: var(--mark); margin-left: 0.15rem; }

.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }

.fact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.6rem;
  padding: 0.7rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fbfcfd;
}
.fact__key {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--mark);
  color: #fff;
  font: 600 0.7rem/1 var(--mono);
}
.fact__note { flex-basis: 100%; margin: 0.1rem 0 0; color: var(--muted); font: 400 0.75rem/1.45 var(--mono); }

/* ---------- Type map ---------- */

.families {
  display: grid;
  gap: 1rem;
}

.family {
  padding: 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.family h4 { margin: 0 0 0.25rem; color: var(--ink); font-size: 0.98rem; font-weight: 600; letter-spacing: -0.01em; }
.family p { margin: 0 0 0.85rem; color: var(--muted); font-size: 0.86rem; line-height: 1.5; }
.family .types { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--ink);
  font: 500 0.8rem/1.3 var(--sans);
}
.type-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--type-color, var(--muted));
}

.stat-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1.4rem;
  margin: 0 0 1.4rem;
}
.stat-line b { color: var(--ink); font-size: clamp(2.2rem, 6vw, 3.1rem); font-weight: 600; letter-spacing: -0.05em; line-height: 1; }
.stat-line span { color: var(--muted); font-size: 0.95rem; margin-left: 0.35rem; }

/* ---------- Receipt row ---------- */

.receipt-grid {
  display: grid;
  gap: 1.2rem;
  align-items: start;
}

/* ---------- Flow (review, pipeline) ---------- */

.flow {
  display: grid;
  gap: 0.75rem;
}

.flow__step {
  padding: 1rem 1.05rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.flow__step h4 { margin: 0.45rem 0 0.25rem; color: var(--ink); font-size: 0.98rem; font-weight: 600; }
.flow__step p { margin: 0; color: var(--text); font-size: 0.9rem; line-height: 1.55; }

.outcomes { display: grid; gap: 0.45rem; margin-top: 0.7rem; }
.outcomes div { display: flex; gap: 0.5rem; align-items: baseline; font-size: 0.88rem; line-height: 1.45; }

/* ---------- Converge (one node per teammate) ---------- */

.converge { padding: 1.4rem; }
.converge__notes { display: grid; gap: 0.8rem; }

.note-card {
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfd;
}
.note-card small { display: block; margin-bottom: 0.3rem; color: var(--muted); font: 500 0.72rem/1.3 var(--mono); }
.note-card p { margin: 0 0 0.55rem; color: var(--ink); font-size: 0.93rem; line-height: 1.5; }

.converge__wire { width: 100%; height: 56px; color: var(--line-strong); }
.converge__wire path { fill: none; stroke: currentColor; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.converge__wire .live { stroke: var(--violet); stroke-width: 1.6; stroke-dasharray: 5 5; }

.converge__target { display: flex; justify-content: center; }
.member-node {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 1rem;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
}
.member-node .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 0 4px rgba(107, 76, 255, 0.25); }
.member-node b { font-weight: 600; }
.member-node small { display: block; color: #b8bdca; font: 400 0.72rem/1.3 var(--mono); }

/* ---------- Three things (FalkorDB) ---------- */

.three {
  display: grid;
  gap: 1rem;
}

.thing {
  display: flex;
  flex-direction: column;
  padding: 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.thing h4 { margin: 0 0 0.35rem; color: var(--ink); font-size: 1.05rem; font-weight: 600; letter-spacing: -0.015em; }
.thing p { margin: 0; color: var(--text); font-size: 0.92rem; line-height: 1.55; }
.thing svg { width: 100%; height: auto; margin: 0 0 1rem; }
.thing svg text { font-family: var(--mono); font-size: 11px; fill: var(--muted); }
.thing svg .ink { fill: var(--ink); font-weight: 500; }
.thing svg .wire { fill: none; stroke: var(--line-strong); stroke-width: 1.5; }
.thing svg .wire-on { fill: none; stroke: var(--blue); stroke-width: 1.8; }
.thing svg .box { fill: #fbfcfd; stroke: var(--line); }

/* ---------- Code ---------- */

.code {
  margin: 1.3rem 0 1.7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.code__bar {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  font: 500 0.74rem/1.4 var(--mono);
  color: var(--muted);
}
.code__bar a { color: var(--muted); text-decoration: none; }
.code__bar a:hover { color: var(--blue); }

.code pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font: 400 0.8rem/1.75 var(--mono);
  color: var(--ink);
  tab-size: 2;
}
.code pre code { padding: 0; background: none; box-shadow: none; font-size: inherit; overflow-wrap: normal; }

.tok-kw { color: var(--blue-deep); font-weight: 500; }
.tok-label { color: #7a3fd1; }
.tok-rel { color: #b05a0c; }
.tok-param { color: #0b7f9c; }
.tok-str { color: #1f7a4d; }
.tok-num { color: #a3366a; }
.tok-com { color: var(--muted); font-style: italic; }

.plan {
  margin: 1.2rem 0 1.6rem;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  background: var(--sunk);
  overflow-x: auto;
  font: 400 0.78rem/1.7 var(--mono);
  color: var(--ink);
}

/* ---------- Callouts (no side rules) ---------- */

.aside {
  margin: 1.6rem 0;
  padding: 1.1rem 1.2rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.aside p:last-child { margin-bottom: 0; }
.aside__title { display: block; margin-bottom: 0.3rem; color: var(--ink); font-weight: 600; }

/* ---------- Learned list ---------- */

.learned { display: grid; gap: 0.4rem 2.5rem; margin: 1.4rem 0 2rem; }
.learned article {
  padding: 1.3rem 0 1.1rem;
  border-top: 1px solid var(--line-strong);
}
.learned h3 { margin: 0 0 0.4rem !important; font-size: 1.05rem !important; }
.learned p { margin: 0; font-size: 0.95rem; }

/* ---------- Cards linking to deeper pages ---------- */

.deeper { display: grid; gap: 1rem; margin: 2rem 0; }
.deeper a {
  display: block;
  padding: 1.2rem 1.25rem;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.deeper a:hover { border-color: var(--line-strong); box-shadow: var(--shadow); color: var(--text); }
.deeper b { display: block; margin-bottom: 0.25rem; color: var(--ink); font-size: 1.05rem; font-weight: 600; }
.deeper span { display: block; font-size: 0.93rem; line-height: 1.5; }

/* ---------- Tables (catalog pages) ---------- */

.table-scroll { overflow-x: auto; margin: 1rem 0 2rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.catalog { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.catalog caption { padding: 0.9rem 1rem 0.2rem; text-align: left; color: var(--ink); font-weight: 600; }
.catalog th, .catalog td { padding: 0.7rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.catalog tr:last-child td { border-bottom: 0; }
.catalog th { color: var(--muted); font: 500 0.74rem/1.4 var(--mono); }
.catalog td:first-child { white-space: nowrap; }
.catalog code { background: none; box-shadow: none; padding: 0; font-weight: 500; }
.ends { font: 400 0.8rem/1.5 var(--mono); color: var(--muted); }
.ends b { color: var(--ink); font-weight: 500; }

.type-grid { display: grid; gap: 0.9rem; margin: 1.2rem 0 2rem; }
.type-card {
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.type-card h3 { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.3rem !important; font-size: 1.05rem !important; }
.type-card h3::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--type-color, var(--muted)); }
.type-card p { margin: 0 0 0.6rem; font-size: 0.9rem; }
.type-card .rels { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.rules { counter-reset: rule; list-style: none; padding: 0 !important; display: grid; gap: 0.6rem; }
.rules li {
  counter-increment: rule;
  position: relative;
  margin: 0 !important;
  padding: 0.85rem 1rem 0.85rem 3rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.rules li::before {
  content: counter(rule);
  position: absolute;
  left: 0.9rem;
  top: 0.85rem;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--sunk);
  color: var(--ink);
  font: 500 0.72rem/1 var(--mono);
}

/* ---------- Section dots (desktop) ---------- */

.dots {
  position: fixed;
  right: 1.25rem;
  top: 50%;
  translate: 0 -50%;
  z-index: 20;
  display: none;
}

.dots ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }

.dots a {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0.3rem 0;
  color: var(--muted);
  font: 500 0.72rem/1 var(--mono);
  text-decoration: none;
}
.dots a span {
  opacity: 0;
  translate: 6px 0;
  transition: opacity 0.18s ease, translate 0.18s ease;
  white-space: nowrap;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
}
.dots a i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
  transition: background 0.18s ease, transform 0.18s ease;
}
.dots:hover a span,
.dots a:focus-visible span,
.dots a.is-active span { opacity: 1; translate: 0 0; }
.dots a.is-active { color: var(--ink); }
.dots a.is-active i { background: var(--ink); transform: scale(1.35); box-shadow: 0 0 0 4px rgba(31, 94, 219, 0.14); }

/* ---------- Progress bar ---------- */

.progress {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 40;
  height: 2px;
  width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: var(--spectrum);
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 3rem;
  padding: 2.5rem var(--gutter) 3rem;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}
.site-footer__inner {
  max-width: var(--wide);
  margin: 0 auto;
  display: grid;
  gap: 1.5rem;
  font-size: 0.92rem;
}
.site-footer h2 { margin: 0 0 0.5rem; color: var(--ink); font-size: 1rem; font-weight: 600; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.site-footer a { color: var(--text); text-decoration: none; }
.site-footer a:hover { color: var(--blue); text-decoration: underline; }
.site-footer .small { color: var(--muted); font-size: 0.84rem; }

/* ---------- Breakpoints (mobile first) ---------- */

@media (min-width: 640px) {
  :root { --gutter: 2rem; }
  .nav-hide-sm { display: inline-block; }
  .story { grid-template-columns: 1fr auto 1fr; }
  .story__link { flex-direction: column; min-width: 110px; }
  .families { grid-template-columns: 1fr 1fr; }
  .three { grid-template-columns: 1fr; }
  .converge__notes { grid-template-columns: 1fr 1fr; }
  .flow { grid-template-columns: repeat(3, 1fr); }
  .learned { grid-template-columns: 1fr 1fr; }
  .deeper { grid-template-columns: 1fr 1fr; }
  .type-grid { grid-template-columns: 1fr 1fr; }
  .site-footer__inner { grid-template-columns: 2fr 1fr 1fr; }
}

@media (min-width: 900px) {
  .hero { grid-template-columns: 1.05fr 1fr; padding: 4.5rem 0 3rem; }
  .receipt-grid { align-items: center; }
  .three { grid-template-columns: repeat(3, 1fr); }
  .steps.is-row { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1240px) {
  .dots { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .schematic .trace-live { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; opacity: 0.85; }
  .dots a span, .dots a i, .video .video__play, .deeper a { transition: none; }
}

@media print {
  body { background: #fff; }
  body::before, .site-header, .dots, .progress, .video { display: none; }
  .article a::after { content: " (" attr(href) ")"; font-size: 0.8em; color: var(--muted); }
}

/* ---------- Ontology map ---------- */

.onto-panel { display: none; padding: 1.2rem 1.4rem; }
.onto-map { width: 100%; }
.onto-map .rel { font-size: 11px; }

@media (min-width: 760px) {
  .onto-panel { display: block; }
  .onto-panel + .families { display: none; }
}

.neg-quote { margin-bottom: 1rem !important; }
.neg-fact { background: var(--neg-soft); border-color: #f6c9d1; }

/* ---------- Graph model (FalkorDB page) ---------- */

.model-panel { display: none; padding: 1.2rem 1.4rem; }
.model-map { width: 100%; }
.model-map .rel { font-size: 10.5px; }
.model-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.model-list li { padding: 0.6rem 0.8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.model-list code { box-shadow: none; padding: 0; font-size: 0.8rem; white-space: nowrap; }

@media (min-width: 760px) {
  .model-panel { display: block; }
  .model-panel + .model-list { display: none; }
}

.thing h4 { font-size: 1.6rem !important; letter-spacing: -0.04em !important; }

@media (min-width: 900px) {
  .steps.pipeline { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Real screenshots beside content ---------- */

.setup-grid { display: grid; gap: 1.5rem; align-items: center; }
.setup-shot { margin: 0; }
.receipt-shot { max-width: 360px; margin: 0 auto; }

@media (min-width: 900px) {
  .setup-grid { grid-template-columns: 1.1fr 1fr; }
  .receipt-grid { grid-template-columns: 0.55fr 1.45fr; }
}

@media (min-width: 900px) {
  .catalog { table-layout: fixed; }
  .catalog th:nth-child(1) { width: 26%; }
  .catalog th:nth-child(2) { width: 30%; }
  .catalog td:first-child { white-space: normal; overflow-wrap: anywhere; }
}

@media (max-width: 639px) {
  .story__link { flex-direction: column; gap: 0.2rem; }
  .story__link svg { width: 26px; max-width: 26px; height: 40px; transform: rotate(90deg); }
}
