/* ==========================================================
   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: 1120px;
    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: 900px; }
.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: 860px; }
.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: 760px; }
.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: 900px; }
.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: 900px; 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: 860px; }
.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: 620px; }

/* ---------- Cards (contributions, layers) ---------- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 0 clamp(20px, 3vw, 40px);
    max-width: 960px;
}
.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: 900px; }
.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: 860px; }
.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: 860px;
}
.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: 860px;
}
.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: 900px;
}
.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: 900px; }
.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: 900px; }
.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: 900px; }
.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: 760px;
}
.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: 860px; 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("../images/PP3.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: 900px; }

.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: 900px;
    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: 980px; }
.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: 1040px; }
.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: 760px; 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: 980px; }
.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: 980px; }
.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: 760px; 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: 1040px; }
.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: 960px;
    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: 960px; }
.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: 960px;
    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: 960px; 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: 760px; }
