/* Layout and type follow the TopoOR project page (wngtn.github.io/TopoOR); colours follow the cortex teaser
   (source M blue, target N green). */
:root {
  color-scheme: light;
  --bg: #fafbfd;
  --surface: #ffffff;
  --ink: #192538;
  --body: #465267;
  --muted: #647187;
  --accent: #2f6fbf;
  --border: #e2e7ee;
  --soft: #f1f5fa;
  --row: #edf3fc;
  --stage: #ffffff;
  --shadow: 0 5px 25px rgba(29, 45, 70, .05);
  --m: #2f7fc4;          /* source shape M */
  --n: #17a050;          /* target shape N */
  --v: #d4830f;          /* spectral basis */
  --bad: #b4452f;
  --font: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #101725;
  --surface: #172131;
  --ink: #e9eef6;
  --body: #b9c5d6;
  --muted: #9aaac1;
  --accent: #8db6ee;
  --border: #2a374a;
  --soft: #1c293c;
  --row: #1f3049;
  --stage: #f4f6f9;
  --shadow: 0 5px 28px rgba(0, 0, 0, .13);
  --m: #6aaee8;
  --n: #4fcf84;
  --v: #f0a640;
  --bad: #ec8a74;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--body); font: 400 16px/1.8 var(--font); -webkit-font-smoothing: antialiased; overflow-x: clip; }
::selection { background: #d4e3fa; color: #132641; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 4px; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3, strong { color: var(--ink); }
strong { font-weight: 600; }
img { max-width: 100%; }
sup { font-size: .64em; line-height: 0; vertical-align: super; }
sub { font-size: .7em; line-height: 0; }

.page-shell { max-width: 1184px; padding-inline: 32px; margin: auto; }
.skip-link { position: absolute; top: -100px; left: 16px; background: var(--surface); padding: 10px 16px; z-index: 10; }
.skip-link:focus { top: 12px; }

/* ---------- masthead ---------- */
.masthead { height: 70px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.wordmark { white-space: nowrap; font-size: 19px; font-weight: 700; letter-spacing: -.6px; color: var(--ink); }
.wordmark span { color: var(--accent); }
.wordmark:hover { text-decoration: none; }
.masthead nav { display: flex; align-items: center; gap: 27px; font-size: 14px; }
.masthead nav > a { color: var(--body); }
.theme-toggle { width: 35px; height: 35px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--border); background: transparent; }
.theme-toggle:hover { background: var(--soft); }
.theme-toggle svg { width: 17px; height: 17px; }
.sun-icon, [data-theme='dark'] .moon-icon { display: none; }
[data-theme='dark'] .sun-icon { display: block; }

/* ---------- hero ---------- */
.hero { padding-top: 56px; }
.publication-line { text-align: center; color: var(--accent); font-size: 14px; font-weight: 600; letter-spacing: .045em; margin-bottom: 18px; }
h1 { max-width: 1020px; margin: auto; text-align: center; font-weight: 700; font-size: clamp(30px, 3.4vw, 46px); line-height: 1.2; letter-spacing: -.035em; text-wrap: balance; }
.title-sub { display: block; font-size: .62em; margin-top: 12px; color: var(--body); font-weight: 500; letter-spacing: -.02em; }

/* "Attention" starts blacked out (as on the talk's title slide) and is revealed. */
.redact { position: relative; display: inline-block; color: var(--accent); }
.js .redact::after { content: ''; position: absolute; inset: .08em -.08em .02em; background: var(--ink); border-radius: 3px; transform-origin: right; transition: transform .9s cubic-bezier(.7, 0, .2, 1); }
.js .redact.revealed::after { transform: scaleX(0); }

.paper-details { margin: 31px auto 40px; text-align: center; }
.authors { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px 26px; font-size: 15px; line-height: 1.7; font-weight: 500; max-width: 980px; margin: 0 auto; }
.author { white-space: nowrap; color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.author a { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--ink); }
.author-portrait { width: 80px; height: 80px; object-fit: cover; border-radius: 50%; background: var(--soft); }
.author-portrait.initials { display: grid; place-items: center; font-size: 21px; font-weight: 600; letter-spacing: .02em; color: var(--muted); border: 1px solid var(--border); }
.author sup { margin-left: 3px; color: var(--accent); }
.affiliations { max-width: 850px; margin: 18px auto 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 3px 20px; font-size: 13px; line-height: 1.9; color: var(--muted); }
.affiliations > span { white-space: nowrap; }
.affiliations sup { color: var(--accent); }
.resources { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.resource-button { display: inline-flex; align-items: center; gap: 9px; height: 40px; padding: 0 19px; font-size: 14px; font-weight: 500; border: 1px solid var(--border); border-radius: 7px; color: var(--ink); background: var(--surface); }
.resource-button:hover { text-decoration: none; border-color: var(--accent); }
.resource-button svg { width: 17px; height: 17px; }
.resource-button:disabled { cursor: default; color: var(--muted); }
.resource-button:disabled:hover { border-color: var(--border); }
.button-status { font-size: 11px; font-weight: 400; }

/* ---------- teaser video ---------- */
.teaser { max-width: 980px; margin: 0 auto; }
.video-frame { position: relative; overflow: hidden; border-radius: 15px; border: 1px solid var(--border); box-shadow: var(--shadow); background: #fff; }
.video-frame video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: contain; background: #fff; cursor: pointer; }
.video-start { position: absolute; left: 50%; top: calc(50% - 23px); transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; color: #fff; background: rgba(25, 37, 56, .78); border: 1px solid rgba(255,255,255,.7); display: grid; place-items: center; box-shadow: 0 3px 18px rgba(0,0,0,.14); transition: opacity .25s; }
.video-start:hover { background: #1d3557; }
.video-start svg { width: 28px; height: 28px; }
.playing .video-start { opacity: 0; pointer-events: none; }
.video-controls { height: 46px; display: flex; align-items: center; gap: 12px; padding: 0 15px; background: var(--surface); border-top: 1px solid var(--border); }
.player-button { flex: 0 0 30px; height: 30px; padding: 5px; border: 0; background: transparent; display: grid; place-items: center; border-radius: 4px; }
.player-button:hover { background: var(--soft); }
.player-button svg { width: 18px; height: 18px; }
.pause-icon, .playing .play-icon { display: none; }
.playing .pause-icon { display: block; }
.video-time, .video-duration { font-size: 12px; font-variant-numeric: tabular-nums; min-width: 30px; }
.seek { position: relative; flex: 1; height: 24px; cursor: pointer; display: flex; align-items: center; touch-action: none; }
.seek-track { position: relative; width: 100%; height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.seek-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); }
.seek-tick { position: absolute; top: 7px; width: 2px; height: 10px; margin-left: -1px; border-radius: 1px; background: var(--surface); box-shadow: 0 0 0 1px var(--border); pointer-events: none; }
.video-frame:fullscreen { display: flex; flex-direction: column; justify-content: center; border: 0; border-radius: 0; background: #fff; }
.video-frame:fullscreen video { flex: 1; min-height: 0; max-height: calc(100dvh - 46px); }

.chapters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; max-width: 760px; margin: 14px auto 0; position: relative; }
.chapters button { position: relative; border: 0; background: transparent; padding: 8px 4px 12px; font-size: 13px; color: var(--muted); transition: color .3s; text-align: center; }
.chapters button::after { content: ''; position: absolute; left: 12%; right: 12%; bottom: 0; height: 2px; border-radius: 2px; background: var(--border); transition: background .3s; }
.chapters button span { margin-right: 7px; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chapters button:hover, .chapters button.is-active { color: var(--ink); }
.chapters button.is-active span { color: var(--accent); }
.chapters button.is-active::after { background: var(--accent); }

figcaption { max-width: 820px; margin: 16px auto 0; text-align: center; font-size: 14px; line-height: 1.7; color: var(--muted); }
.caption-title { display: block; color: var(--body); font-weight: 600; }

/* ---------- highlights ---------- */

/* ---------- sections ---------- */
.introduction { max-width: 780px; margin: 76px auto 72px; }
h2 { font-size: 29px; line-height: 1.3; font-weight: 650; letter-spacing: -.025em; }
.introduction h2 { text-align: center; margin-bottom: 23px; text-wrap: balance; }
.prose p + p { margin-top: 17px; }
h3 { font-size: 20px; line-height: 1.4; font-weight: 600; letter-spacing: -.015em; margin-bottom: 14px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.section { margin-bottom: 96px; }
.section-heading { text-align: center; max-width: 760px; margin: 0 auto 32px; }
.section-heading > p:not(.eyebrow) { max-width: 660px; margin: 14px auto 0; color: var(--muted); font-size: 15px; }

.figure-card { display: block; position: relative; background: var(--stage); padding: 26px 24px; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; cursor: zoom-in; }
.figure-card img { display: block; width: 100%; height: auto; }
.figure-card.wide { padding: 26px 22px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; max-width: 1000px; margin: auto; }
.split h2 { margin-bottom: 18px; }
.split .figure-card { padding: 16px; max-width: 470px; justify-self: center; }

/* ---------- equation ---------- */
.equation-card { max-width: 980px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 36px 36px 28px; }
.equation-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; column-gap: .45em; font-size: 1.32em; color: var(--ink); padding: 4px 0 8px; }
.equation { max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.equation .katex-display { margin: .4em 0; }
main { overflow-x: clip; }
.eq-q { color: var(--n); }
.eq-k { color: var(--m); }
.eq-v { color: var(--v); }
.qkv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 26px; }
.qkv-item { display: flex; gap: 13px; align-items: flex-start; padding: 14px 16px; border-radius: 10px; background: var(--soft); font-size: 14px; line-height: 1.55; }
.qkv-item p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.qkv-tag { flex: 0 0 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; font-weight: 700; font-size: 14px; color: #fff; }
.q .qkv-tag { background: var(--n); }
.k .qkv-tag { background: var(--m); }
.v .qkv-tag { background: var(--v); }
.modes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 26px; padding: 14px 10px 6px; background: var(--stage); border-radius: 10px; }
.modes figure img { display: block; width: 100%; height: auto; }
.modes figcaption { margin-top: 2px; font-size: 13px; color: #647187; }
.modes-caption { margin-top: 12px; text-align: center; font-size: 13px; color: var(--muted); }




/* ---------- results ---------- */
.table-block { max-width: 940px; margin: 52px auto 0; }
.table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; line-height: 1.5; font-variant-numeric: tabular-nums; text-align: right; }
caption { text-align: left; padding: 0 0 14px; font-size: 14px; font-weight: 500; color: var(--ink); }
.table-number { font-weight: 400; font-size: 12px; color: var(--muted); margin-right: 13px; }
th, td { padding: 11px 16px; border-bottom: 1px solid var(--border); }
thead th { background: var(--soft); font-size: 13px; font-weight: 600; color: var(--body); vertical-align: bottom; white-space: nowrap; }
thead tr:first-child th:first-child { border-top-left-radius: 8px; }
thead tr:first-child th:last-child { border-top-right-radius: 8px; }
thead th.group { text-align: center; color: var(--ink); border-bottom: 1px solid var(--border); }
th:first-child { text-align: left; }
tbody th { font-weight: 400; white-space: nowrap; }
tbody td { white-space: nowrap; }
.group-row th { font-size: 12px; font-weight: 500; color: var(--muted); padding-top: 17px; padding-bottom: 5px; border-bottom: 0; font-style: italic; }
.ours { background: var(--row); }
.ours > th { color: var(--accent); font-weight: 600; }
.ours-label { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.metric-start { border-left: 1px solid var(--border); }
td.muted { color: var(--muted); }
td.bad { color: var(--bad); }
.table-note { margin-top: 13px; font-size: 12px; color: var(--muted); line-height: 1.7; }


/* ---------- cortex explorer ---------- */


/* ---------- citation / footer ---------- */
.citation { max-width: 900px; margin: 0 auto 56px; }
.citation-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.copy-button { background: var(--surface); color: var(--body); border: 1px solid var(--border); padding: 7px 13px; border-radius: 6px; font-size: 12px; }
.copy-button:hover { background: var(--soft); border-color: var(--accent); }
pre { margin: 0; overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--soft); padding: 24px 28px; font: 12.5px/1.85 'SFMono-Regular', ui-monospace, Consolas, monospace; color: var(--body); }
.copy-status { font-size: 13px; min-height: 23px; margin-top: 8px; color: var(--accent); }
footer { border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 18px 32px; align-items: center; justify-content: space-between; padding: 26px 0 34px; font-size: 12px; color: var(--muted); }
footer p { margin: 0; }
.logos { display: flex; align-items: center; gap: 26px; }
.logos img { height: 26px; width: auto; opacity: .75; }
.logos .logo-imperial { height: 20px; }
.logos .logo-dil { height: 30px; }
[data-theme='dark'] .logos img { filter: brightness(0) invert(.88); }

/* ---------- figure dialog ---------- */
#figure-dialog { width: min(1400px, 96vw); max-width: none; max-height: 94vh; padding: 28px; border: 0; border-radius: 14px; background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
#figure-dialog::backdrop { background: rgba(10, 16, 28, .65); }
#figure-dialog img { display: block; width: 100%; height: auto; max-height: calc(94vh - 56px); object-fit: contain; }
.dialog-close { position: absolute; top: 6px; right: 10px; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; font-size: 24px; color: #465267; }
.dialog-close:hover { background: #f1f5fa; }

.katex { font-size: 1.04em; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .page-shell { padding-inline: 24px; }
  .qkv { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .page-shell { padding-inline: 16px; }
  .masthead { height: 60px; }
  .masthead nav { gap: 12px; font-size: 12.5px; }
  .masthead nav > a:first-child { display: none; }
  .wordmark { font-size: 15px; letter-spacing: -.4px; }
  .hero { padding-top: 38px; }
  h1 { font-size: 29px; }
  h2 { font-size: 24px; }
  .authors { gap: 18px 14px; font-size: 13px; }
  .author-portrait { width: 62px; height: 62px; }
  .author-portrait.initials { font-size: 17px; }
  .chapters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .equation-card { padding: 22px 16px 18px; }
  .equation-row { font-size: 1.02em; }
  .modes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .video-controls { gap: 8px; padding: 0 10px; }
  .figure-card, .figure-card.wide { padding: 12px; }
  footer { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (max-width: 400px) {
  .masthead nav > a[href='#citation'] { display: none; }
}

.js .redact::after{display:none}.authors{gap:8px 22px}.author-note{font-size:13px;color:var(--muted);text-align:center;margin:14px auto}.resources a{text-decoration:none}.video-frame video{display:block;width:100%;height:auto}@media(max-width:600px){.wordmark{font-size:12px}.masthead nav{gap:10px}}
