/* ProbeBench project page. Fonts and colors follow the home site (css/fonts.css, css/style.css). */

:root {
  --text: #1a1a1a;
  --muted: #555;
  --faint: #777;
  --bg: #ffffff;
  --surface: #f7f7f5;
  --line: #e0e0e0;
  --accent: #3574d4;
  --accent-hover: #2a60b7;
  --accent-soft: rgba(53, 116, 212, 0.08);
  --accent-line: rgba(53, 116, 212, 0.65);
  --up: #44985c;
  --slim-row: #eef3fb;
  --figure-bg: #ffffff;
  --takeaway: #fff6ec;
  color-scheme: light;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --serif: 'Source Serif 4', Georgia, serif;
  --measure: 52rem;
  --wide: 52rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 {
  font-family: var(--serif);
  letter-spacing: -0.025em;
  line-height: 1.2;
  font-weight: 600;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; }

::selection { background-color: rgba(53, 116, 212, 0.2); }

img { max-width: 100%; display: block; }

/* hero */
.hero {
  max-width: 68rem;
  margin: 0 auto;
  padding: 5.5rem 1.5rem 3rem;
  text-align: center;
}
.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4.5vw, 2.85rem);
}
.subtitle {
  margin: 0.6rem auto 0;
  max-width: 52rem;
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  line-height: 1.35;
  color: var(--muted);
}
.authors {
  margin: 2rem 0 0.2rem;
  font-size: 1.1rem;
}
.authors a { white-space: nowrap; }
.affiliation { margin: 0; color: var(--muted); }

.links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem;
  margin-top: 1.75rem;
}
.pill {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.95rem;
  font-weight: 500;
}
.pill.is-disabled { cursor: default; }

/* main column */
main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}
section { padding-top: 3.5rem; scroll-margin-top: 1rem; }
section h2 { font-size: 2rem; margin: 0 0 1.25rem; }
section h3 { font-size: 1.3rem; margin: 2.5rem 0 1rem; }
p { margin: 0 0 1.1rem; text-wrap: pretty; }
b { font-weight: 600; }
.nw { white-space: nowrap; }

.abstract {
  margin-top: 1rem;
  padding: 2rem 2.25rem;
  background: var(--surface);
  border-radius: 12px;
}
.abstract h2 { font-size: 1.5rem; margin-bottom: 0.9rem; }
.abstract p { margin: 0; color: var(--text); }

/* findings: same color as the paper's takeaway boxes (RGB 255, 246, 236) */
.finding {
  margin: 1.5rem 0 2rem;
  padding: 0.75rem 1rem;
  background: var(--takeaway);
}

/* ProbeBench heading: four marker strokes tracing each model's segmentation curve (Figure 1) */
.pb-title {
  position: relative;
  display: inline-block;
  margin-bottom: 1.25rem;
  padding-bottom: 11px; /* underline tucks into the empty descender space */
}
.pb-title h2 { margin: 0; line-height: 1.1; }
.pb-underline {
  position: absolute;
  left: -3px;
  right: -3px;
  bottom: 0;
  width: calc(100% + 6px);
  height: 14px;
  overflow: visible;
}
.pb-underline path {
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pb-underline.will-draw path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.pb-underline.draw path {
  animation: pb-draw 0.6s cubic-bezier(0.3, 0.7, 0.4, 1) forwards;
  animation-delay: calc(var(--i) * 0.13s + 0.1s);
}
@keyframes pb-draw { to { stroke-dashoffset: 0; } }

/* figures */
figure { margin: 2rem 0; }
figure img {
  width: 100%;
  background: var(--figure-bg);
  border-radius: 8px;
  cursor: zoom-in;
}
figcaption {
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
figcaption b { color: var(--text); }

/* figures wrapped by text, like the paper's wrapfigures */
.split { display: flow-root; }
.split figure {
  float: right;
  width: 55%;
  margin: 0.3rem 0 0.4rem 1.75rem;
}
.split-slim figure {
  float: left;
  width: 40%;
  margin: 0.3rem 1.75rem 0.4rem 0;
}
.split figcaption { margin-top: 0.4rem; }
.split > :last-child { margin-bottom: 0; }
.split + .finding { margin-top: 1.25rem; }
.split + .table-figure { margin-top: 1.75rem; }

/* rebuilt paper figures (inline SVG from src/build_figures.py) */
@font-face { font-family: 'DejaVu Serif'; src: url('../fonts/DejaVuSerif.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'DejaVu Serif'; font-weight: 700; src: url('../fonts/DejaVuSerif-Bold.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'DejaVu Serif'; font-style: italic; src: url('../fonts/DejaVuSerif-Italic.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'DejaVu Sans'; src: url('../fonts/DejaVuSans.woff2') format('woff2'); font-display: swap; }

.pb-svgfig { position: relative; cursor: zoom-in; }
.pb-svgfig svg.pb-fig { display: block; width: 100%; height: auto; overflow: visible; }
.pb-svgfig text { pointer-events: none; }
.pb-composite img { display: block; width: 100%; height: auto; border-radius: 0; cursor: zoom-in; }
.pb-place { position: absolute; }

.pb-hits > * { fill: transparent; cursor: pointer; }
.pb-hits circle.is-on { stroke: #1a1a1a; stroke-width: 1.4; }
.pb-hits .pb-hit-line { cursor: help; }
.pb-hits rect.is-on { fill: rgba(26, 26, 26, 0.05); }

/* Figure 2: hovering a point or legend entry fades the other families */
svg.pb-focus g[data-fam] { transition: opacity 0.15s; }
svg.pb-focus g[data-fam]:not(.is-focus) { opacity: 0.15; }
svg [data-fam-label] { pointer-events: auto; cursor: default; }
svg [data-fam-label].is-focus { font-weight: 700; }

.pb-tip {
  position: fixed; z-index: 40; pointer-events: none;
  min-width: 11rem; max-width: 19rem;
  padding: 0.55rem 0.7rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  font-family: var(--sans);
  font-size: 0.8rem; line-height: 1.45;
  color: var(--text);
  opacity: 0; transition: opacity 0.08s;
}
.pb-tip.on { opacity: 1; }
.pb-tip-h { font-weight: 600; }
.pb-tip-sub { color: var(--faint); font-size: 0.72rem; margin-bottom: 0.35rem; }
.pb-tip-row { display: flex; align-items: center; gap: 0.45rem; }
.pb-tip-row b { margin-left: auto; padding-left: 0.9rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.pb-tip-muted { color: var(--faint); }
.pb-tip-note { margin-top: 0.3rem; color: var(--faint); font-size: 0.72rem; }
.pb-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.pb-dash { display: inline-block; width: 11px; border-top: 2px dashed; flex: none; }

/* results table */
.table-figure { margin: 2.5rem 0; }
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.results {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  white-space: nowrap;
}
.results th, .results td {
  padding: 0.3rem 0.8rem;
  line-height: 1.4;
  text-align: center;
}
.results thead th {
  font-weight: 600;
  vertical-align: bottom;
  border-bottom: 1px solid var(--line);
  line-height: 1.3;
}
.results thead th span {
  display: block;
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--faint);
}
.results td:first-child,
.results th:first-child { text-align: left; }
.results tr.group th {
  padding-top: 0.9rem;
  text-align: left;
  font-weight: 400;
  font-style: italic;
  color: var(--muted);
}
.results tbody + tbody tr.group th { border-top: 1px solid var(--line); }
.results tbody.ref td { color: var(--muted); }
.results tr.slim td { background: var(--slim-row); }
.results tr.slim td:first-child { font-weight: 600; }
.results .up, .results .pr { font-size: 0.75rem; font-weight: 600; }
.results .up { color: var(--up); }
.results .pr { color: var(--faint); }
.results .up::before, .results .pr::before { content: "("; }
.results .up::after, .results .pr::after { content: ")"; }

/* contents (wide screens only) */
.toc {
  position: fixed;
  top: 50%;
  left: max(1.5rem, calc((100vw - var(--wide)) / 2 - 15rem));
  transform: translateY(-50%);
  width: 12.5rem;
  display: none;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.85rem;
  z-index: 10;
}
.toc a {
  padding: 0.3rem 0 0.3rem 0.85rem;
  border-left: 2px solid var(--line);
  color: var(--faint);
  line-height: 1.35;
}
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}
@media (min-width: 1400px) {
  .toc { display: flex; }
}

/* footer */
footer {
  width: calc(100% - 3rem);
  max-width: calc(var(--measure) - 3rem);
  margin: 2rem auto 0;
  padding: 2rem 0 4rem;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}
footer a { color: var(--muted); }
footer a:hover { color: var(--text); }

/* lightbox */
.lightbox {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  padding: 3rem 1.5rem 1.5rem;
  background: rgba(20, 20, 20, 0.85);
  z-index: 30;
}
.lightbox.open { display: flex; }
.lightbox-inner {
  max-width: 100%; max-height: 100%;
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem;
}
.lightbox-inner > * { width: min(1400px, 92vw); min-width: 860px; cursor: default; }
.lightbox-inner > img { width: auto; min-width: 0; max-width: min(1000px, 88vw); max-height: 80vh; }
.lightbox-inner .pb-svgfig[data-fig="fig3"] { width: min(900px, 92vw); min-width: 640px; }
.lightbox-close {
  position: absolute; top: 0.6rem; right: 0.9rem;
  border: 0; background: none; color: #fff;
  font-size: 2rem; line-height: 1; cursor: pointer;
}
html.lb-open { overflow: hidden; }

/* phones */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .hero { padding-top: 3.5rem; }
  section h2 { font-size: 1.6rem; }
  .abstract { padding: 1.5rem 1.25rem; }
  .pb-pair { grid-template-columns: 1fr; }
  .split figure, .split-slim figure { float: none; width: 100%; max-width: 30rem; margin: 0 auto 1.5rem; }
}

/* keep row labels visible when the table scrolls sideways */
.results td:first-child,
.results thead th:first-child {
  position: sticky;
  left: 0;
  background: var(--bg);
  z-index: 1;
}
.results tr.slim td:first-child { background: var(--slim-row); }
