/* © 2024-2026 XAGI Labs Private Limited. xagilab.com design system.
   A sibling of Bhai (bhai.xagilab.com): warm paper, Geist throughout, hairline rules.
   Cobalt is XAGI's accent where Bhai uses orange: links, the active page, focus, a few numbers.
   Motion contract: anything hidden for an animation is hidden only under html.js (set in <head>),
   a CSS fallback shows it if site.js never adds .motion-ready, and the reduced-motion block shows it again.
   Hiding that needs a working control (phone nav, topic filter) waits for site.js's .menu-ready/.filter-ready. */

/* ── Tokens ── */
:root {
    --bg: #faf8f5;
    --text: #1d1b19;
    --muted: #6e6862;   /* 5.2:1 on --bg */
    --line: #e7e2dc;
    --soft: #f2eeea;
    --accent: #2f4fe0;  /* 6.0:1 on --bg, 5.5:1 on --soft */
    --on-accent: #fff;
    --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
    --max: 1280px;
    --gutter: clamp(16px, 4vw, 48px);
    --col-gap: clamp(16px, 2vw, 32px);
    --header: 64px;
    --radius: 4px;
    --ease: cubic-bezier(.2, .7, .2, 1);
    color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #141312;
        --text: #f2efeb;
        --muted: #a29b94;  /* 6.8:1 on --bg */
        --line: #2e2b28;
        --soft: #221f1d;
        --accent: #7b93ff; /* 6.6:1 on --bg */
        --on-accent: #141312;
    }
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header) + 16px); }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 16px/1.6 var(--sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: clip;
}
img, video, svg { display: block; max-width: 100%; }
img, video { height: auto; }
a { color: inherit; text-decoration: none; }
p { margin: 0; text-wrap: pretty; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; text-wrap: balance; }
h1, h2, h3, table { overflow-wrap: anywhere; }
h1 { font-size: clamp(38px, 5vw, 76px); line-height: 1.02; letter-spacing: -.035em; }
h2 { font-size: clamp(28px, 3vw, 44px); line-height: 1.08; letter-spacing: -.025em; }
h3 { font-size: clamp(19px, 1.6vw, 22px); line-height: 1.3; letter-spacing: -.012em; }
h4 { font-size: 16px; line-height: 1.4; }
strong { font-weight: 500; }
time, .num, [data-count] { font-variant-numeric: tabular-nums; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
[hidden] { display: none !important; }
.skip-link {
    position: absolute; z-index: 60; left: var(--gutter); top: -80px;
    padding: 10px 16px; background: var(--text); color: var(--bg); border-radius: var(--radius);
}
.skip-link:focus { top: 12px; }
.sr-only {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
}

/* ── Layout: a 12-column grid inside a 1280 px measure, 16 px gutters on phones ── */
.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--col-gap); }
.grid > * { grid-column: 1 / -1; }
@media (min-width: 900px) {
    .span-3 { grid-column: span 3; }
    .span-4 { grid-column: span 4; }
    .span-5 { grid-column: span 5; }
    .span-6 { grid-column: span 6; }
    .span-7 { grid-column: span 7; }
    .span-8 { grid-column: span 8; }
    .span-9 { grid-column: span 9; }
    .start-5 { grid-column-start: 5; }
    .start-7 { grid-column-start: 7; }
}
.section { padding-block: clamp(64px, 9vw, 136px); }
.section + .section { padding-top: 0; }
.section-head {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px;
    margin-bottom: clamp(28px, 4vw, 56px);
}
.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* ── Type roles ── */
.display { font-size: clamp(44px, 6.6vw, 104px); line-height: .98; letter-spacing: -.045em; font-weight: 500; }
.lead { font-size: clamp(18px, 1.55vw, 22px); line-height: 1.5; color: var(--text); max-width: 40ch; letter-spacing: -.008em; }
.lbl { font-size: 15px; line-height: 1.4; font-weight: 500; color: var(--muted); }
.lbl.accent { color: var(--accent); }
.muted { color: var(--muted); }

/* ── Header ── */
.site-header {
    position: sticky; top: 0; z-index: 40;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.2) blur(12px);
    backdrop-filter: saturate(1.2) blur(12px);
    border-bottom: 1px solid var(--line);
}
.header-inner {
    width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto;
    min-height: var(--header); display: flex; align-items: center; gap: 12px 32px;
}
.brand {
    display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin-right: auto;
    font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
}
.brand .mark { width: 27px; height: auto; }
.site-nav { display: flex; align-items: center; gap: 4px 28px; font-size: 14px; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; transition: color .2s; }
.site-nav a:hover, .site-nav [aria-current] { color: var(--accent); }
.menu-toggle {
    display: none; align-items: center; gap: 10px; min-height: 44px; padding: 0;
    border: 0; background: none; color: inherit; font: inherit; font-size: 14px; cursor: pointer;
}
.menu-icon { position: relative; width: 18px; height: 8px; }
.menu-icon::before, .menu-icon::after {
    content: ""; position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor;
    transition: transform .3s var(--ease), top .3s var(--ease);
}
.menu-icon::before { top: 0; }
.menu-icon::after { top: 6.5px; }
.menu-toggle[aria-expanded="true"] .menu-icon::before { top: 3.25px; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-icon::after { top: 3.25px; transform: rotate(-45deg); }
@media (max-width: 899px) {
    /* Until site.js has wired the toggle (no JS, or it failed) the nav stays visible on its own row under the brand. */
    .header-inner { flex-wrap: wrap; }
    .site-nav { order: 3; width: 100%; flex-wrap: wrap; gap: 0 20px; padding-bottom: 6px; }
    html:not(.menu-ready) .site-header { position: static; }
    html.menu-ready .menu-toggle { display: inline-flex; }
    html.menu-ready .site-nav { display: none; }
    html.menu-ready .site-header.is-open .site-nav {
        display: flex; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 0;
        position: absolute; top: 100%; left: 0; right: 0; height: calc(100dvh - var(--header));
        padding: 8px var(--gutter) 40px; overflow-y: auto; background: var(--bg);
    }
    html.menu-ready .site-header.is-open .site-nav a {
        font-size: 28px; font-weight: 500; letter-spacing: -.02em; min-height: 64px;
        border-bottom: 1px solid var(--line);
    }
}

/* ── Loading screen: only exists with JS (site.js runs it); CSS fades it by 1.5 s even if JS stalls ── */
.loader { display: none; }
html.js .loader {
    position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 20px;
    background: var(--bg); color: var(--text);
    transition: opacity .5s var(--ease), visibility .5s;
    animation: loader-out .45s var(--ease) 1.5s forwards;
}
html.js .loader.is-done { opacity: 0; visibility: hidden; }
html.seen .loader { display: none; } /* once per session: the head script marks later pages */
.loader-mark { width: 52px; height: auto; }
.loader p { font-size: 14px; letter-spacing: .01em; color: var(--muted); }
.loader-line { position: relative; display: block; width: 168px; height: 1px; overflow: hidden; background: var(--line); }
html.js .loader-line::after {
    content: ""; position: absolute; inset: 0; background: var(--accent);
    transform: scaleX(0); transform-origin: left; animation: loader-fill 1.3s cubic-bezier(.65, 0, .25, 1) .1s forwards;
}
@keyframes loader-fill { to { transform: scaleX(1); } }
@keyframes loader-out { to { opacity: 0; visibility: hidden; } }

/* ── Links and buttons ── */
.text-link {
    display: inline-flex; align-items: center; gap: .45em; min-height: 44px;
    color: var(--accent); font-weight: 500; font-size: 15px;
}
.text-link svg { width: 1em; height: 1em; flex: none; transition: transform .25s var(--ease); }
.text-link:hover svg { transform: translateX(3px); }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.pill {
    display: inline-flex; align-items: center; gap: .6em; min-height: 44px; padding: 0 20px;
    border-radius: 999px; background: var(--text); color: var(--bg); font-size: 15px; font-weight: 500;
    transition: background-color .2s, color .2s;
}
.pill svg { width: 1em; height: 1em; }
.pill:hover { background: var(--accent); color: var(--on-accent); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }

/* ── Page openings ── */
.hero {
    display: grid; gap: 32px; align-items: end;
    padding-block: clamp(56px, 9vw, 136px) clamp(48px, 6vw, 96px);
}
.hero .lead { margin-bottom: 24px; }
.hero img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); }
.hero h1 { font-size: clamp(40px, 5vw, 80px); line-height: .98; letter-spacing: -.04em; }
@media (min-width: 900px) {
    .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--col-gap) clamp(40px, 5vw, 80px); }
}
.page-head {
    padding-block: clamp(56px, 9vw, 128px) clamp(40px, 5vw, 72px);
    border-bottom: 1px solid var(--line);
}
.page-head h1 { max-width: 18ch; }
.page-head .lead { margin-top: 24px; }

/* ── Research list: date · topic · title · number ── */
.research-list { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.research-row {
    display: grid; align-items: baseline; column-gap: 28px; padding: 20px 0;
    grid-template-columns: 7.5rem 9rem minmax(0, 1fr) minmax(4.5rem, auto);
    grid-template-areas: "date topic title num" ". . summary .";
    border-top: 1px solid var(--line);
}
.research-row .date { grid-area: date; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.research-row .topic { grid-area: topic; font-size: 15px; font-weight: 500; color: var(--accent); }
.research-row .title {
    grid-area: title; font-size: clamp(17px, 1.45vw, 20px); font-weight: 500; line-height: 1.32;
    letter-spacing: -.012em; overflow-wrap: anywhere; transition: color .2s;
}
.research-row .summary { grid-area: summary; margin-top: 6px; font-size: 16px; max-width: 64ch; }
.research-row .num {
    grid-area: num; justify-self: end; font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.research-row a.num { color: var(--muted); transition: color .2s; }
.research-row:hover .title, .research-row .title a:hover, .research-row a.num:hover { color: var(--accent); }
@media (max-width: 699px) {
    .research-row {
        grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 14px; row-gap: 6px;
        grid-template-areas: "date topic num" "title title title" "summary summary summary";
    }
    .research-row .summary { margin-top: 0; }
}

/* ── Scorecard: big tabular numbers, each under its own rule ── */
.scorecard { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--col-gap); }
@media (min-width: 900px) { .scorecard { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.scorecard > * { display: flex; flex-direction: column; gap: 10px; padding: 16px 0 36px; border-top: 1px solid var(--text); }
.scorecard .value {
    font-size: clamp(34px, 4vw, 58px); font-weight: 400; line-height: 1; letter-spacing: -.04em;
    font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.scorecard a.value { transition: color .2s; }
.scorecard a.value:hover { color: var(--accent); }
.scorecard .label { font-size: 14px; line-height: 1.4; color: var(--muted); }

/* ── Feature: image + copy ── */
.feature { display: grid; gap: 28px; align-items: center; }
.feature figure { margin: 0; }
.feature figure, .wide { overflow: hidden; border-radius: var(--radius); } /* frames for the scroll parallax */
.feature img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius); }
.feature h2 + p, .feature .lbl + h2 { margin-top: 16px; }
.feature p { max-width: 42ch; }
.feature p + p { margin-top: 12px; }
.feature p.lead { color: var(--text); }
.feature .actions { margin-top: 28px; }
@media (min-width: 900px) {
    .feature { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(40px, 6vw, 104px); }
    .feature.flip { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
    .feature.flip > figure { order: 2; }
}

/* ── Logos: Recognised and supported by, and the wider ecosystem ── */
.supporters ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--col-gap); }
@media (min-width: 1000px) { .supporters ul { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.supporters li { display: flex; flex-direction: column; gap: 2px; padding: 20px 0 32px; border-top: 1px solid var(--line); font-size: 15px; }
.supporters li > a { display: flex; flex-direction: column; gap: 2px; }
.supporters .logo { height: 56px; display: flex; align-items: center; margin-bottom: 14px; }
.supporters .logo img { max-height: 40px; max-width: min(150px, 100%); width: auto; object-fit: contain; }
.supporters .name { font-weight: 500; }
.supporters .via { font-size: 15px; color: var(--muted); }
.supporters a:hover .name { color: var(--accent); }
.supporters img, .ecosystem img { filter: grayscale(1); mix-blend-mode: multiply; }
@media (prefers-color-scheme: dark) {
    .supporters img, .ecosystem img { filter: grayscale(1) invert(1); mix-blend-mode: screen; }
}

/* ── Article: sticky meta sidebar from 1000 px, a readable column for the body ── */
.article { display: grid; gap: 32px; padding-block: clamp(40px, 6vw, 88px) 0; }
.article-meta { font-size: 14px; border-top: 1px solid var(--text); padding-top: 14px; }
.article-meta dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 18px var(--col-gap); }
.article-meta dt { font-size: 13px; font-weight: 500; color: var(--muted); }
.article-meta dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.article-meta a { color: var(--accent); }
.article-meta a:hover { text-decoration: underline; text-underline-offset: 3px; }
.article-meta code { font: 12.5px/1.5 var(--mono); overflow-wrap: anywhere; }
.article-body { min-width: 0; max-width: 46rem; }
.article-body > h1 { font-size: clamp(30px, 4.4vw, 64px); }
.cover { margin: clamp(32px, 4vw, 48px) 0 0; overflow: hidden; border-radius: var(--radius); }
.cover img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; }
.research-head { display: grid; gap: 32px; align-items: end; }
.research-head figure { margin: 0; overflow: hidden; border-radius: var(--radius); }
.research-head img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
@media (min-width: 900px) { .research-head { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--col-gap) clamp(40px, 5vw, 80px); } }
.article-body > .byline { margin-top: 16px; font-size: 15px; color: var(--muted); }
.article-body > .byline a { color: var(--accent); }
.article-body > .byline a:hover { text-decoration: underline; text-underline-offset: 3px; }
.article-body > .lead { margin-top: 20px; max-width: 48ch; }
.article-summary { margin-top: 20px; }
.article-summary .lead { margin-top: 4px; max-width: 48ch; }
.article-body > .prose { margin-top: clamp(32px, 4vw, 48px); }
@media (min-width: 1000px) {
    .article { grid-template-columns: 15rem minmax(0, 1fr); gap: clamp(48px, 6vw, 104px); }
    .article-meta { position: sticky; top: calc(var(--header) + 32px); align-self: start; }
    .article-meta dl { grid-template-columns: 1fr; }
}

/* ── Long-form text ── */
.prose { font-size: 18px; line-height: 1.68; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: clamp(24px, 2.3vw, 30px); margin-top: 2.2em; }
.prose h3 { margin-top: 1.8em; }
.prose h2 + *, .prose h3 + * { margin-top: .6em; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: .45em; }
.prose blockquote { margin-inline: 0; padding-left: 20px; border-left: 2px solid var(--accent); color: var(--muted); }
.prose code { font: .86em var(--mono); background: var(--soft); padding: .12em .38em; border-radius: 3px; overflow-wrap: anywhere; }
.prose pre { font: 14px/1.6 var(--mono); background: var(--soft); padding: 16px 18px; border-radius: var(--radius); overflow-x: auto; }
.prose pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }

/* Tables (research numbers): hairlines only, numbers right-aligned in tabular figures. */
.prose table, .data-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.45; }
.prose th, .data-table th {
    text-align: left; font-size: 13px; font-weight: 500;
    color: var(--muted); padding: 0 16px 10px 0; vertical-align: bottom;
}
.prose td, .data-table td { padding: 11px 16px 11px 0; border-top: 1px solid var(--line); vertical-align: baseline; }
.prose tr > :last-child, .data-table tr > :last-child { padding-right: 0; }
.prose td.num, .data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table td a { color: var(--accent); }
.data-table td a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── Footer layout (colours live in game.css: footer-game.js animates them) ── */
.site-footer { margin-top: clamp(80px, 9vw, 136px); padding-top: clamp(48px, 6vw, 80px); font-size: 15px; border-top: 1px solid var(--footer-line); }
.footer-grid, .footer-bottom, .footer-credits { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.footer-grid { display: grid; gap: 48px; }
@media (min-width: 900px) { .footer-grid { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--col-gap); } }
.footer-about { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.footer-brand { display: block; width: 128px; }
.footer-brand img { width: 100%; height: auto; }
.footer-email { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; }
.footer-open-source {
    display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 14px;
    border-radius: 999px; font-size: 13px; transition: background-color .2s;
}
.footer-open-source svg { flex: none; }
.footer-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px var(--col-gap); }
@media (min-width: 700px) { .footer-columns { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.footer-columns h2 { font-size: 15px; line-height: 1.4; font-weight: 500; margin: 0 0 10px; }
.footer-columns a { display: flex; align-items: center; min-height: 36px; transition: color .2s; }
.footer-bottom {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px;
    margin-top: clamp(40px, 5vw, 64px); padding-top: 18px; border-top: 1px solid var(--footer-line); font-size: 15px;
}
.footer-credits { font-size: 16px; }
.footer-credits summary { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; list-style: none; }
.footer-credits summary::-webkit-details-marker { display: none; }
.footer-credits summary span { font-size: 18px; line-height: 1; transition: transform .25s var(--ease); }
.footer-credits[open] summary span { transform: rotate(45deg); }
.credits-content { padding: 8px 0 32px; line-height: 1.65; max-width: 72rem; }
.credits-content > p { max-width: 64ch; }
.trademark-list { list-style: none; margin: 20px 0; padding: 0; columns: 2 22rem; column-gap: 48px; }
.trademark-list li { break-inside: avoid; margin-bottom: 14px; }
.credits-content a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--footer-line); }
.credits-content .nvidia-attribution { margin-top: 16px; }

/* ── Motion hooks (site.js): reveal on scroll ── */
html.js [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
html.js [data-reveal].is-in { opacity: 1; transform: none; }
html.js [data-reveal] { transition-delay: calc(var(--d, 0) * 90ms); } /* parts of a section arrive one after another */
/* The home headline: each line rises from behind its own baseline. */
.line { display: block; overflow: hidden; padding-bottom: .12em; margin-bottom: -.12em; }
.line > span { display: block; }
html.js .line > [data-reveal] { opacity: 1; transform: translateY(108%); transition-duration: 1s; transition-delay: calc(150ms + var(--d, 0) * 110ms); }
html.js .line > [data-reveal].is-in { transform: none; }
/* Safety net: if site.js never takes over (it adds .motion-ready first thing), everything shows by itself. */
html.js:not(.motion-ready) [data-reveal] { animation: reveal-fallback .6s var(--ease) 2.5s forwards; }
@keyframes reveal-fallback { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    html.js .loader, .loader { display: none; }
    html.js [data-reveal] { opacity: 1; transform: none; transition: none; }
    html.js .line > [data-reveal] { transform: none; }
    *, *::before, *::after {
        animation-duration: .01ms !important; animation-iteration-count: 1 !important;
        transition-duration: .01ms !important; scroll-behavior: auto !important;
    }
}

/* ── Research: index filter, entry results, wide tables ── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.topic-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: clamp(24px, 3vw, 40px); }
html:not(.filter-ready) .topic-filter { display: none; } /* until site.js wires it, every row is already listed */
.topic-filter button {
    min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; cursor: pointer;
    background: var(--soft); color: var(--text); font: 500 15px/1 var(--sans);
    transition: color .2s, background-color .2s;
}
.topic-filter button:hover { color: var(--accent); }
.topic-filter button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.article-numbers { margin-top: clamp(32px, 4vw, 48px); }
.article-numbers h2 { margin-bottom: 12px; }
.article-back { margin-top: clamp(40px, 5vw, 64px); }
.results-notes { margin-top: clamp(32px, 4vw, 48px); max-width: 46rem; font-size: 16px; color: var(--muted); }
.section.research-index, .section.results { padding-top: clamp(32px, 4vw, 56px); }
.results-group + .results-group { margin-top: clamp(48px, 6vw, 80px); }
.results-group h2 { font-size: clamp(20px, 2vw, 26px); }
.results-group .group-topic { margin: 6px 0 16px; font-size: 15px; color: var(--accent); }
.results-group h2 a:hover { color: var(--accent); }
@media (max-width: 999px) { .article-meta { order: 1; } } /* phones: title first, the record after the text */
@media (max-width: 699px) { .col-src { display: none; } } /* the result itself links to the same file */

/* ── Pages: home, MELRA, Bhai, Mission, The lab, Careers, Contact, 404 ── */
.hero h1 + .lead { margin-top: 24px; }
.hero .actions { margin-bottom: 0; }
.supporters .section-head, .ecosystem .section-head { margin-bottom: 0; }
.scorecard .label { transition: color .2s; }
.scorecard a.label:hover { color: var(--accent); }
.section-head h2:not(.lbl) { font-size: clamp(24px, 2.4vw, 34px); }
.section-head > p { max-width: 44ch; }

/* From decision to effect: five frames, a grid that wraps on narrow screens (site.js may pin it as a sideways row on wide ones) */
.sequence-head { display: grid; gap: 20px; margin-bottom: clamp(28px, 4vw, 48px); }
@media (min-width: 900px) { .sequence-head { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: end; } }
.steps ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px var(--col-gap); }
@media (max-width: 559px) { .steps ol { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 900px) { .steps ol { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
/* Pinned (site.js, wide screens with motion): the section holds still and the row slides through it as you scroll. */
.sequence.is-pinned {
    min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: center;
    padding-block: calc(var(--header) + 24px) 32px; overflow: hidden;
}
.sequence.is-pinned .steps { overflow: visible; padding: 0; }
.sequence.is-pinned .steps ol { width: max-content; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: clamp(220px, calc((100svh - 420px) * .8), 400px); gap: clamp(24px, 3vw, 56px); will-change: transform; }
.steps figure { margin: 0; }
.steps img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius); }
@media (max-width: 559px) { .steps img { aspect-ratio: 3 / 2; } }
.steps figcaption { margin-top: 16px; font-size: clamp(17px, 1.4vw, 20px); line-height: 1.35; letter-spacing: -.01em; }

/* Statement: heading on the left, one large sentence and its links on the right */
.statement { display: grid; gap: 20px; }
@media (min-width: 900px) { .statement { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--col-gap); } }
.statement > h2 { border-top: 1px solid var(--text); padding-top: 14px; }
.statement > div { border-top: 1px solid var(--line); padding-top: 14px; }
.statement .big { font-size: clamp(22px, 2.3vw, 32px); line-height: 1.3; letter-spacing: -.018em; max-width: 30ch; }
.statement .big + p, .statement p + p { margin-top: 18px; max-width: 52ch; }
.statement .actions { margin-top: 24px; }

/* Facts strip, three points, layered list, wide image */
.facts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--col-gap); }
@media (min-width: 900px) { .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.facts li { display: flex; flex-direction: column; gap: 6px; padding: 16px 0 28px; border-top: 1px solid var(--text); min-width: 0; }
.facts strong { font-size: clamp(17px, 1.6vw, 22px); line-height: 1.25; letter-spacing: -.012em; overflow-wrap: anywhere; }
.facts strong a:hover { color: var(--accent); }
.facts span { font-size: 14px; color: var(--muted); }
.registry-line { margin-top: 4px; font-size: 13px; }
.points { display: grid; gap: 0 var(--col-gap); }
@media (min-width: 900px) { .points { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.points article { padding: 18px 0 28px; border-top: 1px solid var(--line); }
.points p { margin-top: 10px; max-width: 38ch; }
.layers { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.layers li { display: grid; gap: 8px 32px; padding: 22px 0; border-top: 1px solid var(--line); align-items: baseline; }
@media (min-width: 900px) { .layers li { grid-template-columns: 12rem minmax(0, 1fr) auto; } }
.layers p { font-size: clamp(18px, 1.6vw, 22px); line-height: 1.4; letter-spacing: -.01em; max-width: 44ch; }
.layers .text-link { min-height: 0; }
.loop { margin-top: 20px; color: var(--muted); }
.loop span { color: var(--accent); margin-right: 6px; }
.wide { margin-block: 0; }
.wide img { width: 100%; aspect-ratio: 21 / 9; object-fit: cover; border-radius: var(--radius); }
@media (max-width: 699px) { .wide img { aspect-ratio: 4 / 3; } }

/* Recognised and supported by: the badge-style marks keep their shape */
.supporters ul { margin-top: 0; }
.supporters .via.accent { color: var(--accent); margin-top: 6px; }
.inception { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 24px 0; font-size: 15px; color: var(--muted); border-bottom: 1px solid var(--line); }
.inception img { height: 40px; width: auto; }
.directory { display: grid; gap: 16px; padding-top: 24px; }
@media (min-width: 900px) { .directory { grid-template-columns: 12rem minmax(0, 1fr); } }
.directory > div { display: grid; gap: 0 var(--col-gap); }
@media (min-width: 700px) { .directory > div { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .directory > div { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; } }
.directory details { border-top: 1px solid var(--line); }
.directory summary { display: flex; align-items: center; gap: 10px; min-height: 48px; cursor: pointer; list-style: none; font-weight: 500; font-size: 15px; }
.directory summary::-webkit-details-marker { display: none; }
.directory summary > span:last-child { margin-left: auto; font-size: 18px; transition: transform .25s var(--ease); }
.directory details[open] summary > span:last-child { transform: rotate(45deg); }
.directory .count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.directory ul { list-style: none; margin: 0 0 16px; padding: 0; font-size: 14px; color: var(--muted); }
.directory li + li { margin-top: 4px; }

/* MELRA: demo video, four questions, outcome states, install, docs */
.video { margin: 0; }
.video-frame { position: relative; }
.video video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--soft); border-radius: var(--radius); }
.video-sound {
    position: absolute; top: 14px; right: 14px; min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; cursor: pointer;
    background: #141312; color: #f2efeb; font: 500 15px/1 var(--sans); transition: background-color .2s, color .2s, transform .2s var(--ease);
}
.video-sound:hover { background: #f2efeb; color: #141312; }
.video-sound:active { transform: scale(.96); }
.questions { list-style: none; margin: 28px 0 0; padding: 0; counter-reset: q; }
.questions li { padding: 14px 0; border-top: 1px solid var(--line); }
.questions h3 { font-size: 18px; }
.feature .questions p { margin-top: 4px; }
.outcomes, .install, .open-desk { display: grid; gap: 28px; }
@media (min-width: 900px) {
    .outcomes, .install, .open-desk { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--col-gap); }
}
.outcomes .lead, .install .lead, .open-desk .lead { margin-top: 18px; }
.outcome-demo { display: grid; gap: 20px; border-top: 1px solid var(--text); padding-top: 14px; }
@media (min-width: 700px) { .outcome-demo { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.outcome-demo fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.outcome-demo legend { padding: 0; margin-bottom: 10px; font-size: 14px; color: var(--muted); }
.outcome-demo label { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; border-top: 1px solid var(--line); font-size: 15px; }
.outcome-demo input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; flex: none; }
.outcome-demo label:has(:checked) { color: var(--accent); }
.outcome-results { display: grid; gap: 12px; align-content: start; }
.outcome-result { padding: 18px; background: var(--soft); border-radius: var(--radius); }
.outcome-result code { font: 500 15px/1.4 var(--mono); color: var(--accent); }
.outcome-result p { margin-top: 8px; color: var(--muted); }
/* Every state is listed without :has(); with it, only the picked one shows */
@supports selector(:has(*)) {
    .outcome-result { display: none; }
    .outcome-demo:has(#outcome-success:checked) [data-outcome="success"],
    .outcome-demo:has(#outcome-partial:checked) [data-outcome="partial"],
    .outcome-demo:has(#outcome-blocked:checked) [data-outcome="blocked"],
    .outcome-demo:has(#outcome-approval:checked) [data-outcome="approval"],
    .outcome-demo:has(#outcome-crash:checked) [data-outcome="crash"] { display: block; }
}
.terminal {
    margin: 0 0 14px; padding: 20px 22px; border-radius: var(--radius); background: var(--text); color: var(--bg);
    font: 15px/1.5 var(--mono); overflow-x: auto;
}
.terminal span { opacity: .55; }
.install > div:last-child, .open-desk > div:last-child { border-top: 1px solid var(--text); padding-top: 14px; }
.install .actions { margin-top: 20px; }
.doc-links { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.doc-links a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 24px; align-items: center; padding: 18px 0; border-top: 1px solid var(--line); }
.doc-links .name { font-size: clamp(18px, 1.6vw, 22px); font-weight: 500; letter-spacing: -.012em; transition: color .2s; }
.doc-links .muted { grid-column: 1; font-size: 15px; }
.doc-links svg { grid-row: 1 / span 2; grid-column: 2; width: 20px; height: 20px; color: var(--accent); transition: transform .25s var(--ease); }
.doc-links a:hover .name { color: var(--accent); }
.doc-links a:hover svg { transform: translateX(3px); }
.section-head code { font: 13px var(--mono); }

/* The lab: open desk; Careers; Contact; 404 */
.path { list-style: none; margin: 0 0 20px; padding: 0; }
.path li { display: flex; gap: 18px; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--line); font-size: clamp(18px, 1.6vw, 22px); }
.fit { list-style: none; margin: 0 0 20px; padding: 0; }
.fit li { padding: 14px 0; border-top: 1px solid var(--line); font-size: clamp(18px, 1.6vw, 22px); line-height: 1.4; letter-spacing: -.01em; }
.contact-hero h1 { font-size: clamp(38px, 6.4vw, 96px); letter-spacing: -.045em; }
.contact-hero h1 a { transition: color .2s; }
.contact-hero h1 a:hover { color: var(--accent); }
.registered { margin-top: 32px; font-style: normal; color: var(--muted); }
.registered strong { color: var(--text); }
.registry { margin: 24px 0 0; display: grid; gap: 14px; font-size: 15px; }
.registry dt { font-size: 13px; font-weight: 500; color: var(--muted); }
.registry dd { margin: 2px 0 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.not-found { border-bottom: 0; }
.not-found .actions { margin-top: 32px; }

/* Next: a quiet closing link to the next page */
.next { display: grid; gap: 6px; padding-top: 16px; border-top: 1px solid var(--text); }
.next-title { display: inline-flex; align-items: center; gap: .3em; font-size: clamp(32px, 4.4vw, 64px); font-weight: 500; letter-spacing: -.035em; line-height: 1.05; transition: color .2s; }
.next-title svg { width: .7em; height: .7em; transition: transform .3s var(--ease); }
.next:hover .next-title { color: var(--accent); }
.next:hover .next-title svg { transform: translateX(6px); }
.hero + .section, .hero + .wrap { padding-top: 0; }
@media (max-width: 899px) { .statement > div { border-top: 0; padding-top: 0; } }

/* ── Home: colour chapters. Each section is one flat field holding one thing; fields meet edge to edge.
   A chapter re-declares the tokens, so every component inside takes its colours from the field. ── */
.chapter { padding-block: clamp(88px, 11vw, 168px); background: var(--bg); color: var(--text); }
.chapter + .chapter, .chapter + .section, .section + .chapter { margin-top: 0; }
/* Every chapter colour is a palette token: ink #1d1b19 (light) / soft #221f1d (dark) fields carry the dark-theme inks. */
.chapter-ink {
    --bg: #1d1b19; --text: #faf8f5; --muted: #a29b94; --line: #2e2b28; --soft: #221f1d; --accent: #7b93ff; --on-accent: #141312;
}
.chapter-cobalt { --bg: #2f4fe0; --text: #fff; --muted: #fff; --line: rgba(255, 255, 255, .4); --accent: #fff; --on-accent: #2f4fe0; }
.chapter-soft { --bg: #f2eeea; --line: #e7e2dc; }
@media (prefers-color-scheme: dark) {
    /* Dark stays dark: the ink chapter is one tone step up from the page (#141312 → #221f1d), never inverted. */
    .chapter-ink {
        --bg: #221f1d; --text: #f2efeb; --muted: #a29b94; --line: #2e2b28; --soft: #141312; --accent: #7b93ff; --on-accent: #141312;
    }
    .chapter-cobalt { --bg: #7b93ff; --text: #141312; --muted: #141312; --line: rgba(20, 19, 18, .35); --accent: #141312; --on-accent: #7b93ff; }
    .chapter-soft { --bg: #221f1d; --line: #2e2b28; }
}
.chapter .text-link { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.chapter-cobalt .pill:hover, .chapter-ink .pill:hover { background: var(--accent); color: var(--on-accent); }
.chapter-head { display: grid; gap: 16px 24px; margin-bottom: clamp(40px, 5vw, 80px); }
.chapter-head h2, .sequence-head h2 { font-size: clamp(40px, 5.6vw, 88px); line-height: 1; letter-spacing: -.04em; }
.chapter-head > p:not(.actions) { font-size: 18px; line-height: 1.5; max-width: 40ch; }
.chapter-head .actions { margin-top: -4px; }
@media (min-width: 900px) {
    .chapter-head { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: end; }
    .chapter-head > h2 { grid-row: span 2; }
}

/* First screen: the line, then the sentence and the sculpture */
.home-hero { padding-block: clamp(32px, 4vw, 64px) clamp(72px, 9vw, 136px); }
.home-hero .display { font-size: clamp(46px, 9.6vw, 156px); line-height: .92; letter-spacing: -.05em; }
.hero-below { display: grid; gap: 32px; margin-top: clamp(28px, 3.6vw, 52px); }
.hero-copy { display: flex; flex-direction: column; height: 100%; }
.hero-copy .lead { max-width: 32ch; }
.org-line { margin-top: auto; padding-top: 28px; font-size: 18px; color: var(--muted); }
.hero-copy .actions { margin-top: 28px; }
.hero-media { margin: 0; overflow: hidden; border-radius: var(--radius); }
.hero-media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
@media (min-width: 900px) { .hero-below { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); align-items: stretch; gap: var(--col-gap); } }

/* Latest research: titles set large, the date, topic and number small around them */
.latest .research-list { border-bottom: 1px solid var(--line); }
.latest .research-row { padding: 26px 0; grid-template-columns: 7.5rem 8.5rem minmax(0, 1fr) minmax(4.5rem, auto); }
.latest .research-row .title { font-size: clamp(21px, 2.1vw, 30px); line-height: 1.2; letter-spacing: -.02em; }
.latest .research-row .num { font-size: 18px; }
@media (max-width: 699px) { .latest .research-row { grid-template-columns: auto minmax(0, 1fr) auto; } }

/* Results: one figure at full display size, three beside it */
.chapter-cobalt .scorecard { grid-template-columns: minmax(0, 1fr); gap: 0 var(--col-gap); }
.chapter-cobalt .scorecard > * { border-top-color: var(--line); padding: 18px 0 28px; }
.chapter-cobalt .scorecard > :first-child { border-top: 0; padding-top: 0; padding-bottom: clamp(32px, 4vw, 56px); }
.chapter-cobalt .scorecard > :first-child .value { font-size: clamp(72px, 13vw, 210px); letter-spacing: -.055em; line-height: .9; }
.chapter-cobalt .scorecard .value { font-size: clamp(40px, 4.4vw, 68px); font-weight: 500; }
.chapter-cobalt .scorecard .label { color: var(--text); font-size: 18px; max-width: 30ch; }
.chapter-cobalt .scorecard + .actions { margin-top: 12px; }
.chapter-cobalt .scorecard a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
@media (min-width: 900px) {
    .chapter-cobalt .scorecard { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .chapter-cobalt .scorecard > :first-child { grid-column: 1 / -1; }
}

/* MELRA: the demo playing, and the one command that installs it */
.melra-chapter .statement-line { font-size: clamp(18px, 1.55vw, 22px); line-height: 1.4; letter-spacing: -.012em; max-width: 34ch; }
.melra-try { display: grid; gap: 20px; margin-top: clamp(40px, 5vw, 72px); align-items: center; }
.melra-try .terminal { margin: 0; background: var(--soft); color: var(--text); font-size: 16px; }
@media (min-width: 900px) { .melra-try { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--col-gap); } }

/* Bhai: an example chat, and the agent in three sentences */
.bhai-chapter .wrap { display: grid; gap: 32px; align-items: center; }
.bhai-copy h2 { font-size: clamp(40px, 5.6vw, 88px); line-height: 1; letter-spacing: -.04em; }
.bhai-copy .statement-line { margin-top: 20px; font-size: clamp(18px, 1.55vw, 22px); line-height: 1.35; letter-spacing: -.012em; }
.bhai-copy p:not(.statement-line):not(.actions) { margin-top: 16px; max-width: 40ch; }
.bhai-copy .actions { margin-top: 32px; }
@media (min-width: 900px) { .bhai-chapter .wrap { grid-template-columns: minmax(0, 540px) minmax(0, 480px); justify-content: center; gap: clamp(40px, 6vw, 112px); } }

/* Recognised and supported by: the five programmes, then the wider ecosystem's marks */
.chapter.supporters li { border-top: 0; padding: 0; }
.chapter.supporters ul:not(.logos) { gap: 40px var(--col-gap); }
.chapter.supporters img { filter: grayscale(1); mix-blend-mode: multiply; }
@media (prefers-color-scheme: dark) { .chapter.supporters img { filter: grayscale(1) invert(1); mix-blend-mode: screen; } }
.home .site-footer { margin-top: 0; }

/* ── Pictures that are the product's own: demo stills keep the frame's 16:9 ── */
.hero img.still, .feature img.still, .cover img.still { aspect-ratio: 16 / 9; }
.cover figcaption, .research-head .chart figcaption { margin-top: 12px; font-size: 15px; color: var(--muted); }

/* An example chat with Bhai (pages.chat), built as real text in the channels people use it on: Bhai is a contact in
   WhatsApp or Telegram, or an email address. Each channel's own colours apply inside its view only; Bhai's orange is
   only in its icon. Tabs (site.js) switch channels; without them every channel shows, one under the other. */
.chat { margin: 0; display: grid; justify-items: center; gap: 12px; }
.chat figcaption { display: grid; justify-items: center; gap: 2px; text-align: center; }
.chat-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.chat-label::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.chat-title { font-size: 17px; font-weight: 500; letter-spacing: -.01em; }
.chat-tabs { display: inline-flex; gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.chat-tabs button {
    font: 500 14px/1 var(--sans); padding: 8px 15px; border: 0; border-radius: 999px;
    background: none; color: var(--muted); cursor: pointer; transition: background .2s, color .2s;
}
.chat-tabs button:hover { color: var(--text); }
.chat-tabs [aria-selected="true"] { background: var(--text); color: var(--bg); }
.chat-tabs button:focus-visible { outline-offset: 1px; border-radius: 999px; }
.chat-views { width: 100%; display: grid; gap: 40px; }
.chat-view { display: grid; justify-items: center; gap: 10px; align-content: start; }
.chat-view:focus-visible { outline-offset: 6px; }
.chat-channel { font-size: 13px; font-weight: 500; color: var(--muted); }
.chat.tabs-ready .chat-views { gap: 0; }
.chat.tabs-ready .chat-view { grid-area: 1 / 1; } /* stacked: switching never moves the page */
.chat.tabs-ready .chat-channel { display: none; } /* the tabs name the channel */
.chat-view.is-off { visibility: hidden; }
.chat .chat-avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; }
.chat time { font-variant-numeric: tabular-nums; }
.chat-tag {
    display: flex; align-items: center; gap: 5px; width: fit-content; margin-top: 6px; padding-top: 5px;
    border-top: 1px solid rgba(0, 0, 0, .08); font-size: 12.5px; font-weight: 500; color: var(--tag);
}
.chat-tag svg { width: 13px; height: 13px; stroke-width: 2.6; }
.chat svg { flex: none; }

/* The phone: WhatsApp and Telegram */
.phone {
    width: min(100%, 360px); padding: 9px; border-radius: 48px; background: #131313;
    box-shadow: inset 0 0 0 1.5px #3b3b3b, 0 0 0 1px rgba(0, 0, 0, .06), 0 32px 64px -30px rgba(29, 27, 25, .55);
}
.phone-screen {
    display: flex; flex-direction: column; min-height: 580px; overflow: hidden; border-radius: 39px;
    background: var(--wall); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, var(--sans);
}
.phone-status {
    position: relative; display: flex; justify-content: space-between; align-items: center; height: 30px; padding: 3px 26px 0 30px;
    background: var(--head); color: var(--head-ink); font-size: 13px; font-weight: 600;
}
.phone-status::after { content: ""; position: absolute; left: 50%; top: 8px; width: 11px; height: 11px; margin-left: -5.5px; border-radius: 50%; background: #0a0a0a; }
.phone-status i { display: flex; align-items: center; gap: 5px; }
.phone-status svg { height: 10px; width: auto; }
.phone-status .battery { height: 11px; }
.phone-head { display: flex; align-items: center; gap: 8px; padding: 6px 12px 10px 8px; background: var(--head); color: var(--head-ink); }
.phone-head > svg:first-child { width: 22px; height: 22px; }
.phone-head > span { flex: 1; display: grid; line-height: 1.25; min-width: 0; }
.phone-head b { font-size: 16.5px; font-weight: 600; }
.phone-head b + span { font-size: 12.5px; opacity: .8; }
.phone-head i { display: flex; gap: 18px; }
.phone-head i svg { width: 20px; height: 20px; }
.chat-log { flex: 1; list-style: none; margin: 0; padding: 10px 14px 6px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.chat-log .msg {
    position: relative; max-width: 86%; padding: 6px 9px 7px; font-size: 14.5px; line-height: 1.34;
    overflow-wrap: anywhere; box-shadow: 0 1px .5px rgba(11, 20, 26, .13);
}
.chat-log .msg.bhai { align-self: flex-start; background: var(--in); }
.chat-log .msg.you { align-self: flex-end; background: var(--out); }
.chat-log .msg.you + .msg.bhai, .chat-log .msg.bhai + .msg.you { margin-top: 8px; }
.chat-log .msg > :nth-last-child(2)::after { content: ""; display: inline-block; width: 44px; height: 1px; } /* room for the time */
.chat-log .msg.you > :nth-last-child(2)::after { width: 64px; }
.chat-log .meta { position: absolute; right: 8px; bottom: 4px; display: flex; align-items: center; gap: 3px; font-size: 11px; line-height: 1; color: var(--meta); }
.chat-log .msg.you .meta { color: var(--meta-out, var(--meta)); }
.chat-log .ticks { width: 17px; height: 16px; color: var(--ticks); stroke-width: 1.7; }
.chat-day { align-self: center; margin-block: 4px; }
.chat-day span { display: block; padding: 3px 11px; font-size: 12.5px; }
.phone-compose { display: flex; align-items: center; gap: 6px; }
.phone-compose svg { width: 23px; height: 23px; color: var(--icon); }

/* WhatsApp: the dark-green bar, the doodled beige wall, light-green bubbles that you send */
.wa {
    --head: #008069; --head-ink: #fff; --ink: #111b21; --in: #fff; --out: #d9fdd3; --meta: #667781; --ticks: #53bdeb;
    --icon: #8696a0; --tag: #008069; --wall: #efeae2;
    --doodle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='132' height='132' fill='none' stroke='%23000' stroke-opacity='.05' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='20' cy='22' r='9'/%3E%3Cpath d='M16 21h.1M24 21h.1M16.5 25.5a5 5 0 0 0 7 0'/%3E%3Cpath d='M70 12l3 6 6.5 1-4.7 4.6 1.1 6.4L70 27l-5.9 3 1.1-6.4-4.7-4.6 6.5-1z'/%3E%3Crect x='104' y='14' width='16' height='24' rx='3'/%3E%3Cpath d='M110 34h4'/%3E%3Cpath d='M14 80c0-6 9-6 9 0 0-6 9-6 9 0 0 6-9 11-9 11s-9-5-9-11z'/%3E%3Cpath d='M58 70h22v14H58zM58 70l11 8 11-8'/%3E%3Ccircle cx='112' cy='78' r='8'/%3E%3Cpath d='M112 74v4l3 2'/%3E%3Cpath d='M18 112l8-8 8 8M26 104v18'/%3E%3Cpath d='M62 118c4-8 12-8 16 0M66 108h.1M74 108h.1'/%3E%3Cpath d='M104 106h16v10a8 8 0 0 1-16 0z'/%3E%3C/svg%3E");
}
.wa .phone-screen { background: var(--doodle), var(--wall); }
.wa .chat-log .msg { border-radius: 8px; }
/* the first message of a run has the little tail at its top corner */
.wa .msg.bhai:not(.msg.bhai + .msg.bhai) { border-top-left-radius: 0; }
.wa .msg.you:not(.msg.you + .msg.you) { border-top-right-radius: 0; }
.wa .msg.bhai:not(.msg.bhai + .msg.bhai)::before, .wa .msg.you:not(.msg.you + .msg.you)::before {
    content: ""; position: absolute; top: 0; width: 8px; height: 13px; background: inherit;
}
.wa .msg.bhai:not(.msg.bhai + .msg.bhai)::before { left: -8px; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.wa .msg.you:not(.msg.you + .msg.you)::before { right: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.wa .chat-day span { border-radius: 8px; background: #fff; color: #54656f; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); }
.wa .phone-compose { padding: 5px 6px 12px; }
.wa .phone-compose > span {
    flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; height: 46px; padding: 0 14px 0 12px;
    border-radius: 999px; background: var(--in); color: var(--meta); font-size: 16px; box-shadow: 0 1px .5px rgba(11, 20, 26, .13);
}
.wa .phone-compose > span > span { flex: 1; }
.wa .phone-compose i { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: #00a884; }
.wa .phone-compose i svg { color: #fff; }

/* Telegram: the blue bar, the green-gold gradient wall, round bubbles with the tail at the bottom */
.tg {
    --head: #517da2; --head-ink: #fff; --ink: #000; --in: #fff; --out: #effdde; --meta: #a1aab3; --meta-out: #5dad59;
    --ticks: #5dad59; --icon: #8e969c; --tag: #3a8ed0;
    --wall: radial-gradient(circle at 12% 8%, #dbddbb 0, transparent 52%), radial-gradient(circle at 92% 30%, #6ba587 0, transparent 55%),
            radial-gradient(circle at 18% 78%, #d5d88d 0, transparent 55%), radial-gradient(circle at 88% 96%, #88b884 0, transparent 60%), #b6c99a;
    --doodle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' fill='none' stroke='%23000' stroke-opacity='.09' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 24l18-8-6 18-3-7z'/%3E%3Ccircle cx='76' cy='20' r='8'/%3E%3Cpath d='M72 18h.1M80 18h.1M72.5 23a5 5 0 0 0 7 0'/%3E%3Cpath d='M20 70c0-5 7-5 7 0 0-5 7-5 7 0 0 5-7 9-7 9s-7-4-7-9z'/%3E%3Cpath d='M66 62l3 5 5.5 1-4 3.8.9 5.2-5.4-2.6-5.4 2.6.9-5.2-4-3.8 5.5-1z'/%3E%3Cpath d='M100 60a8 8 0 1 0 8 8M104 100h.1M20 106h14M27 99v14'/%3E%3Cpath d='M64 102l6 6 10-12'/%3E%3C/svg%3E");
}
.tg .phone-screen { background: var(--doodle), var(--wall); }
.tg .phone-head { padding-bottom: 9px; }
.tg .chat-log .msg { border-radius: 16px; padding-inline: 11px; }
.tg .msg.bhai:not(:has(+ .msg.bhai)) { border-bottom-left-radius: 4px; }
.tg .msg.you:not(:has(+ .msg.you)) { border-bottom-right-radius: 4px; }
.tg .msg.bhai:not(:has(+ .msg.bhai))::before, .tg .msg.you:not(:has(+ .msg.you))::before {
    content: ""; position: absolute; bottom: 0; width: 9px; height: 14px; background: inherit;
}
.tg .msg.bhai:not(:has(+ .msg.bhai))::before { left: -6px; clip-path: polygon(100% 0, 100% 100%, 0 100%); border-bottom-left-radius: 3px; }
.tg .msg.you:not(:has(+ .msg.you))::before { right: -6px; clip-path: polygon(0 0, 100% 100%, 0 100%); }
.tg .chat-day span { border-radius: 12px; background: rgba(54, 74, 46, .32); color: #fff; font-weight: 500; }
.tg .phone-compose { gap: 14px; height: 52px; padding: 0 14px; background: var(--in); font-size: 16px; color: #9ba3a8; }
.tg .phone-compose > span { flex: 1; }

/* Email: a neutral mail client's thread view; you write to your own Bhai address */
.mail {
    --win: #fff; --ink: #1f1f1f; --soft-ink: #5f6368; --rule: #e3e5e8; --bar: #f1f3f4; --tag: #1a73e8;
}
.mail-window {
    width: min(100%, 560px); overflow: hidden; border: 1px solid var(--rule); border-radius: 12px; background: var(--win); color: var(--ink);
    box-shadow: 0 32px 64px -34px rgba(29, 27, 25, .5), 0 2px 6px rgba(29, 27, 25, .06);
}
.mail-bar { display: flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px; background: var(--bar); border-bottom: 1px solid var(--rule); color: var(--soft-ink); }
.mail-bar > i { width: 11px; height: 11px; border-radius: 50%; background: #c9ccd1; }
.mail-bar > span { display: flex; gap: 16px; margin-left: 18px; }
.mail-bar > span + span { margin-left: auto; }
.mail-bar svg { width: 18px; height: 18px; }
.mail-subject { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 16px 20px 6px; font-size: 19px; line-height: 1.3; letter-spacing: -.01em; }
.mail-subject span { padding: 1px 7px; border-radius: 4px; background: var(--bar); color: var(--soft-ink); font-size: 12px; letter-spacing: 0; }
.mail-thread { list-style: none; margin: 0; padding: 0 20px; }
.mail-thread .msg { padding: 11px 0 12px; border-top: 1px solid var(--rule); font-size: 14.5px; line-height: 1.45; }
.mail-thread .msg:first-child { border-top: 0; }
.mail-from { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 2px; line-height: 1.3; }
.mail-from .chat-avatar { width: 34px; height: 34px; }
.mail-you { display: grid; place-items: center; background: #5f6b7a; color: #fff; font-size: 15px; font-weight: 600; }
.mail-from > span { flex: 1; min-width: 0; font-size: 14px; }
.mail-from b { font-weight: 600; }
.mail-addr, .mail-to { color: var(--soft-ink); font-size: 12.5px; }
.mail-to { display: block; }
.mail-from time { flex: none; font-size: 12.5px; color: var(--soft-ink); }
.mail-thread .msg > p, .mail-thread .chat-tag, .mail-quote { margin-left: 44px; }
.mail-thread .chat-tag { border-top-color: var(--rule); }
.mail-quote {
    margin-block: 8px 0; margin-right: 0; padding-left: 12px; border-left: 2px solid var(--rule); color: var(--soft-ink); font-size: 13px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; /* a copy of the email above it */
}
.mail-quote span { display: block; }
.mail-actions { display: flex; gap: 10px; padding: 2px 20px 16px 64px; }
.mail-actions span {
    display: inline-flex; align-items: center; gap: 7px; padding: 7px 16px; border: 1px solid #c4c7c5; border-radius: 999px;
    font-size: 14px; font-weight: 500; color: var(--soft-ink);
}
.mail-actions svg { width: 16px; height: 16px; }

@media (prefers-color-scheme: dark) {
    .phone { background: #050505; box-shadow: inset 0 0 0 1.5px #3b3b3b, 0 0 0 1px var(--line), 0 32px 64px -30px rgba(0, 0, 0, .8); }
    .chat-tag { border-top-color: rgba(255, 255, 255, .12); }
    .wa {
        --head: #1f2c34; --head-ink: #e9edef; --ink: #e9edef; --in: #1f2c34; --out: #005c4b; --meta: #8696a0;
        --meta-out: rgba(233, 237, 239, .62); --icon: #8696a0; --tag: #00a884; --wall: #0b141a;
        --doodle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='132' height='132' fill='none' stroke='%23fff' stroke-opacity='.045' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='20' cy='22' r='9'/%3E%3Cpath d='M70 12l3 6 6.5 1-4.7 4.6 1.1 6.4L70 27l-5.9 3 1.1-6.4-4.7-4.6 6.5-1z'/%3E%3Crect x='104' y='14' width='16' height='24' rx='3'/%3E%3Cpath d='M14 80c0-6 9-6 9 0 0-6 9-6 9 0 0 6-9 11-9 11s-9-5-9-11z'/%3E%3Cpath d='M58 70h22v14H58zM58 70l11 8 11-8'/%3E%3Ccircle cx='112' cy='78' r='8'/%3E%3Cpath d='M18 112l8-8 8 8M26 104v18'/%3E%3Cpath d='M104 106h16v10a8 8 0 0 1-16 0z'/%3E%3C/svg%3E");
    }
    .wa .chat-day span { background: #182229; color: #8696a0; }
    .wa .phone-compose i svg { color: #0b141a; }
    .tg {
        --head: #232e3c; --head-ink: #f5f5f5; --ink: #f5f5f5; --in: #182533; --out: #2b5278; --meta: #6d7f8f; --meta-out: #7da8d3;
        --ticks: #72bcfd; --icon: #6d7883; --tag: #6ab2f2;
        --wall: radial-gradient(circle at 15% 10%, #1d2b3a 0, transparent 55%), radial-gradient(circle at 85% 85%, #182a26 0, transparent 60%), #0e1621;
        --doodle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' fill='none' stroke='%23fff' stroke-opacity='.05' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 24l18-8-6 18-3-7z'/%3E%3Ccircle cx='76' cy='20' r='8'/%3E%3Cpath d='M20 70c0-5 7-5 7 0 0-5 7-5 7 0 0 5-7 9-7 9s-7-4-7-9z'/%3E%3Cpath d='M66 62l3 5 5.5 1-4 3.8.9 5.2-5.4-2.6-5.4 2.6.9-5.2-4-3.8 5.5-1z'/%3E%3Cpath d='M100 60a8 8 0 1 0 8 8M20 106h14M27 99v14'/%3E%3Cpath d='M64 102l6 6 10-12'/%3E%3C/svg%3E");
    }
    .tg .chat-day span { background: rgba(0, 0, 0, .35); }
    .tg .phone-compose { background: #17212b; color: #6d7883; }
    .mail { --win: #1f1f1f; --ink: #e8eaed; --soft-ink: #9aa0a6; --rule: #3c4043; --bar: #2a2b2e; --tag: #8ab4f8; }
    .mail-window { box-shadow: 0 0 0 1px var(--line), 0 32px 64px -34px rgba(0, 0, 0, .8); }
    .mail-bar > i { background: #4a4d52; }
    .mail-actions span { border-color: #5f6368; }
}
.chat-duo { display: grid; gap: clamp(56px, 6vw, 72px) var(--col-gap); align-items: start; }
@media (min-width: 700px) { .chat-duo { grid-template-columns: 1fr 1fr; } }
.hero:has(> .chat) { align-items: center; padding-top: clamp(24px, 2.4vw, 40px); }

/* Research charts, drawn from the entry's own numbers: bar length is the amount, the fill the share */
.chart { padding: clamp(20px, 3.4vw, 40px); background: var(--soft); }
.chart ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.chart ul + .chart-group { margin-top: 28px; }
.chart-group { margin-bottom: 12px; font-size: 15px; font-weight: 500; }
.chart li { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) 6.5rem; gap: 16px; align-items: center; font-size: 15px; }
.chart .bar { display: block; height: 14px; width: var(--w); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.chart .bar > span { display: block; height: 100%; width: var(--f); background: var(--accent); }
.chart li > a { text-align: right; font-variant-numeric: tabular-nums; color: var(--accent); }
.chart figcaption { margin-top: 24px; }
.research-head .chart li { grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr) 4.5rem; }
@media (max-width: 559px) {
    .chart li, .research-head .chart li { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
    .chart .bar { grid-column: 1 / -1; grid-row: 2; }
}

/* An illustrative piece of MELRA's interface (verify-before-retrying): its own small borders and status badge */
.ui-cover { overflow: visible; }
[data-ui].ui-task { max-width: 520px; padding: 20px 22px; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
[data-ui] .ui-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
[data-ui] .ui-name { font-weight: 600; }
[data-ui] .ui-badge { padding: 2px 8px; border-radius: 4px; font-size: 13px; }
[data-ui] .ui-warn { background: #8a5a00; color: #fff; }
[data-ui] .ui-op { margin-top: 14px; }
[data-ui] .ui-note { margin-top: 6px; color: var(--muted); }
[data-ui] .ui-steps { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
[data-ui] .ui-steps li { display: grid; grid-template-columns: 14px auto; column-gap: 10px; align-items: baseline; font-weight: 500; }
[data-ui] .ui-steps li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--text); grid-row: span 2; align-self: center; }
[data-ui] .ui-steps li.stop::before { background: #c08a12; }
[data-ui] .ui-steps span { grid-column: 2; font-weight: 400; color: var(--muted); font-size: 14px; }

/* Ecosystem logos (home and The lab): every mark in one row flowing edge to edge, a copy behind it for a seamless loop.
   Transform only; it pauses under the pointer or focus, and under reduced motion it stands still (see above). */
.marquee {
    width: 100vw; margin-inline: calc(50% - 50vw); overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
/* The moving track (and the mask) isolate their layer, so the logos' blend needs the field's own colour inside it. */
.marquee-track { display: flex; width: max-content; background: var(--bg); animation: marquee 70s linear infinite; }
.marquee:hover .marquee-track, .marquee:focus-within .marquee-track { animation-play-state: paused; }
.marquee .logos {
    list-style: none; margin: 0; padding: 0 clamp(40px, 4.5vw, 72px) 0 0; flex: none;
    display: flex; align-items: center; gap: clamp(40px, 4.5vw, 72px);
}
.marquee li { flex: none; padding: 0; border: 0; }
.marquee img { height: 28px; width: auto; max-width: 150px; object-fit: contain; opacity: .8; filter: grayscale(1); mix-blend-mode: multiply; }
@media (prefers-color-scheme: dark) { .marquee img { filter: grayscale(1) invert(1); mix-blend-mode: screen; } }
@keyframes marquee { to { transform: translateX(-50%); } }
.chapter.supporters .marquee { margin-top: clamp(56px, 7vw, 104px); }
.ecosystem .marquee { margin-block: clamp(28px, 4vw, 48px); }
/* Under reduced motion the marquee stands still: one centred, wrapping set, no copy, no fade. */
@media (prefers-reduced-motion: reduce) {
    .marquee { width: auto; margin-inline: 0; padding-inline: var(--gutter); -webkit-mask-image: none; mask-image: none; }
    .marquee-track { animation: none; width: auto; }
    .marquee .logos { flex-wrap: wrap; justify-content: center; padding: 0; row-gap: 28px; }
    .marquee [aria-hidden="true"] { display: none; }
}
