/* Set like a LaTeX paper: Latin Modern throughout, numbered figures and tables, booktabs rules.
   Color lives in the figures, in H&E tones. */
@font-face {
  font-family: "Latin Modern";
  src: url("/blog/mitosisbench/fonts/LM-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Latin Modern";
  src: url("/blog/mitosisbench/fonts/LM-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Latin Modern";
  src: url("/blog/mitosisbench/fonts/LM-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #1c1a1f;
  --soft: #3a3540;
  --muted: #6c6572;
  --faint: #a49eaa;
  --line: #e6e1e8;
  --accent: #4a2878;
  --eosin: #c13f77;
  --hema-2: #8d6bbd;
  --text: 44rem;
  --figure: 50rem;
  --wide: 62rem;
  --pad: clamp(1rem, 4vw, 2rem);
  /* Latin Modern lacks a few symbols (µ, ≈); Palatino is the closest stand-in. */
  --serif: "Latin Modern", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: #e7dcf1;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

a:hover {
  text-decoration-color: currentColor;
}

/* a bare URL has no break points, which would stretch the justified line before it */
a.url {
  word-break: break-all;
}

strong {
  font-weight: 700;
}

code {
  font-family: var(--mono);
  font-size: 0.82em;
}

/* ── top bar ── */
.topbar {
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  max-width: calc(var(--wide) + 2 * var(--pad));
  margin: 0 auto;
  padding: 0.85rem var(--pad);
  font-size: 16px;
}

.topbar a {
  color: var(--ink);
  text-decoration: none;
}

.topbar a:hover {
  color: var(--accent);
}

.links {
  display: flex;
  gap: clamp(0.9rem, 2.5vw, 1.6rem);
}

/* ── breakout grid: text, a slightly wider column for charts and tables, a wide one for images ── */
.flow {
  display: grid;
  grid-template-columns:
    [full-start] minmax(var(--pad), 1fr)
    [wide-start] minmax(0, calc((var(--wide) - var(--figure)) / 2))
    [figure-start] minmax(0, calc((var(--figure) - var(--text)) / 2))
    [text-start] min(var(--text), 100% - 2 * var(--pad))
    [text-end] minmax(0, calc((var(--figure) - var(--text)) / 2))
    [figure-end] minmax(0, calc((var(--wide) - var(--figure)) / 2))
    [wide-end] minmax(var(--pad), 1fr) [full-end];
}

.flow > * {
  grid-column: text;
  min-width: 0;
}

.flow > .figure,
.flow > .table-wrap {
  grid-column: figure;
}

.flow > .wide {
  grid-column: wide;
}

/* ── title block, as \maketitle sets it ── */
.masthead {
  padding: clamp(2.75rem, 7vw, 4.5rem) 0 clamp(2rem, 4vw, 2.75rem);
  text-align: center;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5.5vw, 3.2rem);
  font-weight: 400;
  line-height: 1.15;
}

.byline {
  display: grid;
  gap: 0.15rem;
  margin-top: 1.1rem;
}

.byline .author {
  font-size: 1.12em;
}

.byline .date {
  color: var(--muted);
}

.mosaic {
  margin-top: clamp(2rem, 4vw, 2.75rem);
}

.mosaic img {
  display: block;
  width: 100%;
  height: auto;
}

/* ── article ── */
.post {
  counter-reset: figure table;
  padding-bottom: clamp(3rem, 6vw, 5rem);
}

h2 {
  margin: 2.6rem 0 0.75rem;
  font-size: 1.45em;
  font-weight: 700;
  line-height: 1.25;
}

.post section:first-child h2 {
  margin-top: 0.25rem;
}

h2 .num {
  margin-right: 0.55em;
  color: var(--accent);
}

h2 .anchor {
  margin-left: 0.4em;
  color: var(--faint);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s;
}

h2 .anchor::after {
  content: "#";
}

h2:hover .anchor {
  opacity: 1;
}

p {
  margin: 0 0 1rem;
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}

/* ── figures and captions ── */
.figure {
  margin: 1.1rem 0 2.2rem;
}

.figure img {
  display: block;
  width: 100%;
  height: auto;
}

/* fit-content centers a one-line caption and lets a longer one fill the width, as LaTeX does */
figcaption {
  width: fit-content;
  max-width: 100%;
  margin: 0.8rem auto 0;
  color: var(--soft);
  font-size: 16px;
  line-height: 1.5;
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}

figcaption::before {
  counter-increment: figure;
  content: "Figure " counter(figure) ". ";
  color: var(--ink);
  font-weight: 700;
}

.figure svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--serif);
}

.figure svg text {
  fill: var(--ink);
  font-size: 16px;
}

.figure svg .muted {
  fill: var(--muted);
  font-size: 15px;
}

.figure svg .light {
  fill: #ffffff;
}

.figure svg .strong {
  font-weight: 700;
}

.figure svg .grid {
  stroke: var(--line);
  stroke-width: 1;
}

.figure svg .axis {
  stroke: var(--ink);
  stroke-width: 1;
}

.panel-label {
  margin: 0 0 0.35rem;
  color: var(--soft);
  font-size: 15px;
  text-align: center;
}

.two-up {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.cells {
  display: grid;
  gap: 0.9rem;
}

/* inline keys in captions */
.swatch {
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin: 0 0.1em;
  vertical-align: -0.04em;
}

.dot {
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  vertical-align: 0.02em;
}

.ring {
  display: inline-block;
  width: 0.78em;
  height: 0.78em;
  border: 2px solid var(--eosin);
  border-radius: 50%;
  vertical-align: -0.1em;
}

.ring.dashed {
  border-style: dashed;
  border-color: var(--hema-2);
}

.cross {
  color: var(--eosin);
  font-weight: 700;
}

.ramp {
  display: inline-flex;
  gap: 1px;
  vertical-align: -0.04em;
}

.ramp .swatch {
  margin: 0;
}

/* ── tile and bar charts ── */
.s0 {
  background: #f1eaf0;
}

.s1 {
  background: #f6c9dc;
}

.s2 {
  background: #ec9cbf;
}

.s3 {
  background: #d2669c;
}

.s4 {
  background: #9b4c9f;
}

.s5 {
  background: #4a2878;
}

.waffles {
  display: grid;
  grid-template-columns: repeat(var(--models, 3), minmax(0, 1fr));
  gap: clamp(1.25rem, 3.5vw, 2.5rem);
}

.waffle-name {
  display: flex;
  justify-content: center;
  margin-bottom: 0.5rem;
  font-size: 16px;
}

.waffle {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 2px;
}

.waffle span {
  aspect-ratio: 1;
}

.waffle-sum {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.tumorbars {
  display: grid;
  grid-template-columns: auto max-content minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem 0.85rem;
  font-size: 16px;
}

.tb {
  display: contents;
}

.thumb {
  width: 30px;
  height: 30px;
  background-image: url("/blog/mitosisbench/tumor-thumbs.webp");
  background-size: 700% 100%;
}

.tb-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--soft);
}

.tb-bar i {
  height: 14px;
  background: var(--hema-2);
}

/* ── tables, booktabs style ── */
.table-wrap {
  overflow-x: auto;
  margin: 1.1rem 0 2.2rem;
}

table {
  margin: 0 auto;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.35;
  font-variant-numeric: lining-nums tabular-nums;
}

caption {
  padding-bottom: 0.65rem;
  color: var(--soft);
  font-size: 16px;
  text-align: center;
}

caption::before {
  counter-increment: table;
  content: "Table " counter(table) ". ";
  color: var(--ink);
  font-weight: 700;
}

th,
td {
  padding: 0.38rem 0.8rem;
  text-align: left;
  vertical-align: top;
}

th {
  padding-top: 0.5rem;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  font-weight: 700;
  vertical-align: bottom;
}

tbody tr:first-child td {
  padding-top: 0.55rem;
}

tbody tr:last-child td {
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--ink);
}

tr.total td {
  border-top: 1px solid var(--ink);
}

td.num,
th.num {
  text-align: right;
}

td.num {
  white-space: nowrap;
}

th .sub {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.model {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

/* ── footer ── */
.foot {
  max-width: calc(var(--text) + 2 * var(--pad));
  margin: 0 auto;
  padding: 1.2rem var(--pad) 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

.foot a {
  color: var(--muted);
  text-decoration: none;
}

.foot a:hover {
  color: var(--accent);
}

@media (max-width: 640px) {
  body {
    font-size: 17.5px;
  }

  p {
    text-align: left;
    -webkit-hyphens: manual;
    hyphens: manual;
  }

  .mosaic img {
    height: 190px;
    object-fit: cover;
  }

  .two-up {
    grid-template-columns: 1fr;
  }

  .waffles {
    grid-template-columns: minmax(0, 17rem);
    justify-content: center;
  }

  .tumorbars {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.15rem 0.7rem;
  }

  .thumb {
    grid-row: span 2;
  }

  .tb-bar {
    grid-column: 2;
    margin-bottom: 0.4rem;
  }

  .chart {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .chart svg {
    min-width: 600px;
  }
}
