/* Research page redesign: one compact row per project, small image on the left.
   Uses the site colour variables, so light and dark themes both work. */

.rx-page {
  max-width: 920px;
  margin: 0 auto;
  padding: var(--spacing-xxl) 0 var(--spacing-xxl);
}

.rx-header {
  margin-bottom: var(--spacing-xl);
}

.rx-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.rx-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

.rx-toc a {
  color: var(--color-text-secondary);
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 0.25em;
}

.rx-toc a:hover {
  color: var(--color-accent-dark);
  text-decoration-color: currentColor;
}

.rx-section {
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--color-border);
  margin-bottom: var(--spacing-xl);
}

.rx-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin: 0 0 var(--spacing-lg);
}

/* ---------- One project ---------- */

.research-page .research-item {
  animation: none;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
}

.rx-item,
.rx-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.75rem;
  margin-bottom: var(--spacing-xl) !important;
}

/* entries without a picture use the full width, the date is in the grey line */
.rx-row {
  grid-template-columns: 1fr;
}

/* Main works get a big picture.
   --feature: picture on the left at about half width.
   --wide: very wide pictures (the replication map) go above the text, full width. */
.rx-item--feature {
  grid-template-columns: 440px 1fr;
}

.rx-item--wide {
  grid-template-columns: 1fr;
  gap: 1rem;
}

.research-page .rx-item.rx-item--feature img.rx-thumb,
.research-page .rx-item.rx-item--wide img.rx-thumb {
  width: 100%;
  height: auto;
  object-fit: initial;
  padding: 0;
}

.rx-item--feature .rx-title,
.rx-item--wide .rx-title {
  font-size: 1.35rem;
}

/* no single image: the demos use the full width, starting at the left edge like the pictures above */
.rx-item--demos {
  grid-template-columns: 1fr;
}

.rx-row {
  margin-bottom: var(--spacing-lg) !important;
}

.research-page .research-item img.rx-thumb {
  width: 220px;
  height: 138px;
  /* whole image visible: most are diagrams with a white background */
  object-fit: contain;
  padding: 4px;
  margin: 0.2rem 0 0;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: #fff;
  cursor: zoom-in;
  transition: border-color 0.15s ease;
}

.research-page .research-item img.rx-thumb:hover {
  border-color: var(--color-accent);
  transform: none;
  box-shadow: none;
}

.rx-body {
  min-width: 0;
}

.rx-title {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0 0 0.25rem;
  text-wrap: balance;
}

.rx-meta {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: 0 0 0.5rem;
}

.rx-desc {
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin: 0 0 0.6rem;
}

.rx-desc a,
.rx-links a,
.rx-press a {
  color: var(--color-accent-dark);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.2em;
  transition: text-decoration-color 0.15s ease;
}

.rx-desc a:hover,
.rx-links a:hover,
.rx-press a:hover {
  text-decoration-color: currentColor;
}

.rx-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.1rem;
  margin: 0 0 0.3rem;
  font-weight: 500;
}

.rx-press {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: 0;
}

.rx-press a {
  color: var(--color-text-secondary);
  text-decoration-color: var(--color-border);
}

.rx-press a:hover {
  color: var(--color-accent-dark);
}

/* ---------- Three small demos inside one project ---------- */

.rx-demos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 0.9rem;
}

.rx-demo {
  display: block;
  color: var(--color-text);
}

.research-page .rx-demo img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: top;
  margin: 0 0 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: border-color 0.15s ease;
}

.rx-demo strong {
  display: block;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.rx-demo span {
  display: block;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--color-text-secondary);
}

.rx-demo:hover strong {
  color: var(--color-accent-dark);
}

.rx-demo:hover img {
  border-color: var(--color-accent);
}

/* keyboard focus */
.rx-page a:focus-visible,
.rx-thumb:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ---------- Small screens ---------- */

@media (max-width: 768px) {
  .rx-page {
    padding: var(--spacing-lg) 0 6rem;
  }

  .rx-header h1 {
    font-size: 2rem;
  }

  .rx-item,
  .rx-row,
  .rx-item--feature {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .rx-row {
    gap: 0.2rem;
  }


  .research-page .research-item img.rx-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .research-page .rx-item.rx-item--feature img.rx-thumb,
  .research-page .rx-item.rx-item--wide img.rx-thumb {
    aspect-ratio: auto;
  }

  /* demos become rows: small picture left, text right */
  .rx-demos {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .rx-demo {
    display: grid;
    grid-template-columns: 112px 1fr;
    column-gap: 0.9rem;
    align-items: start;
  }

  .research-page .rx-demo img {
    grid-row: span 2;
    margin: 0;
  }
}
