/* ============================================================
   IMBUE project page
   One stylesheet, no build step. Every colour is a token on :root;
   the dark theme redefines the same names under [data-theme="dark"],
   which script.js sets before the first paint (following the reader's
   system setting, unless they pick a theme with the button). Change
   the palette here and nowhere else.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  /* math is set by KaTeX in its own fonts, as in the paper (see .katex) */

  /* One column below the header, as on the ALINE page: headings, text,
     figures, tables and captions share both edges. */
  --measure: 960px;
  --narrow: 600px; /* near-square plots, centred in the column */
  --gutter: 24px;
  --topbar-h: 56px;

  color-scheme: light;

  /* The accent is the blue that marks IMBUE in the paper's plots, so text
     and figures point at the same thing. ~5.1:1 on white. */
  --accent: #0173b2;
  --accent-strong: #015a8c;
  --on-accent: #ffffff;
  --accent-soft: rgba(1, 115, 178, 0.08);   /* our rows in tables, badges */
  --accent-softer: rgba(1, 115, 178, 0.04); /* our ablated variants */

  --ink: #1f2933;
  --ink-strong: #0f1720;
  --muted: #5b6672;       /* captions; ~5.9:1 on white, ~5.5:1 on the tint */
  --rule: #e3e8ee;
  --rule-strong: #c9d1da;
  --rule-soft: #eef1f4;

  --bg: #ffffff;
  --bg-tint: #f6f8fa;     /* alternate section bands */
  --surface: #ffffff;     /* cards, tables, code */
  --hover-bg: rgba(15, 23, 32, 0.05);
  --code-bg: #f3f5f7;
  --topbar-bg: rgba(255, 255, 255, 0.86);

  --hero-bg: linear-gradient(125deg, #101d31, #163d59);
  --hero-ink: #f4f7fb;
  --hero-muted: #bfd0df;
  --hero-accent: #8dd8ff;
  --hero-accent-strong: #b9e8ff;
  --hero-soft: rgba(141, 216, 255, 0.12);
  --hero-button-ink: #122a42;
  --hero-rule: rgba(191, 208, 223, 0.4);

  --figure-bg: #ffffff;   /* plots keep their white paper in both themes */
  --figure-border: var(--rule);

  --btn-bg: #1f2933;      /* dark pills, as on most project pages */
  --btn-ink: #ffffff;
  --btn-border: #d3d8de;

  --swatch-prior: #f0b252;    /* the orange "Prior Info" of the overview figure */
  --swatch-instance: #9b8ee6; /* the purple "Auxiliary Data" */

  --shadow: 0 1px 2px rgba(15, 23, 32, 0.05), 0 6px 20px rgba(15, 23, 32, 0.05);
  --scroll-shadow: rgba(15, 23, 32, 0.16);
  --backdrop: rgba(15, 23, 32, 0.78);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --accent: #56b4e9;        /* the light blue of the same plot palette, ~7.9:1 */
  --accent-strong: #8ccbf0;
  --on-accent: #14161a;
  --accent-soft: rgba(86, 180, 233, 0.12);
  --accent-softer: rgba(86, 180, 233, 0.06);

  --ink: #d5dae0;
  --ink-strong: #f1f3f5;
  --muted: #9aa4ae;
  --rule: #2b3037;
  --rule-strong: #3d444d;
  --rule-soft: #262b31;

  --bg: #14161a;
  --bg-tint: #191c21;
  --surface: #1c2026;
  --hover-bg: rgba(255, 255, 255, 0.06);
  --code-bg: #171a1e;
  --topbar-bg: rgba(20, 22, 26, 0.86);
  --hero-bg: linear-gradient(125deg, #0e1726, #142f45);

  --figure-bg: #ffffff;
  --figure-border: transparent;

  --btn-bg: #e6eaef;
  --btn-ink: #14161a;
  --btn-border: #3f4750;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 22px rgba(0, 0, 0, 0.3);
  --scroll-shadow: rgba(0, 0, 0, 0.55);
  --backdrop: rgba(0, 0, 0, 0.82);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 16px); /* clear of the top bar */
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 18px; /* about 100 characters a line across the column */
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

img,
video {
  max-width: 100%;
  height: auto;
}

p {
  margin: 0 0 1em;
  text-wrap: pretty;
}

h1,
h2,
h3,
h4 {
  color: var(--ink-strong);
  text-wrap: balance;
}

h2 {
  margin: 0 0 clamp(20px, 3vw, 32px);
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 700;
  text-align: left;
}

h3 {
  margin: 0 0 10px;
  font-size: 1.2rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
  font-weight: 650;
}

h4 {
  margin: 32px 0 8px;
  font-size: 1.15rem;
  line-height: 1.4;
  font-weight: 650;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

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

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

/* KaTeX's default 1.21em is sized against Computer Modern; next to Inter
   a little smaller sits better. Inline math stays on one line instead of
   breaking after "=" or "∼" as KaTeX otherwise allows. */
.katex {
  font-size: 1.1em;
  white-space: nowrap;
}

/* Display equations scroll sideways inside their own box on a phone
   instead of widening the page. */
.eq {
  overflow-x: auto;
  overflow-y: hidden;
  margin: 4px 0 16px;
}

.eq .katex-display {
  margin: 0;
  padding: 6px 0;
}

sub,
sup {
  position: relative;
  font-size: 0.72em;
  line-height: 0;
  vertical-align: baseline;
}

sup {
  top: -0.5em;
}

sub {
  bottom: -0.25em;
}

/* The [hidden] attribute must win over the display values set below. */
[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 0;
  left: -9999px;
  z-index: 20;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  background: var(--ink-strong);
  color: var(--bg);
}

.skip-link:focus {
  left: 0;
}

/* ---------- Layout ---------- */
/* Everything inside fills the column, so text, figures, tables and
   captions line up on both sides. */
.container {
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(48px, 7vw, 80px);
}

.section--tint {
  background: var(--bg-tint);
}

/* Scope, BibTeX, and Acknowledgments share one tinted band. */
.section--tint + .section--tint {
  padding-top: 0;
}

/* ---------- Top bar ----------
   Section links and the theme toggle, stuck to the top of the window.
   script.js marks the link of the section in view (aria-current) and
   shows the name on the left once the big one in the header is gone. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--rule);
  background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  backdrop-filter: saturate(1.6) blur(12px);
}

.topbar__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  height: var(--topbar-h);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.topbar__name {
  justify-self: start;
  color: var(--ink-strong);
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease, color 0.15s ease;
}

.topbar.is-scrolled .topbar__name {
  opacity: 1;
  visibility: visible;
}

.topbar__name:hover {
  color: var(--accent);
  text-decoration: none;
}

.topbar__links {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.topbar__links a {
  display: block;
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.topbar__links a:hover {
  background: var(--hover-bg);
  color: var(--ink-strong);
  text-decoration: none;
}

.topbar__links a[aria-current="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- Header ----------
   The paper title is the entry point; the subtitle states its practical
   contribution. The blue comes from IMBUE's own result plots. */
.hero {
  --ink: var(--hero-ink);
  --ink-strong: var(--hero-ink);
  --muted: var(--hero-muted);
  --accent: var(--hero-accent);
  --accent-strong: var(--hero-accent-strong);
  --accent-soft: var(--hero-soft);
  --rule-soft: var(--hero-soft);
  --btn-bg: var(--hero-ink);
  --btn-ink: var(--hero-button-ink);
  --btn-border: var(--hero-rule);
  --on-accent: var(--hero-button-ink);
  /* kept short so the overview figure below starts on the first screen */
  padding-block: clamp(40px, 5vw, 64px);
  background: var(--hero-bg);
  color: var(--ink);
  text-align: center;
}

.venue {
  display: inline-block;
  margin: 0 0 24px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero__titles {
  margin: 0;
}

/* At most 42px, so the full title fits the column in two lines on a
   desktop screen. */
.title {
  margin: 0 auto;
  color: var(--ink-strong);
  font-size: clamp(1.85rem, 1.2rem + 2vw, 2.625rem);
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: -0.03em;
}

.hero__name {
  color: var(--accent);
}

.title__term {
  white-space: nowrap;
}

.hero__claim {
  max-width: 46rem;
  margin: 24px auto 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 0.98rem + 0.4vw, 1.3rem);
  line-height: 1.6;
  text-wrap: balance;
}

/* each clause wraps as a unit, so a wide screen breaks between them */
.hero__claim span {
  display: inline-block;
}

.hero .btn[href^="#"] {
  border-color: var(--hero-rule);
  background: transparent;
  color: var(--ink);
}

.authors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 24px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  font-size: 1.1rem;
  font-weight: 500;
}

.authors sup {
  margin-left: 2px;
  color: var(--muted);
}

.affiliations {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 20px;
  max-width: 980px; /* two lines on a desktop screen */
  margin: 12px auto 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.6;
}

.affiliations sup {
  margin-right: 2px;
}

.author-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ---------- Link buttons ----------
   A button without an href is a placeholder: dashed, muted, tagged
   "soon", and not focusable. Adding the href publishes it. */
.buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 12px;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn svg {
  flex: none;
  width: 18px;
  height: 18px;
}

.btn[href]:hover {
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
}

.btn[href]:focus-visible {
  outline-offset: 3px;
}

.btn:not([href]) {
  border: 1px dashed var(--btn-border);
  background: transparent;
  color: var(--muted);
  cursor: default;
}

.btn:not([href])::after {
  content: "soon";
  margin-left: 2px;
  padding: 3px 6px 2px;
  border-radius: 4px;
  background: var(--rule-soft);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Figures ---------- */
.figure {
  margin: 0;
}

/* The white "paper" a plot sits on; also the link that opens the zoom. */
.figure__frame {
  position: relative;
  display: block;
  padding: clamp(8px, 1.6vw, 16px);
  border: 1px solid var(--figure-border);
  border-radius: 12px;
  background: var(--figure-bg);
  box-shadow: var(--shadow);
}

.figure__frame picture,
.figure__frame img {
  display: block;
  width: 100%;
  height: auto;
}

/* Captions are as wide as their figure or table, never narrower. */
.figure figcaption,
.table-figure figcaption {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
  text-align: left;
}

.figure figcaption {
  margin-block: 12px 0;
}

.figure figcaption p {
  margin: 0 0 0.6em;
}

.figure figcaption p:last-child {
  margin-bottom: 0;
}

.figure figcaption b,
.table-figure figcaption b {
  color: var(--ink);
  font-weight: 600;
}

.figure--spaced {
  margin-block: clamp(28px, 4vw, 44px);
}

/* Near-square plots would fill a whole screen at the full column width,
   so they sit centred at a narrower width, their captions with them. */
.figure--narrow {
  max-width: var(--narrow);
  margin-inline: auto;
}

/* Zoom affordance: an "expand" badge on hover and keyboard focus, always
   visible on touch screens, where there is no hover. */
.zoom {
  cursor: zoom-in;
}

.zoom::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(15, 23, 32, 0.68)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6'/%3E%3Cpath d='M9 21H3v-6'/%3E%3Cpath d='M21 3l-7 7'/%3E%3Cpath d='M3 21l7-7'/%3E%3C/svg%3E")
    center / 16px no-repeat;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.zoom:hover::after,
.zoom:focus-visible::after {
  opacity: 1;
}

/* Touch screens have no hover, so the badge stays visible and says what
   it does; it sits on the frame's top edge rather than over the plot,
   where it would hide data. */
@media (hover: none) {
  .zoom::after {
    content: "Tap to enlarge";
    top: -12px;
    right: 12px;
    width: auto;
    height: 24px;
    padding: 0 10px 0 25px;
    border-radius: 999px;
    background-position: 9px center;
    background-size: 11px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 24px;
    white-space: nowrap;
    opacity: 1;
  }
}

.video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: #000;
}

/* ---------- Overview ----------
   The overview figure opens the page right under the header, so the
   first screen already shows what IMBUE does; the problem statement,
   the highlights and the abstract follow it. */
.section--overview {
  padding-top: clamp(28px, 4vw, 44px);
}

.teaser {
  margin-bottom: clamp(48px, 7vw, 72px);
}

.intro-lead {
  color: var(--ink-strong);
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem);
  line-height: 1.75;
}

/* ---------- Highlights: the paper's three contributions in brief ---------- */
.highlights {
  margin-top: clamp(28px, 4vw, 40px);
  padding: 6px 24px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--surface);
}

.highlights h3 {
  margin: 16px 0 4px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.highlights ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: highlight;
}

.highlights li {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  padding-block: 14px 16px;
  border-top: 1px solid var(--rule);
  counter-increment: highlight;
}

.highlights li:first-child {
  border-top: 0;
}

.highlights li::before {
  content: counter(highlight, decimal-leading-zero);
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.highlights p {
  margin: 0;
}

.highlights a {
  font-weight: 600;
  white-space: nowrap;
}

/* the arrow is decoration; the "/ ''" alternative keeps it silent for
   screen readers where supported */
.highlights a::after {
  content: " \2192";
  content: " \2192" / "";
}

/* ---------- Method: setup, token interface, filter, training ----------
   Subsections in the order of Section 3 of the paper, as on the ALINE
   page; each explains a step in prose, then states it as an equation. */
.subsection {
  margin: clamp(48px, 7vw, 64px) 0 12px;
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
}

/* Prior and instance tokens keep the colours they have in the figures:
   orange for prior information, purple for previous-instance data. */
.swatch {
  display: flex;
  align-items: center;
  gap: 10px;
}

.swatch::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--swatch);
}

.swatch--prior {
  --swatch: var(--swatch-prior);
}

.swatch--instance {
  --swatch: var(--swatch-instance);
}

/* bulleted terms with a bold lead, as in the ALINE method section */
.term-list {
  margin: 0 0 1em;
  padding-left: 1.25em;
}

.term-list li + li {
  margin-top: 0.45em;
}

.term-list li::marker {
  color: var(--accent);
}

/* ---------- Results: one application and its evidence per block ---------- */
.result-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 24px;
}

.result-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 7px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
}

.result-nav a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.finding__label {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.finding {
  margin-top: clamp(48px, 7vw, 80px);
}

.finding__text h3 {
  font-size: clamp(1.15rem, 1.05rem + 0.4vw, 1.35rem);
}

.finding__text p:last-child {
  margin-bottom: 0;
}

/* Every finding reads the same way: label, claim and text, then the
   evidence (figure or table) underneath. */
.finding > .figure,
.finding > .table-figure {
  margin-top: 24px;
}

/* One short attribution note replaces the appendix-style ablation section. */
.research-note {
  margin-top: clamp(48px, 7vw, 80px);
  padding-block: 24px;
  border-block: 1px solid var(--rule-strong);
}

.research-note p:last-child {
  margin-bottom: 0;
}

.paper-link {
  margin-top: 24px;
  margin-bottom: 0;
  color: var(--muted);
}

/* ---------- Glossary: how to read the results ---------- */
.glossary {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 20px;
  margin: 28px 0 0;
  padding: 18px 22px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
  font-size: 0.93rem;
  line-height: 1.55;
}

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

.glossary dd {
  margin: 0;
}

/* ---------- Tables ---------- */
.table-figure {
  margin: 28px 0 0;
}

.table-figure figcaption {
  margin-block: 0 10px;
}

/* Wide tables scroll sideways inside their frame on phones instead of
   pushing the page wider; the frame is focusable so keyboards can too.
   position: relative keeps the visually hidden cell text (absolutely
   positioned) inside the clipped frame; without it those spans escape
   the frame and widen the whole page on a phone. */
.table-wrap {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 12px;
  /* Scroll shadows: a soft edge appears on a side only while there is
     more table to scroll to (the "local" covers hide it at either end). */
  background:
    linear-gradient(to right, var(--surface) 40%, transparent) left / 28px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 40%, transparent) right / 28px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, var(--scroll-shadow), transparent) left / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, var(--scroll-shadow), transparent) right / 12px 100% no-repeat scroll,
    var(--surface);
}

.results {
  width: 100%;
  border-collapse: separate; /* collapsed borders do not travel with sticky cells */
  border-spacing: 0;
  font-size: 0.94rem;
  line-height: 1.45;
}

/* Aligned digits in the number cells only: Inter's tabular figures also
   widen the hyphen, which would space out names like "RL-BOED". */
.results td {
  font-variant-numeric: tabular-nums;
}

.results th,
.results td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  text-align: center;
  white-space: nowrap;
}

.results thead th {
  color: var(--ink-strong);
  font-size: 0.88rem;
  font-weight: 600;
}

.results thead tr:first-child > * {
  position: relative;
  padding-bottom: 6px;
  border-bottom: 0;
}

/* inset rule under each column group, like \cmidrule in the paper */
.results thead tr:first-child > th::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 0;
  left: 12px;
  height: 1px;
  background: var(--rule-strong);
}

.results thead tr:only-child > th::after {
  content: none;
}

.results thead tr:only-child > * {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

.results th:first-child {
  text-align: left;
}

.results tbody th {
  min-width: 9em;
  color: var(--ink-strong);
  font-weight: 500;
  white-space: normal;
}

.results tbody + tbody > tr:first-child > * {
  border-top: 2px solid var(--rule-strong);
}

.results tbody:last-child tr:last-child > * {
  border-bottom: 0;
}

.results .ci {
  color: var(--muted);
  font-size: 0.86em;
}

.results strong {
  font-weight: 700;
}

.results .na {
  color: var(--muted);
}

/* our method: tinted row with an accent bar */
.results tr.ours > * {
  background: var(--accent-soft);
}

.results tr.ours > th {
  box-shadow: inset 3px 0 0 var(--accent);
  font-weight: 700;
}

.results tr.ours--variant > * {
  background: var(--accent-softer);
}

.results tr.ours--variant > th {
  box-shadow: inset 3px 0 0 var(--rule-strong);
  font-weight: 500;
}

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px 1px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 1px;
}

/* tables of words rather than numbers */
.results--text td {
  min-width: 9em;
  text-align: left;
  white-space: normal;
  font-variant-numeric: normal;
}

.results--text th {
  text-align: left;
}

/* ---------- Collapsible extras ---------- */
.more {
  margin-top: 28px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
}

.more > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 20px;
  border-radius: 12px;
  color: var(--ink-strong);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.more > summary::-webkit-details-marker {
  display: none;
}

.more > summary::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin: 0 2px 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.more[open] > summary::before {
  transform: rotate(45deg);
}

.more > summary:hover {
  color: var(--accent);
}

.more__body {
  padding: 4px 20px 22px;
}

.more__body > * + * {
  margin-top: 18px;
}

.more__body > :first-child {
  margin-top: 0;
}

.more .glossary {
  padding: 0;
  border: 0;
  background: none;
}

.more__body > p {
  margin-bottom: 0;
}

/* ---------- Acknowledgments ---------- */
.ack {
  margin: 0;
  font-size: 0.95rem;
}

/* ---------- BibTeX ---------- */
.code-block {
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--code-bg);
}

.code-block__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

.code-block__label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* announced to screen readers; the button's own label shows "Copied" */
.copy-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--btn-border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.copy-btn svg {
  width: 15px;
  height: 15px;
}

.code-block pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 32px 0 40px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.site-footer p {
  margin: 0 0 6px;
}

/* ---------- Figure zoom (native <dialog>) ---------- */
.lightbox {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: clamp(12px, 3vw, 32px);
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox::backdrop {
  background: var(--backdrop);
}

.lightbox__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: min(100%, 1480px);
  max-height: 100%;
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.4);
}

.lightbox__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background: #fff;
}

.lightbox__img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100vh - 220px);
  max-height: calc(100dvh - 220px);
  margin: 0 auto;
  padding: 12px;
}

.lightbox__caption {
  flex: none;
  max-height: 28vh;
  overflow: auto;
  padding: 12px 18px 14px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.lightbox__caption p {
  margin: 0 0 0.5em;
}

.lightbox__caption p:last-child {
  margin-bottom: 0;
}

/* ---------- Theme toggle ----------
   In the top bar. Cycles automatic (the reader's system setting) → light
   → dark. Hidden without JavaScript, where the light theme is all there
   is. */
.theme-toggle {
  display: none;
  justify-self: end;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px 0 11px;
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

:root[data-mode] .theme-toggle {
  display: inline-flex;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle svg {
  display: none;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  color: var(--accent);
}

.theme-toggle .label {
  display: none;
}

/* the icon and word show the mode you are in, not the one you switch to */
:root[data-mode="auto"] .theme-toggle .i-auto,
:root[data-mode="light"] .theme-toggle .i-light,
:root[data-mode="dark"] .theme-toggle .i-dark {
  display: block;
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  /* Wide tables scroll here, so the first column (the method) stays put
     while the numbers slide under it. Its cells need opaque backgrounds,
     tinted ones included, and a rule along their right edge. */
  .results thead tr > :first-child,
  .results tbody tr > :first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--surface);
    box-shadow: inset -1px 0 0 var(--rule);
  }

  .results tbody tr.ours > :first-child {
    background: linear-gradient(var(--accent-soft), var(--accent-soft)) var(--surface);
    box-shadow: inset 3px 0 0 var(--accent), inset -1px 0 0 var(--rule);
  }

  .results tbody tr.ours--variant > :first-child {
    background: linear-gradient(var(--accent-softer), var(--accent-softer)) var(--surface);
    box-shadow: inset 3px 0 0 var(--rule-strong), inset -1px 0 0 var(--rule);
  }

  .results tbody th {
    min-width: 7.5em;
  }
}

/* below this the bar has no room for the toggle's word ("Auto", "Light"...) */
@media (max-width: 720px) {
  .theme-toggle {
    justify-content: center;
    width: 34px;
    padding: 0;
  }

  /* icon only; the button's aria-label still names the mode */
  :root[data-mode] .theme-toggle .label {
    display: none;
  }
}

@media (max-width: 700px) {
  /* full-screen zoom; wide figures open at half their pixel width so a
     phone can pan across them instead of squinting */
  .lightbox {
    padding: 0;
  }

  .lightbox__panel {
    width: 100%;
    height: 100%;
    max-width: none;
    border-radius: 0;
  }

  .lightbox__img {
    width: var(--zoom-width, 100%);
    min-width: 100%;
    max-width: none;
    max-height: none;
  }
}

@media (max-width: 600px) {
  :root {
    --gutter: 16px;
    --topbar-h: 50px;
  }

  body {
    font-size: 16px;
  }

  /* links from the left edge, the toggle as an icon on the right; the
     name stays out of the bar, there is no room for it */
  .topbar__inner {
    display: flex;
    gap: 6px;
  }

  .topbar__name {
    display: none;
  }

  .topbar__links {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: -10px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .topbar__links::-webkit-scrollbar {
    display: none;
  }

  .topbar__links a {
    padding: 7px 10px;
    font-size: 0.9rem;
  }

  .theme-toggle {
    flex: none;
  }

  /* the header is shorter on a phone: tighter spacing, short affiliations */
  .hero {
    padding-block: 24px 28px;
  }

  .venue {
    margin-bottom: 12px;
    font-size: 0.74rem;
  }

  .hero__claim {
    margin-top: 12px;
  }

  .authors {
    gap: 0 16px;
    margin-top: 18px;
    font-size: 1rem;
  }

  .affiliations {
    gap: 0 12px;
    margin-top: 8px;
    font-size: 0.84rem;
    line-height: 1.55;
  }

  .aff-long {
    display: none;
  }

  .buttons {
    gap: 8px;
    margin-top: 20px;
  }

  .btn {
    min-height: 42px;
    padding: 0 16px 0 13px;
    font-size: 14.5px;
  }

  .glossary {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .glossary dd + dt {
    margin-top: 10px;
  }

  .results th,
  .results td {
    padding: 9px 11px;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- Print: light colours, no controls ---------- */
@media print {
  :root,
  :root[data-theme="dark"] {
    color-scheme: light;
    --ink: #000;
    --ink-strong: #000;
    --muted: #333;
    --rule: #ccc;
    --rule-strong: #999;
    --bg: #fff;
    --bg-tint: #fff;
    --surface: #fff;
    --code-bg: #fff;
    --accent: #0173b2;
    --accent-soft: transparent;
    --accent-softer: transparent;
    --shadow: none;
  }

  .skip-link,
  .topbar,
  .buttons,
  .result-nav,
  .copy-btn,
  .lightbox,
  .zoom::after {
    display: none !important;
  }

  .hero {
    --hero-bg: none;
    --hero-ink: #000;
    --hero-muted: #333;
    --hero-accent: #0173b2;
    --hero-soft: transparent;
    padding-block: 18pt;
  }

  .section {
    padding-block: 18pt;
  }

  .figure__frame,
  .table-wrap,
  .eq,
  .glossary {
    break-inside: avoid;
  }
}
