/* CAB-OOD project page. Light theme only. */
:root {
  color-scheme: light;
  --ink: #15171c;
  --ink-2: #454a55;
  --muted: #6a707c;
  --line: #e4e7ec;
  --line-strong: #cfd4dc;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --focus: #2a78d6;
  /* HBox orange, Point green and Unified blue, for the lettering */
  --grad: linear-gradient(90deg, #e2572a 0%, #0f9c6b 52%, #2468c4 100%);
  --shell: min(1120px, calc(100% - 48px));
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --math: "STIX Two Math", "Cambria Math", "Latin Modern Math", "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3, p, figure { margin: 0; }
button { font: inherit; color: inherit; }
:where(a, button, input, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}
.shell { width: var(--shell); margin-inline: auto; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }

/* ---------- hero ---------- */
.hero { padding: 72px 0 56px; text-align: center; }
.hero__inner { display: grid; justify-items: center; }
.wordmark {
  position: relative; display: inline-block;
  font-size: clamp(3.4rem, 9vw, 6.2rem); font-weight: 800; line-height: 1; letter-spacing: -0.045em;
}
/* a cap hung on the corner of the C; sized in em so it follows the lettering */
.wordmark__hat {
  position: absolute; left: -0.17em; top: -0.175em; z-index: 1; width: 0.64em; height: auto;
  transform: rotate(-22deg); transform-origin: 60% 80%;
  filter: drop-shadow(0 0.02em 0.02em rgba(21, 23, 28, 0.25));
}
/* The title shows the gradient only through the letters that spell CAB-OOD. */
.title {
  margin-top: 16px; max-width: 21em;
  font-size: clamp(1.45rem, 2.7vw, 2.15rem); line-height: 1.22; font-weight: 700; letter-spacing: -0.025em;
  text-wrap: balance;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
}
.title .hl { -webkit-text-fill-color: transparent; color: transparent; font-weight: 800; }
.venue { margin-top: 14px; color: var(--ink-2); font-size: 1.1rem; font-weight: 600; }
.authors { margin-top: 18px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; font-size: 1.06rem; font-weight: 600; }
.authors sup, .affils sup { font-size: 0.7em; font-weight: 500; color: var(--muted); margin-left: 1px; }
.affils { margin-top: 8px; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 18px; color: var(--muted); font-size: 14.5px; }
.actions { margin-top: 24px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px;
  border: 1px solid var(--ink); border-radius: 999px; background: var(--ink); color: #fff;
  font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: #2a2e37; }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--surface-2); }
.btn[aria-disabled="true"] { border-color: var(--line); background: var(--surface-2); color: var(--muted); cursor: default; }
.btn small { font-size: 11px; font-weight: 500; opacity: 0.8; }

/* Figure 1(b) of the paper, right under the title; a chart, so narrower than a photo figure */
.teaser { max-width: 600px; margin-top: 40px; }

/* ---------- sections ---------- */
.section { padding: 56px 0; border-top: 1px solid var(--line); }
.section h2 { font-size: clamp(1.45rem, 2.2vw, 1.8rem); line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
.section__sub { margin-top: 8px; color: var(--ink-2); }
/* the abstract sits in a narrower column, heading and text on one left edge */
.abstract { max-width: 780px; }
.abstract p { margin-top: 14px; color: var(--ink-2); text-align: justify; hyphens: auto; }
.stack { display: grid; gap: 48px; margin-top: 28px; }
/* grid children may shrink below their content, so wide tables scroll inside their own box */
.stack > *, .info > * { min-width: 0; }

/* ---------- the question the paper starts from ---------- */
/* left: the question, its two paragraphs and, at the bottom, the times; right: the image to label; below: the pace line */
.question { --rbox: #3b82f6; --hbox: #d9771f; --point: #4a9a5a; }
.question__body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 28px 56px; }
.question__text { display: flex; flex-direction: column; }
.question__text h2 { text-wrap: balance; }
.question__text p { margin-top: 12px; color: var(--ink-2); }
.question__text h2 + p { margin-top: 20px; }
.question__times { margin-top: auto; padding-top: 28px; }

/* label it yourself: corner clicks, dragged boxes, single clicks, and how long each takes */
.annot__lead { color: var(--ink); font-size: 15px; font-weight: 600; }
.annot__modes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.annot__modes [data-next="true"] { border-color: var(--ink); color: var(--ink); }
.annot__reset { margin-left: auto; }
.annot__stage { display: block; width: 100%; height: auto; margin-top: 10px; overflow: hidden; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.annot__stage[data-drawing="hbox"] { touch-action: none; }   /* a drag draws a box instead of scrolling the page */
.annot__stage image { pointer-events: none; }
.mark { vector-effect: non-scaling-stroke; }
.mark--point { fill: var(--point); stroke: #fff; stroke-width: 2px; }
.mark--box { fill: none; stroke: var(--hbox); stroke-width: 2.5px; }
.mark--live { fill: rgba(217, 119, 31, 0.14); stroke: var(--hbox); stroke-width: 1.5px; stroke-dasharray: 5 4; }
.mark--rbox { fill: none; stroke: var(--rbox); stroke-width: 3px; stroke-linejoin: round; }
.mark--line { fill: none; stroke: var(--rbox); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.mark--corner { fill: var(--rbox); stroke: #fff; stroke-width: 1.5px; }
.annot__status { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 8px; color: var(--ink-2); font-size: 14px; }
.annot__status b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.annot__result { margin: 0; border-top: 1px solid var(--line); }
.annot__result div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.annot__result dt b { margin-right: 10px; font-size: 15px; font-weight: 650; }
.annot__result dd { margin: 0; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.annot__result [data-done="true"] dd { color: var(--ink); font-weight: 650; }
.annot__result [data-result="point"] { --mark: var(--point); }
.annot__result [data-result="rbox"] { --mark: var(--rbox); }
.annot__result [data-result="hbox"] { --mark: var(--hbox); }
.question__times .annot__note { margin-top: 6px; color: var(--muted); font-size: 12.5px; }
/* one full-width line under both columns */
.annot__verdict { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink); font-size: 1.05rem; font-weight: 600; text-wrap: pretty; }
.annot__verdict[data-empty="true"] { color: var(--muted); font-weight: 400; }
/* the box as a tuple: what the label does not give is boxed with a dashed line */
.tuple { color: var(--ink); font-family: "Times New Roman", Times, serif; font-size: 16px; white-space: nowrap; }
.tuple var, .tuple i { font-style: italic; }
.tuple i { padding: 0 4px; border: 1.5px dashed var(--mark); border-radius: 3px; }

/* ---------- interactive pipeline ---------- */
.pipeline { margin-top: 24px; }
.pipeline__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.pipeline__label { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.phases { display: flex; flex-wrap: wrap; gap: 6px; }
.pill-btn {
  display: inline-flex; align-items: baseline; gap: 7px; padding: 6px 13px; border: 1px solid var(--line-strong);
  border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.pill-btn small { color: var(--muted); font-size: 11.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.pill-btn:hover { background: var(--surface-2); }
.pill-btn[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.pill-btn[aria-pressed="true"] small { color: #c9ced8; }
.pill-btn--play { gap: 8px; border-color: var(--ink); color: var(--ink); }
.pill-btn--play [data-play-icon] { font-size: 10px; }

.diagram-scroll { margin-top: 16px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.diagram { display: block; width: 100%; min-width: 980px; height: auto; }
.scroll-hint { display: none; margin-top: 6px; color: var(--muted); font-size: 12.5px; }

/* The diagram is the paper's Figure 2, converted shape by shape from its slide, so it keeps the paper's lettering and colours. */
.diagram text { font-family: "Times New Roman", Times, "Nimbus Roman", "Liberation Serif", serif; white-space: pre; }
.diagram .i { font-style: italic; }
.diagram .b { font-weight: 700; }
.diagram .m { font-family: var(--math); }

.diagram .scaffold, .diagram .node, .diagram .part { transition: opacity 0.25s ease; }
/* during Play the signals come on more slowly, so each stage reads as a change */
.diagram[data-playing="true"] .part { transition-duration: 0.7s; }
.diagram .part { cursor: pointer; }
.diagram .part:focus { outline: none; }
.diagram .part:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.diagram rect.hit { fill: transparent; }
.diagram path.hit { fill: none; stroke: transparent; stroke-width: 18; }
.diagram .wire { transition: stroke-width 0.2s ease; }
.diagram .flow { display: none; fill: none; stroke: #fff; stroke-linecap: round; stroke-dasharray: 0.1 11; pointer-events: none; }

/* training stage: what is switched on */
.diagram .part[data-state="ramp"] { opacity: 0.5; }
.diagram .part[data-state="off"] { opacity: 0.16; }
/* a chosen signal: everything it does not touch steps back */
.diagram[data-focus="true"] .scaffold { opacity: 0.4; }
.diagram[data-focus="true"] .node:not([data-lit="true"]) { opacity: 0.28; }
.diagram[data-focus="true"] .part:not([data-selected="true"]) { opacity: 0.1; }
.diagram .part[data-selected="true"] { opacity: 1; }
.diagram .part[data-selected="true"][data-state="off"] { opacity: 0.55; }
.diagram .part[data-hover="true"] .wire, .diagram .part[data-selected="true"] .wire { stroke-width: 5.2px; }
.diagram .part[data-selected="true"]:not([data-state="off"]) .flow { display: inline; animation: flow 0.9s linear infinite; }
@keyframes flow { from { stroke-dashoffset: 11.1; } to { stroke-dashoffset: 0; } }

/* what the chosen stage or signal is; the height is held so the page does not jump */
.info {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px 40px;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); min-height: 132px;
}
.info__kicker { color: var(--muted); font-size: 13px; font-weight: 600; }
.info h3 { margin-top: 2px; font-size: 1.08rem; font-weight: 650; letter-spacing: -0.01em; }
.info h3 .loss { margin-right: 8px; }
.info__main p:not(.info__kicker) { margin-top: 6px; color: var(--ink-2); font-size: 14.5px; }
.info__clear { margin-top: 12px; }
.info__facts { margin: 0; display: grid; gap: 7px; align-content: start; font-size: 14px; }
.info__facts div { display: grid; grid-template-columns: 4.6em 1fr; gap: 10px; }
.info__facts dt { color: var(--muted); }
.info__facts dd { margin: 0; color: var(--ink); }
.loss { font-family: var(--math); font-style: italic; font-size: 1.2em; line-height: 1; white-space: nowrap; }
.loss sub, .loss sup { font-family: var(--sans); font-style: normal; font-size: 0.6em; font-weight: 700; }

/* ---------- figures ---------- */
.figure { width: 100%; margin-inline: auto; }
.figure--mid { max-width: 960px; }
.figure figcaption, .caption { margin-top: 12px; color: var(--ink-2); font-size: 14.5px; line-height: 1.6; }
.figure figcaption b, .caption b { color: var(--ink); font-weight: 650; }
.zoom { position: relative; display: block; cursor: zoom-in; }
.zoom::after {
  content: "Enlarge ↗"; position: absolute; right: 8px; bottom: 8px; padding: 3px 9px;
  border: 1px solid var(--line-strong); border-radius: 6px; background: rgba(255, 255, 255, 0.94);
  color: var(--ink-2); font-size: 12px; font-weight: 500;
  /* shown on hover or keyboard focus only, so it never sits on top of a number in the figure */
  opacity: 0; transition: opacity 0.15s ease;
}
.zoom:hover::after, .zoom:focus-visible::after { opacity: 1; }

.table-scroll { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
/* Paper tables are images: scale each by its font size so their text matches,
   stop growing on wide screens and scroll sideways on narrow ones. */
.paper-table .zoom {
  width: calc(100% * var(--table-scale, 1));
  min-width: calc(680px * var(--table-scale, 1));
  max-width: calc(960px * var(--table-scale, 1));
  margin-inline: auto;
}

/* results that stay folded until asked for */
.more { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.more summary { display: flex; align-items: center; gap: 10px; padding: 14px 0; font-size: 1.05rem; font-weight: 650; cursor: pointer; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: "+"; width: 1em; color: var(--muted); font-weight: 500; text-align: center; }
.more[open] summary::before { content: "\2212"; }
.more .stack { margin-top: 8px; padding-bottom: 28px; }

/* ---------- cite ---------- */
.cite { margin-top: 20px; position: relative; }
.cite pre {
  margin: 0; padding: 20px; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); color: var(--ink-2); font: 13.5px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.cite .btn { position: absolute; top: 12px; right: 12px; padding: 6px 12px; font-size: 12.5px; }
.cite__status { min-height: 1.4em; margin-top: 8px; color: var(--muted); font-size: 13px; }

/* ---------- figure viewer ---------- */
.lightbox { width: 94vw; max-width: 1600px; height: 92vh; max-height: 92dvh; padding: 0; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; color: var(--ink); }
.lightbox[open] { display: flex; flex-direction: column; }
.lightbox::backdrop { background: rgba(15, 17, 21, 0.72); }
.lightbox header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.lightbox header h2 { font-size: 14.5px; font-weight: 600; }
.lightbox__actions { display: flex; gap: 8px; flex: none; }
.lightbox__view { flex: 1; min-height: 0; padding: 14px; overflow: auto; }
.lightbox__view img { width: 100%; height: 100%; object-fit: contain; }
body.lightbox-open { overflow: hidden; }

/* ---------- responsive ---------- */
/* below this width the page is narrower than the diagram's minimum, so the diagram scrolls */
@media (max-width: 1028px) {
  .scroll-hint { display: block; }
}
@media (max-width: 860px) {
  .info { grid-template-columns: 1fr; }
  /* one column: the question and text, then the image, then the times */
  .question__body { display: flex; flex-direction: column; }
  .question__text { display: contents; }
  .annot { order: 1; }
  .question__times { order: 2; padding-top: 0; }
}
@media (max-width: 760px) {
  :root { --shell: calc(100% - 32px); }
  .hero { padding: 48px 0 40px; }
  .section { padding: 44px 0; }
  .cite .btn { position: static; margin-top: 10px; }
  /* justified text leaves wide gaps in a narrow column */
  .abstract p { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .diagram .part[data-selected="true"]:not([data-state="off"]) .flow { animation: none; }
}
