/* CompDiff site styles — scaffolding */
:root {
  --text: #1a1a1a;
  --bg: #ffffff;
  --accent: #2b7a78;
  --muted: #555555;
  --border: #d0d0d0;
  --max-width: 880px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-weight: 600;
  line-height: 1.2;
  margin-top: 0;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.5rem; margin-top: 3rem; }
h3 { font-size: 1.125rem; }

code, pre {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.9rem;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.hero {
  text-align: center;
  padding: 2rem 0 3rem;
}

.hero__title {
  font-size: 2rem;
  max-width: 760px;
  margin: 0 auto 1.25rem;
}

.hero__conf {
  color: var(--muted);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 1.5rem;
}

.hero__authors {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

.hero__affil {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
}

.hero__corr {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

.hero sup {
  font-size: 0.7em;
}

.resources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.resources__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid #1a1a1a;
  background: #1a1a1a;
  border-radius: 999px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.resources__pill:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}

.pill__icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.pill__label {
  line-height: 1;
}

.resources__pill--disabled {
  background: #2d2d2d;
  border-color: #2d2d2d;
  color: #aaa;
  cursor: not-allowed;
  opacity: 0.85;
}

.resources__pill--disabled:hover {
  background: #2d2d2d;
  border-color: #2d2d2d;
  color: #aaa;
  transform: none;
}

.figure {
  margin: 1.5rem 0;
  text-align: center;
}

.figure img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.figure figcaption {
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
  margin-top: 0.75rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.section__lede {
  color: var(--muted);
  max-width: 700px;
  margin: 0 auto 1.5rem;
  text-align: center;
}

.method__intro {
  color: var(--text);
  max-width: 720px;
  margin: 0 auto 1.25rem;
  text-align: left;
  line-height: 1.65;
}

.method__steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 1.5rem auto;
  max-width: 720px;
  display: grid;
  gap: 0.75rem;
}

.method__steps li {
  position: relative;
  padding: 0.85rem 1rem 0.85rem 3rem;
  background: #fafafa;
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  line-height: 1.55;
}

.method__steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.method__steps strong {
  color: var(--accent);
}

/* Architecture blueprint ------------------------------------------------- */

.blueprint {
  margin: 2rem auto;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.blueprint__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.blueprint__box {
  position: relative;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.blueprint__box--input {
  background: #f5f6f7;
}

.blueprint__box--hcn {
  background: rgba(43, 122, 120, 0.08);
  border-color: rgba(43, 122, 120, 0.35);
}

.blueprint__box--frozen {
  background: #fafafa;
  border-style: dashed;
}

.blueprint__box--join {
  align-items: center;
  background: #fff;
  border: 1px dashed var(--accent);
}

.blueprint__box--unet {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
  align-items: flex-start;
}

.blueprint__box--unet .blueprint__title { color: #fff; }

.blueprint__box--unet .blueprint__sub { color: #c7c7c7; }

.blueprint__box--output {
  background: rgba(43, 122, 120, 0.12);
  border-color: var(--accent);
  text-align: center;
  align-items: center;
}

.blueprint__kicker {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.blueprint__title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.blueprint__sub {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.blueprint__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.blueprint__chip {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
}

.blueprint__quote {
  font-size: 0.82rem;
  color: var(--text);
  font-style: italic;
  line-height: 1.45;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-style: normal;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.4rem 0.55rem;
}

.blueprint__list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.blueprint__out {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}

.blueprint__out code {
  background: rgba(43, 122, 120, 0.1);
  padding: 0 0.3em;
  border-radius: 3px;
  font-size: 0.95em;
}

.blueprint__code {
  font-size: 0.95rem;
  color: var(--text);
  background: #fafafa;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
}

.blueprint__badge {
  position: absolute;
  top: -0.5rem;
  right: 0.75rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
}

.blueprint__badge--frozen {
  background: #757575;
}

.blueprint__badge--tuned {
  background: #b87333;  /* warm copper for LoRA */
}

.blueprint__arrows {
  display: flex;
  justify-content: space-around;
  align-items: center;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.1rem 2rem;
  gap: 1rem;
}

.blueprint__arrow--merge {
  font-size: 1.3rem;
  color: var(--accent);
}

.blueprint__merge-label {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: #fff;
}

@media (max-width: 600px) {
  .blueprint__row {
    grid-template-columns: 1fr;
  }
  .blueprint__arrows {
    padding: 0.1rem 0;
  }
}

.gallery__modality {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 1.5rem 0 0.75rem;
  flex-wrap: wrap;
}

.gallery__modality-tab {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  line-height: 1.1;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.gallery__modality-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.gallery__modality-tab.is-active {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
}

.gallery__modality-tab .gallery__src {
  display: block;
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-top: 0.15em;
}

.gallery__note {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0 0 0.6rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.gallery__legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem 0.9rem;
  margin: 0 0 1rem;
  padding: 0.5rem 0.75rem;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.gallery__legend-caption {
  font-weight: 500;
  color: var(--text);
}

.gallery__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-variant-numeric: tabular-nums;
}

.gallery__legend-chip {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.gallery__legend-item[data-rarity="rare"]     .gallery__legend-chip { background: rgba(196, 43, 43, 0.92); }
.gallery__legend-item[data-rarity="moderate"] .gallery__legend-chip { background: rgba(184, 115, 51, 0.92); }
.gallery__legend-item[data-rarity="common"]   .gallery__legend-chip { background: rgba(85, 85, 85, 0.88); }
.gallery__legend-item[data-rarity="majority"] .gallery__legend-chip { background: rgba(43, 122, 120, 0.92); }

.gallery__legend.is-hidden { display: none; }

.gallery__controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1.25rem;
  flex-wrap: wrap;
}

.gallery__toggle {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  flex-wrap: wrap;
}

.gallery__shuffle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

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

.gallery__shuffle:active {
  background: rgba(43, 122, 120, 0.08);
}

.gallery__shuffle svg {
  transition: transform 0.6s cubic-bezier(0.22, 0.68, 0, 1);
}

.gallery__shuffle.is-spinning svg {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .gallery__shuffle svg { transition: none; }
}

.gallery__tab {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

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

.gallery__tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.gallery__grid {
  display: grid;
  grid-template-columns: auto repeat(8, 1fr);
  gap: 4px;
  margin: 1.5rem auto 0;
}

.gallery__corner {
  /* empty top-left */
}

.gallery__colhead,
.gallery__rowhead {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  padding: 0.25rem 0;
}

.gallery__rowhead {
  text-align: right;
  padding-right: 0.5rem;
  align-self: center;
}

.gallery__cell {
  position: relative;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: none;
  background: #eee;
  cursor: pointer;
  overflow: hidden;
  transition: opacity 0.2s ease;
}

.gallery__cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery__cell:hover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.25);
}

.gallery__cell--missing {
  background: repeating-linear-gradient(
    45deg,
    #fafafa,
    #fafafa 6px,
    #ececec 6px,
    #ececec 12px
  );
  cursor: not-allowed;
}

.gallery__cell--missing img {
  display: none;
}

.gallery__cell--missing::before {
  content: "no data";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.gallery__cell--missing:hover::after {
  display: none;
}

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

/* Per-cell training-data size chip (color-coded by rarity) */
.gallery__cell-count {
  position: absolute;
  left: 3px;
  bottom: 3px;
  z-index: 2;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.63rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: rgba(85, 85, 85, 0.88);
  pointer-events: none;
  letter-spacing: 0.01em;
  line-height: 1.3;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
}

.gallery__cell[data-rarity="rare"]     .gallery__cell-count { background: rgba(196, 43, 43, 0.92); }
.gallery__cell[data-rarity="moderate"] .gallery__cell-count { background: rgba(184, 115, 51, 0.92); }
.gallery__cell[data-rarity="common"]   .gallery__cell-count { background: rgba(85, 85, 85, 0.88); }
.gallery__cell[data-rarity="majority"] .gallery__cell-count { background: rgba(43, 122, 120, 0.92); }

.gallery__cell--missing .gallery__cell-count {
  display: none !important;
}

.gallery--fading .gallery__cell img {
  opacity: 0.3;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  padding: 2rem;
  z-index: 1000;
}

.lightbox[aria-hidden="false"] {
  display: flex;
  animation: fadein 150ms ease;
}

@keyframes fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox__img {
  max-width: min(90vw, 700px);
  max-height: 70vh;
  object-fit: contain;
  background: #111;
}

.lightbox__meta {
  color: #eee;
  text-align: center;
  max-width: 700px;
}

.lightbox__title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: #fff;
}

.lightbox__size {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.9rem;
  background: rgba(255, 255, 255, 0.06);
  border-left: 3px solid rgba(85, 85, 85, 0.9);
  border-radius: 0 4px 4px 0;
  font-size: 0.82rem;
  color: #e8e8e8;
  letter-spacing: 0.01em;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: center;
  justify-content: center;
}

.lightbox__size[data-rarity="rare"]     { border-left-color: rgba(236, 120, 120, 0.95); }
.lightbox__size[data-rarity="moderate"] { border-left-color: rgba(229, 156, 98, 0.95); }
.lightbox__size[data-rarity="common"]   { border-left-color: rgba(170, 170, 170, 0.9); }
.lightbox__size[data-rarity="majority"] { border-left-color: rgba(80, 188, 185, 0.95); }

.lightbox__size-label {
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: #a8a8a8;
}

.lightbox__size-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #fff;
}

.lightbox__size-sep { color: #666; }

.lightbox__size-pct {
  font-variant-numeric: tabular-nums;
  color: #e0e0e0;
}

.lightbox__size-tier {
  font-size: 0.65rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: #fff;
  margin-left: 0.2rem;
}

.lightbox__size[data-rarity="rare"]     .lightbox__size-tier { background: rgba(196, 43, 43, 0.92); }
.lightbox__size[data-rarity="moderate"] .lightbox__size-tier { background: rgba(184, 115, 51, 0.92); }
.lightbox__size[data-rarity="common"]   .lightbox__size-tier { background: rgba(110, 110, 110, 0.95); }
.lightbox__size[data-rarity="majority"] .lightbox__size-tier { background: rgba(43, 122, 120, 0.95); }

.lightbox__prompt {
  margin: 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.85rem;
  color: #ccc;
  padding: 0.5rem 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid rgba(200, 200, 200, 0.4);
  border-radius: 0 4px 4px 0;
  line-height: 1.5;
  text-align: left;
  white-space: pre-wrap;
}

.lightbox__prompt::before {
  content: "Clinical prompt";
  display: block;
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: #a8a8a8;
  margin-bottom: 0.25rem;
  font-family: "Inter", system-ui, sans-serif;
}

.lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .lightbox[aria-hidden="false"] { animation: none; }
}

.results__subhead {
  margin-top: 2.5rem;
  margin-bottom: 0.25rem;
  font-size: 1.05rem;
}

.legend__swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 2px;
  vertical-align: middle;
  margin: 0 0.25rem;
}

.intersectional-toggle {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: 0.5rem 0 0.75rem;
  flex-wrap: wrap;
}

.intersectional-tab {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.intersectional-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.intersectional-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.intersectional-table.is-hidden {
  display: none;
}

.intersectional-table + .intersectional-table {
  margin-top: 0.5rem;
}

.section__caption {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
  line-height: 1.5;
}

.section__caption .legend {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
}

.table-wrap {
  overflow-x: auto;
  margin: 0.5rem 0 0.75rem;
  -webkit-overflow-scrolling: touch;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.results-table caption.table-caption {
  caption-side: top;
  text-align: left;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.75rem 0 0.35rem;
}

.results-table th,
.results-table td {
  padding: 0.55rem 0.6rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
  position: relative;
  transition: background-color 0.15s ease;
}

.results-table td[data-value] {
  padding-bottom: 1.15rem;
}

.results-table td[data-value]::after {
  content: "";
  position: absolute;
  left: 0.45rem;
  right: 0.45rem;
  bottom: 0.3rem;
  height: 3px;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.15));
  background-size: var(--bar-pct, 0%) 100%;
  background-repeat: no-repeat;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 2px;
  transition: background-size 0.6s cubic-bezier(0.22, 0.68, 0, 1);
}

.results-table td.is-best[data-value]::after {
  background: linear-gradient(to right, var(--accent), var(--accent));
  background-size: var(--bar-pct, 0%) 100%;
  background-repeat: no-repeat;
  background-color: rgba(43, 122, 120, 0.12);
}

.results-table td.is-best .val {
  color: var(--accent);
  font-weight: 600;
}

.results-table td.is-best .val::before {
  content: "★ ";
  color: var(--accent);
  font-size: 0.75em;
  margin-right: 0.1em;
  vertical-align: 0.1em;
}

.results-table .val {
  font-variant-numeric: tabular-nums;
}

.results-table th .pct {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--muted);
  margin-top: 0.15em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.results-table th .sg__age {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.results-table th .sg__sr {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text);
  margin-top: 0.05em;
  white-space: nowrap;
}

.results-table th[data-rarity="rare"] .pct,
.results-table th[data-rarity="rarest"] .pct {
  color: #b45309;
}

.results-table th[data-rarity="rarest"] {
  background: #fffaf3;
}

.results-table th[title] {
  cursor: help;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--border);
}

/* Crosshair hover: highlight whole row + column header */
.results-table tbody tr:hover td,
.results-table tbody tr:hover th {
  background-color: rgba(43, 122, 120, 0.09);
}

.results-table tbody tr.row--cd:hover td,
.results-table tbody tr.row--cd:hover th {
  background-color: rgba(43, 122, 120, 0.13);
}

.results-table td.is-col-hover,
.results-table th.is-col-hover {
  background-color: rgba(43, 122, 120, 0.08) !important;
}

.results-table td.method,
.results-table th.method,
.results-table th[scope="row"].method {
  font-weight: 600;
  background: #fafafa;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  line-height: 1.25;
  white-space: nowrap;
}

.results-table tr.row--cd .method {
  color: var(--accent);
  background: rgba(43, 122, 120, 0.08);
}

.row--delta th,
.row--delta td {
  border-top: 2px solid var(--border);
  background: #fafbfb;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

.row--delta .delta-placeholder {
  padding: 0;
}

.delta-grid {
  display: grid;
  grid-template-columns: repeat(var(--delta-cols, 7), 1fr);
  gap: 2px;
  padding: 0.35rem 0.45rem;
}

.delta-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  padding: 0.3rem 0.15rem;
  border-radius: 4px;
  background: rgba(43, 122, 120, 0.08);
  color: var(--accent);
  font-weight: 600;
}

.delta-cell--neutral {
  background: rgba(0, 0, 0, 0.04);
  color: var(--muted);
  font-weight: 500;
}

.delta-cell--bad {
  background: rgba(200, 62, 62, 0.08);
  color: #a83838;
}

.delta-cell .arrow {
  font-size: 0.7em;
  margin-right: 0.15em;
}

.results-table thead th {
  font-weight: 600;
  color: var(--text);
  background: #fafafa;
  border-bottom: 1px solid var(--border);
}

.results-table thead th.col-group {
  background: #f1f1f1;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.results-table td strong,
.results-table th strong {
  color: var(--accent);
}

.results-table .std {
  color: var(--muted);
  font-size: 0.75em;
  margin-left: 0.15em;
  font-variant-numeric: tabular-nums;
}

.results-table td.modality {
  font-weight: 600;
  background: #fafafa;
  border-right: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.results-table tr.row--cd {
  background: rgba(43, 122, 120, 0.06);
}

.results-table tr.row--cd td,
.results-table tr.row--cd th {
  border-top: 1px solid rgba(43, 122, 120, 0.25);
  border-bottom: 1px solid rgba(43, 122, 120, 0.25);
}

.results-table tr.row--subtle th {
  background: #fafafa;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.8rem;
}

.results-table--intersectional {
  margin-top: 0.75rem;
}

.results-table--intersectional th[scope="row"] {
  background: #fafafa;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
  border-right: 1px solid var(--border);
}

.results__takeaway {
  background: rgba(43, 122, 120, 0.06);
  border-left: 3px solid var(--accent);
  padding: 0.6rem 0.9rem;
  margin: 0.75rem 0 1.5rem;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.55;
}

.section__note {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  margin: 1rem 0 0;
}

/* Interactive bar charts ------------------------------------------------- */

.charts {
  margin: 1.5rem 0 2rem;
}

/* Method colours — Baseline/FairDiffusion/CompDiff */
:root {
  --bar-baseline: #bdcad1;
  --bar-fairdiffusion: #d18e82;
  --bar-compdiff: #2b7a78;
  --bar-baseline-hover: #9caab3;
  --bar-fairdiffusion-hover: #b07166;
  --bar-compdiff-hover: #1f5b5a;
}

.charts__legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.6rem 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 1.1rem;
}

.charts__swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 0.15rem;
}

.charts__swatch--baseline      { background: var(--bar-baseline); }
.charts__swatch--fairdiffusion { background: var(--bar-fairdiffusion); }
.charts__swatch--compdiff      { background: var(--bar-compdiff); }

.charts__legend-sep {
  color: var(--border);
  margin: 0 0.2rem;
}

.charts__best-marker {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: #bdcad1;
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  vertical-align: middle;
  margin: 0 0.25rem 0 0.15rem;
}

.charts__star {
  color: var(--accent);
  font-size: 0.9em;
  margin: 0 0.1rem 0 0.2rem;
}

.charts__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.9rem;
}

.plot {
  margin: 0;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 0.45rem 0.65rem;
  display: flex;
  flex-direction: column;
}

.plot__title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  margin-bottom: 0.9rem;
  white-space: nowrap;
}

.plot__groups {
  display: flex;
  gap: 0.5rem;
  align-items: end;
  justify-content: center;
  flex: 1;
}

.plot--single .plot__groups {
  justify-content: center;
}

.plot__group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1;
  min-width: 0;
}

.plot__bars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  align-items: end;
  height: 135px;
}

.plot__bar {
  position: relative;
  border-radius: 3px 3px 0 0;
  height: 0;
  margin-top: auto;
  min-height: 22px;
  transition:
    height 0.7s cubic-bezier(0.22, 0.68, 0, 1),
    background-color 0.2s ease,
    outline-color 0.2s ease;
  cursor: default;
}

.plot__bar--in { height: var(--h-target, 0); }

.plot__bar--baseline      { background: var(--bar-baseline); }
.plot__bar--fairdiffusion { background: var(--bar-fairdiffusion); }
.plot__bar--compdiff      { background: var(--bar-compdiff); }

.plot__bar--baseline:hover      { background: var(--bar-baseline-hover); }
.plot__bar--fairdiffusion:hover { background: var(--bar-fairdiffusion-hover); }
.plot__bar--compdiff:hover      { background: var(--bar-compdiff-hover); }

.plot__bar--best {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  z-index: 1;
}

.plot__bar--best::after {
  content: "★";
  position: absolute;
  top: -1.1rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--accent);
  font-size: 0.78rem;
  line-height: 1;
  pointer-events: none;
}

.plot__value {
  position: absolute;
  top: 4px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease 0.45s;
}

.plot__bar--in .plot__value { opacity: 1; }

/* On the lighter Baseline bar, dark text reads better than white */
.plot__bar--baseline .plot__value {
  color: #2a2a2a;
  text-shadow: none;
}

.plot__group-label {
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.45rem;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.charts__caption {
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
  margin: 1rem 0 0;
  line-height: 1.5;
}

@media (max-width: 880px) {
  .charts__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .charts__grid {
    grid-template-columns: 1fr;
  }
  .plot__bars { height: 120px; }
}

@media (prefers-reduced-motion: reduce) {
  .plot__bar {
    transition: background-color 0.2s ease;
  }
  .plot__value { transition: none; opacity: 1; }
}

.bibtex {
  position: relative;
  margin: 1rem 0;
}

.bibtex pre {
  background: #f6f6f6;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1rem 1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0;
}

.bibtex__copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

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

.bibtex__copy.is-copied {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.footer p {
  margin: 0.35rem 0;
}

/* Tablets */
@media (max-width: 880px) {
  main {
    padding: 2rem 1rem;
  }

  .hero__title {
    font-size: 1.6rem;
  }

  .gallery__grid {
    gap: 3px;
  }

  .gallery__colhead,
  .gallery__rowhead {
    font-size: 0.65rem;
  }
}

/* Phones */
@media (max-width: 600px) {
  .hero__title {
    font-size: 1.35rem;
  }

  .gallery__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery__corner,
  .gallery__colhead,
  .gallery__rowhead {
    display: none;
  }

  .gallery__cell::before {
    content: attr(data-age-label) " · " attr(data-sex) " · " attr(data-race);
    position: absolute;
    bottom: 2px;
    left: 2px;
    right: 2px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 4px;
    text-align: center;
    border-radius: 2px;
  }

  .results-table th,
  .results-table td {
    font-size: 0.85rem;
    padding: 0.4rem;
  }
}

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

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
}
