/* Tessera — tiles and grout. Content blocks sit as tiles on a pale grout. */
:root {
  --grout: #f3f5f8;
  --paper: #ffffff;
  --ink: #0f1e38;
  --cobalt: #1e49c9;
  --sky: #3fa9e6;
  --deep: #0a2a7a;
  --night: #061128;
  --muted: #5d6b83;
  --line: #d6dce7;
  --tile-r: 6px;
  --display: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wrap: 1120px;
  --gutter: 20px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body { margin: 0; background: var(--grout); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.6; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--cobalt); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--deep); }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.wrap { width: min(var(--wrap), 100% - 2 * var(--gutter)); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

h1, h2, h3, h4 { font-family: var(--display); line-height: 1.12; letter-spacing: -0.01em; margin: 0 0 0.4em; font-weight: 600; }
h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin-top: 2.2em; }
h3 { font-size: 1.25rem; margin-top: 1.8em; }
p { margin: 0 0 1em; }
.lede { font-size: 1.22rem; line-height: 1.5; color: var(--muted); max-width: 44em; }

/* header */
.site-head { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 68px; }
.brand img { width: 168px; height: auto; }
.site-nav { display: flex; flex-wrap: wrap; gap: 2px; }
.site-nav a { font-family: var(--display); font-weight: 600; font-size: 0.98rem; color: var(--ink); text-decoration: none; padding: 8px 11px; border-radius: 4px; border-bottom: 3px solid transparent; }
.site-nav a:hover { background: var(--grout); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--cobalt); color: var(--cobalt); }
.site-nav a.ext::after, .btn.ext::after { content: " ↗"; font-size: 0.8em; opacity: 0.7; }
.nav-toggle { display: none; font: inherit; font-family: var(--display); font-weight: 600; background: none; border: 1px solid var(--line); border-radius: 4px; padding: 6px 12px; color: var(--ink); }
@media (max-width: 900px) {
  .nav-toggle { display: inline-block; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--paper); border-bottom: 1px solid var(--line); padding: 8px var(--gutter) 14px; flex-direction: column; }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 10px 6px; border-bottom: 1px solid var(--line); border-radius: 0; }
  .site-nav a[aria-current="page"] { border-bottom: 1px solid var(--line); background: var(--grout); }
}

/* page scaffolding */
.page-head { background: var(--paper); border-bottom: 1px solid var(--line); padding: 52px 0 36px; }
.page-head .meta { color: var(--muted); margin-bottom: 0.6em; }
.page-head .meta a { color: var(--muted); }
.page-head .meta time { margin-left: 10px; }
.prose { padding: 36px 0 72px; max-width: 46em; }
.prose .prose { padding: 0; }
.prose-wide { max-width: none; }
.prose h2 { padding-top: 0.2em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 0.35em; }
.prose code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.88em; background: #e9edf4; padding: 1px 5px; border-radius: 3px; }
.prose pre { background: var(--night); color: #dfe7f5; padding: 16px 18px; border-radius: var(--tile-r); overflow: auto; font-size: 0.86rem; line-height: 1.5; }
.prose pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.prose blockquote { margin: 1.4em 0; padding: 0.2em 0 0.2em 1.1em; border-left: 4px solid var(--sky); color: var(--muted); }
.prose table { border-collapse: collapse; width: 100%; margin: 1.2em 0 1.8em; font-size: 0.95rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--tile-r); overflow: hidden; }
.prose th, .prose td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-family: var(--display); font-weight: 600; background: #eaeef5; }
.prose tr:last-child td { border-bottom: 0; }
.prose td:first-child { white-space: nowrap; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.table-wrap { overflow-x: auto; }

.fig { margin: 1.6em 0 2.2em; background: var(--paper); border: 1px solid var(--line); border-radius: var(--tile-r); padding: 10px; }
.fig img { margin-inline: auto; }
.fig figcaption { font-size: 0.92rem; color: var(--muted); padding: 10px 6px 2px; line-height: 1.5; }
.fig-wide { width: min(var(--wrap), 100% - 2 * var(--gutter)); }
@media (min-width: 1000px) { .prose:not(.prose-wide) .fig-wide { width: var(--wrap); } }

/* buttons */
.btn { display: inline-block; font-family: var(--display); font-weight: 600; font-size: 1rem; padding: 11px 18px; border-radius: 4px; text-decoration: none; border: 1.5px solid transparent; }
.btn-primary { background: var(--cobalt); color: #fff; }
.btn-primary:hover { background: var(--deep); color: #fff; }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,0.55); }
.btn-ghost:hover { background: rgba(255,255,255,0.12); color: #fff; }
.btn-outline { background: transparent; color: var(--cobalt); border-color: var(--cobalt); }
.btn-outline:hover { background: var(--cobalt); color: #fff; }

/* tags */
.tag { display: inline-block; font-size: 0.78rem; font-family: var(--display); font-weight: 600; padding: 2px 8px; border-radius: 3px; background: #e6edff; color: var(--deep); vertical-align: middle; }
.tag-warm { background: #fff1dc; color: #7a4a00; }
.tag-grey { background: #e9edf4; color: var(--muted); }

/* ---------- home ---------- */
.hero { position: relative; background: var(--night); color: #fff; overflow: hidden; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; opacity: 0.85; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(6,17,40,0.92) 0%, rgba(6,17,40,0.72) 42%, rgba(6,17,40,0.18) 100%); }
.hero .wrap { position: relative; z-index: 1; padding: 96px 0 88px; max-width: var(--wrap); }
.hero h1 { font-size: clamp(2.8rem, 6vw, 4.8rem); max-width: 11em; margin-bottom: 0.35em; font-weight: 800; letter-spacing: -0.02em; }
.hero p { font-size: 1.2rem; line-height: 1.5; max-width: 34em; color: #d6e0f2; margin-bottom: 1.6em; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 700px) { .hero .wrap { padding: 64px 0 60px; } }

.section { padding: 64px 0 24px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.section-title h2 { margin: 0; }
.section-title a { font-family: var(--display); font-weight: 600; text-decoration: none; }
.section-title a:hover { text-decoration: underline; }

/* the mosaic of facts: tiles on grout */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
@media (max-width: 760px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { background: var(--cobalt); color: #fff; border-radius: 3px; padding: 18px 16px 14px; min-height: 128px; display: flex; flex-direction: column; justify-content: flex-end; }
.tile:nth-child(3n+2) { background: var(--deep); }
.tile:nth-child(4n+3) { background: var(--sky); color: var(--night); }
.tile .num { font-family: var(--display); font-weight: 700; font-size: clamp(1.6rem, 2.6vw, 2.1rem); line-height: 1; letter-spacing: -0.02em; margin-bottom: 8px; }
.tile .num sup { font-size: 0.55em; }
.tile .lab { font-size: 0.88rem; line-height: 1.3; opacity: 0.92; }

/* how it works: the pipeline as a sequence */
.steps { counter-reset: step; display: grid; gap: 6px; grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1000px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }
.step { counter-increment: step; background: var(--paper); border: 1px solid var(--line); border-radius: var(--tile-r); overflow: hidden; display: flex; flex-direction: column; }
.step img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.step img.plot { object-fit: contain; background: #fff; padding: 8px; border-bottom: 1px solid var(--line); }
.step .body { padding: 16px 18px 20px; }
.step h3 { margin: 0 0 6px; font-size: 1.12rem; display: flex; gap: 10px; align-items: baseline; }
.step h3::before { content: counter(step); font-size: 0.85rem; color: var(--cobalt); font-weight: 700; flex: 0 0 auto; }
.step p { margin: 0; font-size: 0.95rem; color: var(--muted); }

/* cards */
.cards { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--tile-r); padding: 18px 20px 20px; }
.card h3 { margin: 0 0 6px; font-size: 1.12rem; }
.card h3 a { text-decoration: none; color: var(--ink); }
.card h3 a:hover { color: var(--cobalt); }
.card time, .card .meta { font-size: 0.86rem; color: var(--muted); display: block; margin-bottom: 8px; }
.card p { margin: 0; font-size: 0.96rem; }
.card img { border-radius: 3px; margin-bottom: 12px; border: 1px solid var(--line); }

.split { display: grid; gap: 32px; grid-template-columns: 1.1fr 1fr; align-items: center; }
@media (max-width: 800px) { .split { grid-template-columns: 1fr; } }
.split .fig { margin: 0; }

/* lists for data, people, publications */
.products { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin: 1.4em 0 2em; }
.product { background: var(--paper); border: 1px solid var(--line); border-radius: var(--tile-r); padding: 16px 18px; }
.product h3 { margin: 0 0 4px; font-size: 1.08rem; }
.product .meta { font-size: 0.86rem; color: var(--muted); margin-bottom: 8px; }
.product p { margin: 0; font-size: 0.95rem; }

.people { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin: 1.4em 0 2em; }
.person { background: var(--paper); border: 1px solid var(--line); border-radius: var(--tile-r); padding: 14px 16px; }
.person strong { font-family: var(--display); font-weight: 600; font-size: 1.05rem; display: block; }
.person .role { color: var(--cobalt); font-size: 0.9rem; }
.person .aff { color: var(--muted); font-size: 0.88rem; display: block; line-height: 1.4; margin-top: 2px; }

.pub { background: var(--paper); border: 1px solid var(--line); border-radius: var(--tile-r); padding: 18px 20px; margin-bottom: 6px; }
.pub h3 { margin: 0 0 4px; font-size: 1.12rem; }
.pub .authors { color: var(--muted); font-size: 0.93rem; margin-bottom: 6px; }
.pub p { margin: 0 0 6px; font-size: 0.95rem; }
.pub .links a { margin-right: 14px; font-size: 0.93rem; }

.news-list { list-style: none; padding: 0; margin: 0; }
.news-list li { background: var(--paper); border: 1px solid var(--line); border-radius: var(--tile-r); padding: 18px 20px; margin-bottom: 6px; }
.news-list time { color: var(--muted); font-size: 0.88rem; display: block; margin-bottom: 4px; }
.news-list h3 { margin: 0 0 6px; font-size: 1.15rem; }
.news-list h3 a { text-decoration: none; color: var(--ink); }
.news-list h3 a:hover { color: var(--cobalt); }
.news-list p { margin: 0; }

.post-nav { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 60px; font-size: 0.95rem; }

/* faq */
.faq details { background: var(--paper); border: 1px solid var(--line); border-radius: var(--tile-r); padding: 0 18px; margin-bottom: 6px; }
.faq summary { cursor: pointer; font-family: var(--display); font-weight: 600; font-size: 1.05rem; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--cobalt); font-weight: 700; }
.faq details[open] summary::after { content: "–"; }
.faq details p { padding-bottom: 12px; margin: 0; }
.faq details p + p { padding-top: 0; }

/* footer */
.site-foot { background: var(--paper); border-top: 1px solid var(--line); margin-top: 40px; padding: 44px 0 28px; font-size: 0.95rem; }
.foot-grid { display: grid; gap: 32px; grid-template-columns: 1.3fr 1fr; align-items: start; }
@media (max-width: 700px) { .foot-grid { grid-template-columns: 1fr; } }
.foot-mark { width: 120px; margin-bottom: 10px; }
.foot-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.foot-nav a { color: var(--ink); text-decoration: none; }
.foot-nav a:hover { color: var(--cobalt); }
.partners { display: flex; flex-wrap: wrap; align-items: center; gap: 28px; margin: 30px 0 18px; padding-top: 24px; border-top: 1px solid var(--line); }
.partners img { height: 44px; width: auto; }
.partners .badge { border-radius: 4px; }
.fine { color: var(--muted); font-size: 0.85rem; margin: 0; }

/* ---------- buttons (emulators) ---------- */
.cat-btn { font: inherit; font-family: var(--display); font-weight: 600; font-size: 0.92rem; padding: 7px 14px; border-radius: 4px; border: 1.5px solid var(--cobalt); background: #fff; color: var(--cobalt); cursor: pointer; }
.cat-btn:hover { background: #e6edff; }
.cat-btn.primary { background: var(--cobalt); color: #fff; }
.cat-btn.primary:hover { background: var(--deep); }
.cat-btn:disabled { opacity: 0.45; cursor: default; }

/* ---------- emulators ---------- */
.emulator { margin: 1.4em 0 2.4em; background: var(--paper); border: 1px solid var(--line); border-radius: var(--tile-r); padding: 16px 18px 6px; }
.emu-body { display: grid; grid-template-columns: minmax(220px, 280px) 1fr; gap: 22px; align-items: start; }
@media (max-width: 760px) { .emu-body { grid-template-columns: 1fr; } }
.emu-controls { display: flex; flex-direction: column; gap: 8px; font-size: 0.92rem; }
.emu-slider { display: grid; grid-template-columns: 2.6em 1fr 3.4em; gap: 8px; align-items: center; }
.emu-slider label { font-family: var(--display); font-weight: 600; }
.emu-slider input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; margin: 0; padding: 0; background: transparent; cursor: pointer; --accent: var(--cobalt); }
.emu-slider input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--line); }
.emu-slider input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(15,30,56,0.25); }
.emu-slider input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
.emu-slider input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(15,30,56,0.25); }
.emu-slider input[type=range]:focus-visible { outline: none; }
.emu-slider input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(30,73,201,0.4); }
.emu-slider input[type=range]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px rgba(30,73,201,0.4); }
.emu-slider output { font-variant-numeric: tabular-nums; text-align: right; color: var(--muted); }
.emu-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.emu-buttons .cat-btn:disabled { opacity: 0.45; cursor: default; }
.emu-check { display: flex; align-items: center; gap: 8px; margin-top: 4px; cursor: pointer; }
.emu-check input { accent-color: var(--cobalt); width: 16px; height: 16px; margin: 0; }
.emu-track { position: relative; }
.emu-track input { display: block; }
.emu-fid { position: absolute; top: 50%; left: calc(8px + var(--f) * (100% - 16px)); width: 2px; height: 16px; margin: -8px 0 0 -1px; background: var(--ink); opacity: 0.6; border-radius: 1px; pointer-events: none; }
.emu-slider output.is-changed { color: var(--ink); font-weight: 600; }
.emu-canvas { user-select: none; }
.emu-plot { min-width: 0; }
.emu-canvas { width: 100%; display: block; }
.emu-ylabel, .emu-xlabel { font-family: var(--display); font-weight: 600; font-size: 0.86rem; color: var(--ink); }
.emu-ylabel { padding-left: 62px; margin-bottom: 4px; }
.emu-xlabel { text-align: center; padding-left: 62px; }
.emu-note { font-size: 0.86rem; color: var(--muted); margin: 12px 0 8px; line-height: 1.5; }
.emu-error { color: #a4231c; }
.emu-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.emu-head label { font-family: var(--display); font-weight: 600; }
.emu-head select { font: inherit; font-size: 0.95rem; padding: 7px 8px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); }
.emu-desc { max-width: 60em; font-size: 0.95rem; margin-bottom: 14px; }
.emu-desc p { margin: 0; }
.emu-legend { list-style: none; margin: 8px 0 0 62px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.86rem; color: var(--ink); }
.emu-legend li { display: flex; align-items: center; gap: 7px; }
.emu-legend li[hidden] { display: none; }
.emu-swatch { display: inline-block; width: 20px; height: 3px; border-radius: 2px; background: var(--muted); }
.emu-swatch.is-dashed { height: 0; background: none; border-top: 2px dashed var(--muted); }
.emu-remove { width: 18px; height: 18px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--muted); font-size: 0.95rem; line-height: 1; cursor: pointer; display: inline-grid; place-items: center; }
.emu-remove:hover, .emu-remove:focus-visible { border-color: #a4231c; color: #a4231c; background: #fbeeed; outline: none; }
