/* ==========================================================
   Sanjay Oruganti — personal site
   Paper, ink, and one cobalt accent. The margin rail on wide
   screens is drawn like a behavior tree: the page title is the
   root, each section is a node, and the node being read is the
   one currently "running".
   ========================================================== */

/* Fonts (Newsreader, IBM Plex Sans, IBM Plex Mono) are loaded from the
   <link> in each page's <head>. */

/* ---------- Tokens ---------- */
:root {
    --paper: #f4f1ea;
    --surface: #fbf9f4;
    --ink: #14161a;
    --text: #2d3136;
    --muted: #676c72;
    --rule: #dcd7ca;
    --rule-strong: #b8b2a2;
    --accent: #2340c8;
    --accent-ink: #ffffff;
    --accent-soft: rgba(35, 64, 200, 0.12);
    --plate: #ffffff;

    --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    --sans: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

    --rail: 76px;
    --gutter: clamp(20px, 4vw, 48px);
    --node-pad: clamp(44px, 6vw, 76px);
    --measure: 66ch;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --paper: #0e1013;
    --surface: #15181c;
    --ink: #f1efe9;
    --text: #c9c8c2;
    --muted: #8d9197;
    --rule: #262a30;
    --rule-strong: #414650;
    --accent: #93a6ff;
    --accent-ink: #0e1013;
    --accent-soft: rgba(147, 166, 255, 0.16);
    --plate: #ffffff;
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --paper: #0e1013;
        --surface: #15181c;
        --ink: #f1efe9;
        --text: #c9c8c2;
        --muted: #8d9197;
        --rule: #262a30;
        --rule-strong: #414650;
        --accent: #93a6ff;
        --accent-ink: #0e1013;
        --accent-soft: rgba(147, 166, 255, 0.16);
        color-scheme: dark;
    }
}

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

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

body {
    margin: 0;
    background: var(--paper);
    color: var(--text);
    font-family: var(--sans);
    font-size: 1.0625rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, pre { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img, video { display: block; max-width: 100%; height: auto; }

a { color: inherit; }

p a, li a, dd a, .link {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.22em;
    transition: color 0.15s ease, text-decoration-thickness 0.15s ease;
}
p a:hover, li a:hover, dd a:hover, .link:hover {
    color: var(--accent);
    text-decoration-thickness: 2px;
}

strong { color: var(--ink); font-weight: 600; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

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

.wrap {
    max-width: calc(1120px + var(--grow, 0px) * 1);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.skip {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    padding: 10px 14px;
    background: var(--ink);
    color: var(--paper);
    font-family: var(--mono);
    font-size: 0.8rem;
}
.skip:focus { left: 12px; top: 12px; }

/* ---------- Header ---------- */
.site-head {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
}

.site-head .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px 28px;
    min-height: 60px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    font-weight: 600;
    letter-spacing: -0.005em;
    text-decoration: none;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--ink);
    font-family: var(--mono);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.brand:hover .brand-mark { background: var(--ink); color: var(--paper); }

.site-nav {
    display: flex;
    align-items: center;
    gap: clamp(14px, 2.4vw, 30px);
    margin-left: auto;
}

.site-nav a {
    position: relative;
    padding: 6px 0;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-decoration: none;
    text-transform: uppercase;
    transition: color 0.15s ease;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); }
.site-nav a[aria-current="page"]::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: var(--accent);
}

.theme-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--rule-strong);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.theme-btn:hover { border-color: var(--ink); }
.theme-btn svg { width: 15px; height: 15px; }

@media (max-width: 900px) {
    .site-head .wrap { flex-wrap: wrap; padding-top: 10px; padding-bottom: 6px; }
    .site-nav {
        order: 3;
        width: 100%;
        margin-left: 0;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 0 16px;
    }
    .site-nav a { font-size: 0.72rem; }
    .theme-btn { margin-left: auto; }
}

/* ---------- Tree rail + nodes ---------- */
.node {
    position: relative;
    padding: var(--node-pad) 0 0 var(--rail);
    /* the rail segment that runs through this node */
    background: linear-gradient(var(--rule-strong), var(--rule-strong)) 12px 0 / 1px 100% no-repeat;
}

.node:last-child {
    padding-bottom: var(--node-pad);
    background-size: 1px calc(var(--node-pad) + 6px);
}

/* node marker */
.node::before {
    content: "";
    position: absolute;
    left: 7px;
    top: calc(var(--node-pad) + 1px);
    width: 11px;
    height: 11px;
    border: 1px solid var(--rule-strong);
    background: var(--paper);
    transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

/* branch from the rail to the content */
.node::after {
    content: "";
    position: absolute;
    left: 18px;
    top: calc(var(--node-pad) + 6px);
    width: calc(var(--rail) - 32px);
    height: 1px;
    background: var(--rule-strong);
}

.node.is-done::before {
    background: var(--ink);
    border-color: var(--ink);
}
.node.is-running::before {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

/* root node: the sequence arrow */
.node--root {
    background-position: 12px calc(var(--node-pad) + 25px);
}
.node--root::before {
    content: "\2192";
    left: 0;
    top: var(--node-pad);
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    border-color: var(--ink);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.8rem;
    line-height: 1;
}
.node--root::after {
    left: 25px;
    top: calc(var(--node-pad) + 12px);
    width: calc(var(--rail) - 39px);
}
.node--root.is-done::before,
.node--root.is-running::before {
    color: var(--accent-ink);
}
.node--root.is-done::before { color: var(--paper); }

.tree { counter-reset: node; }

/* section label */
.label {
    display: flex;
    align-items: baseline;
    gap: 0.9em;
    margin-bottom: 26px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.74rem;
    font-weight: 500;
    letter-spacing: 0.13em;
    line-height: 1.2;
    text-transform: uppercase;
    transition: color 0.25s ease;
}
.label::before {
    counter-increment: node;
    content: counter(node, decimal-leading-zero);
    color: var(--accent);
}
.node.is-running .label { color: var(--ink); }

@media (max-width: 860px) {
    :root { --rail: 0px; }
    .node { background: none; }
    .node::before, .node::after { display: none; }
    .node + .node { border-top: 1px solid var(--rule); margin-top: var(--node-pad); }
}

/* ---------- Type ---------- */
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1.05em; }
.prose h3 { margin-top: 1.8em; }

.title {
    color: var(--ink);
    font-family: var(--serif);
    font-size: clamp(2.3rem, 1.3rem + 3.6vw, 3.8rem);
    font-weight: 400;
    letter-spacing: -0.022em;
    line-height: 1.05;
}

.subtitle {
    max-width: 40ch;
    margin-top: 16px;
    color: var(--text);
    font-family: var(--serif);
    font-size: clamp(1.2rem, 1rem + 0.8vw, 1.5rem);
    line-height: 1.35;
}

.kicker, .crumb {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.kicker { margin-bottom: 18px; }
.crumb { margin-bottom: 30px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }

.byline {
    max-width: var(--measure);
    margin-top: 20px;
    color: var(--muted);
    font-size: 0.95rem;
}
.byline strong { font-weight: 500; }

h3, .h3 {
    color: var(--ink);
    font-family: var(--serif);
    font-size: 1.45rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.lede {
    max-width: 52ch;
    color: var(--ink);
    font-family: var(--serif);
    font-size: clamp(1.25rem, 1.05rem + 0.9vw, 1.6rem);
    line-height: 1.4;
}

.bullets { max-width: var(--measure); }
.bullets li {
    position: relative;
    padding-left: 1.5em;
}
.bullets li + li { margin-top: 0.5em; }
.bullets li::before {
    content: "";
    position: absolute;
    left: 0.15em;
    top: 0.68em;
    width: 7px;
    height: 7px;
    border: 1px solid var(--accent);
}

.small { font-size: 0.92rem; }
.muted { color: var(--muted); }

/* ---------- Buttons + link rows ---------- */
.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 34px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6em;
    padding: 0.72em 1.05em;
    border: 1px solid var(--ink);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    line-height: 1.2;
    text-decoration: none;
    text-transform: uppercase;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}
.btn--solid { background: var(--ink); color: var(--paper); }

.links {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 20px;
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.03em;
}
.links a, .links summary {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--rule-strong);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.3em;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
.links a:hover, .links summary:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
}
.links a[href^="http"]::after { content: "\00a0\2197"; color: var(--muted); }

.more {
    display: inline-block;
    margin-top: 30px;
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-decoration: none;
    text-transform: uppercase;
    border-bottom: 1px solid var(--accent);
    padding-bottom: 3px;
    transition: color 0.15s ease;
}
.more:hover { color: var(--accent); }
.more span { display: inline-block; transition: transform 0.15s ease; }
.more:hover span { transform: translateX(4px); }

/* ---------- Home: identity ---------- */
.ident {
    display: flex;
    align-items: center;
    gap: clamp(18px, 3vw, 32px);
    margin-bottom: clamp(28px, 4vw, 44px);
}
.ident-photo {
    flex: none;
    width: clamp(140px, 15vw, 170px);
    height: clamp(140px, 15vw, 170px);
    object-fit: cover;
    object-position: 50% 20%;
    border: 1px solid var(--rule-strong);
}
.ident-role {
    max-width: 46ch;
    margin-top: 12px;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.5;
}
.ident-role strong { font-weight: 500; }

.hero .prose { margin-top: clamp(22px, 3vw, 32px); }

@media (max-width: 600px) {
    .ident { flex-direction: column; align-items: flex-start; }
    .ident-photo { width: 120px; height: 120px; }
}

/* ---------- Topic rows (research interests, teaching summary) ---------- */
.topics { max-width: calc(900px + var(--grow, 0px) * 0.804); }
.topic {
    display: grid;
    grid-template-columns: minmax(0, 17rem) minmax(0, 1fr);
    gap: 6px clamp(20px, 4vw, 48px);
    padding: 22px 0;
    border-top: 1px solid var(--rule);
}
.topic:first-child { padding-top: 0; border-top: 0; }
.topic:last-child { padding-bottom: 0; }
.topic h3 { font-size: 1.35rem; }
.topic p { line-height: 1.6; }
.topic p + p { margin-top: 8px; }
@media (max-width: 700px) {
    .topic { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Work list ---------- */
.work-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    gap: 14px clamp(24px, 4vw, 56px);
    align-items: start;
    padding: 30px 0;
    border-top: 1px solid var(--rule);
}
.work-item:first-child { padding-top: 0; border-top: 0; }
.work-item:last-child { padding-bottom: 0; }
.work-item--plain { grid-template-columns: minmax(0, 1fr); }

.work-meta {
    margin-bottom: 10px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.work-item h3 {
    font-size: clamp(1.7rem, 1.4rem + 1vw, 2.2rem);
    font-weight: 400;
    letter-spacing: -0.018em;
    line-height: 1.12;
}
.work-item h3 a {
    color: var(--ink);
    text-decoration: none;
    background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 1px no-repeat;
    transition: background-size 0.25s ease, color 0.15s ease;
}
.work-item h3 a:hover { color: var(--accent); background-size: 100% 1px; }
.work-item h3 + p { max-width: 58ch; margin-top: 12px; }
.work-item .links { margin-top: 16px; }

.work-thumb {
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border: 1px solid var(--rule);
    background: var(--plate);
    transition: border-color 0.15s ease;
}
.work-thumb:hover { border-color: var(--accent); }
.work-thumb img {
    width: 100%;
    height: 100%;
    padding: 10px;
    object-fit: contain;
}
.work-thumb--cover img { padding: 0; object-fit: cover; object-position: center top; }

@media (max-width: 700px) {
    .work-item { grid-template-columns: minmax(0, 1fr); }
    .work-thumb { max-width: 340px; }
}

/* compact related-paper list */
.refs { max-width: var(--measure); margin-top: 34px; }
.refs-title {
    margin-bottom: 10px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.refs li {
    padding: 10px 0;
    border-top: 1px solid var(--rule);
    font-size: 0.95rem;
    line-height: 1.5;
}
.refs li span { color: var(--muted); }

/* ---------- Timeline (news, trajectory, CV) ---------- */
.rows { max-width: calc(860px + var(--grow, 0px) * 0.346); }
.row {
    display: grid;
    grid-template-columns: 9.5rem minmax(0, 1fr);
    gap: 4px 28px;
    padding: 15px 0;
    border-top: 1px solid var(--rule);
}
.row:first-child { padding-top: 0; border-top: 0; }
.row:last-child { padding-bottom: 0; }
.row-when {
    padding-top: 0.28em;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    line-height: 1.5;
}
.row-what { color: var(--ink); font-weight: 500; line-height: 1.45; }
.row-what a { font-weight: 500; }
.row-where { margin-top: 3px; color: var(--muted); font-size: 0.94rem; line-height: 1.5; }
.row-note { margin-top: 6px; font-size: 0.94rem; line-height: 1.55; }
.rows--news .row-what { font-weight: 400; color: var(--text); }

@media (max-width: 600px) {
    .row { grid-template-columns: minmax(0, 1fr); }
    .row-when { padding-top: 0; }
}

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; max-width: calc(760px + var(--grow, 0px) * 0.679); }
.chips li {
    padding: 0.45em 0.8em;
    border: 1px solid var(--rule-strong);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.76rem;
    letter-spacing: 0.03em;
}

/* ---------- Contact ---------- */
.contact .row-what { font-weight: 400; color: var(--text); overflow-wrap: anywhere; }

/* plain lists inside CV sections */
.plain { max-width: var(--measure); }
.plain li { padding: 7px 0; border-top: 1px solid var(--rule); line-height: 1.5; }
.plain li:first-child { padding-top: 0; border-top: 0; }
.plain li span { color: var(--muted); }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(24px, 4vw, 56px); max-width: calc(900px + var(--grow, 0px) * 0.804); }
.cols-2 h3 { margin-bottom: 14px; font-size: 1.2rem; }
@media (max-width: 700px) {
    .cols-2 { grid-template-columns: minmax(0, 1fr); row-gap: 30px; }
}

/* poster list */
.posters { max-width: calc(900px + var(--grow, 0px) * 0.362); counter-reset: poster; }
.posters li {
    padding: 10px 0;
    border-top: 1px solid var(--rule);
    font-size: 0.93rem;
    line-height: 1.5;
}
.posters li:first-child { padding-top: 0; border-top: 0; }
.posters li i { color: var(--ink); }
.posters li b { color: var(--ink); font-weight: 600; }
.posters li span { color: var(--muted); }
.footnote { max-width: var(--measure); margin-top: 22px; color: var(--muted); font-size: 0.86rem; line-height: 1.55; }

/* ---------- Figures + media ---------- */
.figure { max-width: calc(860px + var(--grow, 0px) * 0.768); }
.figure + .prose, .prose + .figure, .figure + .figure { margin-top: 32px; }
.plate {
    border: 1px solid var(--rule);
    background: var(--plate);
}
.plate img, .plate video { width: 100%; }
.plate--pad { padding: clamp(10px, 2vw, 22px); }
.figure figcaption {
    margin-top: 10px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.02em;
    line-height: 1.55;
}
.figure--narrow { max-width: calc(620px + var(--grow, 0px) * 0.249); }

/* ---------- Cards (contributions, layers) ---------- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 0 clamp(20px, 3vw, 40px);
    max-width: calc(960px + var(--grow, 0px) * 0.857);
}
.card {
    padding: 18px 0 26px;
    border-top: 1px solid var(--ink);
}
.card-tag {
    margin-bottom: 10px;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.card h3 { font-size: 1.3rem; }
.card h3 + p, .card h3 + ul { margin-top: 10px; }
.card p, .card li { font-size: 0.96rem; line-height: 1.58; }
.card .bullets li + li { margin-top: 0.35em; }
.cards + .prose, .prose + .cards, .cards + .figure { margin-top: 34px; }

/* ---------- Publications ---------- */
.pub-jump {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 30px;
}
.pub-jump a {
    display: inline-flex;
    align-items: baseline;
    gap: 0.7em;
    padding: 0.5em 0.85em;
    border: 1px solid var(--rule-strong);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.76rem;
    letter-spacing: 0.03em;
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.pub-jump a:hover { border-color: var(--accent); color: var(--accent); }
.pub-jump b { color: var(--accent); font-weight: 500; }

.pubs { max-width: calc(900px + var(--grow, 0px) * 0.362); }
.pub {
    display: grid;
    grid-template-columns: 4.2rem minmax(0, 1fr);
    gap: 4px 24px;
    padding: 20px 0;
    border-top: 1px solid var(--rule);
}
.pub:first-child { padding-top: 0; border-top: 0; }
.pub:last-child { padding-bottom: 0; }
.pub-year {
    padding-top: 0.3em;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}
.pub-title {
    color: var(--ink);
    font-size: 1.04rem;
    font-weight: 500;
    line-height: 1.42;
}
.pub-authors { margin-top: 5px; color: var(--muted); font-size: 0.93rem; line-height: 1.5; }
.pub-authors b { color: var(--ink); font-weight: 600; }
.pub-venue { margin-top: 2px; font-size: 0.93rem; line-height: 1.5; }
.pub-venue i { color: var(--ink); }
.pub-note {
    display: inline-block;
    margin-top: 8px;
    padding: 0.25em 0.6em;
    background: var(--accent-soft);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.03em;
}
.pub .links { margin-top: 10px; }

details.bib summary { cursor: pointer; list-style: none; }
details.bib summary::-webkit-details-marker { display: none; }
details.bib { min-width: 0; max-width: 100%; }
details.bib[open] { flex-basis: 100%; }
details.bib[open] summary { color: var(--accent); text-decoration-color: var(--accent); }

.bib-box {
    position: relative;
    margin-top: 12px;
    border: 1px solid var(--rule);
    background: var(--surface);
}
.bib-box pre {
    padding: 16px 18px;
    overflow-x: auto;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.76rem;
    letter-spacing: 0;
    line-height: 1.6;
    white-space: pre;
}
.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 0.35em 0.7em;
    border: 1px solid var(--rule-strong);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }

/* citation blocks on project pages */
.cites { max-width: calc(860px + var(--grow, 0px) * 0.346); }
.cite + .cite {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--rule);
}
.cite .links { margin-top: 10px; }

@media (max-width: 600px) {
    .pub { grid-template-columns: minmax(0, 1fr); }
    .pub-year { padding-top: 0; }
}

/* ---------- Project pager ---------- */
.pager {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 clamp(20px, 3vw, 40px);
    max-width: calc(860px + var(--grow, 0px) * 0.346);
}
.pager a {
    display: block;
    padding: 16px 0 4px;
    border-top: 1px solid var(--ink);
    color: var(--ink);
    text-decoration: none;
}
.pager a span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.pager a b {
    font-family: var(--serif);
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: -0.015em;
    transition: color 0.15s ease;
}
.pager a:hover b { color: var(--accent); }
.pager a:last-child { text-align: right; }

/* ---------- Footer ---------- */
.site-foot {
    margin-top: clamp(20px, 3vw, 40px);
    border-top: 1px solid var(--rule);
}
.site-foot .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px 40px;
    padding-top: 26px;
    padding-bottom: 40px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    line-height: 1.7;
}
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--accent); }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 20px; }

.legend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.legend i {
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 6px;
    border: 1px solid var(--rule-strong);
    vertical-align: -1px;
}
.legend .l-run { background: var(--accent); border-color: var(--accent); }
.legend .l-done { background: var(--ink); border-color: var(--ink); }
@media (max-width: 860px) { .legend { display: none; } }

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

/* ---------- Print (mainly for the CV) ---------- */
@media print {
    :root, :root[data-theme="dark"] {
        --paper: #fff;
        --surface: #fff;
        --ink: #000;
        --text: #111;
        --muted: #444;
        --rule: #bbb;
        --rule-strong: #888;
        --accent: #000;
        --accent-soft: transparent;
        --rail: 0px;
        --node-pad: 20px;
    }
    body { font-size: 10.5pt; line-height: 1.45; }
    .site-head, .site-foot, .actions, .skip, .copy-btn, .pager, .no-print { display: none !important; }
    .wrap { max-width: none; padding: 0; }
    .node { background: none; padding-left: 0; }
    .node::before, .node::after { display: none; }
    .title { font-size: 24pt; }
    .label { margin-bottom: 10px; }
    .label::before { color: #000; }
    .row { padding: 6px 0; break-inside: avoid; }
    .pub { padding: 8px 0; break-inside: avoid; }
    a { text-decoration: none !important; }
    .links a[href^="http"]::after { content: ""; }
}

/* ---------- Vertical rhythm between blocks inside a node ---------- */
.node > :not(.label) + .figure,
.node > .figure + *,
.node > :not(.label) + .cards,
.node > .cards + *,
.node > :not(.label) + .rows { margin-top: 34px; }
.node > .lede + .work { margin-top: 40px; }
.node > .lede + .prose { margin-top: 28px; }
.subtitle + .chips { margin-top: 30px; }
.card p + .bullets { margin-top: 14px; }

/* ---------- "New" marker on recent news ---------- */
.new-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    color: var(--accent);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    vertical-align: 1px;
}
.new-badge i {
    position: relative;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}
.new-badge i::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid var(--accent);
    opacity: 0;
    animation: new-pulse 2.6s ease-out infinite;
}
@keyframes new-pulse {
    0% { transform: scale(0.5); opacity: 0.7; }
    70%, 100% { transform: scale(1.5); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .new-badge i::after { animation: none; }
}
@media print { .new-badge { display: none; } }

/* ---------- Photo pair ---------- */
.photos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(14px, 2.4vw, 28px);
    max-width: calc(860px + var(--grow, 0px) * 0.768);
}
.photos .plate { aspect-ratio: 3 / 2; overflow: hidden; }
.photos img { width: 100%; height: 100%; object-fit: cover; }
.photos figcaption {
    margin-top: 10px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.02em;
    line-height: 1.55;
}
@media (max-width: 600px) {
    .photos { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Quotes ---------- */
.quotes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 clamp(20px, 3vw, 40px);
    max-width: calc(900px + var(--grow, 0px) * 0.362);
}
.quotes blockquote {
    margin: 0;
    padding: 18px 0 0;
    border-top: 1px solid var(--ink);
}
.quotes p {
    color: var(--ink);
    font-family: var(--serif);
    font-size: 1.18rem;
    line-height: 1.45;
}
.quotes cite {
    display: block;
    margin-top: 12px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.72rem;
    font-style: normal;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
@media (max-width: 700px) {
    .quotes { grid-template-columns: minmax(0, 1fr); row-gap: 26px; }
}

/* topic rows may hold a single paragraph directly */
.topic > p { align-self: start; }
.node > :not(.label) + .topics,
.node > .topics + *,
.node > :not(.label) + .quotes,
.node > :not(.label) + .photos,
.node > :not(.label) + .work { margin-top: 34px; }
.node > .footnote { margin-top: 22px; }
.node--root > .prose { margin-top: 26px; }

/* ---------- Small identity on inner pages ----------
   The photo and name from the home page, settled into the top-left
   corner under the nav bar. */
.ident-mini {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-top: 22px;
    color: var(--ink);
    text-decoration: none;
    transform-origin: left top;
    animation: ident-settle 0.65s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.ident-mini img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border: 1px solid var(--rule-strong);
}
.ident-mini b {
    display: block;
    font-family: var(--serif);
    font-size: 1.3rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.2;
    transition: color 0.15s ease;
}
.ident-mini small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.35;
}
.ident-mini:hover b { color: var(--accent); }
.ident-mini + .node { --node-pad: clamp(30px, 4vw, 48px); }
@keyframes ident-settle {
    from { transform: translate(76px, 54px) scale(2.5); opacity: 0; }
    35% { opacity: 1; }
    to { transform: none; opacity: 1; }
}
@media (max-width: 860px) {
    @keyframes ident-settle {
        from { transform: translate(0, 40px) scale(1.8); opacity: 0; }
        35% { opacity: 1; }
        to { transform: none; opacity: 1; }
    }
}
@media (prefers-reduced-motion: reduce) { .ident-mini { animation: none; } }
@media print { .ident-mini { display: none; } }

/* ---------- Feature block ---------- */
.feature {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: clamp(20px, 3vw, 40px);
    align-items: center;
    padding: clamp(22px, 3.4vw, 40px);
    background: var(--ink);
    color: var(--paper);
}
.feature-text {
    font-family: var(--serif);
    font-size: clamp(1.35rem, 1rem + 1.3vw, 1.9rem);
    letter-spacing: -0.012em;
    line-height: 1.25;
}
.feature-fig img { width: 100%; background: #fff; }
.feature-fig figcaption {
    margin-top: 10px;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    line-height: 1.55;
    opacity: 0.72;
}
@media (max-width: 800px) {
    .feature { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Tiles ---------- */
.tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(12px, 1.8vw, 20px);
}
.tiles--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: calc(900px + var(--grow, 0px) * 0.804); }
.tile {
    padding: clamp(18px, 2.2vw, 26px);
    border: 1px solid var(--rule);
    background: var(--surface);
    transition: border-color 0.15s ease;
}
.tile:hover { border-color: var(--rule-strong); }
.tile-icon { display: block; width: 38px; height: 38px; margin-bottom: 18px; color: var(--accent); }
.tile-n {
    display: block;
    margin-bottom: 14px;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 0.76rem;
    letter-spacing: 0.1em;
}
.tile h3 { font-size: 1.28rem; }
.tile p { margin-top: 8px; font-size: 0.96rem; line-height: 1.55; }
@media (max-width: 800px) {
    .tiles, .tiles--2 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Project cards ---------- */
.pcards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(14px, 2vw, 24px);
}
.pcards--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: calc(900px + var(--grow, 0px) * 0.804); }
.pcard { display: block; color: inherit; text-decoration: none; }
.pcard-img {
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border: 1px solid var(--rule);
    background: var(--plate);
    transition: border-color 0.15s ease;
}
.pcard-img img { width: 100%; height: 100%; padding: 12px; object-fit: contain; }
.pcard-img--cover img { padding: 0; object-fit: cover; object-position: center top; }
.pcard-img .tile-icon { width: 64px; height: 64px; margin: 0; }
.pcard:hover .pcard-img { border-color: var(--accent); }
.pcard-meta {
    display: block;
    margin-top: 14px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.pcard-title {
    display: block;
    margin-top: 6px;
    color: var(--ink);
    font-family: var(--serif);
    font-size: 1.6rem;
    font-weight: 400;
    letter-spacing: -0.015em;
    line-height: 1.15;
    transition: color 0.15s ease;
}
.pcard:hover .pcard-title { color: var(--accent); }
.pcard-text { display: block; margin-top: 6px; font-size: 0.95rem; line-height: 1.5; }
@media (max-width: 800px) {
    .pcards, .pcards--2 { grid-template-columns: minmax(0, 1fr); }
    .pcard-img { max-width: 420px; }
}

/* ---------- Compact publication list ---------- */
.plist { max-width: calc(900px + var(--grow, 0px) * 0.362); }
.plist li {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: 4px 28px;
    padding: 13px 0;
    border-top: 1px solid var(--rule);
}
.plist li:first-child { padding-top: 0; border-top: 0; }
.plist-where {
    padding-top: 0.25em;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    line-height: 1.5;
}
.plist-title { color: var(--ink); font-weight: 500; line-height: 1.45; }
@media (max-width: 700px) {
    .plist li { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Small facts row ---------- */
.facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(14px, 2.4vw, 32px);
    max-width: calc(760px + var(--grow, 0px) * 0.679);
}
.facts li { padding-top: 12px; border-top: 1px solid var(--ink); }
.facts b {
    display: block;
    color: var(--ink);
    font-family: var(--serif);
    font-size: clamp(2rem, 1.6rem + 1.4vw, 2.7rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.05;
}
.facts span { display: block; margin-top: 6px; color: var(--muted); font-size: 0.88rem; line-height: 1.4; }
@media (max-width: 520px) {
    .facts { grid-template-columns: minmax(0, 1fr); max-width: 320px; }
}

/* ---------- Fold (details) ---------- */
.fold { max-width: calc(860px + var(--grow, 0px) * 0.346); margin-top: 22px; }
.fold summary {
    display: inline-block;
    padding-bottom: 3px;
    border-bottom: 1px solid var(--accent);
    color: var(--ink);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    list-style: none;
    text-transform: uppercase;
    transition: color 0.15s ease;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: " +"; color: var(--accent); }
.fold[open] summary::after { content: " \2212"; }
.fold summary:hover { color: var(--accent); }
.fold[open] summary { margin-bottom: 22px; }

.node > :not(.label) + .tiles,
.node > .tiles + *,
.node > :not(.label) + .pcards,
.node > :not(.label) + .facts,
.node > .feature + *,
.node > .photos + *,
.node > :not(.label) + .chips,
.node--root > .title + .chips,
.node--root > .title + .facts { margin-top: 34px; }

/* ---------- Tags (journal / conference / preprint) ---------- */
.tag {
    display: inline-block;
    margin: 0 10px 6px 0;
    padding: 0.2em 0.55em;
    border: 1px solid var(--rule-strong);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.64rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    line-height: 1.3;
    text-transform: uppercase;
    vertical-align: 1px;
}
.tag--journal { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.tag--conference { border-color: var(--accent); color: var(--accent); }
.plist-where .tag { margin-bottom: 0; }

/* ---------- Publication filter ---------- */
.pub-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 30px; }
.pub-filter button {
    display: inline-flex;
    align-items: baseline;
    gap: 0.6em;
    padding: 0.5em 0.9em;
    border: 1px solid var(--rule-strong);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.pub-filter button b { color: var(--muted); font-weight: 500; }
.pub-filter button:hover { border-color: var(--ink); }
.pub-filter button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.pub-filter button[aria-pressed="true"] b { color: inherit; opacity: 0.7; }
.pub[hidden] { display: none; }
.pubs .pub:not([hidden]) { border-top: 1px solid var(--rule); padding-top: 20px; }
.pubs .pub:first-child:not([hidden]) { border-top: 0; padding-top: 0; }
@media print { .pub-filter { display: none !important; } }

/* brand is the monogram only */
.brand { gap: 0; }
.node--root > .title + .lede { margin-top: 22px; }
.node--root > .lede + .facts { margin-top: 34px; }
.node > .fold + .photos { margin-top: 40px; }

/* ---------- Home: photo and name dock into the header on scroll ----------
   .dock is an invisible slot in the header that marks where they land.
   js/site.js moves the real photo and name there as the page scrolls. */
.dock {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-left: 14px;
    visibility: hidden;
}
.dock-photo {
    width: 30px;
    height: 30px;
    background: url("../img/site/profile.jpg") center 20% / cover no-repeat;
}
.dock-name {
    color: var(--ink);
    font-family: var(--serif);
    font-size: 1.3rem;
    letter-spacing: -0.022em;
    line-height: 1.05;
    white-space: nowrap;
}
.dock-live [data-dock] {
    position: relative;
    z-index: 60;
    transform-origin: 0 0;
    will-change: transform;
}
.title [data-dock] { display: inline-block; }
/* with reduced motion nothing travels; the slot itself appears once the hero has scrolled away */
.dock-static.is-docked .dock { visibility: visible; }
@media print {
    .dock { display: none; }
    [data-dock] { transform: none !important; }
}

/* ---------- Year timeline ----------
   Lists are grouped by year. On wide screens each year's tab sits on the
   left rail, stays in view while that year is on screen, and opens or
   closes the year when clicked. */
.years { margin-left: calc(-1 * var(--rail)); }
.year {
    display: grid;
    grid-template-columns: var(--rail) minmax(0, 1fr);
}
.year[hidden] { display: none; }
.year-body { min-width: 0; padding: 26px 0; border-top: 1px solid var(--rule); }
.year:first-child .year-body { padding-top: 0; border-top: 0; }
.year:last-child .year-body { padding-bottom: 0; }

.year-tab {
    position: sticky;
    top: 78px;
    align-self: start;
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 26px;
    padding: 3px 0 3px 8px;
    border: 0;
    background: none;
    color: var(--ink);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1;
    text-align: left;
    transition: color 0.15s ease;
}
.year:first-child .year-tab { margin-top: 2px; }
.year-tab::before {
    content: "";
    flex: none;
    width: 9px;
    height: 9px;
    border: 1px solid var(--accent);
    border-radius: 50%;
    background: var(--accent);
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.year-n { padding: 2px 0; background: var(--paper); }
.year-c { display: none; }
.year-tab:hover { color: var(--accent); }
.year-tab:hover::before { box-shadow: 0 0 0 4px var(--accent-soft); }

.year-hint {
    display: none;
    color: var(--muted);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    transition: color 0.15s ease;
}
.year-hint b { color: var(--ink); font-weight: 500; }
.year-hint span::after { content: "  +"; color: var(--accent); white-space: pre; }
.year-hint:hover { color: var(--accent); }

.year.is-closed .year-body { padding: 14px 0; }
.year.is-closed:first-child .year-body { padding-top: 0; }
.year.is-closed .year-body > :not(.year-hint) { display: none; }
.year.is-closed .year-hint { display: block; }
.year.is-closed .year-tab { margin-top: 13px; color: var(--muted); }
.year.is-closed:first-child .year-tab { margin-top: 0; }
.year.is-closed .year-tab::before { border-color: var(--rule-strong); background: var(--paper); }

/* inside a year, the year column on each item is redundant */
.year .pub { grid-template-columns: minmax(0, 1fr); }
.year .pub-year { display: none; }
.year .pubs, .year .rows, .year .posters { max-width: calc(900px + var(--grow, 0px) * 0.362); }

.years-tools { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: -14px 0 30px; }
.years-tools button {
    padding: 0 0 2px;
    border: 0;
    border-bottom: 1px solid var(--rule-strong);
    background: none;
    color: var(--muted);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.years-tools button:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 860px) {
    .years { margin-left: 0; }
    .year { grid-template-columns: minmax(0, 1fr); }
    .year-tab {
        position: static;
        justify-content: space-between;
        width: 100%;
        margin: 0;
        padding: 14px 0 12px;
        border-top: 1px solid var(--rule);
        font-size: 0.9rem;
    }
    .year:first-child .year-tab, .year.is-closed .year-tab, .year.is-closed:first-child .year-tab { margin-top: 0; }
    .year:first-child .year-tab { border-top: 0; padding-top: 0; }
    .year-tab::before { display: none; }
    .year-c { display: inline; color: var(--muted); font-size: 0.76rem; }
    .year-c::after { content: "  \2212"; color: var(--accent); white-space: pre; }
    .year.is-closed .year-c::after { content: "  +"; }
    .year-body, .year:first-child .year-body { padding: 6px 0 22px; border-top: 0; }
    .year.is-closed .year-body, .year.is-closed:first-child .year-body { padding: 0; }
    .year.is-closed .year-hint { display: none; }
}
@media print {
    .years-tools, .year-hint { display: none !important; }
    .year.is-closed .year-body > :not(.year-hint) { display: block !important; }
}

/* ---------- News teasers ---------- */
.news-title { color: var(--ink); font-weight: 500; line-height: 1.45; }
.news-title .tag { margin-bottom: 0; }
.news-meta { margin-top: 5px; color: var(--muted); font-size: 0.93rem; line-height: 1.5; }
.tag--paper, .tag--award, .tag--grant { border-color: var(--accent); color: var(--accent); }
.tag--workshop, .tag--talk { border-color: var(--ink); color: var(--ink); }

/* ---------- Testimonials ---------- */
.tcar { position: relative; }
.tcar-track {
    display: flex;
    gap: clamp(14px, 2vw, 22px);
    padding: 2px 2px 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: var(--rule-strong) transparent;
}
.tcard {
    flex: 0 0 min(400px, 86%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 22px;
    padding: clamp(20px, 2.4vw, 28px);
    border: 1px solid var(--rule);
    background: var(--surface);
    scroll-snap-align: start;
}
.tcard blockquote { margin: 0; }
.tcard blockquote::before {
    content: "\201C";
    display: block;
    height: 0.5em;
    margin-bottom: 14px;
    color: var(--accent);
    font-family: var(--serif);
    font-size: 3.6rem;
    line-height: 1;
}
.tcard blockquote p {
    color: var(--ink);
    font-family: var(--serif);
    font-size: 1.16rem;
    line-height: 1.45;
}
.tcard-who { padding-top: 14px; border-top: 1px solid var(--rule); line-height: 1.4; }
.tcard-who b { display: block; color: var(--ink); font-weight: 600; }
.tcard-who span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.86rem;
}
.tcar-nav { display: flex; gap: 8px; margin-top: 12px; }
.tcar-nav[hidden] { display: none; }
.tcar-nav button {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--rule-strong);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 1rem;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.tcar-nav button:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.node > .tcar + .more { margin-top: 26px; }
@media print {
    .tcar-track { flex-wrap: wrap; overflow: visible; }
    .tcar-nav { display: none !important; }
}

/* Once a piece reaches the header, the header's own copy is shown and the
   travelling one is hidden, so the docked name is ordinary sticky content. */
.dock-live.photo-docked .dock-photo,
.dock-live.name-docked .dock-name { visibility: visible; }
.dock-live.photo-docked [data-dock="photo"],
.dock-live.name-docked [data-dock="name"] { visibility: hidden; }

/* ---------- Text beside a photo (research page header) ---------- */
.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
    gap: clamp(24px, 4vw, 56px);
    align-items: start;
}
.split .title { font-size: clamp(2.1rem, 1.3rem + 2.3vw, 3.1rem); }
.split .title + .lede { margin-top: 22px; }
.split-fig img { width: 100%; }
.split-fig figcaption {
    margin-top: 10px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.02em;
    line-height: 1.55;
}
@media (max-width: 760px) {
    .split { grid-template-columns: minmax(0, 1fr); }
    .split-fig { max-width: 420px; }
}

/* ---------- News: venue label + kind tag above each headline ---------- */
.news-labels { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 7px; }
.news-labels .tag { margin: 0; }
.venue {
    display: inline-block;
    padding: 0.24em 0.6em;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
    font-family: var(--mono);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    line-height: 1.3;
    text-transform: uppercase;
}
.node > .more + .photos { margin-top: 40px; }
.site-nav { gap: clamp(12px, 2vw, 26px); }

/* ---------- Publications page ---------- */
.pub-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(14px, 2.4vw, 32px);
    max-width: calc(900px + var(--grow, 0px) * 0.804);
    margin-top: 34px;
}
.pub-stats a {
    display: block;
    padding-top: 12px;
    border-top: 1px solid var(--ink);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease;
}
.pub-stats b {
    display: block;
    color: var(--ink);
    font-family: var(--serif);
    font-size: clamp(2rem, 1.6rem + 1.4vw, 2.7rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.05;
    transition: color 0.15s ease;
}
.pub-stats span { display: block; margin-top: 6px; color: var(--muted); font-size: 0.88rem; line-height: 1.4; }
.pub-stats a:hover { border-color: var(--accent); }
.pub-stats a:hover b { color: var(--accent); }
@media (max-width: 600px) {
    .pub-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 24px; }
}

/* labels above each title: venue chip, kind, note */
.pub-labels { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.pub-labels .tag { margin: 0; }
.tag--journal { border-color: var(--accent); background: transparent; color: var(--accent); }
.tag--conference { border-color: var(--rule-strong); color: var(--muted); }
.tag--note { border-color: transparent; background: var(--accent-soft); color: var(--ink); }

.pub-title a { color: var(--ink); text-decoration: none; }
.pub-title a:hover { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.pub-venue { color: var(--muted); }
.pub-venue i, .pub-venue a { color: var(--text); }

/* patent tiles */
.ptile h3 { font-family: var(--sans); font-size: 1.04rem; font-weight: 500; letter-spacing: 0; line-height: 1.42; }
.ptile h3 a { color: var(--ink); text-decoration: none; }
.ptile h3 a:hover { color: var(--accent); }
.ptile .pub-authors { margin-top: 8px; font-size: 0.9rem; }
.ptile-no { margin-top: 10px; color: var(--text); font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.02em; line-height: 1.5; }
.ptile-no i { font-style: normal; }
.ptile-year { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 0.76rem; }

/* ---------- News items with a photo ---------- */
.rows--news { max-width: calc(980px + var(--grow, 0px) * 0.394); }
.row--img { grid-template-columns: 9.5rem minmax(0, 1fr) 200px; }
.news-thumb {
    display: block;
    align-self: start;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border: 1px solid var(--rule);
    background: var(--surface);
    transition: border-color 0.15s ease;
}
.news-thumb--tall { aspect-ratio: 4 / 5; }
.news-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.news-thumb:hover { border-color: var(--accent); }
.news-thumb:hover img { transform: scale(1.03); }
@media (max-width: 760px) {
    .row--img { grid-template-columns: 9.5rem minmax(0, 1fr); }
    .news-thumb { grid-column: 2; max-width: 300px; margin-top: 8px; }
}
@media (max-width: 600px) {
    .row--img { grid-template-columns: minmax(0, 1fr); }
    .news-thumb { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) { .news-thumb:hover img { transform: none; } }

/* ---------- Label colours by kind ----------
   Each kind of item gets its own colour, used for the solid venue chip
   and the outlined kind tag beside it. */
:root {
    --c-paper: #2340c8;
    --c-talk: #0d7a6c;
    --c-workshop: #c2410c;
    --c-poster: #7c3aed;
    --c-award: #be123c;
    --c-grant: #15803d;
    --c-note: #57606a;
    --c-journal: #2340c8;
    --c-conference: #0d7a6c;
    --c-patent: #c2410c;
}
:root[data-theme="dark"] {
    --c-paper: #93a6ff;
    --c-talk: #5fd9c7;
    --c-workshop: #fdba74;
    --c-poster: #c4b5fd;
    --c-award: #fda4af;
    --c-grant: #86efac;
    --c-note: #b6bec7;
    --c-journal: #93a6ff;
    --c-conference: #5fd9c7;
    --c-patent: #fdba74;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --c-paper: #93a6ff;
        --c-talk: #5fd9c7;
        --c-workshop: #fdba74;
        --c-poster: #c4b5fd;
        --c-award: #fda4af;
        --c-grant: #86efac;
        --c-note: #b6bec7;
        --c-journal: #93a6ff;
        --c-conference: #5fd9c7;
        --c-patent: #fdba74;
    }
}
.k-paper { --k: var(--c-paper); }
.k-talk, .k-teaching { --k: var(--c-talk); }
.k-workshop { --k: var(--c-workshop); }
.k-poster { --k: var(--c-poster); }
.k-award { --k: var(--c-award); }
.k-grant { --k: var(--c-grant); }
.k-note { --k: var(--c-note); }
.k-journal { --k: var(--c-journal); }
.k-conference { --k: var(--c-conference); }
.k-patent { --k: var(--c-patent); }
[class*="k-"] > .venue { border-color: var(--k, var(--accent)); background: var(--k, var(--accent)); }
[class*="k-"] > .tag:not(.tag--note) { border-color: var(--k, var(--accent)); background: transparent; color: var(--k, var(--accent)); }
.tag--journal { border-color: var(--c-journal); color: var(--c-journal); }
.tag--conference { border-color: var(--c-conference); color: var(--c-conference); }
.tag--preprint { border-color: var(--c-poster); color: var(--c-poster); }

/* ---------- Margin rail: behavior-tree symbols ----------
   Root        -> sequence box (arrow), set earlier
   Section     -> action node (rectangle)
   Section with a year list -> fallback box (?), since you pick a year
   Year        -> condition node (ellipse): filled when open */
.node:not(.node--root)::before {
    left: 5px;
    top: calc(var(--node-pad) + 2px);
    width: 15px;
    height: 9px;
}
.node:not(.node--root)::after {
    left: 20px;
    width: calc(var(--rail) - 34px);
}
.node:not(.node--root):has(.years)::before {
    content: "?";
    left: 3px;
    top: calc(var(--node-pad) - 3px);
    display: grid;
    place-items: center;
    width: 19px;
    height: 19px;
    border-color: var(--ink);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1;
}
.node:not(.node--root):has(.years)::after { left: 22px; width: calc(var(--rail) - 36px); }
.node:not(.node--root):has(.years).is-done::before { color: var(--paper); }
.node:not(.node--root):has(.years).is-running::before { color: var(--accent-ink); }

.year-tab { padding-left: 5px; }
.year-tab::before { width: 15px; height: 9px; border-radius: 50%; }

.legend .l-ctl {
    display: inline-grid;
    place-items: center;
    width: 13px;
    height: 13px;
    border: 1px solid var(--muted);
    color: var(--muted);
    font-size: 0.6rem;
    font-style: normal;
    line-height: 1;
    vertical-align: -2px;
}
.legend .l-act { width: 13px; height: 8px; vertical-align: 0; }
.legend .l-cond { width: 13px; height: 8px; border-radius: 50%; vertical-align: 0; }

/* when the last section holds a year list, let the rail run on past its marker so the year nodes stay attached */
.node:last-child:has(.years) { background-size: 1px 100%; }

/* location on a news item */
.news-where { display: inline-flex; align-items: center; gap: 5px; color: var(--text); white-space: nowrap; }
.news-where svg { flex: none; width: 9px; height: 12px; color: var(--k, var(--accent)); }
.news-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }

/* ---------- Phone and small-tablet fixes ---------- */
.news-meta { display: block; }
.news-where { display: inline-flex; vertical-align: baseline; }

@media (max-width: 860px) {
    /* the rail is hidden at this width, so its symbols are too */
    .node:not(.node--root)::before,
    .node:not(.node--root):has(.years)::before,
    .node:not(.node--root)::after { display: none; }
    .year-tab { padding-left: 0; }
    html { scroll-padding-top: 112px; }
}

@media (max-width: 640px) {
    /* six links fit on one line; Contact is in the footer of every page */
    .site-nav a[href="#contact"] { display: none; }
    .site-nav { flex-wrap: nowrap; justify-content: space-between; gap: 0 10px; }
    .site-nav a { padding: 10px 0; font-size: 0.7rem; letter-spacing: 0.02em; }
    .site-head .wrap { padding-bottom: 0; }

    body { font-size: 1rem; }
    .title { font-size: clamp(2rem, 9vw, 2.5rem); }
    .lede { font-size: 1.2rem; }
    .btn { padding: 0.8em 1em; }
    .links { gap: 10px 18px; }
    .links a, .links summary { padding: 3px 0; }

    /* facts: number on the left, label on the right */
    .facts { grid-template-columns: minmax(0, 1fr); gap: 0; max-width: none; }
    .facts li {
        display: grid;
        grid-template-columns: 4.4rem minmax(0, 1fr);
        align-items: baseline;
        gap: 0 12px;
        padding: 10px 0;
        border-top: 1px solid var(--rule);
    }
    .facts li:first-child { border-top-color: var(--ink); }
    .facts b { font-size: 2rem; }
    .facts span { margin-top: 0; font-size: 0.92rem; }

    .tcard { flex-basis: 88%; }
    .tcard blockquote p { font-size: 1.08rem; }
    .pub-filter button { padding: 0.6em 0.8em; }
    .years-tools { margin-top: -8px; }
    .feature { padding: 20px; }
    .tile { padding: 18px; }
    .site-foot .wrap { padding-bottom: 28px; }
    .foot-links { gap: 8px 18px; }
    .foot-links a { padding: 4px 0; }
}

@media (max-width: 380px) {
    .site-nav a { font-size: 0.64rem; letter-spacing: 0; }
    .dock-name { font-size: 1.1rem; }
}

/* Testimonials drift slowly on their own; snapping would fight that motion,
   and the scrollbar would crawl along underneath, so both are off while drifting. */
.tcar.is-drifting .tcar-track { scroll-snap-type: none; scrollbar-width: none; }
.tcar.is-drifting .tcar-track::-webkit-scrollbar { display: none; }
.tcar.is-drifting { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%); mask-image: linear-gradient(to right, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%); }
.tcar.is-drifting .tcar-nav { padding-left: 2px; }

/* ---------- Larger behavior-tree symbols on the margin rail ---------- */
@media (min-width: 861px) {
    .node { background-position: 15px 0; }
    .node:last-child { background-size: 1px calc(var(--node-pad) + 8px); }
    .node:last-child:has(.years) { background-size: 1px 100%; }

    /* root: sequence */
    .node--root { background-position: 15px calc(var(--node-pad) + 30px); }
    .node--root::before { width: 30px; height: 30px; font-size: 0.95rem; }
    .node--root::after { left: 30px; top: calc(var(--node-pad) + 15px); width: calc(var(--rail) - 44px); }

    /* section: action */
    .node:not(.node--root)::before { left: 5px; top: calc(var(--node-pad) + 1px); width: 20px; height: 12px; }
    .node:not(.node--root)::after { left: 25px; top: calc(var(--node-pad) + 7px); width: calc(var(--rail) - 39px); }

    /* section with years: fallback */
    .node:not(.node--root):has(.years)::before { left: 3px; top: calc(var(--node-pad) - 5px); width: 24px; height: 24px; font-size: 0.84rem; }
    .node:not(.node--root):has(.years)::after { left: 27px; width: calc(var(--rail) - 41px); }

    /* year: condition */
    .year-tab { padding-left: 6px; gap: 6px; }
    .year-tab::before { width: 18px; height: 11px; }
}
.legend .l-ctl { width: 15px; height: 15px; font-size: 0.66rem; }
.legend .l-act { width: 16px; height: 10px; }
.legend .l-cond { width: 16px; height: 10px; }

/* eight nav links: keep them on one line, and let the row scroll sideways on very narrow phones */
.site-nav { gap: clamp(10px, 1.7vw, 24px); }
@media (max-width: 640px) {
    .site-nav { overflow-x: auto; scrollbar-width: none; gap: 0 9px; }
    .site-nav::-webkit-scrollbar { display: none; }
    .site-nav a { flex: none; font-size: 0.66rem; letter-spacing: 0.01em; }
}
@media (max-width: 380px) {
    .site-nav a { font-size: 0.62rem; }
}
.node > .figure + .rows { margin-top: 34px; }

/* tighter rows, used on the CV */
.rows--tight .row { padding: 10px 0; }
.rows--tight .row:first-child { padding-top: 0; }
.rows--tight .row-where { margin-top: 1px; font-size: 0.92rem; }
.rows--tight .row-note { margin-top: 3px; font-size: 0.92rem; }
.tile h3 a { color: var(--ink); text-decoration: none; }
.tile h3 a:hover { color: var(--accent); }
.node--root > .lede + .byline { margin-top: 14px; }

/* a wide, short crop for group photos */
.figure--band .plate { aspect-ratio: 5 / 2; overflow: hidden; }
.figure--band img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 72%; }
@media (max-width: 640px) { .figure--band .plate { aspect-ratio: 16 / 9; } }

/* A portrait photo shown as a small landscape crop */
.figure--snap { max-width: 420px; }
.figure--snap .plate { aspect-ratio: 4 / 3; overflow: hidden; }
.figure--snap img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 62%; }

/* Phones: keep news photos small so the list stays short */
@media (max-width: 860px) {
    .news-thumb { max-width: 220px; }
    .news-thumb--tall { max-width: 150px; }
}

/* ---------- Research areas: what, where, and links ---------- */
.areas { max-width: calc(1040px + var(--grow, 0px) * 0.929); }
.area {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) minmax(0, 21rem);
    gap: 6px 26px;
    align-items: start;
    padding: 22px 0;
    border-top: 1px solid var(--rule);
}
.area:first-child { padding-top: 0; border-top: 0; }
.area:last-child { padding-bottom: 0; }
.area .tile-icon { width: 34px; height: 34px; margin: 2px 0 0; }
.area-main h3 { font-size: 1.36rem; line-height: 1.2; }
.area-main p { margin-top: 6px; max-width: 46ch; font-size: 0.98rem; line-height: 1.55; }
.area-lab {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    line-height: 1.5;
    text-transform: uppercase;
}
.area-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.area-links a {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid var(--rule-strong);
    background: var(--surface);
    color: var(--ink);
    font-size: 0.84rem;
    line-height: 1.4;
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.area-links a:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 860px) {
    .area { grid-template-columns: 34px minmax(0, 1fr); }
    .area-where { grid-column: 2; margin-top: 8px; }
}

/* ---------- Dissertation block ---------- */
.thesis { max-width: calc(760px + var(--grow, 0px) * 0.305); padding-left: 20px; border-left: 2px solid var(--accent); }
.thesis-meta {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.thesis-title { margin-top: 8px; font-size: 1.5rem; font-style: italic; line-height: 1.25; }
.thesis-title a { color: var(--ink); text-decoration-color: var(--rule-strong); }
.thesis-title a:hover { color: var(--accent); }
.thesis p:last-child { margin-top: 10px; max-width: var(--measure); font-size: 0.98rem; line-height: 1.55; }

/* ---------- Compact CV ---------- */
.node--cv { --node-pad: 30px; }
.node--cv.node--root .title { font-size: clamp(2rem, 4.4vw, 2.7rem); }
.node--cv.node--root > .title + .lede { margin-top: 10px; font-size: 1.12rem; }
.node--cv.node--root > .lede + .byline { margin-top: 8px; }
.node--cv.node--root > .actions { margin-top: 16px; }
.node--cv .label { margin-bottom: 12px; }
.rows--cv { max-width: calc(980px + var(--grow, 0px) * 0.394); }
.rows--cv .row { grid-template-columns: 8.2rem minmax(0, 1fr); gap: 2px 20px; padding: 5px 0; border-top: 0; }
.rows--cv .row:first-child { padding-top: 0; }
.rows--cv .row > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }
.rows--cv .row-when { padding-top: 0.2em; font-size: 0.72rem; }
.rows--cv .row-what { font-size: 0.96rem; line-height: 1.4; }
.rows--cv .row-where { margin-top: 0; font-size: 0.88rem; line-height: 1.4; }
.rows--cv .row-note { flex-basis: 100%; margin-top: 0; font-size: 0.86rem; line-height: 1.4; color: var(--muted); }
@media (max-width: 600px) {
    .rows--cv .row { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 7px 0; }
}

/* ---------- Site notice (above the header, scrolls away) ---------- */
.notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 7px var(--gutter);
    background: var(--accent-soft);
    border-bottom: 1px solid var(--rule);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    line-height: 1.5;
    text-align: center;
}
.notice i {
    position: relative;
    flex: none;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
}
.notice i::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid var(--accent);
    opacity: 0;
    animation: new-pulse 2.6s ease-out infinite;
}
@media (prefers-reduced-motion: reduce) { .notice i::after { animation: none; } }
@media print { .notice { display: none; } }

/* ---------- News: several items from one event share an entry ---------- */
.venue--event { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.row--group .news-labels { gap: 6px 12px; margin-bottom: 10px; }
.row--group .news-labels .news-where { color: var(--muted); font-size: 0.9rem; }
.news-subs { display: grid; gap: 14px; }
.news-sub { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px 22px; align-items: start; }
.news-sub:has(.news-thumb) { grid-template-columns: minmax(0, 1fr) 150px; }
.news-sub .news-title .tag { margin: 0 9px 0 0; vertical-align: 0.14em; }
.news-sub .news-meta { margin-top: 3px; }
.news-sub .news-thumb { aspect-ratio: 4 / 3; max-width: none; margin-top: 0; }
@media (max-width: 600px) {
    .news-sub:has(.news-thumb) { grid-template-columns: minmax(0, 1fr); }
    .news-sub .news-thumb { max-width: 200px; }
}

/* ---------- Photo strips ---------- */
.photos--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 1.4vw, 16px); max-width: calc(980px + var(--grow, 0px) * 0.875); }
.photos--4 .plate { aspect-ratio: 3 / 4; }
@media (max-width: 600px) { .photos--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.photos--lead { max-width: calc(760px + var(--grow, 0px) * 0.679); margin-bottom: 30px; }
@media (max-width: 600px) { .photos--lead { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }

/* ---------- Projects: three across ---------- */
.pcards--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(22px, 2.6vw, 34px) clamp(16px, 2vw, 26px); max-width: calc(1040px + var(--grow, 0px) * 0.929); }
.pcards--3 .pcard-title { font-size: 1.3rem; }
.pcards--3 .pcard-text { font-size: 0.92rem; }
@media (max-width: 900px) { .pcards--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .pcards--3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
    .pcards--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; }
    .pcards--3 .pcard-img { max-width: none; }
    .pcards--3 .pcard-title { font-size: 1.08rem; }
    .pcards--3 .pcard-text { font-size: 0.86rem; }
}

/* ---------- Home: icon links beside the buttons ---------- */
.social { display: inline-flex; flex-wrap: wrap; gap: 8px; margin-left: 8px; }
.social a {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--rule-strong);
    border-radius: 50%;
    color: var(--ink);
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.social a:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.social svg { width: 18px; height: 18px; fill: currentColor; }
@media (max-width: 600px) { .social { margin-left: 0; flex-basis: 100%; } }

/* ---------- Rail: year conditions follow the reading line ----------
   idle: hollow and faint · being checked: accent · checked and open: filled
   (true) · checked and closed: hollow with a dark outline (false) */
.rail-live .year .year-tab::before { border-color: var(--rule-strong); background: var(--paper); box-shadow: none; }
.rail-live .year.is-ticked .year-tab::before { border-color: var(--ink); background: var(--ink); }
.rail-live .year.is-ticked.is-closed .year-tab::before { border-color: var(--ink); background: var(--paper); }
.rail-live .year.is-ticking .year-tab::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.rail-live .year .year-tab:hover::before { box-shadow: 0 0 0 4px var(--accent-soft); }


/* ---------- Rail: a glow on the node the tree is at ---------- */
:root { --accent-glow: rgba(35, 64, 200, 0.5); }
:root[data-theme="dark"] { --accent-glow: rgba(147, 166, 255, 0.55); }
@keyframes bt-glow {
    0%, 100% { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 5px 0 var(--accent-glow); }
    50% { box-shadow: 0 0 0 6px var(--accent-soft), 0 0 18px 4px var(--accent-glow); }
}
.node:not(.node--root).is-running::before,
.rail-live .year.is-ticking .year-tab::before { animation: bt-glow 1.9s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
    .node:not(.node--root).is-running::before,
    .rail-live .year.is-ticking .year-tab::before { animation: none; }
}

/* ---------- Home: the tree's root above the sequence box ---------- */
.bt-root { display: none; }
@media (min-width: 861px) {
    .bt-root { display: block; position: absolute; left: 0; top: calc(var(--node-pad) - 36px); width: 30px; height: 36px; }
    .bt-root::before { content: ""; position: absolute; left: 8px; top: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); transition: background-color 0.25s ease; }
    .bt-root::after { content: ""; position: absolute; left: 15px; top: 14px; width: 1px; height: 22px; background: var(--rule-strong); }
    .bt-root b { position: absolute; left: 30px; top: 2px; color: var(--muted); font-family: var(--mono); font-size: 0.62rem; font-weight: 500; letter-spacing: 0.14em; line-height: 1; text-transform: uppercase; }
    .node--root.is-running .bt-root::before { background: var(--accent); }
}
@media print { .bt-root { display: none; } }

/* ---------- Tree controls: two icon buttons on one line. The first ticks
   once (one node forward); the second plays, and becomes pause. They stay
   with the reader down the page; the hint with the arrow shows at the top. ---------- */
.bt-bar {
    position: sticky;
    top: 60px;
    z-index: 45;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 8px 0;
    background: var(--paper);
    visibility: hidden;
}
.rail-live .bt-bar { visibility: visible; }
.bt-btns { display: inline-flex; flex: none; gap: 6px; }
.bt-btns .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.bt-step, .bt-tick {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--ink);
    background: var(--paper);
    color: var(--ink);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.bt-step:hover, .bt-tick:hover { border-color: var(--accent); color: var(--accent); }
.bt-step i, .bt-tick i { box-sizing: content-box; width: 0; height: 0; border-left: 10px solid currentColor; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.bt-step i { position: relative; margin-right: 4px; }
.bt-step i::after { content: ""; position: absolute; left: 1px; top: -6px; width: 2px; height: 12px; background: currentColor; }
.is-auto .bt-tick, .is-auto .bt-tick:hover { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.is-auto .bt-tick i { width: 4px; height: 12px; border: 0; border-left: 3px solid currentColor; border-right: 3px solid currentColor; }
.bt-hint { color: var(--muted); font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.03em; line-height: 1.45; transition: opacity 0.25s ease; }
.bt-hint i { display: inline-block; margin-right: 7px; color: var(--accent); font-style: normal; font-size: 0.95rem; animation: bt-nudge 1.6s ease-in-out infinite; }
.bt-hint i::before { content: "\2190"; }
.bt-scrolled .bt-hint, .is-auto .bt-hint { opacity: 0; pointer-events: none; }
@keyframes bt-nudge {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-5px); }
}
@keyframes bt-nudge-up {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
.bt-bar + .node--root.hero { --node-pad: 54px; }
.bt-bar + .ident-mini { margin-top: 10px; }

/* Wide screens: the buttons hang in the left page margin, outside the rail,
   with the arrow and hint underneath. */
@media (min-width: 1270px) {
    .bt-bar { display: block; top: 68px; height: 0; padding: 0; background: none; }
    .bt-btns { position: absolute; top: 8px; left: calc((100% - 100vw) / 2 + 22px); }
    .bt-hint { position: absolute; top: 46px; left: calc((100% - 100vw) / 2 + 14px); width: 100px; font-size: 0.66rem; }
    .bt-hint i { display: block; margin: 0 0 2px 22px; animation-name: bt-nudge-up; }
    .bt-hint i::before { content: "\2191"; }
    .bt-bar + .node--root.hero { --node-pad: inherit; }
    .bt-bar + .ident-mini { margin-top: 22px; }
}
@media (prefers-reduced-motion: reduce) { .bt-hint i { animation: none; } }
@media (max-width: 860px) { .bt-bar { display: none; } }
@media print { .bt-bar { display: none; } }

/* ---------- Hidden tree debugger (type "bt") ---------- */
.bt-status { display: none; }
.bt-debug .bt-status {
    display: inline-block;
    margin-left: 4px;
    padding: 2px 6px;
    border: 1px solid var(--rule-strong);
    color: var(--muted);
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    line-height: 1.2;
}
.bt-debug .bt-status[data-s="run"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.bt-debug .bt-status[data-s="ok"] { border-color: var(--c-grant, var(--ink)); color: var(--c-grant, var(--ink)); }
.bt-hud {
    position: fixed;
    left: 14px;
    bottom: 14px;
    z-index: 70;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    max-width: min(560px, calc(100vw - 28px));
    padding: 9px 13px;
    border: 1px solid var(--ink);
    background: var(--ink);
    color: var(--paper);
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    line-height: 1.4;
}
.bt-hud b { color: #9fe870; font-weight: 500; }
@media print { .bt-hud { display: none; } }

/* ---------- "Teach this page" (Research) ---------- */
.teach { max-width: 780px; border: 1px solid var(--rule-strong); background: var(--surface); }
.teach-head { padding: 20px 22px 0; }
.teach-head h3 { font-size: 1.45rem; }
.teach-head p { margin-top: 6px; max-width: 56ch; font-size: 0.96rem; line-height: 1.55; }
.teach-log { max-height: 230px; margin-top: 16px; padding: 4px 22px; overflow-y: auto; border-top: 1px solid var(--rule); }
.teach-line { display: grid; grid-template-columns: 3.2rem minmax(0, 1fr); gap: 0 10px; padding: 7px 0; font-size: 0.93rem; line-height: 1.5; }
.teach-line + .teach-line { border-top: 1px dashed var(--rule); }
.teach-line b { padding-top: 0.2em; color: var(--muted); font-family: var(--mono); font-size: 0.68rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; }
.teach-line--you span { color: var(--ink); font-family: var(--mono); font-size: 0.86rem; }
.teach-line--page b { color: var(--accent); }
.teach-form { display: flex; align-items: center; gap: 10px; padding: 12px 22px; border-top: 1px solid var(--rule); }
.teach-form > span { color: var(--accent); font-family: var(--mono); font-weight: 500; }
.teach-form input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--rule-strong);
    background: var(--paper);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.88rem;
}
.teach-form input:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 0; }
.teach-form .btn { flex: none; }
.teach-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 22px 14px; }
.teach-chips button {
    padding: 4px 9px;
    border: 1px solid var(--rule-strong);
    background: var(--paper);
    color: var(--text);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.72rem;
    line-height: 1.4;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.teach-chips button:hover { border-color: var(--accent); color: var(--accent); }
.teach-traits { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 12px 22px; border-top: 1px solid var(--rule); }
.teach-traits li { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; }
.teach-traits li::before { content: ""; width: 8px; height: 8px; border: 1px solid var(--rule-strong); border-radius: 50%; }
.teach-traits li.is-lit { animation: trait-lit 2.6s ease-out both; }
.teach-traits li.is-lit::before { animation: trait-dot 2.6s ease-out both; }
@keyframes trait-lit { 0%, 70% { color: var(--accent); } 100% { color: var(--muted); } }
@keyframes trait-dot {
    0%, 70% { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
    100% { border-color: var(--rule-strong); background: transparent; box-shadow: none; }
}
.teach-note { padding: 0 22px 16px; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
@media (max-width: 600px) {
    .teach-head, .teach-log, .teach-form, .teach-chips, .teach-traits, .teach-note { padding-left: 14px; padding-right: 14px; }
    .teach-form .btn { padding-left: 12px; padding-right: 12px; }
}
@media print { #teach { display: none; } }

/* ---------- The site as one behavior tree ----------
   SO mark = root -> "?" selector -> one child per page (the nav links, hung
   from the header's bottom line) -> the current page's sequence node -> its
   sections. Drawn on desktop widths only. */
.bt-sel, .bt-wire { display: none; }
.legend .l-root { width: auto; padding: 0 3px; font-size: 0.56rem; letter-spacing: 0; }
.bt-bar { background: none; }
.bt-scrolled .bt-bar { background: var(--paper); }
@media (min-width: 901px) {
    /* selector node */
    .bt-sel {
        position: relative;
        display: inline-grid;
        place-items: center;
        flex: none;
        width: 24px;
        height: 24px;
        margin-left: 20px;
        border: 1px solid var(--ink);
        color: var(--ink);
        font-family: var(--mono);
        font-size: 0.8rem;
        font-weight: 500;
        line-height: 1;
        transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
    }
    .bt-sel::before { content: ""; position: absolute; right: 100%; top: 50%; width: 20px; height: 1px; margin-right: 1px; background: var(--rule-strong); }
    .bt-sel::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: 19px; margin-top: 1px; background: var(--rule-strong); }
    .dock { margin-left: 16px; }

    /* one child per page, hung from the header's bottom line */
    .site-nav { align-self: stretch; align-items: stretch; }
    .site-nav a { display: inline-flex; align-items: center; padding: 0; }
    .site-nav a::before { content: ""; position: absolute; left: 50%; bottom: 0; width: 1px; height: 11px; background: var(--rule-strong); }
    .site-nav a[aria-current="page"]::before { height: 13px; background: var(--ink); }
    .site-nav a[aria-current="page"]::after { bottom: -1px; }

    /* root and selector share the state of the tree */
    .rail-live.tree-running .brand-mark,
    .rail-live.tree-running .bt-sel { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
    .rail-live.tree-done .brand-mark,
    .rail-live.tree-done .bt-sel { border-color: var(--ink); background: var(--ink); color: var(--paper); }

    /* the wire from the current page's link to the page's sequence node */
    main.tree { position: relative; }
    .bt-wire {
        display: block;
        position: absolute;
        top: -1px;
        left: calc(var(--gutter) + 15px);
        width: 0;
        height: var(--wire-h, 14px);
        border-right: 1px solid var(--ink);
        border-bottom: 1px solid var(--rule-strong);
        pointer-events: none;
    }
    .bt-wire::after { content: ""; position: absolute; left: 0; top: 100%; width: 1px; height: var(--wire-drop, 0px); background: var(--rule-strong); }
    .ident-mini { margin-left: var(--rail); }
}
/* between 901px and the wide layout the tick buttons share that strip: keep clear of the wire */
@media (min-width: 901px) and (max-width: 1269px) {
    .bt-wire { --wire-h: 5px; }
    .bt-btns { margin-left: var(--rail); }
}
@media print { .bt-sel, .bt-wire { display: none !important; } }
@media (min-width: 901px) {
    .bt-sel { margin-left: 0; }
    .bt-sel::before { width: 27px; margin-right: 1px; }
}

/* ---------- Teach this page: extras ---------- */
.teach-chips { align-items: center; }
.teach-chips > span { color: var(--muted); font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; }
.teach-line span a { color: var(--accent); }
.teach-note button { padding: 0; border: 0; background: none; color: var(--text); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 0.2em; }
.teach-note button:hover { color: var(--accent); }
.teach-toast {
    position: fixed;
    left: 50%;
    bottom: 18px;
    z-index: 80;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 12px;
    width: max-content;
    max-width: min(680px, calc(100vw - 24px));
    padding: 11px 14px;
    transform: translateX(-50%);
    border: 1px solid var(--ink);
    background: var(--ink);
    color: var(--paper);
    font-size: 0.9rem;
    line-height: 1.45;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}
.teach-toast > b { color: #9fb0ff; font-family: var(--mono); font-size: 0.66rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; }
.teach-toast > span:first-of-type { flex: 1 1 16rem; }
.teach-toast-tools { display: inline-flex; align-items: center; gap: 12px; margin-left: auto; }
.teach-toast a { color: var(--paper); font-family: var(--mono); font-size: 0.72rem; white-space: nowrap; }
.teach-toast button { padding: 3px 9px; border: 1px solid var(--paper); background: none; color: var(--paper); cursor: pointer; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; }
.teach-toast button:hover { background: var(--paper); color: var(--ink); }
.teach-toast .teach-toast-x { padding: 0 4px; border: 0; font-size: 1.05rem; line-height: 1; }
@media print { .teach-toast { display: none; } }

/* ---------- Year lists as a selector of (condition -> action) pairs ----------
   The year ellipse is the condition "is this year chosen?". When it is true
   (the year is open), an action node sits under it: show the block. */
@media (min-width: 861px) {
    .year:not(.is-closed) .year-tab::after {
        content: "";
        position: absolute;
        left: 5px;
        top: calc(100% + 9px);
        width: 20px;
        height: 12px;
        border: 1px solid var(--ink);
        background: var(--paper);
        transition: background-color 0.25s ease, border-color 0.25s ease;
    }
    /* idle: not reached yet */
    .rail-live .year:not(.is-closed) .year-tab::after { border-color: var(--rule-strong); }
    /* being read: the condition has returned true, the action is running */
    .rail-live .year.is-ticking:not(.is-closed) .year-tab::before { border-color: var(--ink); background: var(--ink); box-shadow: none; animation: none; }
    .rail-live .year.is-ticking:not(.is-closed) .year-tab::after { border-color: var(--accent); background: var(--accent); animation: bt-glow 1.9s ease-in-out infinite; }
    /* being checked and false: nothing to run */
    .rail-live .year.is-ticking.is-closed .year-tab::before { border-color: var(--accent); background: var(--paper); animation: none; box-shadow: 0 0 0 3px var(--accent-soft); }
    /* passed: condition true, action done */
    .rail-live .year.is-ticked:not(.is-closed) .year-tab::after { border-color: var(--ink); background: var(--ink); }
}
@media (min-width: 861px) and (max-width: 1269px) { .year-tab { top: 112px; } }
@media (prefers-reduced-motion: reduce) { .rail-live .year.is-ticking:not(.is-closed) .year-tab::after { animation: none; } }

/* ---------- Conditions: whatever is expanded is true ----------
   An open year's condition is satisfied, so its ellipse is green wherever the
   reader is on the page; a closed year stays hollow (false). The action node
   under an open year carries the idle / running / done states. */
:root { --c-true: #15803d; }
:root[data-theme="dark"] { --c-true: #5fd98a; }
.year:not(.is-closed) .year-tab::before,
.rail-live .year:not(.is-closed) .year-tab::before,
.rail-live .year.is-ticked:not(.is-closed) .year-tab::before,
.rail-live .year.is-ticking:not(.is-closed) .year-tab::before {
    border-color: var(--c-true);
    background: var(--c-true);
    box-shadow: none;
    animation: none;
}
.rail-live .year.is-closed .year-tab::before,
.rail-live .year.is-ticked.is-closed .year-tab::before,
.rail-live .year.is-ticking.is-closed .year-tab::before {
    border-color: var(--rule-strong);
    background: var(--paper);
    box-shadow: none;
    animation: none;
}
.rail-live .year .year-tab:hover::before { box-shadow: 0 0 0 4px var(--accent-soft); }
.legend .l-true { border-color: var(--c-true); background: var(--c-true); }

/* ---------- One set of states for every node on the site ----------
   idle    : hollow
   running : accent fill (root, selector, the page's sequence, the section in view)
   success : green fill (a finished node; a condition that is true)
   The glow marks only the leaf being read: an action section, or the action
   under an open year. Lines are structure and stay grey. */
.node.is-done::before,
.node--root.is-done::before,
.node:not(.node--root):has(.years).is-done::before { border-color: var(--c-true); background: var(--c-true); }
.node--root.is-done::before,
.node:not(.node--root):has(.years).is-done::before { color: #fff; }
:root[data-theme="dark"] .node--root.is-done::before,
:root[data-theme="dark"] .node:not(.node--root):has(.years).is-done::before { color: #0e1013; }
.legend .l-done { border-color: var(--c-true); background: var(--c-true); }
/* composite nodes do not glow; their running leaf does */
.node:not(.node--root):has(.years).is-running::before { animation: none; }
@media (min-width: 861px) {
    .rail-live .year.is-ticked:not(.is-closed) .year-tab::after { border-color: var(--c-true); background: var(--c-true); }
}
@media (min-width: 901px) {
    .rail-live.tree-done .brand-mark,
    .rail-live.tree-done .bt-sel { border-color: var(--c-true); background: var(--c-true); color: #fff; }
    :root[data-theme="dark"].rail-live.tree-done .brand-mark,
    :root[data-theme="dark"].rail-live.tree-done .bt-sel { color: #0e1013; }
    .site-nav a[aria-current="page"]::before { height: 11px; background: var(--rule-strong); }
    .bt-wire { border-right-color: var(--rule-strong); }
    .rail-live.tree-done .site-nav a[aria-current="page"]::after { background: var(--c-true); }
}
.bt-debug .bt-status[data-s="ok"] { border-color: var(--c-true); color: var(--c-true); }

/* ---------- Year lists, drawn as the tree they are ----------
   selector (the section's "?")
     -> one sequence per year (small arrow box, labelled with the year)
          -> condition: is this year chosen?   (ellipse; green when true)
          -> action: show the block            (rectangle; idle, running, success)
   A closed year's condition is false, so its sequence stops there and the
   selector moves on to the next year. */
.year-kids { display: none; }
@media (min-width: 861px) {
    html .years .year .year-tab { flex-wrap: wrap; gap: 5px 6px; padding-left: 8px; }
    html .years .year .year-tab::after { content: none; }

    /* the year's sequence node */
    html .years .year .year-tab::before {
        content: "\2192";
        display: grid;
        place-items: center;
        width: 14px;
        height: 14px;
        border: 1px solid var(--ink);
        border-radius: 0;
        background: var(--paper);
        box-shadow: none;
        color: var(--ink);
        font-family: var(--mono);
        font-size: 0.56rem;
        line-height: 1;
        animation: none;
    }
    html.rail-live .years .year .year-tab::before { border-color: var(--rule-strong); background: var(--paper); color: var(--muted); }
    html.rail-live .years .year.is-ticking:not(.is-closed) .year-tab::before { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
    html.rail-live .years .year.is-ticked:not(.is-closed) .year-tab::before { border-color: var(--c-true); background: var(--c-true); color: #fff; }
    html.rail-live .years .year .year-tab:hover::before { box-shadow: 0 0 0 3px var(--accent-soft); }

    /* its two children, in order: condition, then action */
    .year-kids {
        position: relative;
        display: inline-flex;
        flex: 0 0 auto;
        align-items: center;
        gap: 5px;
        margin: 0 100% 0 14px;
        background: linear-gradient(var(--rule-strong), var(--rule-strong)) 0 50% / 100% 1px no-repeat;
    }
    .year-kids::before { content: ""; position: absolute; right: 100%; top: 50%; width: 7px; height: 1px; background: var(--rule-strong); }
    .year-kids i { display: block; width: 14px; height: 9px; border: 1px solid var(--ink); background: var(--paper); transition: background-color 0.25s ease, border-color 0.25s ease; }
    .year-kids .yc { border-radius: 50%; }

    /* condition: whatever is expanded is true */
    .year .yc { border-color: var(--c-true); background: var(--c-true); }
    .year.is-closed .yc { border-color: var(--rule-strong); background: var(--paper); }

    /* action: only runs when its condition is true */
    .rail-live .year .ya { border-color: var(--rule-strong); }
    .rail-live .year.is-ticking:not(.is-closed) .ya { border-color: var(--accent); background: var(--accent); animation: bt-glow 1.9s ease-in-out infinite; }
    .rail-live .year.is-ticked:not(.is-closed) .ya { border-color: var(--c-true); background: var(--c-true); }
    .year.is-closed .ya { border-style: dashed; }
}
@media (prefers-reduced-motion: reduce) { .rail-live .year.is-ticking:not(.is-closed) .ya { animation: none; } }

/* ---------- Teach this page: conversation beside a guided list of things to try ---------- */
.teach { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); max-width: 1040px; }
.teach-main { min-width: 0; }
.teach-log { max-height: 290px; }
.teach-traits { border-top: 0; padding-top: 2px; }
.teach-guide { min-width: 0; padding: 20px 20px 18px; border-left: 1px solid var(--rule); background: var(--paper); }
.teach-guide h4 { color: var(--muted); font-family: var(--mono); font-size: 0.68rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; }
.teach-guide ol { margin-top: 12px; counter-reset: try; }
.teach-guide li { position: relative; padding: 7px 0 7px 26px; counter-increment: try; }
.teach-guide li + li { border-top: 1px dashed var(--rule); }
.teach-guide li::before {
    content: counter(try);
    position: absolute;
    left: 0;
    top: 9px;
    display: grid;
    place-items: center;
    width: 17px;
    height: 17px;
    border: 1px solid var(--rule-strong);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.6rem;
    line-height: 1;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.teach-guide li.is-used::before { content: "\2713"; border-color: var(--c-true); background: var(--c-true); color: #fff; }
.teach-guide button {
    display: block;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.76rem;
    line-height: 1.45;
    text-align: left;
    text-decoration: underline;
    text-decoration-color: var(--rule-strong);
    text-underline-offset: 0.22em;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
.teach-guide button:hover { color: var(--accent); text-decoration-color: var(--accent); }
.teach-guide li span { display: block; margin-top: 2px; color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.teach-guide > p { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
@media (max-width: 900px) {
    .teach { grid-template-columns: minmax(0, 1fr); }
    .teach-guide { border-left: 0; border-top: 1px solid var(--rule); }
}

/* ---------- Teach this page: a shorter panel ---------- */
.teach-head { padding-top: 16px; }
.teach-head h3 { font-size: 1.3rem; }
.teach-head p { margin-top: 4px; font-size: 0.92rem; }
.teach-log { max-height: 168px; margin-top: 12px; }
.teach-line { padding: 5px 0; }
.teach-form { padding-top: 10px; padding-bottom: 10px; }
.teach-traits { padding-top: 0; padding-bottom: 8px; }
.teach-note { padding-bottom: 12px; font-size: 0.76rem; }
.teach-guide { padding: 16px 18px 12px; }
.teach-guide ol { margin-top: 8px; }
.teach-guide li { padding: 4px 0 4px 24px; }
.teach-guide li + li { border-top: 0; }
.teach-guide li::before { top: 5px; width: 15px; height: 15px; font-size: 0.56rem; }
.teach-guide button { font-size: 0.74rem; line-height: 1.4; }

/* ---------- Teach OntoAgent on this page: labels and the pointer to the real one ---------- */
.teach-line { grid-template-columns: 5.3rem minmax(0, 1fr); }
.teach-line b { letter-spacing: 0.06em; }
.teach-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 7px;
    border: 1px solid var(--c-true);
    color: var(--c-true);
    font-family: var(--mono);
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    line-height: 1.2;
    text-transform: uppercase;
    vertical-align: 0.3em;
    white-space: nowrap;
}
.teach-more { margin: 0 22px 10px; padding: 10px 12px; border-left: 2px solid var(--accent); background: var(--accent-soft); color: var(--text); font-size: 0.84rem; line-height: 1.5; }
.teach-more a { color: var(--accent); font-weight: 500; white-space: nowrap; }
.teach-toast > b { white-space: nowrap; }
@media (max-width: 600px) {
    .teach-line { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .teach-more { margin-left: 14px; margin-right: 14px; }
}

/* ---------- Teach OntoAgent: Clear and Forget everything ---------- */
.teach-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 0 22px 10px; }
.teach-row .teach-traits { padding: 0; }
.teach-tools { display: inline-flex; gap: 6px; }
.teach-tools button {
    padding: 5px 9px;
    border: 1px solid var(--rule-strong);
    background: var(--paper);
    color: var(--text);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.64rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    line-height: 1.2;
    text-transform: uppercase;
    white-space: nowrap;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.teach-tools button:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 600px) { .teach-row { padding-left: 14px; padding-right: 14px; } }

/* ---------- Teach OntoAgent: the easter egg hint ---------- */
.teach-guide .teach-egg { margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--rule-strong); color: var(--muted); font-size: 0.78rem; line-height: 1.4; }
.teach-guide .teach-egg button { display: inline; color: var(--accent); text-decoration-color: var(--accent); }

/* ---------- Footer: a quiet hint at the easter egg ---------- */
.legend .l-egg { color: var(--muted); font-style: italic; }
.legend .l-egg kbd { padding: 1px 5px; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--accent); font-family: var(--mono); font-size: 0.92em; font-style: normal; }

/* ---------- Teach OntoAgent: the conversation keeps one height and scrolls inside ---------- */
.teach-log {
    height: 200px;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--rule-strong) transparent;
}
.teach-log::-webkit-scrollbar { width: 6px; }
.teach-log::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 3px; }
.teach-log::-webkit-scrollbar-track { background: transparent; }
@media (max-width: 600px) { .teach-log { height: 180px; } }

/* ---------- Teach OntoAgent: the ontology printed as a tree ---------- */
.teach-line .teach-pre { display: block; white-space: pre; overflow-x: auto; color: var(--ink); font-family: var(--mono); font-size: 0.72rem; line-height: 1.5; }

/* ==========================================================
   Teach OntoAgent on this page: one tidy panel
   ========================================================== */
.teach { grid-template-columns: minmax(0, 1fr) minmax(0, 300px); }
.teach-head { padding: 18px 22px 0; }
.teach-head h3 { font-size: 1.35rem; }
.teach-head p { margin-top: 5px; max-width: 54ch; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }

/* the recruiter walk starts here, inside the agent */
.teach-recruit { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 12px 22px 0; padding: 8px 10px; border: 1px dashed var(--rule-strong); font-size: 0.84rem; line-height: 1.3; }
.teach-recruit span { margin-right: 4px; color: var(--text); }
.teach-recruit button {
    padding: 5px 10px;
    border: 1px solid var(--ink);
    background: var(--ink);
    color: var(--paper);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    line-height: 1.2;
    text-transform: uppercase;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.teach-recruit button:hover { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }

/* the conversation: you on the right, OntoAgent on the left */
.teach-log { height: 230px; margin-top: 12px; padding: 12px 22px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--paper); }
.teach-line { display: block; padding: 0; margin: 0 0 12px; font-size: 0.9rem; line-height: 1.5; }
.teach-line + .teach-line { border-top: 0; }
.teach-line:last-child { margin-bottom: 2px; }
.teach-line > b { display: block; margin-bottom: 3px; padding: 0; color: var(--muted); font-family: var(--mono); font-size: 0.6rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; }
.teach-line--page > b { color: var(--accent); }
.teach-say { max-width: 92%; padding: 9px 12px; border-left: 2px solid var(--accent); background: var(--surface); color: var(--text); }
.teach-line--you { text-align: right; }
.teach-line--you > b { display: none; }
.teach-line--you .teach-say { display: inline-block; max-width: 80%; padding: 6px 11px; border: 0; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 0.8rem; text-align: left; }
.teach-line--you span, .teach-line--you .teach-say { font-family: var(--mono); }
.tl-p { display: block; }
.tl-p + .tl-p, .tl-bullet + .tl-p, .tl-slot + .tl-p, .tl-try + .tl-p { margin-top: 6px; }
.tl-bullet { position: relative; display: block; margin-top: 3px; padding-left: 14px; }
.tl-bullet::before { content: ""; position: absolute; left: 2px; top: 0.62em; width: 5px; height: 5px; background: var(--accent); }
.tl-head { display: inline-block; margin: 8px 0 4px; padding: 2px 7px; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 0.7rem; font-weight: 500; letter-spacing: 0.06em; }
.tl-slot { display: grid; grid-template-columns: 6.6rem minmax(0, 1fr); gap: 0 8px; align-items: baseline; margin-top: 3px; }
.tl-slot > i { color: var(--muted); font-family: var(--mono); font-size: 0.64rem; font-style: normal; letter-spacing: 0.06em; text-transform: uppercase; overflow-wrap: anywhere; }
.tl-slot > span { display: flex; flex-wrap: wrap; gap: 3px 4px; }
.tl-slot em { padding: 1px 6px; border: 1px solid var(--rule-strong); background: var(--paper); color: var(--ink); font-family: var(--mono); font-size: 0.66rem; font-style: normal; line-height: 1.5; }
.tl-try { display: inline-block; margin: 6px 6px 0 0; padding: 3px 9px; border: 1px solid var(--accent); background: none; color: var(--accent); cursor: pointer; font-family: var(--mono); font-size: 0.7rem; line-height: 1.4; text-align: left; transition: background-color 0.15s ease, color 0.15s ease; }
.tl-try:hover { background: var(--accent); color: var(--accent-ink); }
.tl-link { display: block; margin-top: 7px; color: var(--accent); font-size: 0.82rem; font-weight: 500; }
.teach-line .teach-pre { max-width: 100%; white-space: pre; overflow-x: auto; font-family: var(--mono); font-size: 0.7rem; line-height: 1.5; }

.teach-form { padding: 12px 22px 8px; border-top: 0; }
.teach-row { padding: 0 22px 10px; }
.teach-traits li { font-size: 0.62rem; }
.teach-more { margin: 0 22px 8px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.teach-more a { color: var(--accent); font-weight: 500; white-space: nowrap; }
.teach-note { padding: 0 22px 14px; color: var(--muted); font-size: 0.72rem; line-height: 1.45; }

/* things to try: small groups of commands */
.teach-guide { padding: 18px 18px 14px; }
.teach-guide h4 { margin-bottom: 4px; }
.try-group { margin-top: 10px; }
.try-group h5 { color: var(--muted); font-family: var(--mono); font-size: 0.58rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; }
.try-group p { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.teach-guide .try-group button {
    display: inline-block;
    padding: 3px 8px;
    border: 1px solid var(--rule-strong);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.7rem;
    line-height: 1.45;
    text-align: left;
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.teach-guide .try-group button:hover { border-color: var(--accent); color: var(--accent); }
.teach-guide .try-group button.is-used { border-color: var(--c-true); color: var(--c-true); }
.teach-guide .teach-egg { margin-top: 14px; }
@media (max-width: 900px) { .teach { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
    .teach-head, .teach-form, .teach-row, .teach-note { padding-left: 14px; padding-right: 14px; }
    .teach-recruit, .teach-more { margin-left: 14px; margin-right: 14px; }
    .teach-log { height: 220px; padding-left: 14px; padding-right: 14px; }
    .teach-say { max-width: 100%; }
    .tl-slot { grid-template-columns: 5.4rem minmax(0, 1fr); }
}

/* ==========================================================
   OntoAgent comes along: docked at the left with a face, and
   the page goes dark around the section it is showing
   ========================================================== */
.agent-dock {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 95;
    width: min(320px, calc(100vw - 32px));
    max-height: calc(100vh - 110px);
    display: flex;
    flex-direction: column;
    border: 1px solid #2b3040;
    border-radius: 14px;
    background: #14161a;
    color: #f1efe9;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(159, 176, 255, 0.12);
    animation: agent-in 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes agent-in {
    from { opacity: 0; transform: translateX(-18px); }
    to { opacity: 1; transform: none; }
}
.agent-dock-head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 10px 14px; }
.agent-face-wrap { flex: none; width: 46px; height: 46px; }
.agent-face { display: block; width: 46px; height: 46px; overflow: visible; }
.agent-face .af-head { fill: #1b1f29; stroke: #9fb0ff; stroke-width: 1.6; }
.agent-face .af-ear { fill: #9fb0ff; opacity: 0.55; }
.agent-face .af-ant { stroke: #9fb0ff; stroke-width: 1.6; stroke-linecap: round; }
.agent-face .af-dot { fill: #4ade80; animation: af-pulse 2.2s ease-in-out infinite; transform-origin: 24px 4.5px; }
.agent-face .af-eyes { animation: af-look 7s ease-in-out infinite; }
.agent-face .af-eye { fill: #9fb0ff; transform-box: fill-box; transform-origin: center; animation: af-blink 4.6s infinite; }
.agent-face .af-mouth rect { fill: #9fb0ff; opacity: 0.75; transform-box: fill-box; transform-origin: center; }
.is-talking .agent-face .af-mouth rect { animation: af-talk 0.42s ease-in-out infinite; }
.is-talking .agent-face .af-mouth rect:nth-child(2) { animation-delay: 0.12s; }
.is-talking .agent-face .af-mouth rect:nth-child(3) { animation-delay: 0.24s; }
@keyframes af-blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.12); } }
@keyframes af-look { 0%, 40%, 100% { transform: translateX(1.4px); } 55%, 80% { transform: translateX(-0.6px); } }
@keyframes af-talk { 0%, 100% { transform: scaleY(0.6); } 50% { transform: scaleY(2.1); } }
@keyframes af-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.55; transform: scale(0.7); } }
.agent-dock-who { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.agent-dock-who b { display: block; color: #fff; font-size: 0.98rem; font-weight: 600; }
.agent-dock-who span { display: block; margin-top: 2px; color: rgba(255, 255, 255, 0.58); font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; }
.agent-dock-x { flex: none; align-self: flex-start; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.8); cursor: pointer; font-size: 1.05rem; line-height: 1; }
.agent-dock-x:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }
.agent-dock-dots { display: flex; gap: 4px; margin: 0 14px; }
.agent-dock-dots i { flex: 1 1 0; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.18); }
.agent-dock-dots i.is-done { background: #4ade80; }
.agent-dock-dots i.is-on { background: #9fb0ff; }
.agent-dock-main { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px 14px 4px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.25) transparent; }
.agent-dock-main h4 { color: #fff; font-family: var(--serif); font-size: 1.22rem; font-weight: 500; letter-spacing: -0.01em; line-height: 1.2; }
.agent-dock-text, .agent-dock-more, .agent-dock-away { margin-top: 8px; color: rgba(255, 255, 255, 0.88); font-size: 0.88rem; line-height: 1.52; }
.agent-dock-more { padding-left: 10px; border-left: 2px solid #9fb0ff; color: rgba(255, 255, 255, 0.78); }
.agent-dock-away { color: rgba(255, 255, 255, 0.6); font-size: 0.8rem; }
.agent-dock-link { padding: 0; border: 0; background: none; color: #9fb0ff; cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 0.2em; }
.agent-dock-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 14px; }
.agent-btn {
    display: inline-block;
    padding: 8px 11px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 7px;
    background: none;
    color: #fff;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.64rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.agent-btn:hover { border-color: #fff; background: #fff; color: #14161a; }
.agent-btn--solid { margin-left: auto; border-color: #9fb0ff; background: #9fb0ff; color: #14161a; }

/* the spotlight: the section being shown stays lit, everything else dims */
.agent-spot .agent-focus {
    position: relative;
    z-index: 90;
    background-color: var(--paper);
    box-shadow: 0 0 0 14px var(--paper), 0 0 0 100vmax rgba(10, 12, 16, 0.66);
    animation: agent-spot 0.5s ease both;
}
@keyframes agent-spot {
    from { box-shadow: 0 0 0 14px var(--paper), 0 0 0 100vmax rgba(10, 12, 16, 0); }
    to { box-shadow: 0 0 0 14px var(--paper), 0 0 0 100vmax rgba(10, 12, 16, 0.66); }
}
.agent-pointer { margin-left: 12px; padding: 2px 8px; background: var(--accent); color: var(--accent-ink); font-family: var(--mono); font-size: 0.6rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; animation: agent-point 1.6s ease-in-out infinite; }
@keyframes agent-point {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-5px); }
}
.agent-along .teach-toast { display: none; }
@media (max-width: 700px) {
    .agent-dock { left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 52vh; border-radius: 12px; }
    .agent-dock-head { padding: 10px 10px 8px 12px; }
    .agent-face-wrap, .agent-face { width: 38px; height: 38px; }
    .agent-dock-main h4 { font-size: 1.08rem; }
    .agent-dock-text, .agent-dock-more { font-size: 0.84rem; }
}
@media (prefers-reduced-motion: reduce) {
    .agent-dock, .agent-pointer, .agent-spot .agent-focus, .agent-face .af-dot, .agent-face .af-eyes, .agent-face .af-eye, .is-talking .agent-face .af-mouth rect { animation: none; }
}
@media print { .agent-dock, .agent-pointer { display: none; } .agent-spot .agent-focus { box-shadow: none; } }

/* ==========================================================
   Home: an invitation to the agent
   ========================================================== */
.assist {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 560px;
    margin-top: 24px;
    padding: 12px 14px;
    border: 1px solid var(--ink);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.assist:hover { border-color: var(--accent); box-shadow: 5px 5px 0 0 var(--accent-soft); transform: translate(-1px, -1px); }
.assist-mark { position: relative; display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; background: var(--accent); color: var(--accent-ink); font-family: var(--mono); font-size: 0.8rem; font-weight: 500; }
.assist-mark::after { content: ""; position: absolute; inset: -5px; border: 1px solid var(--accent); opacity: 0; animation: assist-ring 2.6s ease-out infinite; }
@keyframes assist-ring {
    0% { transform: scale(0.85); opacity: 0.7; }
    70%, 100% { transform: scale(1.25); opacity: 0; }
}
.assist-text { flex: 1 1 auto; min-width: 0; }
.assist-text b { display: block; font-family: var(--serif); font-size: 1.18rem; font-weight: 500; letter-spacing: -0.01em; line-height: 1.25; }
.assist-text small { display: block; margin-top: 3px; color: var(--muted); font-size: 0.82rem; line-height: 1.4; }
.assist-go { flex: none; color: var(--accent); font-size: 1.3rem; transition: transform 0.15s ease; }
.assist:hover .assist-go { transform: translateX(4px); }
@media (min-width: 1240px) {
    .assist { position: absolute; right: 0; top: calc(var(--node-pad) + 8px); flex-direction: column; align-items: flex-start; gap: 12px; width: 270px; margin: 0; padding: 18px; }
    .assist-go { align-self: flex-end; margin-top: -6px; }
}
@media (prefers-reduced-motion: reduce) { .assist-mark::after { animation: none; } }
@media print { .assist { display: none; } }

/* ---------- Things to try: the recruiter entry, highlighted ---------- */
.try-recruit { margin-top: 10px; padding: 10px 12px 11px; border: 1px solid var(--accent); background: var(--accent-soft); }
.try-recruit h5 { color: var(--ink); font-family: var(--serif); font-size: 1.02rem; font-weight: 500; letter-spacing: -0.005em; line-height: 1.2; text-transform: none; }
.try-recruit p { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.teach-guide .try-recruit button {
    display: inline-block;
    flex: 1 1 auto;
    padding: 6px 10px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.teach-guide .try-recruit button:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- The ontology, in a window of its own ---------- */
.tl-onto { display: inline-block; margin: 7px 6px 0 0; padding: 4px 10px; border: 1px solid var(--c-true); background: var(--c-true); color: #fff; cursor: pointer; font-family: var(--mono); font-size: 0.68rem; font-weight: 500; letter-spacing: 0.04em; line-height: 1.4; }
.tl-onto:hover { background: var(--ink); border-color: var(--ink); }
.onto-pop { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 18px; background: rgba(20, 22, 26, 0.55); animation: onto-fade 0.2s ease both; }
@keyframes onto-fade { from { opacity: 0; } to { opacity: 1; } }
.onto-card { display: flex; flex-direction: column; width: min(860px, 100%); max-height: min(84vh, 760px); border: 1px solid var(--ink); background: var(--surface); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35); }
.onto-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px 12px; border-bottom: 1px solid var(--rule); }
.onto-title h4 { color: var(--ink); font-family: var(--serif); font-size: 1.5rem; font-weight: 500; letter-spacing: -0.01em; line-height: 1.15; }
.onto-title p { margin-top: 4px; color: var(--muted); font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; }
.onto-x { flex: none; width: 34px; height: 34px; border: 1px solid var(--rule-strong); background: var(--paper); color: var(--ink); cursor: pointer; font-size: 1.2rem; line-height: 1; }
.onto-x:hover { border-color: var(--ink); }
.onto-key { display: flex; flex-wrap: wrap; gap: 6px 10px; padding: 10px 20px; border-bottom: 1px solid var(--rule); background: var(--paper); }
.onto-body { flex: 1 1 auto; overflow: auto; padding: 14px 20px 18px; overscroll-behavior: contain; }
.onto-tree, .onto-tree ul { list-style: none; margin: 0; padding: 0; }
.onto-tree ul { margin-left: 9px; padding-left: 16px; border-left: 1px solid var(--rule-strong); }
.onto-tree li { position: relative; padding-top: 6px; }
.onto-tree ul > li::before { content: ""; position: absolute; left: -16px; top: 18px; width: 12px; height: 1px; background: var(--rule-strong); }
.onto-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.onto-chip { display: inline-block; padding: 2px 8px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); font-family: var(--mono); font-size: 0.7rem; font-weight: 500; letter-spacing: 0.03em; line-height: 1.5; white-space: nowrap; }
.onto-chip.is-inst { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.onto-chip.is-taught { border-color: var(--c-true); background: var(--c-true); color: #fff; }
.onto-chip.is-focus { outline: 3px solid var(--accent-soft); outline-offset: 2px; box-shadow: 0 0 0 2px var(--accent); }
.onto-rel { color: var(--muted); font-size: 0.74rem; line-height: 1.5; }
.onto-rel i { color: var(--text); font-family: var(--mono); font-size: 0.62rem; font-style: normal; letter-spacing: 0.06em; }
.onto-foot { padding: 10px 20px 14px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.72rem; line-height: 1.5; }
.onto-foot a { color: var(--accent); white-space: nowrap; }
@media (max-width: 600px) {
    .onto-pop { padding: 8px; }
    .onto-head, .onto-key, .onto-body, .onto-foot { padding-left: 14px; padding-right: 14px; }
    .onto-tree ul { margin-left: 5px; padding-left: 12px; }
    .onto-tree ul > li::before { left: -12px; width: 9px; }
}
@media (prefers-reduced-motion: reduce) { .onto-pop { animation: none; } }
@media print { .onto-pop { display: none; } }

/* ==========================================================
   Teach OntoAgent: the compact layout again
   (plain conversation lines, fixed height, a short list beside it)
   ========================================================== */
.teach { grid-template-columns: minmax(0, 1fr) minmax(0, 320px); max-width: 1040px; }
.teach-head { padding: 16px 22px 0; }
.teach-head h3 { font-size: 1.3rem; }
.teach-head p { margin-top: 4px; max-width: 56ch; color: var(--text); font-size: 0.92rem; line-height: 1.55; }

.teach-log { height: 200px; margin-top: 12px; padding: 4px 22px; border-top: 1px solid var(--rule); border-bottom: 0; background: none; }
.teach-line { display: grid; grid-template-columns: 5.3rem minmax(0, 1fr); gap: 0 10px; margin: 0; padding: 5px 0; font-size: 0.9rem; line-height: 1.5; text-align: left; }
.teach-line + .teach-line { border-top: 1px dashed var(--rule); }
.teach-line:last-child { margin-bottom: 0; }
.teach-line > b, .teach-line--you > b { display: block; margin: 0; padding-top: 0.25em; color: var(--muted); font-family: var(--mono); font-size: 0.66rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.teach-line--page > b { color: var(--accent); }
.teach-say, .teach-line--you .teach-say { display: block; max-width: none; padding: 0; border: 0; background: none; color: var(--text); text-align: left; }
.teach-line--you .teach-say { color: var(--ink); font-family: var(--mono); font-size: 0.84rem; }
/* structured parts of a reply stay small */
.tl-p + .tl-p, .tl-bullet + .tl-p, .tl-slot + .tl-p, .tl-try + .tl-p { margin-top: 4px; }
.tl-bullet { margin-top: 2px; font-size: 0.86rem; }
.tl-head { margin: 5px 0 2px; font-size: 0.66rem; }
.tl-slot { grid-template-columns: 6rem minmax(0, 1fr); margin-top: 2px; }
.tl-try, .tl-onto { margin-top: 4px; padding: 2px 8px; font-size: 0.68rem; }
.tl-link { margin-top: 4px; font-size: 0.8rem; }

.teach-form { padding: 10px 22px; border-top: 1px solid var(--rule); }
.teach-row { padding: 0 22px 8px; }
.teach-more { margin: 0 22px 8px; padding: 8px 12px; border-left: 2px solid var(--accent); background: var(--accent-soft); color: var(--text); font-size: 0.82rem; line-height: 1.5; }
.teach-note { padding: 0 22px 12px; font-size: 0.74rem; }

/* the list beside it: recruiter line on top, then the commands */
.teach-guide { padding: 16px 18px 12px; }
.teach-guide h4 { margin-bottom: 0; }
.teach-guide .try-recruit { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 6px; margin: 8px 0 2px; padding: 6px 8px; border: 1px solid var(--accent); background: var(--accent-soft); }
.teach-guide .try-recruit b { margin-right: auto; color: var(--ink); font-family: var(--mono); font-size: 0.74rem; font-weight: 500; }
.teach-guide .try-recruit button {
    display: inline-block;
    flex: none;
    padding: 4px 8px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    line-height: 1.2;
    text-decoration: none;
    text-transform: uppercase;
}
.teach-guide .try-recruit button:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); }
@media (max-width: 900px) { .teach { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
    .teach-head, .teach-log, .teach-form, .teach-row, .teach-note { padding-left: 14px; padding-right: 14px; }
    .teach-more { margin-left: 14px; margin-right: 14px; }
    .teach-log { height: 180px; }
    .teach-line { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
.teach-guide .try-recruit { flex-wrap: nowrap; }
.teach-guide .try-recruit b { font-size: 0.7rem; white-space: nowrap; }
.teach-guide .try-recruit button { padding: 4px 6px; letter-spacing: 0.03em; }

/* ---------- The docked agent: tucked away, and the header in spotlight mode ---------- */
.agent-dock { width: min(300px, calc(100vw - 32px)); }
button.agent-face-wrap { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 12px; transition: transform 0.15s ease; }
button.agent-face-wrap:hover { transform: scale(1.08) rotate(-4deg); }
.agent-dock-x + .agent-dock-x { margin-left: -6px; }
.agent-dock.is-min { width: auto; }
.agent-dock.is-min .agent-dock-dots, .agent-dock.is-min .agent-dock-main { display: none; }
.agent-dock.is-min .agent-dock-head { padding-bottom: 6px; }
.agent-dock.is-min .agent-dock-actions { padding-top: 4px; }
.agent-dock.is-min .agent-dock-actions .agent-btn:not(.agent-btn--solid) { display: none; }
.agent-dock.is-min .agent-btn--solid { margin-left: 0; flex: 1 1 auto; }
/* the nav bar stays on top of the lit section, dimmed like the rest of the page */
.agent-spot .site-head { z-index: 92; }
.agent-spot .site-head::after { content: ""; position: absolute; inset: 0; background: rgba(10, 12, 16, 0.66); pointer-events: none; }
.agent-along .bt-bar { visibility: hidden; }

/* ---------- "No LLMs inside" flashes; the industry button is the quiet one ---------- */
.teach-badge { animation: badge-flash 2.4s ease-in-out infinite; }
@keyframes badge-flash {
    0%, 55%, 100% { background: transparent; color: var(--c-true); box-shadow: 0 0 0 0 transparent; }
    65%, 85% { background: var(--c-true); color: #fff; box-shadow: 0 0 0 4px rgba(21, 128, 61, 0.18); }
    75% { background: transparent; color: var(--c-true); box-shadow: 0 0 0 0 transparent; }
}
.teach-guide .try-recruit button.is-quiet { border-color: var(--rule-strong); background: transparent; color: var(--muted); }
.teach-guide .try-recruit button.is-quiet:hover { border-color: var(--ink); background: transparent; color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .teach-badge { animation: none; } }

/* "No LLMs inside": a slow, quiet glow instead of a flash */
.teach-badge { animation: badge-breathe 4.5s ease-in-out infinite; }
@keyframes badge-breathe {
    0%, 100% { background: transparent; box-shadow: 0 0 0 0 rgba(21, 128, 61, 0); }
    50% { background: rgba(21, 128, 61, 0.1); box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.1); }
}
@media (prefers-reduced-motion: reduce) { .teach-badge { animation: none; } }

/* the closing remark of the walk-through */
.agent-dock-coda { margin-top: 10px; padding: 9px 11px; border: 1px dashed rgba(159, 176, 255, 0.55); border-radius: 8px; color: #c9d2ff; font-size: 0.84rem; line-height: 1.5; }

/* ---------- Home: the invitation sits under the welcome, above News ---------- */
@media (min-width: 1240px) {
    .assist { position: static; flex-direction: row; align-items: center; gap: 14px; width: auto; max-width: 560px; margin: 24px 0 0; padding: 12px 14px; }
    .assist-go { align-self: auto; margin-top: 0; }
}
/* one news item in the spotlight */
.agent-spot li.agent-focus { box-shadow: 0 0 0 12px var(--paper), 0 0 0 100vmax rgba(10, 12, 16, 0.66); }

/* "OntoAgent" stands out in the panel title */
.teach-head h3 { line-height: 1.15; }
.teach-name { font-size: 1.55em; font-weight: 500; letter-spacing: -0.02em; line-height: 1; }
.teach-more { margin-bottom: 14px; }

/* ---------- Teach OntoAgent: type sizes, so only the title, the conversation
   and the input stand out ---------- */
.teach-head p { margin-top: 5px; max-width: 64ch; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.teach-line { font-size: 0.88rem; }
.teach-traits li { font-size: 0.58rem; letter-spacing: 0.06em; }
.teach-tools button { padding: 4px 8px; font-size: 0.6rem; }
.teach-more { padding: 7px 11px; background: none; border-left-color: var(--rule-strong); color: var(--muted); font-size: 0.76rem; line-height: 1.5; }
.teach-more a { font-weight: 500; }
.teach-guide h4 { font-size: 0.64rem; }
.teach-guide li button { font-size: 0.72rem; }
.teach-guide .teach-egg { font-size: 0.72rem; }

/* Home invitation: "No, it is not an LLM" stands out */
.assist-not { color: var(--c-true); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; white-space: nowrap; }
@media (min-width: 1240px) { .assist { max-width: 640px; } }
.assist { max-width: 640px; }

/* ==========================================================
   Phones and narrow screens: the OntoAgent panel for visitors
   who arrive from a shared link
   ========================================================== */
@media (max-width: 900px) {
    /* one column, and "things to try" moves up to sit right under the input */
    .teach { display: flex; flex-direction: column; }
    .teach-main { display: contents; }
    .teach-head { order: 1; }
    .teach-log { order: 2; }
    .teach-form { order: 3; }
    .teach-guide { order: 4; }
    .teach-row { order: 5; }
    .teach-more { order: 6; }

    .teach-guide { padding: 0 22px 10px; border: 0; background: none; }
    .teach-guide h4 { margin: 0 0 6px; }
    .teach-guide .try-recruit { margin: 0 0 8px; }
    /* the commands become one row to swipe through */
    .teach-guide ol {
        display: flex;
        gap: 6px;
        margin: 0 -22px 0 0;
        padding: 0 22px 6px 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
        mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
    }
    .teach-guide ol::-webkit-scrollbar { display: none; }
    .teach-guide li { flex: none; padding: 0; }
    .teach-guide li + li { border-top: 0; }
    .teach-guide li::before { display: none; }
    .teach-guide li button {
        display: block;
        min-height: 36px;
        padding: 6px 12px;
        border: 1px solid var(--rule-strong);
        background: var(--surface);
        font-size: 0.76rem;
        line-height: 1.3;
        text-decoration: none;
        white-space: nowrap;
    }
    .teach-guide li.is-used button { border-color: var(--c-true); color: var(--c-true); }
    .teach-guide .teach-egg { display: none; }
}
@media (max-width: 700px) {
    /* 16px stops iOS from zooming the page when the input is tapped */
    .teach-form input { padding: 10px; font-size: 16px; }
    .teach-form .btn { min-height: 44px; }
    /* things a thumb has to hit */
    .tl-try, .tl-onto { min-height: 34px; margin-top: 6px; padding: 6px 11px; font-size: 0.76rem; }
    .tl-link { padding: 6px 0; font-size: 0.86rem; }
    .teach-tools { flex-wrap: wrap; }
    .teach-tools button { min-height: 34px; padding: 6px 10px; font-size: 0.64rem; }
    .teach-guide .try-recruit { flex-wrap: wrap; }
    .teach-guide .try-recruit button { min-height: 36px; padding: 6px 12px; font-size: 0.68rem; }
    .agent-btn { min-height: 40px; padding: 10px 13px; font-size: 0.7rem; }
    .agent-dock-x { width: 36px; height: 36px; }
    .onto-x { width: 40px; height: 40px; }
    .teach-toast { left: 8px; right: 8px; bottom: 10px; width: auto; max-width: none; transform: none; }
    .teach-toast button { min-height: 34px; }
    .teach-toast a { padding: 6px 0; }
}
@media (max-width: 600px) {
    .teach-guide { padding-left: 14px; padding-right: 14px; }
    .teach-guide ol { margin-right: -14px; padding-right: 14px; }
}
/* the walk-through on a phone: a sheet across the bottom, kept short */
@media (max-width: 700px) {
    .agent-dock { left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 46vh; }
    .agent-dock.is-min { right: auto; }
    .agent-dock-head { padding: 10px 10px 8px 12px; }
    .agent-dock-main { padding: 8px 12px 2px; }
    .agent-dock-main h4 { font-size: 1.05rem; }
    .agent-dock-text, .agent-dock-more, .agent-dock-coda { margin-top: 6px; font-size: 0.82rem; line-height: 1.45; }
    .agent-dock-actions { padding: 8px 12px 12px; }
    .agent-spot .agent-focus { box-shadow: 0 0 0 10px var(--paper), 0 0 0 100vmax rgba(10, 12, 16, 0.66); }
}

/* ---------- Things to try: "I am a recruiter" is the last item, highlighted ---------- */
.teach-guide li.is-key { margin-top: 6px; padding: 6px 8px 6px 32px; border: 1px solid var(--accent); background: var(--accent-soft); }
.teach-guide li.is-key + li, .teach-guide li + li.is-key { border-top: 1px solid var(--accent); }
.teach-guide li.is-key::before { left: 8px; top: 8px; border-color: var(--accent); color: var(--accent); }
.teach-guide li.is-key button { color: var(--ink); font-weight: 500; text-decoration: none; }
.teach-guide li.is-key button:hover { color: var(--accent); }
@media (max-width: 900px) {
    /* in the swipe row it goes first, so it is not hidden off the edge */
    .teach-guide li.is-key { order: -1; margin: 0; padding: 0; border: 0; background: none; }
    .teach-guide li.is-key button { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
    .teach-guide li.is-key button:hover { color: var(--accent-ink); }
}

/* ==========================================================
   One ontological concept: a button in the chat, a frame in a
   window when clicked, a small card on hover
   ========================================================== */
.tl-concept {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 6px 6px 0 0;
    padding: 3px 4px 3px 9px;
    border: 1px solid var(--ink);
    background: var(--paper);
    color: var(--text);
    cursor: pointer;
    font-family: var(--sans);
    font-size: 0.76rem;
    line-height: 1.4;
    text-align: left;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.tl-concept b { padding: 1px 7px; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 0.66rem; font-weight: 500; letter-spacing: 0.04em; }
.tl-concept:hover, .tl-concept:focus-visible { border-color: var(--accent); color: var(--accent); }
.tl-concept:hover b, .tl-concept:focus-visible b { background: var(--accent); color: var(--accent-ink); }

/* the frame window */
.onto-card--frame { width: min(620px, 100%); }
.frame-kicker { margin: 0; color: var(--muted); font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.1em; text-transform: uppercase; }
.onto-title .frame-kicker { margin-top: 0; }
.onto-title .frame-name { display: inline-block; margin-top: 8px; padding: 4px 12px; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 1.15rem; font-weight: 500; letter-spacing: 0.04em; line-height: 1.3; }
.frame { padding-top: 16px; }
.frame-row { display: grid; grid-template-columns: 8.2rem minmax(0, 1fr); gap: 4px 14px; align-items: start; padding: 9px 0; border-top: 1px solid var(--rule); }
.frame-row:first-child { padding-top: 0; border-top: 0; }
.frame-slot { padding-top: 3px; color: var(--accent); font-family: var(--mono); font-size: 0.68rem; font-weight: 500; letter-spacing: 0.08em; }
.frame-vals { display: flex; flex-wrap: wrap; gap: 5px 6px; min-width: 0; }
.frame-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 5px; width: 100%; }
.frame-arrow { color: var(--muted); font-style: normal; font-size: 0.8rem; }
.frame-sep { margin: 14px 0 2px; padding-top: 12px; border-top: 1px dashed var(--rule-strong); color: var(--muted); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; }
.frame-sep + .frame-row { border-top: 0; }
button.onto-chip { cursor: pointer; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
button.onto-chip:hover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.frame-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--rule); background: var(--paper); }
.frame-btn {
    display: inline-block;
    padding: 8px 12px;
    border: 1px solid var(--ink);
    background: var(--paper);
    color: var(--ink);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    line-height: 1.2;
    text-decoration: none;
    text-transform: uppercase;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.frame-btn:hover { border-color: var(--accent); color: var(--accent); }
.frame-btn--solid { background: var(--ink); color: var(--paper); }
.frame-btn--solid:hover { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }

/* the hover card */
.frame-peek {
    position: fixed;
    z-index: 110;
    width: max-content;
    max-width: min(340px, calc(100vw - 16px));
    padding: 10px 12px;
    border: 1px solid var(--ink);
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    animation: onto-fade 0.15s ease both;
}
.frame-peek b { display: inline-block; margin-bottom: 4px; padding: 2px 8px; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 0.7rem; font-weight: 500; letter-spacing: 0.04em; }
.frame-peek p { margin-top: 3px; color: var(--text); font-family: var(--mono); font-size: 0.68rem; line-height: 1.5; }
.frame-peek p i { display: inline-block; min-width: 6.6rem; color: var(--accent); font-style: normal; letter-spacing: 0.05em; }
.frame-peek small { display: block; margin-top: 7px; color: var(--muted); font-size: 0.7rem; }
@media (max-width: 600px) {
    .frame-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
    .frame-actions { padding-left: 14px; padding-right: 14px; }
    .frame-btn { min-height: 38px; padding: 10px 12px; }
    .tl-concept { min-height: 34px; padding: 5px 5px 5px 10px; }
}
@media (prefers-reduced-motion: reduce) { .frame-peek { animation: none; } }
@media print { .frame-peek { display: none; } }

/* "I am a recruiter (for university search committees)" */
.teach-guide li.is-key small { display: block; margin-top: 1px; color: var(--muted); font-size: 0.9em; font-weight: 400; }
.teach-guide li.is-key .key-short { display: none; }
@media (max-width: 900px) {
    .teach-guide li.is-key small { display: inline; margin: 0; color: inherit; opacity: 0.85; }
    .teach-guide li.is-key .key-long { display: none; }
    .teach-guide li.is-key .key-short { display: inline; }
}
@media (max-width: 900px) {
    .teach-guide li.is-key small { color: var(--accent-ink); opacity: 0.92; font-size: 1em; }
}
/* the two wordings inside the recruiter item inherit its look (an older rule greys list spans) */
.teach-guide li.is-key small span { display: inline; margin: 0; color: inherit; font-size: inherit; line-height: inherit; }
.teach-guide li.is-key small .key-short { display: none; }
@media (max-width: 900px) {
    .teach-guide li.is-key small .key-long { display: none; }
    .teach-guide li.is-key small .key-short { display: inline; }
}


/* ================================================================== */
/* Project pages: fact strip, link cards, video cards                  */
/* ================================================================== */

/* facts under a project's header */
.glance {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0 clamp(18px, 3vw, 36px);
    max-width: calc(960px + var(--grow, 0px) * 0.857);
    margin-top: 34px;
}
.glance > div { padding: 12px 0 14px; border-top: 1px solid var(--ink); }
.glance dt {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.glance dd { margin: 5px 0 0; font-size: 0.95rem; line-height: 1.4; }
.glance dd a { color: var(--ink); }
.glance dd a:hover { color: var(--accent); }

/* a small heading inside a section */
h3.sub {
    margin: 34px 0 14px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* groups of links */
.lgroup { max-width: calc(960px + var(--grow, 0px) * 0.857); }
.lgroup + .lgroup { margin-top: 28px; }
.lgroup > h3 {
    margin-bottom: 12px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.lcards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(218px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.lcards > li { display: flex; margin: 0; }
.lcard {
    --k: var(--c-note);
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 5px;
    padding: 13px 15px 12px;
    border: 1px solid var(--rule);
    border-left: 3px solid var(--k);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.lcard:hover { border-color: var(--k); transform: translateY(-2px); }
.lcard--paper { --k: var(--c-paper); }
.lcard--code { --k: var(--c-grant); }
.lcard--video, .lcard--demo { --k: var(--c-award); }
.lcard--lab { --k: var(--c-talk); }
.lcard--site { --k: var(--c-workshop); }
.lcard--poster { --k: var(--c-poster); }
.lcard--news { --k: var(--c-award); }
.lcard--page { --k: var(--c-note); }
.lcard-kind {
    color: var(--k);
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.lcard b { font-size: 1rem; font-weight: 600; line-height: 1.3; }
.lcard-text { color: var(--muted); font-size: 0.86rem; line-height: 1.45; }
.lcard-where {
    margin-top: auto;
    padding-top: 8px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.02em;
}
.lcard:hover .lcard-where { color: var(--k); }

/* videos that live elsewhere, with their picture */
.vcards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    max-width: calc(960px + var(--grow, 0px) * 0.857);
    margin: 0;
    padding: 0;
    list-style: none;
}
.vcards > li { margin: 0; }
.vcard { display: block; color: var(--ink); text-decoration: none; }
.vcard-img {
    position: relative;
    display: block;
    overflow: hidden;
    border: 1px solid var(--rule);
    background: #000;
    aspect-ratio: 16 / 9;
}
.vcard-img img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s ease, opacity 0.2s ease; }
.vcard:hover .vcard-img img { transform: scale(1.04); opacity: 0.85; }
.vcard-img i {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(20, 22, 26, 0.72);
    transform: translate(-50%, -50%);
    transition: background 0.15s ease;
}
.vcard-img i::after {
    content: "";
    position: absolute;
    left: 15px;
    top: 11px;
    border-style: solid;
    border-width: 8px 0 8px 12px;
    border-color: transparent transparent transparent #fff;
}
.vcard:hover .vcard-img i { background: var(--c-paper); }
.vcard b { display: block; margin-top: 10px; font-size: 1rem; font-weight: 600; line-height: 1.3; }
.vcard:hover b { color: var(--accent); }
.vcard-text { display: block; margin-top: 3px; color: var(--muted); font-size: 0.86rem; line-height: 1.45; }

/* two pictures side by side at one height: each figure grows by its own width-to-height ratio */
.duo { display: flex; gap: 14px; max-width: calc(960px + var(--grow, 0px) * 0.857); align-items: flex-start; }
.duo > .figure { flex: var(--r, 1) 1 0; min-width: 0; margin: 0; }
.duo > .figure + .figure { margin-top: 0; }
.duo + .prose { margin-top: 28px; }

.tiles--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tiles--4 .tile { padding: 16px 16px 18px; }
.tiles--4 .tile h3 { font-size: 1.08rem; }
.tiles--4 .tile p { font-size: 0.9rem; }

.node > .lgroup + .more, .node > .vcards + .footnote { margin-top: 18px; }

@media (max-width: 900px) {
    .vcards, .tiles--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .glance { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 26px; }
    .lcards { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .lcard { padding: 12px 14px; }
    .duo { flex-direction: column; }
    .duo > .figure { flex: none; width: 100%; }
    .vcards { gap: 12px; }
    .tiles--4 { grid-template-columns: minmax(0, 1fr); }
}
@media print {
    .vcards, .lgroup { display: none !important; }
}

.lcard--patent { --k: var(--c-patent); }
.duo--device { max-width: calc(760px + var(--grow, 0px) * 0.679); }

/* ---------- Pocket agent: basis tags in the concept windows ---------- */
.onto-chip.is-told { border-style: dashed; border-color: var(--c-true); }
.frame-tag { padding: 2px 8px; border: 1px solid var(--rule-strong); color: var(--muted); font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.04em; line-height: 1.5; }
.frame-tag.is-taught { border-color: var(--c-true); color: var(--c-true); }
.frame-tag.is-inferred { border-style: dashed; }
.frame-from { align-self: center; color: var(--muted); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.04em; }

/* ---------- Pocket agent: text to meaning and back (the strip and its window) ---------- */
.teach-log { height: 172px; }
.teach-mind { display: flex; align-items: stretch; width: 100%; margin: 0; padding: 0 22px; border: 0; border-top: 1px solid var(--rule); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.tm-s { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 1px; padding: 6px 18px 6px 0; box-shadow: inset 0 2px 0 transparent; transition: box-shadow 0.25s ease; }
.tm-s:not(:last-child)::after { content: "\25B8"; position: absolute; right: 5px; top: 50%; transform: translateY(-50%); color: var(--rule-strong); font-size: 0.7rem; }
.tm-s i { color: var(--muted); font-family: var(--mono); font-size: 0.54rem; font-style: normal; letter-spacing: 0.1em; text-transform: uppercase; transition: color 0.25s ease; }
.tm-s b { overflow: hidden; color: var(--ink); font-family: var(--mono); font-size: 0.62rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; transition: color 0.25s ease; }
.teach-mind.is-empty .tm-s b { color: var(--muted); font-weight: 400; }
.tm-s.is-on { box-shadow: inset 0 2px 0 var(--accent); }
.tm-s.is-on i, .tm-s.is-on b { color: var(--accent); }
.teach-mind:hover .tm-s i { color: var(--accent); }
.teach-mind:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mind-step { margin: 16px 0 8px; color: var(--muted); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; }
.mind-step:first-child { margin-top: 0; }
.mind-tokens { display: flex; flex-wrap: wrap; gap: 6px; }
.mind-tok { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 9px 5px; border: 1px solid var(--rule-strong); background: var(--paper); }
.mind-tok b { font-size: 0.84rem; font-weight: 500; }
.mind-tok i { color: var(--accent); font-family: var(--mono); font-size: 0.58rem; font-style: normal; letter-spacing: 0.04em; }
.mind-tok.is-f { border-color: var(--rule); opacity: 0.6; }
.mind-tok.is-f i { color: var(--muted); }
.mind-tok.is-unk { border-style: dashed; border-color: var(--c-award); }
.mind-tok.is-unk i { color: var(--c-award); }
.mind-frame { margin-top: 6px; padding: 9px 12px 10px; border: 1px solid var(--rule); border-left: 3px solid var(--accent); background: var(--paper); }
.mind-frame h5 { margin: 0 0 4px; font-family: var(--mono); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.04em; }
.mind-frame p { display: grid; grid-template-columns: 7.4rem minmax(0, 1fr); gap: 0 10px; margin: 0; font-family: var(--mono); font-size: 0.68rem; line-height: 1.65; }
.mind-frame p i { color: var(--accent); font-style: normal; letter-spacing: 0.04em; }
.mind-frame p.mind-rule { display: block; font-family: inherit; font-size: 0.88rem; line-height: 1.5; }
.mind-say { font-size: 0.92rem; line-height: 1.5; }
@media (max-width: 900px) { .teach-mind { order: 2; } }
@media (max-width: 600px) {
    .teach-log { height: 156px; }
    .teach-mind { padding-left: 14px; padding-right: 14px; }
    .tm-s[data-k="text"], .tm-s[data-k="say"] { display: none; }
    .tm-s[data-k="gmr"]::after { content: none; }
    .mind-frame p { grid-template-columns: 5.6rem minmax(0, 1fr); }
}

/* ---------- Pocket agent: the room, and the two layers under it ---------- */
.teach { grid-template-columns: minmax(0, 1fr) minmax(0, 340px); grid-template-areas: "main world" "main guide"; grid-template-rows: auto 1fr; }
.teach-main { grid-area: main; }
.teach-world { grid-area: world; min-width: 0; border-left: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--paper); }
.teach-guide { grid-area: guide; }
.teach-world canvas { display: block; width: 100%; height: 200px; cursor: grab; touch-action: pan-y; }
.teach-world canvas:active { cursor: grabbing; }
.tw-layers { padding: 2px 14px 10px; border-top: 1px dashed var(--rule); }
.tw-layer { display: block; margin: 6px 0 0; }
.tw-layer i { display: block; color: var(--muted); font-family: var(--mono); font-size: 0.54rem; font-style: normal; letter-spacing: 0.1em; text-transform: uppercase; }
.tw-layer[data-layer="s"] i { color: var(--accent); }
.tw-chips { display: flex; gap: 3px; min-height: 19px; margin-top: 3px; overflow: hidden; color: var(--muted); font-family: var(--mono); font-size: 0.58rem; line-height: 1.5; white-space: nowrap; }
.tw-chip { flex: none; padding: 0 5px; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink); }
.tw-chip.is-cond { border-radius: 9px; }
.tw-chip.is-run { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); animation: bt-glow 1.2s ease-in-out infinite; }
.tw-chip.is-ok { border-color: var(--c-true); color: var(--c-true); }
.tw-chip.is-fail { border-color: var(--c-award); color: var(--c-award); }
@media (min-width: 901px) {
    .teach-guide ol { max-height: 118px; overflow-y: auto; padding-right: 6px; scrollbar-width: thin; }
    .teach-guide li.is-key { position: sticky; bottom: 0; background: var(--paper); box-shadow: inset 0 0 0 100px var(--accent-soft); }
}
@media (max-width: 900px) {
    .teach-world { order: 1; border-left: 0; border-top: 1px solid var(--rule); }
    .teach-world canvas { height: 190px; }
}

/* ---------- Pocket agent: the room at full height, suggestions as chips, the recruiter bar ---------- */
.teach { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "cta cta" "main world"; grid-template-rows: auto 1fr; }
.teach-cta { grid-area: cta; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; width: 100%; margin: 0; padding: 11px 22px 12px; border: 0; background: var(--accent); color: var(--accent-ink); font: inherit; text-align: left; cursor: pointer; transition: background 0.15s ease; }
.teach-cta b { font-family: var(--serif); font-size: 1.22rem; font-weight: 500; letter-spacing: -0.005em; line-height: 1.2; }
.teach-cta small { font-family: var(--mono); font-size: 0.7rem; opacity: 0.92; }
.teach-cta span { margin-left: auto; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; }
.teach-cta:hover { background: var(--ink); color: var(--paper); }
.teach-cta:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }
.teach-world { position: relative; display: flex; flex-direction: column; border-bottom: 0; }
.teach-world canvas { flex: 1 1 0; height: 0; min-height: 360px; }
.tw-top { position: absolute; left: 0; right: 0; top: 0; z-index: 1; display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px 0; pointer-events: none; }
.tw-top > * { pointer-events: auto; }
.tw-try { display: flex; flex: 1; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }
.tw-try li { margin: 0; }
.tw-try button, .tw-reset { padding: 3px 8px; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink); font-family: var(--mono); font-size: 0.64rem; line-height: 1.5; cursor: pointer; transition: border-color 0.15s ease, color 0.15s ease; }
.tw-try button:hover, .tw-reset:hover { border-color: var(--accent); color: var(--accent); }
.tw-try li.is-used button { border-color: var(--c-true); color: var(--c-true); }
.tw-reset { flex: none; border-color: var(--ink); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.6rem; }
.tw-layers { position: relative; }
.tw-note { position: absolute; right: 14px; top: 7px; margin: 0; color: var(--muted); font-family: var(--mono); font-size: 0.54rem; letter-spacing: 0.08em; text-transform: uppercase; }
@media (min-width: 901px) {
    .teach .teach-guide { padding: 0 22px 10px; border: 0; background: none; }
    .teach .teach-guide h4 { margin: 0 0 6px; }
    .teach .teach-guide ol { display: flex; flex-wrap: wrap; gap: 5px; max-height: 82px; margin: 0; padding: 0 4px 0 0; overflow-y: auto; counter-reset: none; scrollbar-width: thin; }
    .teach .teach-guide li { max-width: 100%; margin: 0; padding: 0; border: 0; }
    .teach .teach-guide li + li { border: 0; }
    .teach .teach-guide li::before { display: none; }
    .teach .teach-guide li button { display: block; max-width: 100%; padding: 3px 8px; overflow: hidden; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink); font-family: var(--mono); font-size: 0.64rem; line-height: 1.5; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
    .teach .teach-guide li button:hover { border-color: var(--accent); color: var(--accent); }
    .teach .teach-guide li.is-used button { border-color: var(--c-true); color: var(--c-true); }
    .teach .teach-guide li button small { color: var(--muted); font-size: 0.9em; }
}
@media (max-width: 900px) {
    .teach-cta { order: 0; padding: 11px 22px; }
    .teach-cta span { display: none; }
    .teach-world canvas { flex: none; height: 210px; min-height: 0; }
    .tw-top { position: static; padding: 10px 14px 0; }
    .tw-try { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .tw-try::-webkit-scrollbar { display: none; }
    .tw-try li { flex: none; }
    .tw-try button, .tw-reset { min-height: 32px; padding: 5px 10px; font-size: 0.66rem; }
    .tw-note { display: none; }
}
@media (max-width: 600px) { .teach-cta { padding: 11px 14px; } }

/* ---------- Pocket agent: the blackboard row, and the fallback at rest ---------- */
.tw-layer[data-layer="b"] i { color: var(--c-workshop); }
.tw-layer[data-layer="b"] .tw-chip { border-style: dashed; }
.tw-chip.is-dim { border-style: dashed; color: var(--muted); opacity: 0.7; }

/* ---------- Pocket agent: note line above the three rows ---------- */
.tw-note { position: static; margin: 6px 0 -2px; text-align: right; }

/* ---------- Pocket agent: three panels (conversation, things to try, the room) ---------- */
.teach--app { max-width: none; background: var(--surface); }
.teach-ptitle { display: flex; align-items: center; gap: 8px; margin: 0; padding: 9px 16px; border-bottom: 1px solid var(--rule); color: var(--muted); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.12em; line-height: 1.6; text-transform: uppercase; }
.teach-ptitle b { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border: 1px solid currentColor; font-size: 0.56rem; font-weight: 500; letter-spacing: 0; }
.teach-ptitle span { margin-left: auto; letter-spacing: 0.04em; text-transform: none; }
.teach-ptitle .tw-reset { margin-left: 8px; }
.teach--app .teach-more { margin: 0; padding: 10px 22px; border: 0; border-top: 1px solid var(--rule); font-size: 0.78rem; }
@media (min-width: 901px) {
    .teach--app { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "cta cta" "head head" "main world" "guide world" "more more"; grid-template-rows: auto auto 440px auto auto; }
    .teach--app .teach-head { grid-area: head; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 22px; margin: 0; padding: 14px 22px; border-bottom: 1px solid var(--rule); }
    .teach--app .teach-head h3, .teach--app .teach-head p { margin: 0; }
    .teach--app .teach-head p { flex: 1 1 320px; max-width: none; }
    /* 1. the conversation: a dark console */
    .teach--app .teach-main {
        grid-area: main; display: flex; flex-direction: column; min-width: 0; min-height: 0;
        --paper: #0f1216; --surface: #171b21; --ink: #f1efe9; --muted: #9aa0a8; --rule: #2b3038; --rule-strong: #4a515c;
        --accent: #9db0ff; --accent-ink: #0f1216; --accent-soft: rgba(157, 176, 255, 0.16); --c-true: #7ee0a0; --c-award: #ff9aa8; --plate: #171b21;
        background: #171b21; color: var(--ink);
    }
    .teach--app .teach-main .teach-ptitle { border-bottom-color: var(--rule); }
    .teach--app .teach-log { flex: 1 1 0; height: auto; min-height: 0; margin: 0; padding: 14px 16px; border: 0; }
    .teach--app .teach-line { display: block; margin: 0 0 12px; padding: 0; border: 0; font-size: 0.88rem; }
    .teach--app .teach-line + .teach-line { border: 0; }
    .teach--app .teach-line > b, .teach--app .teach-line--you > b { display: block; margin: 0 0 2px; padding: 0; font-size: 0.58rem; letter-spacing: 0.12em; }
    .teach--app .teach-line--you { text-align: right; }
    .teach--app .teach-line--you > b { display: none; }
    .teach--app .teach-line--you .teach-say { display: inline-block; max-width: 88%; padding: 6px 10px; background: var(--accent); color: var(--accent-ink); font-family: var(--mono); font-size: 0.78rem; text-align: left; }
    .teach--app .teach-mind { padding-left: 16px; padding-right: 16px; }
    .teach--app .teach-form { padding: 10px 16px; }
    .teach--app .teach-form input { background: var(--paper); color: var(--ink); border-color: var(--rule-strong); }
    .teach--app .teach-row { padding: 0 16px 12px; }
    .teach--app .teach-traits { display: none; }
    .teach--app .teach-tools { margin-left: auto; }
    /* 2. things to try: plain lists, in groups */
    .teach--app .teach-guide { grid-area: guide; min-height: 0; padding: 0 0 6px; border: 0; border-top: 1px solid var(--rule); background: var(--paper); }
    .teach--app .teach-guide .teach-ptitle { position: sticky; top: 0; z-index: 1; background: var(--paper); }
    .teach--app .teach-guide h4 { margin: 12px 16px 2px; color: var(--accent); font-family: var(--mono); font-size: 0.6rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; }
    .teach--app .teach-guide ol { display: block; max-height: none; margin: 0 16px; padding: 0; overflow: visible; counter-reset: try; }
    .teach--app .teach-guide li { position: relative; max-width: none; margin: 0; padding: 3px 0 3px 22px; border: 0; counter-increment: try; }
    .teach--app .teach-guide li + li { border: 0; }
    .teach--app .teach-guide li::before { content: counter(try); display: block; position: absolute; left: 0; top: 5px; width: 14px; height: 14px; border: 1px solid var(--rule-strong); background: none; color: var(--muted); font-family: var(--mono); font-size: 0.52rem; line-height: 13px; text-align: center; }
    .teach--app .teach-guide li.is-used::before { content: "\2713"; border-color: var(--c-true); background: var(--c-true); color: #fff; }
    .teach--app .teach-guide li button { display: inline; max-width: none; padding: 0; overflow: visible; border: 0; background: none; color: var(--ink); font-family: var(--mono); font-size: 0.7rem; line-height: 1.45; text-align: left; text-decoration: underline dotted var(--rule-strong); text-underline-offset: 3px; white-space: normal; }
    .teach--app .teach-guide li button:hover { color: var(--accent); text-decoration-color: var(--accent); }
    .teach--app .teach-guide li.is-used button { color: var(--muted); }
    /* 3. the room */
    .teach--app .teach-world { grid-area: world; min-width: 0; min-height: 0; border: 0; border-left: 1px solid var(--rule); background: var(--surface); }
    .teach--app .teach-world canvas { min-height: 0; }
    .teach--app .tw-layers { background: var(--paper); border-top: 1px solid var(--rule); }
    .teach--app .teach-more { grid-area: more; }
}
@media (min-width: 1180px) {
    .teach--app { grid-template-columns: minmax(320px, 1fr) minmax(220px, 0.64fr) minmax(420px, 1.42fr); grid-template-areas: "cta cta cta" "head head head" "main guide world" "more more more"; grid-template-rows: auto auto 580px auto; }
    .teach--app .teach-guide { overflow-y: auto; border-top: 0; border-left: 1px solid var(--rule); scrollbar-width: thin; }
}
@media (max-width: 900px) {
    .teach-ptitle { display: none; }
    .teach-world .teach-ptitle { display: flex; padding: 9px 14px; }
    .teach--app .teach-guide h4 { margin: 8px 0 4px; }
    .teach--app .teach-more { order: 6; padding: 10px 14px; }
}

/* ---------- Pocket agent: three panels, fixes ---------- */
@media (min-width: 901px) {
    .teach--app .teach-main { --text: #dde0e5; }
    .teach--app .teach-say, .teach--app .teach-line .tl-p, .teach--app .tl-bullet { color: var(--text); }
    .teach--app .teach-tools button { border-color: var(--rule-strong); background: none; color: var(--muted); }
    .teach--app .teach-tools button:hover { border-color: var(--accent); color: var(--accent); }
    .teach--app .teach-guide .teach-ptitle { margin: 0; padding: 9px 16px; border-top: 0; font-size: 0.62rem; line-height: 1.6; }
    .teach--app .teach-guide li { font-size: 0.7rem; line-height: 1.45; }
    .teach--app .teach-guide li button { font-size: inherit; line-height: inherit; }
    .teach--app .teach-guide li::before { top: 4px; }
    .teach--app .teach-guide h4 { margin-top: 14px; }
}

/* ---------- Pocket agent: three panels, medium widths ---------- */
@media (min-width: 901px) and (max-width: 1179px) {
    .teach--app { grid-template-areas: "cta cta" "head head" "main world" "guide guide" "more more"; grid-template-rows: auto auto 460px auto auto; }
    .teach--app .teach-guide { column-count: 2; column-gap: 0; padding-bottom: 12px; }
    .teach--app .teach-guide .teach-ptitle { column-span: all; position: static; }
    .teach--app .teach-guide h4 { break-after: avoid; }
    .teach--app .teach-guide ol { break-inside: avoid; }
}

/* ---------- Pocket agent: recruiter button in the conversation; wider suggestions, narrower room ---------- */
.teach--app .teach-main .teach-cta { align-items: baseline; }
@media (min-width: 901px) {
    .teach--app { grid-template-areas: "head head" "main world" "guide world" "more more"; grid-template-rows: auto 440px auto auto; }
    .teach--app .teach-main .teach-cta { flex: none; width: auto; margin: 12px 16px 0; padding: 8px 12px 9px; background: var(--accent); color: var(--accent-ink); }
    .teach--app .teach-main .teach-cta b { font-size: 1.04rem; }
    .teach--app .teach-main .teach-cta small { font-size: 0.64rem; }
    .teach--app .teach-main .teach-cta span { font-size: 0.6rem; }
    .teach--app .teach-main .teach-cta:hover { background: var(--ink); color: var(--paper); }
    .teach--app .teach-guide li { font-size: 0.74rem; }
}
@media (min-width: 901px) and (max-width: 1179px) {
    .teach--app { grid-template-areas: "head head" "main world" "guide guide" "more more"; grid-template-rows: auto 460px auto auto; }
}
@media (min-width: 1180px) {
    .teach--app { grid-template-columns: minmax(320px, 1fr) minmax(280px, 0.95fr) minmax(380px, 1.15fr); grid-template-areas: "head head head" "main guide world" "more more more"; grid-template-rows: auto 580px auto; }
}

/* ---------- Pocket agent: recruiter button on one line ---------- */
@media (min-width: 901px) {
    .teach--app .teach-main .teach-cta { flex-wrap: nowrap; gap: 8px; }
    .teach--app .teach-main .teach-cta b { flex: none; }
    .teach--app .teach-main .teach-cta small { flex: 1 1 auto; min-width: 0; }
    .teach--app .teach-main .teach-cta span { flex: none; margin-left: 0; font-size: 0.9rem; }
}
@media (max-width: 900px) { .teach-cta span { display: none; } }

/* ---------- Pocket agent: two steps (OntoAgent, then HARMONIC) ---------- */
.teach-tabs { grid-area: tabs; display: flex; border-bottom: 1px solid var(--rule); background: var(--paper); }
.teach-tabs button { display: flex; flex: 1 1 0; flex-direction: column; gap: 3px; min-width: 0; margin: 0; padding: 11px 22px 10px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); font: inherit; text-align: left; cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease; }
.teach-tabs button + button { border-left: 1px solid var(--rule); }
.teach-tabs button b { display: flex; align-items: center; gap: 9px; color: var(--ink); font-family: var(--serif); font-size: 1.16rem; font-weight: 500; letter-spacing: -0.005em; line-height: 1.2; }
.teach-tabs button b i { display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px; border: 1px solid currentColor; font-family: var(--mono); font-size: 0.62rem; font-style: normal; font-weight: 500; }
.teach-tabs button span { font-size: 0.8rem; line-height: 1.4; }
.teach-tabs button:hover { background: var(--surface); }
.teach-tabs button[aria-selected="true"] { border-bottom-color: var(--accent); background: var(--surface); }
.teach-tabs button[aria-selected="true"] b { color: var(--accent); }
.teach--app[data-tab="onto"] .teach-world,
.teach--app[data-tab="onto"] .tg[data-for="harmonic"],
.teach--app[data-tab="harmonic"] .tg[data-for="onto"] { display: none; }

/* the room's stage, and the link that appears when a task ends */
.tw-stage { position: relative; flex: 1 1 0; min-height: 0; }
.teach-world .tw-stage canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; min-height: 0; flex: none; }
.tw-read { position: absolute; left: 12px; bottom: 12px; padding: 7px 12px; background: var(--accent); color: var(--accent-ink); font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.06em; text-decoration: none; text-transform: uppercase; animation: tw-read-in 0.5s ease both; }
.tw-read[hidden] { display: none; }
.tw-read:hover { background: var(--ink); color: var(--paper); }
@keyframes tw-read-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* a robot task in the conversation: goal, numbered commands, outcomes */
.tl-stat, .tl-cmd { display: grid; grid-template-columns: 1.2rem minmax(0, 1fr); gap: 0 6px; align-items: baseline; margin-top: 2px; font-family: var(--mono); font-size: 0.7rem; line-height: 1.55; }
.tl-stat i, .tl-cmd i { color: var(--muted); font-style: normal; text-align: right; }
.tl-stat b, .tl-cmd b { font-weight: 500; overflow-wrap: anywhere; }
.tl-stat em { grid-column: 2; color: var(--muted); font-family: var(--sans); font-size: 0.78rem; font-style: normal; line-height: 1.4; }
.tl-stat--ok i { color: var(--c-true); }
.tl-stat--fail i, .tl-stat--fail b { color: var(--c-award); }
.tl-stat--replan i, .tl-stat--replan b { color: var(--accent); }
.tl-stat--goal { grid-template-columns: 2.4rem minmax(0, 1fr); margin: 0 0 5px; padding-bottom: 5px; border-bottom: 1px dashed var(--rule-strong); }
.tl-stat--goal i { color: var(--accent); font-size: 0.56rem; letter-spacing: 0.1em; text-align: left; text-transform: uppercase; }
.tl-stat--goal b { font-family: var(--sans); font-size: 0.9rem; font-weight: 500; }
.tl-stat--end { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; padding: 4px 9px; border: 1px solid currentColor; }
.tl-stat--end i { display: none; }
.tl-stat--end.is-ok { color: var(--c-true); }
.tl-stat--end.is-fail { color: var(--c-award); }
.tl-stat--end em { color: inherit; font-family: var(--mono); font-size: 0.66rem; opacity: 0.85; }
.tl-cmd i { font-size: 0.6rem; }
.teach-line--cont > b { display: none !important; }

@media (min-width: 901px) {
    .teach--app .teach-line--cont { margin-top: -6px; }
    /* step 1: conversation and things to try */
    .teach--app[data-tab="onto"] { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); grid-template-areas: "head head" "tabs tabs" "main guide" "more more"; grid-template-rows: auto auto 560px auto; }
    .teach--app[data-tab="onto"] .teach-guide { column-count: auto; overflow-y: auto; border-top: 0; border-left: 1px solid var(--rule); scrollbar-width: thin; }
    .teach--app[data-tab="onto"] .teach-guide .teach-ptitle { position: sticky; top: 0; }
    .teach--app[data-tab="onto"] .tg { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 6px; }
    .teach--app .teach-guide li { font-size: 0.78rem; }
    /* step 2 at medium widths: conversation and room, goals below */
    .teach--app[data-tab="harmonic"] { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); grid-template-areas: "head head" "tabs tabs" "main world" "guide guide" "more more"; grid-template-rows: auto auto 500px auto auto; }
    .teach--app[data-tab="harmonic"] .teach-guide { column-count: auto; border-top: 1px solid var(--rule); border-left: 0; overflow: visible; }
    .teach--app[data-tab="harmonic"] .tg { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 6px; padding-bottom: 8px; }
}
@media (min-width: 1180px) {
    /* step 2: conversation, goals, the room */
    .teach--app[data-tab="harmonic"] { grid-template-columns: minmax(320px, 1fr) minmax(230px, 0.66fr) minmax(400px, 1.3fr); grid-template-areas: "head head head" "tabs tabs tabs" "main guide world" "more more more"; grid-template-rows: auto auto 580px auto; }
    .teach--app[data-tab="harmonic"] .teach-guide { overflow-y: auto; border-top: 0; border-left: 1px solid var(--rule); scrollbar-width: thin; }
    .teach--app[data-tab="harmonic"] .tg { display: block; padding-bottom: 0; }
}
@media (max-width: 900px) {
    .teach-tabs { order: 1; }
    .teach-tabs button { padding: 9px 14px 8px; }
    .teach-tabs button b { font-size: 1rem; }
    .teach-tabs button span { font-size: 0.72rem; }
    .tw-stage { flex: none; height: 210px; }
}

/* ---------- Pocket agent: trace labels ---------- */
.teach-line .tl-stat b, .teach-line .tl-cmd b { padding: 0; color: inherit; font-size: inherit; letter-spacing: 0; text-transform: none; }
.teach-line .tl-stat--goal b { font-family: var(--sans); font-size: 0.9rem; }
.teach-line .tl-stat--end b { letter-spacing: 0.08em; }

/* ---------- Pocket agent: on phones the recruiter button sits with the conversation ---------- */
@media (max-width: 900px) {
    .teach--app .teach-cta { order: 2; width: auto; margin: 10px 14px 0; padding: 9px 12px; }
    .teach--app .teach-cta b { font-size: 1.04rem; }
}

/* ==================================================================
   Pocket agent v3: two steps, two panels each. This block is complete
   in itself; everything is scoped to .teach.teach--v3.
   ================================================================== */
.teach.teach--v3 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); grid-template-areas: "head head" "tabs tabs" "hint hint" "main side" "more more"; grid-template-rows: auto auto auto 540px auto; max-width: none; background: var(--surface); }
.teach.teach--v3 .teach-head { grid-area: head; display: block; margin: 0; padding: 18px 22px 14px; border: 0; }
.teach.teach--v3 .teach-head h3 { margin: 0; }

/* the two steps */
.teach.teach--v3 .teach-tabs { grid-area: tabs; display: flex; gap: 8px; padding: 0 22px; border-bottom: 1px solid var(--rule-strong); background: none; }
.teach.teach--v3 .teach-tabs button { display: inline-flex; flex: 0 1 auto; flex-direction: row; align-items: center; gap: 9px; margin: 0 0 -1px; padding: 10px 18px 9px; border: 1px solid var(--rule); border-bottom-color: var(--rule-strong); background: var(--paper); color: var(--muted); font-family: var(--serif); font-size: 1.1rem; font-weight: 500; line-height: 1.2; text-align: left; cursor: pointer; }
.teach.teach--v3 .teach-tabs button + button { border-left: 1px solid var(--rule); }
.teach.teach--v3 .teach-tabs button i { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border: 1px solid currentColor; font-family: var(--mono); font-size: 0.64rem; font-style: normal; }
.teach.teach--v3 .teach-tabs button small { padding: 1px 6px; border: 1px solid currentColor; font-family: var(--mono); font-size: 0.56rem; letter-spacing: 0.1em; }
.teach.teach--v3 .teach-tabs button:hover { color: var(--ink); }
.teach.teach--v3 .teach-tabs button[aria-selected="true"] { border-color: var(--rule-strong); border-bottom-color: var(--surface); background: var(--surface); color: var(--ink); box-shadow: inset 0 3px 0 var(--accent); }
.teach.teach--v3 .teach-tabs button[aria-selected="true"] i { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.teach-hint { grid-area: hint; margin: 0; padding: 13px 22px; border-bottom: 1px solid var(--rule); color: var(--text); font-size: 0.98rem; line-height: 1.5; }
.teach--v3[data-tab="onto"] .teach-hint[data-for="harmonic"],
.teach--v3[data-tab="harmonic"] .teach-hint[data-for="onto"],
.teach.teach--v3[data-tab="onto"] .teach-world,
.teach.teach--v3[data-tab="harmonic"] .teach-guide { display: none; }

/* left: the conversation, a dark console */
.teach.teach--v3 .teach-main {
    grid-area: main; display: flex; flex-direction: column; min-width: 0; min-height: 0;
    --paper: #0f1216; --surface: #171b21; --ink: #f1efe9; --text: #dde0e5; --muted: #9aa0a8; --rule: #2b3038; --rule-strong: #4a515c;
    --accent: #9db0ff; --accent-ink: #0f1216; --accent-soft: rgba(157, 176, 255, 0.16); --c-true: #7ee0a0; --c-award: #ff9aa8; --plate: #171b21;
    background: #171b21; color: var(--ink);
}
.teach.teach--v3 .teach-cta { order: 0; display: flex; flex: none; flex-wrap: nowrap; align-items: baseline; gap: 8px; width: auto; margin: 14px 16px 0; padding: 8px 12px 9px; border: 0; background: var(--accent); color: var(--accent-ink); font: inherit; text-align: left; cursor: pointer; }
.teach.teach--v3 .teach-cta b { flex: none; font-family: var(--serif); font-size: 1.04rem; font-weight: 500; }
.teach.teach--v3 .teach-cta small { flex: 1 1 auto; min-width: 0; font-family: var(--mono); font-size: 0.64rem; }
.teach.teach--v3 .teach-cta span { display: inline; flex: none; margin: 0; font-size: 0.9rem; }
.teach.teach--v3 .teach-cta:hover { background: var(--ink); color: var(--paper); }
.teach.teach--v3 .teach-log { order: 0; flex: 1 1 0; height: auto; min-height: 0; margin: 0; padding: 14px 16px; border: 0; background: none; }
.teach.teach--v3 .teach-line { display: block; margin: 0 0 12px; padding: 0; border: 0; font-size: 0.9rem; text-align: left; }
.teach.teach--v3 .teach-line + .teach-line { border: 0; }
.teach.teach--v3 .teach-line > b { display: block; margin: 0 0 2px; padding: 0; font-size: 0.58rem; letter-spacing: 0.12em; }
.teach.teach--v3 .teach-line--you { text-align: right; }
.teach.teach--v3 .teach-line--you > b { display: none; }
.teach.teach--v3 .teach-say { color: var(--text); }
.teach.teach--v3 .teach-line--you .teach-say { display: inline-block; max-width: 88%; padding: 6px 10px; background: var(--accent); color: var(--accent-ink); font-family: var(--mono); font-size: 0.78rem; text-align: left; }
.teach.teach--v3 .teach-line--cont { margin-top: -6px; }
.teach.teach--v3 .teach-form { order: 0; padding: 12px 16px 10px; border-top: 1px solid var(--rule); }
.teach.teach--v3 .teach-form input { border-color: var(--rule-strong); background: var(--paper); color: var(--ink); }
.teach.teach--v3 .teach-row { order: 0; display: block; padding: 0 16px 12px; }
.teach.teach--v3 .teach-traits { display: none; }
.teach.teach--v3 .teach-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.teach.teach--v3 .teach-tools button { min-height: 0; padding: 4px 8px; border: 1px solid var(--rule-strong); background: none; color: var(--muted); font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; }
.teach.teach--v3 .teach-tools button:hover { border-color: var(--accent); color: var(--accent); }
.teach.teach--v3 .teach-tools .teach-mindlink { margin-right: auto; border-color: var(--accent); color: var(--accent); }
.teach.teach--v3 .teach-tools .teach-mindlink.is-empty { visibility: hidden; }

/* right, step 1: a few examples */
.teach.teach--v3 .teach-guide { grid-area: side; min-width: 0; min-height: 0; padding: 4px 24px 20px; overflow-y: auto; border: 0; border-left: 1px solid var(--rule); background: var(--paper); column-count: auto; }
.teach.teach--v3 .teach-guide h4 { margin: 20px 0 9px; color: var(--ink); font-family: var(--sans); font-size: 0.94rem; font-weight: 600; letter-spacing: 0; line-height: 1.3; text-transform: none; }
.teach.teach--v3 .teach-guide h4 small { margin-left: 6px; color: var(--muted); font-family: var(--mono); font-size: 0.62rem; font-weight: 400; }
.teach.teach--v3 .teach-guide ol, .teach.teach--v3 .tw-try { display: flex; flex-wrap: wrap; gap: 7px; max-height: none; margin: 0; padding: 0; overflow: visible; list-style: none; counter-reset: st; }
.teach.teach--v3 .teach-guide li, .teach.teach--v3 .tw-try li { position: static; flex: none; max-width: 100%; margin: 0; padding: 0; border: 0; counter-increment: st; font-size: 0.74rem; line-height: 1.45; }
.teach.teach--v3 .teach-guide li + li { border: 0; }
.teach.teach--v3 .teach-guide li::before { content: none; display: none; }
.teach.teach--v3 .teach-guide li button, .teach.teach--v3 .tw-try button { display: block; max-width: 100%; min-height: 0; padding: 6px 11px; overflow: visible; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink); font-family: var(--mono); font-size: inherit; line-height: inherit; text-align: left; text-decoration: none; white-space: normal; cursor: pointer; transition: border-color 0.15s ease, color 0.15s ease; }
.teach.teach--v3 .teach-guide li button:hover, .teach.teach--v3 .tw-try button:hover { border-color: var(--accent); color: var(--accent); }
.teach.teach--v3 .teach-guide li.is-used button, .teach.teach--v3 .tw-try li.is-used button { border-color: var(--c-true); color: var(--c-true); }
.teach.teach--v3 .teach-guide ol.is-steps li button::before { content: counter(st); display: inline-block; margin-right: 8px; color: var(--accent); font-weight: 600; }

/* right, step 2: the room */
.teach.teach--v3 .teach-world { grid-area: side; position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 0; border-left: 1px solid var(--rule); background: var(--surface); }
.tw-goals { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 16px; border-bottom: 1px solid var(--rule); background: var(--paper); }
.tw-goals > b { font-size: 0.94rem; font-weight: 600; }
.tw-goals .tw-try { flex: 1 1 260px; }
.teach.teach--v3 .tw-goals .tw-try button { border-color: var(--ink); }
.teach.teach--v3 .tw-reset { flex: none; margin-left: auto; padding: 5px 9px; border: 1px solid var(--rule-strong); background: none; color: var(--muted); font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; }
.teach.teach--v3 .tw-reset:hover { border-color: var(--accent); color: var(--accent); }
.teach.teach--v3 .tw-layers { position: relative; padding: 8px 16px 10px; border-top: 1px solid var(--rule); background: var(--paper); }
.teach.teach--v3 .tw-layer { margin: 4px 0 0; }
.teach.teach--v3 .tw-layer i { display: block; color: var(--ink); font-family: var(--sans); font-size: 0.8rem; font-style: normal; font-weight: 600; letter-spacing: 0; text-transform: none; }
.teach.teach--v3 .tw-layer i small { margin-left: 6px; color: var(--muted); font-family: var(--mono); font-size: 0.58rem; font-weight: 400; }
.teach.teach--v3 .tw-chips { min-height: 21px; margin-top: 4px; font-size: 0.62rem; }
.teach.teach--v3 .tw-layer[data-layer="b"], .teach.teach--v3 .tw-chip.is-extra { display: none; }
.teach.teach--v3 .teach-world.is-detail .tw-layer[data-layer="b"] { display: block; }
.teach.teach--v3 .teach-world.is-detail .tw-chip.is-extra { display: inline-block; }
.tw-detail { position: absolute; right: 16px; top: 10px; padding: 0; border: 0; background: none; color: var(--accent); font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.04em; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.tw-more { padding: 0 16px 12px; background: var(--paper); }
.tw-more summary { color: var(--muted); font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.06em; cursor: pointer; }
.tw-more summary:hover { color: var(--accent); }
.tw-more .tw-try { margin-top: 8px !important; }
.teach.teach--v3 .teach-more { grid-area: more; margin: 0; padding: 10px 22px; border: 0; border-top: 1px solid var(--rule); background: none; color: var(--muted); font-size: 0.78rem; }

@media (max-width: 900px) {
    .teach.teach--v3 { display: flex; flex-direction: column; }
    .teach.teach--v3 .teach-head { order: 1; padding: 16px 14px 12px; }
    .teach.teach--v3 .teach-tabs { order: 2; gap: 6px; padding: 0 14px; }
    .teach.teach--v3 .teach-tabs button { flex: 1 1 0; padding: 9px 10px 8px; font-size: 0.96rem; }
    .teach.teach--v3 .teach-tabs button small { display: none; }
    .teach.teach--v3 .teach-hint { order: 3; padding: 11px 14px; font-size: 0.92rem; }
    .teach.teach--v3 .teach-world { order: 4; border-left: 0; border-bottom: 1px solid var(--rule); }
    .teach.teach--v3 .teach-main { order: 5; display: flex; }
    .teach.teach--v3 .teach-guide { order: 6; padding: 0 14px 16px; border-left: 0; border-top: 1px solid var(--rule); overflow: visible; }
    .teach.teach--v3 .teach-more { order: 7; padding: 10px 14px; }
    .teach.teach--v3 .teach-log { flex: none; height: 250px; }
    .teach.teach--v3 .tw-stage { flex: none; height: 230px; }
    .teach.teach--v3 .tw-goals { padding: 10px 14px; }
    .teach.teach--v3 .teach-guide li button, .teach.teach--v3 .tw-try button { padding: 8px 11px; }
}

/* ---------- Pocket agent v3: the goals row above the room ---------- */
.tw-goals > b { order: 0; }
.teach.teach--v3 .tw-goals .tw-reset { order: 1; }
.teach.teach--v3 .tw-goals .tw-try { order: 2; flex: 1 1 100%; }
.teach.teach--v3 .tw-goals .tw-try li { font-size: 0.72rem; }
.teach.teach--v3 .tw-goals .tw-try button { padding: 5px 10px; }

/* ---------- Pocket agent v3: the HARMONIC step has its own red-brown tone ---------- */
.teach.teach--v3 { --harmonic: #9a3412; --harmonic-ink: #ffffff; --harmonic-soft: rgba(154, 52, 18, 0.1); }
:root[data-theme="dark"] .teach.teach--v3 { --harmonic: #f0a184; --harmonic-ink: #1a1210; --harmonic-soft: rgba(240, 161, 132, 0.14); }
.teach.teach--v3 .teach-tabs button[data-tab-go="harmonic"] { border-color: var(--harmonic); background: var(--harmonic-soft); color: var(--harmonic); }
.teach.teach--v3 .teach-tabs button[data-tab-go="harmonic"]:hover { color: var(--harmonic); background: var(--surface); }
.teach.teach--v3 .teach-tabs button[data-tab-go="harmonic"] small { border-color: var(--harmonic); background: var(--harmonic); color: var(--harmonic-ink); }
.teach.teach--v3 .teach-tabs button[data-tab-go="harmonic"][aria-selected="true"] { border-color: var(--harmonic); border-bottom-color: var(--surface); background: var(--surface); color: var(--harmonic); box-shadow: inset 0 4px 0 var(--harmonic); }
.teach.teach--v3 .teach-tabs button[data-tab-go="harmonic"][aria-selected="true"] i { border-color: var(--harmonic); background: var(--harmonic); color: var(--harmonic-ink); }

/* ---------- Pocket agent v3: the recruiter button, quieter ---------- */
.teach.teach--v3 .teach-cta { align-self: flex-start; gap: 7px; width: auto; max-width: calc(100% - 32px); margin: 12px 16px 0; padding: 5px 10px 6px; border: 1px solid var(--rule-strong); background: none; color: var(--text); }
.teach.teach--v3 .teach-cta b { font-family: var(--sans); font-size: 0.8rem; font-weight: 500; }
.teach.teach--v3 .teach-cta small { flex: 0 1 auto; color: var(--muted); font-size: 0.6rem; }
.teach.teach--v3 .teach-cta span { color: var(--accent); font-size: 0.8rem; }
.teach.teach--v3 .teach-cta:hover { border-color: var(--accent); background: none; color: var(--accent); }

/* ---------- Pocket agent v3: the recruiter button sits in the header, in teal ---------- */
.teach.teach--v3 { --recruit: #0d7a6c; --recruit-ink: #ffffff; }
:root[data-theme="dark"] .teach.teach--v3 { --recruit: #5fd9c7; --recruit-ink: #0e1013; }
.teach.teach--v3 .teach-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; }
.teach.teach--v3 .teach-head .teach-cta { order: 0; align-self: center; flex: none; gap: 8px; width: auto; max-width: 100%; margin: 0; padding: 7px 13px 8px; border: 1px solid var(--recruit); background: var(--recruit); color: var(--recruit-ink); }
.teach.teach--v3 .teach-head .teach-cta b { font-family: var(--sans); font-size: 0.86rem; font-weight: 600; }
.teach.teach--v3 .teach-head .teach-cta small { flex: 0 1 auto; color: inherit; font-size: 0.62rem; opacity: 0.9; }
.teach.teach--v3 .teach-head .teach-cta span { color: inherit; font-size: 0.86rem; }
.teach.teach--v3 .teach-head .teach-cta:hover { border-color: var(--recruit); background: none; color: var(--recruit); }

/* ---------- The agent's name: LEIA-MIOnA, with MIOnA set as a subscript ---------- */
.miona { white-space: nowrap; text-transform: none; letter-spacing: 0; }
.miona sub { position: relative; top: 0.3em; margin-left: 0.04em; font-size: 0.68em; line-height: 0; vertical-align: baseline; letter-spacing: 0.01em; }

/* ---------- Home: one quiet line about the agent (it replaced a boxed banner) ---------- */
.meet { display: flex; align-items: baseline; gap: 11px; max-width: 600px; margin-top: 26px; color: var(--muted); font-size: 0.9rem; line-height: 1.55; }
.meet i { flex: none; width: 8px; height: 8px; background: var(--accent); transform: translateY(-1px); }
.meet strong { color: var(--ink); font-weight: 500; }
.meet a { color: var(--ink); }

/* ---------- "Ask" button and chat panel, bottom right of every page ---------- */
.ask-btn {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 85;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 14px 10px 12px;
    border: 1px solid var(--ink);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.25s ease, opacity 0.2s ease, background 0.15s ease, color 0.15s ease;
}
.ask-btn i { flex: none; width: 9px; height: 9px; background: var(--accent); }
.ask-btn:hover { background: var(--ink); color: var(--paper); }
.ask-btn:focus-visible, .ask-x:focus-visible, .ask-try button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
/* out of the way: while its panel is open, while the full panel is on screen, and during the guided walk */
.ask-open .ask-btn, .ask-btn.is-away, .agent-along .ask-btn { visibility: hidden; opacity: 0; pointer-events: none; }

.ask {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 86;
    display: flex;
    flex-direction: column;
    width: min(390px, calc(100vw - 24px));
    max-height: min(620px, calc(100vh - 104px));
    border: 1px solid var(--ink);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.18);
}
.ask[hidden] { display: none; }
.ask > * { order: 0; }
.agent-along .ask { display: none; }
.ask-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 12px 10px 10px 16px; border-bottom: 1px solid var(--rule); }
.ask-title { color: var(--muted); font-size: 0.78rem; line-height: 1.4; }
.ask-title .miona { display: block; color: var(--ink); font-family: var(--serif); font-size: 1.3rem; font-weight: 500; letter-spacing: -0.01em; line-height: 1.2; text-decoration: none; }
.ask-title a.miona:hover { color: var(--accent); }
.ask-x { flex: none; width: 30px; height: 30px; border: 1px solid transparent; background: none; color: var(--ink); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.ask-x:hover { border-color: var(--ink); }
.ask-hello { padding: 12px 16px 0; font-size: 0.86rem; line-height: 1.5; }
.ask-try { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px 13px; }
.ask-try button { padding: 6px 10px; border: 1px solid var(--rule-strong); background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 0.8rem; line-height: 1.3; text-align: left; cursor: pointer; }
.ask-try button:hover { border-color: var(--accent); color: var(--accent); }
.ask .teach-log { flex: 1 1 auto; height: auto; min-height: 0; max-height: none; margin: 0; padding: 12px 16px 6px; border-top: 1px solid var(--rule); border-bottom: 0; background: var(--paper); overflow-y: auto; }
.ask .teach-log:empty { display: none; }
.ask .teach-line { display: block; margin: 0 0 12px; padding: 0; border: 0; font-size: 0.88rem; text-align: left; }
.ask .teach-line--you { text-align: right; }
.ask .teach-line > b { display: block; margin-bottom: 3px; font-size: 0.66rem; }
.ask .teach-form { order: 0; gap: 8px; padding: 10px 12px 8px 16px; border-top: 1px solid var(--rule); }
.ask .teach-form input { flex: 1 1 auto; min-width: 0; }
.ask-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 14px; padding: 2px 16px 10px; color: var(--muted); font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.02em; }
.ask-foot a { color: var(--muted); white-space: nowrap; }
.ask-foot a:hover { color: var(--accent); }
.ask-foot .teach-tools { display: inline-flex; flex-wrap: nowrap; gap: 12px; margin: 0; }
.ask-foot .teach-tools button { min-height: 0; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; letter-spacing: 0; text-transform: none; text-decoration: underline; white-space: nowrap; cursor: pointer; }
.ask-foot .teach-tools .teach-mindlink.is-empty { display: none; }
.ask-foot .teach-tools button:hover { color: var(--accent); }

/* ---------- Home: the robots behind the top section ----------
   The canvas is the whole window and never changes size or place; assets/js/flock.js draws only what is behind
   the top section, and in Zen Mode everything. */
.flock { position: fixed; left: 0; top: 0; z-index: -1; pointer-events: none; transition: opacity 0.5s ease; }
.flock.is-zen { opacity: 1 !important; }
/* ---------- Research: themed line-drawn backgrounds, one canvas behind the whole page ---------- */
.scenes {
    position: fixed;
    left: 0;
    top: 0;
    z-index: -1;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.agent-spot .flock, .agent-spot .scenes { display: none; }

@media (max-width: 700px) {
    .ask-btn { right: 10px; bottom: 10px; padding: 7px 11px 8px 9px; font-size: 0.74rem; box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12); }
    /* it steps aside while the page is being scrolled down */
    .ask-btn.is-tucked { transform: translateY(72px); opacity: 0; pointer-events: none; }
    /* and never sits on the note the agent leaves at the bottom of the screen */
    body:has(.teach-toast) .ask-btn { bottom: 118px; }
    .ask { left: 8px; right: 8px; bottom: 8px; width: auto; max-height: min(72vh, 540px); max-height: min(72dvh, 540px); }
    .ask .teach-form input { font-size: 16px; }
    /* the last line of the page can always be scrolled clear of the button */
    .site-foot { padding-bottom: 68px; }
    .meet { font-size: 0.88rem; }
}
@media (prefers-reduced-motion: reduce) { .ask-btn { transition: none; } }
@media print { .ask-btn, .ask, .flock, .scenes { display: none !important; } }
/* in the small monospace button the subscript needs to be a little larger to stay readable */
.ask-btn .miona sub { top: 0.26em; font-size: 0.82em; }
/* the step buttons on the Research page: the name keeps the size of the words around it */
.teach.teach--v3 .teach-tabs button span { font-size: inherit; line-height: inherit; }

/* ---------- A patent tag on a project card ---------- */
.pcard-patent { display: inline-block; margin-top: 10px; padding: 2px 8px 3px; border: 1px solid var(--ink); color: var(--ink); font-family: var(--mono); font-size: 0.64rem; font-weight: 500; letter-spacing: 0.04em; line-height: 1.5; }

/* ---------- Home: Zen Mode ("Watch the robots work") ----------
   The page fades away and the robot team has the whole screen; a strip of citations stays along the bottom. */
/* the button that opens it stands beside the two small tick buttons at the top left of the home page, in their style */
.bt-zen { height: 30px; padding: 0 10px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); font-family: var(--mono); font-size: 0.62rem; font-weight: 500; letter-spacing: 0.05em; line-height: 1.25; text-align: left; text-transform: uppercase; white-space: nowrap; cursor: pointer; transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease; }
.bt-zen[hidden] { display: none; }
.bt-zen:hover { border-color: var(--accent); color: var(--accent); }
@media (min-width: 1270px) {
    /* in the left margin there is no room beside the two: it goes under them, as wide as the pair */
    .bt-bar--zen .bt-btns { flex-wrap: wrap; width: 82px; }
    .bt-bar--zen .bt-zen { width: 82px; height: auto; padding: 5px 7px 6px; white-space: normal; }
    .bt-bar--zen .bt-hint { top: 92px; }
}
@media (max-width: 860px) {
    /* phones: see "The behaviour tree on phones" at the end of this file */
}
html.zen { overflow: hidden; }
html.zen body > *:not(.flock):not(.zen) { opacity: 0; pointer-events: none; }
html.zen-move body > *:not(.flock):not(.zen) { transition: opacity 0.9s ease; }
.zen { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; animation: zen-in 0.6s ease both; }
.zen[hidden] { display: none; }
.zen.is-out { opacity: 0; pointer-events: none; animation: none; transition: opacity 0.6s ease; }
@keyframes zen-in { from { opacity: 0; } to { opacity: 1; } }
/* the open space: a click here puts down a block */
.zen-stage { flex: 1 1 auto; min-height: 0; cursor: crosshair; touch-action: manipulation; }
.zen-close { position: absolute; right: 18px; top: 16px; padding: 7px 13px 8px; border: 1px solid var(--ink); background: var(--surface); color: var(--ink); font-family: var(--mono); font-size: 0.74rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; }
.zen-close:hover { background: var(--ink); color: var(--paper); }
.zen-close:focus-visible, .zen-tools button:focus-visible, .bt-zen:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.zen-hint { position: absolute; left: 50%; top: 20px; transform: translateX(-50%); max-width: calc(100vw - 190px); padding: 5px 12px 6px; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--muted); font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.02em; text-align: center; pointer-events: none; animation: zen-hint 7s ease both; }
.zen-hint[hidden] { display: none; }
.zen-hint-touch { display: none; }
@media (hover: none), (pointer: coarse) { .zen-hint-mouse { display: none; } .zen-hint-touch { display: inline; } }
@keyframes zen-hint { 0% { opacity: 0; } 8% { opacity: 1; } 82% { opacity: 1; } 100% { opacity: 0; } }
/* two small buttons that add a robot, and the speed: top left, away from the citations */
.zen-tools { position: absolute; left: 18px; top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.zen-tools button { padding: 5px 9px 6px; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--muted); font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.03em; line-height: 1.2; cursor: pointer; transition: border-color 0.15s ease, color 0.15s ease; }
.zen-tools button:hover { border-color: var(--ink); color: var(--ink); }
.zen-tools button:disabled { opacity: 0.45; cursor: default; border-color: var(--rule); color: var(--muted); }
.zen-rate { display: inline-flex; margin-left: 8px; }
.zen-rate button + button { margin-left: -1px; }
.zen-rate button[aria-pressed="true"] { position: relative; border-color: var(--ink); color: var(--ink); }
/* the citations: one short row along the bottom */
.zen-strip { flex: none; border-top: 1px solid var(--rule-strong); background: var(--surface); }
.zen-cites summary { display: flex; align-items: baseline; gap: 10px; padding: 7px 18px 6px; color: var(--ink); font-family: var(--mono); font-size: 0.66rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; }
.zen-cites summary span { color: var(--muted); font-weight: 400; letter-spacing: 0.02em; text-transform: none; }
.zen-cites ol { display: flex; gap: 0; margin: 0; padding: 0 8px 9px; list-style: none; overflow-x: auto; scrollbar-width: thin; counter-reset: cite; }
.zen-cites li { flex: 0 0 auto; width: min(300px, 78vw); padding: 0 10px; border-left: 1px solid var(--rule); counter-increment: cite; }
.zen-cites li:first-child { border-left: 0; }
.zen-cites a { display: block; color: var(--text); font-size: 0.74rem; line-height: 1.42; text-decoration: none; }
.zen-cites a::before { content: "[" counter(cite) "] "; color: var(--muted); font-family: var(--mono); font-size: 0.64rem; }
.zen-cites a b { color: var(--ink); font-weight: 600; }
.zen-cites a i { color: var(--muted); }
.zen-cites a:hover { color: var(--accent); }
.zen-cites a:hover b { color: var(--accent); }
/* the entry a citation leads to, on the Publications page */
.pub.is-cited { outline: 2px solid var(--accent); outline-offset: 8px; }
@media (max-width: 700px) {
    .zen-close { right: 10px; top: 10px; }
    .zen-tools { left: 10px; top: 10px; max-width: calc(100vw - 110px); gap: 5px; }
    .zen-tools button { padding: 6px 8px 7px; }
    .zen-rate { margin-left: 0; }
    .zen-hint { top: 92px; max-width: calc(100vw - 24px); width: max-content; }
    .zen-cites summary { padding: 9px 14px 8px; }
    .zen-cites ol { display: block; max-height: 42vh; padding: 0 14px 10px; overflow-y: auto; }
    .zen-cites li { width: auto; padding: 6px 0; border-left: 0; border-top: 1px solid var(--rule); }
}
@media (prefers-reduced-motion: reduce) { .zen, .zen-hint { animation: none; } .zen.is-out, .flock, html.zen-move body > *:not(.flock):not(.zen) { transition: none; } }
@media print { .zen, .bt-zen { display: none !important; } }

/* ---------- Research: a small line-drawn figure for each area ----------
   An empty box in the page; assets/js/scenes.js draws in it on the canvas behind. */
/* A topic's figure stands in the open gap between its description and its links, in the middle of the gap and of the
   topic, at the same place in every topic so they line up down the page. Where there is no gap (narrower windows,
   phones) it goes under the description, above the links, in the middle. */
.fig { height: 132px; }
.area--fig { grid-template-columns: 38px minmax(0, 25rem) minmax(150px, 1fr) minmax(0, 21rem); align-items: center; }
.area--fig > .tile-icon, .area--fig > .area-main, .area--fig > .area-where { align-self: start; }
.area--fig > .fig { justify-self: center; width: 100%; max-width: 300px; }
@media (max-width: 1179px) {
    .area--fig { grid-template-columns: 38px minmax(0, 1fr) minmax(0, 21rem); }
    .area--fig > .fig { grid-column: 2; grid-row: 2; max-width: 320px; height: 118px; margin: 8px 0 2px; }
    .area--fig > .area-where { grid-column: 3; grid-row: 1 / span 2; }
}
@media (max-width: 860px) {
    .area--fig { grid-template-columns: 34px minmax(0, 1fr); }
    .area--fig > .fig { grid-column: 2; grid-row: 2; height: 112px; margin: 10px 0 6px; }
    .area--fig > .area-where { grid-column: 2; grid-row: 3; }
}
@media print { .fig { display: none; } }

/* ---------- LEIA-MIOnA panel (the tabbed one) ----------
   As wide as the page's content column. HARMONIC-MIOnA is the second tab, in the site's own colours.
   The conversation has a label for who is speaking and a bubble for what is said; the small "Ask" panel on other pages shares it. */
.teach.teach--v3 { width: auto !important; max-width: none; grid-template-rows: auto auto auto 500px auto; --harmonic: var(--accent); --harmonic-ink: var(--accent-ink); --harmonic-soft: var(--accent-soft); }
:root[data-theme="dark"] .teach.teach--v3 { --harmonic: var(--accent); --harmonic-ink: var(--accent-ink); --harmonic-soft: var(--accent-soft); }
.teach.teach--v3 .teach-tabs button .miona { font-family: inherit; }
.teach.teach--v3 .teach-guide li button small { margin-left: 4px; color: var(--muted); font-size: 0.86em; }
.teach.teach--v3 .teach-line, .ask .teach-line { display: flex; flex-direction: column; align-items: flex-start; margin: 0 0 12px; padding: 0; border: 0; font-size: 0.9rem; line-height: 1.5; text-align: left; }
.teach.teach--v3 .teach-line.teach-line--you, .ask .teach-line--you { align-items: flex-end; text-align: left; }
.teach.teach--v3 .teach-line > b, .teach.teach--v3 .teach-line.teach-line--you > b, .ask .teach-line > b { display: block; margin: 0 2px 3px; padding: 0; color: var(--muted); font-family: var(--mono); font-size: 0.62rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.teach.teach--v3 .teach-line--page > b, .ask .teach-line--page > b { color: var(--accent); }
.teach.teach--v3 .teach-line .teach-say, .ask .teach-line .teach-say { display: block; max-width: 92%; padding: 8px 12px 9px; border: 1px solid var(--rule-strong); border-radius: 2px 10px 10px 10px; background: var(--paper); color: var(--text); }
.teach.teach--v3 .teach-line--you .teach-say, .ask .teach-line--you .teach-say { max-width: 84%; border-color: var(--accent); border-radius: 10px 2px 10px 10px; background: var(--accent); color: var(--accent-ink); font-family: var(--mono); font-size: 0.8rem; }
.ask .teach-line--you .teach-say { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.ask .teach-line .teach-say { background: var(--surface); }
/* what the visitor typed: light words on a dark bubble. (The rule above used to win here too, and left light words on a light bubble.) */
.ask .teach-line.teach-line--you .teach-say { border-color: var(--ink); background: var(--ink); color: var(--paper); }
/* the robot's progress lines follow one another without a new label */
.teach.teach--v3 .teach-line--cont, .ask .teach-line--cont { margin-top: -7px; }
.teach.teach--v3 .teach-line--cont > b, .ask .teach-line--cont > b { display: none; }
.teach.teach--v3 .teach-line--cont .teach-say, .ask .teach-line--cont .teach-say { padding: 4px 12px 5px; border-radius: 2px; }

/* under an answer: how it was understood */
.tl-how { margin-top: 7px; }
.tl-how-btn { padding: 0; border: 0; background: none; color: var(--accent); font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.02em; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.tl-how-btn:hover { color: var(--ink); }
.tl-trace { margin-top: 8px; padding: 2px 10px 9px; border: 1px dashed var(--rule-strong); background: var(--paper); font-size: 0.78rem; line-height: 1.45; }
.tl-trace[hidden] { display: none; }
.tl-part-h { margin: 9px 0 5px; color: var(--accent); font-family: var(--mono); font-size: 0.62rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.tl-words { display: flex; flex-wrap: wrap; gap: 4px; }
.tl-word { display: inline-flex; flex-direction: column; padding: 2px 6px 3px; border: 1px solid var(--rule-strong); background: var(--surface); }
.tl-word b { color: var(--ink); font-family: var(--mono); font-size: 0.72rem; font-weight: 500; }
.tl-word i { color: var(--muted); font-family: var(--mono); font-size: 0.58rem; font-style: normal; letter-spacing: 0.02em; }
.tl-word.is-f { border-style: dotted; opacity: 0.7; }
.tl-word.is-unk { border-color: var(--c-award); }
.tl-word.is-unk i { color: var(--c-award); }
.tl-teachme { margin-top: 7px; color: var(--ink); }
.tl-teachme button { padding: 2px 8px; border: 1px solid var(--accent); background: none; color: var(--accent); font-family: var(--mono); font-size: 0.66rem; cursor: pointer; }
.tl-teachme button:hover { background: var(--accent); color: var(--accent-ink); }
.tl-frame { margin-top: 4px; padding: 5px 8px 6px; border: 1px solid var(--rule); background: var(--surface); }
.tl-frame > b { display: block; color: var(--ink); font-family: var(--mono); font-size: 0.68rem; font-weight: 500; letter-spacing: 0.03em; }
.tl-frame-row { display: grid; grid-template-columns: 5.6rem minmax(0, 1fr); gap: 0 8px; margin-top: 2px; }
.tl-frame-row i { color: var(--muted); font-family: var(--mono); font-size: 0.6rem; font-style: normal; letter-spacing: 0.04em; }
.tl-frame-row em { color: var(--text); font-family: var(--mono); font-size: 0.66rem; font-style: normal; overflow-wrap: anywhere; }
.tl-rule, .tl-said { margin-top: 3px; color: var(--text); }
.tl-said { padding-left: 8px; border-left: 2px solid var(--accent); }
.tl-none { color: var(--muted); font-size: 0.74rem; }
.tl-claim { margin-top: 9px; color: var(--c-true); font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.02em; }

/* a patent tag reads as written: "US Patent 11,957,447", "Patent pending" */
.ptile .pub-labels .venue, .ptile .pub-labels .tag { text-transform: none; letter-spacing: 0.03em; }

/* ---------- Large and wide screens ----------
   Up to 1480px wide the page is exactly as it always was. Beyond that the content column grows with the window,
   three quarters of every extra pixel, up to 460px more; every width cap inside it grows by its share
   (see "calc(…px + var(--grow, 0px) * …)" above; lists of text by less than half of theirs, so their lines stay
   comfortable). Type, spacing and line length in paragraphs do not change. */
:root { --grow: clamp(0px, (100vw - 1480px) * 0.75, 460px); }
@media print { :root { --grow: 0px; } }
.teach.teach--v3 .teach-hint { max-width: 96ch; }

/* the agent's name inside the home page's button */
.assist-text b .miona sub { top: 0.28em; font-size: 0.7em; }
@media (max-width: 1100px) and (min-width: 701px) { .zen-hint { top: 58px; } }
.teach.teach--v3 .teach-hint { max-width: none; padding-right: max(22px, calc(100% - 100ch)); }
@media (min-width: 1500px) { .fig { height: 150px; } }

/* ---------- Text that is there but not seen ----------
   A drawing made by a script says nothing to a screen reader, or to a tool that reads the page. Each one has its
   description as real text in the page, hidden from sight with this class. */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* ---------- Zen Mode: the legend of the colours, at the top the whole time ----------
   The same colours assets/js/flock.js draws with (HUE there); change them in both places. */
.zen-legend { --zl-drone: rgb(59, 108, 151); --zl-ugv: rgb(131, 87, 135); --zl-charge: rgb(66, 140, 96); --zl-flash: rgb(200, 128, 36);
    position: absolute; left: 50%; top: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 16px; width: max-content; max-width: calc(100vw - 16px); margin: 0; padding: 5px 12px 6px; border: 1px solid var(--rule); background: var(--surface); color: var(--muted); font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.03em; line-height: 1.2; list-style: none; pointer-events: none; }
:root[data-theme="dark"] .zen-legend { --zl-drone: rgb(160, 200, 231); --zl-ugv: rgb(217, 183, 217); --zl-charge: rgb(156, 214, 170); --zl-flash: rgb(240, 192, 116); }
.zen-legend li { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.zen-legend svg { flex: none; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.zl-drone svg { color: var(--zl-drone); } .zl-ugv svg { color: var(--zl-ugv); } .zl-charge svg { color: var(--zl-charge); } .zl-flash svg { color: var(--zl-flash); }
/* the hint, which goes after a few seconds, sits under it */
.zen-hint { top: 54px; }
@media (max-width: 1100px) { .zen-legend { top: 56px; } .zen-hint { top: 94px; } }
@media (max-width: 700px) { .zen-legend { top: 50px; gap: 11px; padding: 5px 9px 6px; } .zen-hint { top: 88px; } }

/* ---------- Zen Mode: one bar along the top ----------
   The buttons, the legend and the line that says what a click, a double click, a hold and a drag do, side by side,
   all there the whole time. They go onto a second row where the window is too narrow for one. */
.zen-top { position: absolute; left: 18px; right: 122px; top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; pointer-events: none; }
.zen-top > .zen-tools, .zen-top > .zen-legend, .zen-top > .zen-hint { position: static; transform: none; left: auto; top: auto; margin: 0; max-width: 100%; }
.zen-top > .zen-tools { pointer-events: auto; }
.zen-top > .zen-legend { gap: 12px; padding: 5px 10px 6px; }
.zen-top > .zen-hint { width: auto; padding: 5px 10px 6px; border-color: var(--rule); font-size: 0.66rem; line-height: 1.2; text-align: left; animation: none; }
.zen-legend { --zl-spot: rgb(196, 84, 78); }
:root[data-theme="dark"] .zen-legend { --zl-spot: rgb(240, 156, 148); }
.zl-spot svg { color: var(--zl-spot); }
.zen-stage { touch-action: none; }                                       /* a finger drags the zone; it does not scroll */
@media (max-width: 700px) {
    .zen-top { left: 10px; right: 10px; top: 10px; gap: 6px; }
    .zen-top > .zen-tools { max-width: calc(100% - 98px); }             /* the close button is beside them */
    .zen-top > .zen-legend { gap: 9px; padding: 5px 8px 6px; font-size: 0.62rem; }
    .zen-top > .zen-hint { font-size: 0.62rem; }
}
/* at laptop width the three sit on one row */
.zen-top { right: 112px; gap: 8px; }
.zen-top > .zen-legend { gap: 10px; }
.zen-top > .zen-hint { font-size: 0.62rem; letter-spacing: 0; }

/* ---------- Zen Mode: formations ----------
   A few small, quiet buttons at the end of the bar: the preset shapes, Draw, and Release. */
.zen-top > .zen-shapes { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; pointer-events: auto; }
.zen-shapes-label { margin-right: 4px; color: var(--muted); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.04em; }
.zen-shapes button { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 27px; padding: 0 8px; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--muted); font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.03em; line-height: 1; cursor: pointer; transition: border-color 0.15s ease, color 0.15s ease; }
.zen-shapes button[data-zen-form] { width: 28px; padding: 0; }
.zen-shapes button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.zen-shapes button:hover { border-color: var(--ink); color: var(--ink); }
.zen-shapes button[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); }
.zen-shapes button:disabled { opacity: 0.45; cursor: default; border-color: var(--rule); color: var(--muted); }
.zen-shapes button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.zen-shapes [data-zen-draw] { margin-left: 6px; }
.zen-stage.is-drawing { cursor: crosshair; }

/* ---------- The behaviour tree on phones ----------
   Below 861px there is no margin rail. The tree is shown as a short path in the header instead, with the same node
   symbols: a selector (?) for the root that chooses the page, a sequence (the arrow) for this page, and for the section
   being read an action (the small box) or a selector (?) when it holds a list of years. The section's node is "running"
   while it is read and "done" at the end of the page, in the rail's own colours. The tick buttons, and on the home page
   the Zen button, are a small row at the top of the page. */
.bt-path { display: none; }
@media (max-width: 860px) {
    .bt-path { display: flex; flex: 0 0 100%; align-items: center; min-width: 0; height: 24px; margin: 0; padding: 0 0 5px; color: var(--muted); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.05em; line-height: 1; text-transform: uppercase; white-space: nowrap; }
    .bt-path i { flex: none; width: 10px; height: 1px; margin: 0 4px; background: var(--rule-strong); }
    .bt-path b { font-weight: 500; }
    .bt-path .bp-page { flex: none; margin-left: 6px; color: var(--ink); }
    .bt-path .bp-sec { flex: 0 1 auto; min-width: 0; margin-left: 6px; overflow: hidden; text-overflow: ellipsis; transition: color 0.25s ease; }
    .bt-path .bp-sec.is-run, .bt-path .bp-sec.is-done { color: var(--ink); }
    .bp-node { flex: none; display: inline-grid; place-items: center; width: 15px; height: 15px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); font-size: 0.6rem; font-weight: 500; line-height: 1; transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease; }
    .bp-seq.is-run { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
    .bp-leaf { width: 15px; height: 9px; border-color: var(--rule-strong); }                      /* an action: the rail's small box */
    .bp-leaf.bp-leaf--sel { height: 15px; border-color: var(--ink); }                            /* a selector over years */
    .bp-leaf.is-run { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 3px var(--accent-soft); animation: bt-glow 1.9s ease-in-out infinite; }
    .bp-leaf.bp-leaf--sel.is-run { animation: none; }                                            /* a composite node does not glow */
    .bp-node.is-done { border-color: var(--c-true); background: var(--c-true); color: #fff; box-shadow: none; animation: none; }
    :root[data-theme="dark"] .bp-node.is-done { color: #0e1013; }
    .bt-path--short [data-bp-link], .bt-path--short .bp-leaf, .bt-path--short .bp-sec { display: none; }
    /* the small row: tick once, play, and on the home page the Zen button; on the other pages a word of what they do */
    .bt-bar { position: static; display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px 0 0; background: none; }
    .bt-bar .bt-btns { gap: 6px; margin: 0; }
    .bt-bar .bt-step, .bt-bar .bt-tick { width: 34px; height: 28px; }
    .bt-bar .bt-zen { height: 28px; }
    .bt-bar .bt-hint { font-size: 0.62rem; }
    .bt-bar .bt-hint i { display: none; }
    .bt-bar--zen .bt-hint { display: none; }
    /* the row takes a little room; the first section gives most of it back */
    .bt-bar + .node--root.hero { --node-pad: 22px; }
    .bt-bar + .ident-mini { margin-top: 12px; }
}
@media (max-width: 860px) and (prefers-reduced-motion: reduce) { .bp-leaf.is-run { animation: none; } }
@media print { .bt-path { display: none !important; } }

/* ---------- Zen Mode's bar on phones: four short rows ---------- */
@media (max-width: 700px) {
    .zen-top > .zen-tools { flex-wrap: nowrap; max-width: calc(100% - 92px); gap: 4px; }
    .zen-top > .zen-tools button { padding: 6px 6px 7px; font-size: 0.64rem; }
    .zen-top > .zen-tools .zen-rate { margin-left: 2px; }
    .zen-top > .zen-legend { flex-wrap: wrap; gap: 4px 8px; width: auto; }
    .zen-top > .zen-shapes { flex-wrap: nowrap; }
    .zen-shapes-label { display: none; }
    .zen-shapes [data-zen-draw] { margin-left: 4px; }
}
@media (max-width: 700px) { .zen-top > .zen-tools button { flex: none; white-space: nowrap; } }
