/* /research/ overview, direction pages, and demo pages (rs-*). Colors come from the tokens in local-overrides.css. */

html .container[role="main"]:has(.rs-overview) {
  max-width: 1140px;
}

html .container[role="main"]:has(.rs-detail) {
  max-width: 1200px;
}

.rs-page {
  font-weight: 400;
}

html .rs-page span:not([data-demo] *) {
  color: inherit;
}

html .rs-page .post-title {
  margin: 0;
  font-size: 2.1rem;
}

/* Fixed navigation bar: keep linked headings visible. */
.rs-page [id] {
  scroll-margin-top: calc(var(--rs-nav-height, 3.5rem) + 1.5rem);
}

html .rs-page .rs-venue,
html .rs-page figcaption {
  color: var(--global-text-color-light);
}

html .rs-page .rs-award {
  color: var(--aria-award-text);
  font-weight: 600;
}

.rs-page .rs-venue,
.rs-page .rs-award {
  font-size: 0.88em;
}

html .rs-page .rs-question {
  max-width: 46rem;
  margin: 0.4rem 0 0;
  color: var(--aria-heading-color);
  font-size: 1.3rem;
  font-weight: 400;
  line-height: 1.45;
}

/* ---------- Figures ---------- */

.rs-figure {
  margin: 0 0 1.5rem;
}

/* Paper figures are drawn for white pages. */
.rs-figure img,
.rs-figure video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 30rem;
  padding: 0.5rem;
  border-radius: 6px;
  background: #fff;
  object-fit: contain;
}

.rs-figure figcaption {
  margin-top: 0.4rem;
  font-size: 0.86rem;
}

.rs-full-size {
  white-space: nowrap;
}

/* Image could not load: show its alternative text instead of an empty box. */
.rs-figure-failed img {
  height: auto !important;
  min-height: 0;
  aspect-ratio: auto;
  color: #333;
  font-size: 0.88rem;
}

.rs-figure-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0 1.5rem;
}

.rs-figure-pair img {
  height: 16rem;
}

/* ---------- Overview ---------- */

html .rs-page .rs-statement {
  max-width: 44rem;
  margin: 0.75rem 0 0.9rem;
  color: var(--aria-heading-color);
  font-size: clamp(1.55rem, 3.4vw, 2.2rem);
  font-weight: 500;
  line-height: 1.25;
}

.rs-lede {
  max-width: 46rem;
  font-size: 1.06rem;
}

.rs-recent {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.4rem;
  margin: 1.25rem 0 0;
  font-size: 0.93rem;
}

.rs-map {
  margin: 1.5rem 0 0;
}

html .rs-map h2,
html .rs-threads h2,
html .rs-work-with-us h2 {
  margin: 0 0 0.9rem;
  font-size: 1.35rem;
}

.rs-map-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

html a.rs-node {
  display: flex;
  flex-direction: column;
  padding: 0.7rem 0.9rem;
  border-left: 4px solid var(--global-theme-color);
  background: var(--aria-accent-bg);
  color: var(--aria-heading-color);
  text-decoration: none;
}

html a.rs-node:hover .rs-node-name {
  text-decoration: underline;
}

.rs-node-name {
  font-weight: 600;
  line-height: 1.3;
}

.rs-relations {
  margin-top: 0.6rem;
}

.rs-relations ul {
  max-width: 46rem;
  padding-left: 1.1rem;
}

/* For screen readers only. */
.rs-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Slim bar below the site navigation. It takes no space in the page. */
.rs-tabs {
  position: sticky;
  z-index: 5;
  top: var(--rs-nav-height, 3.5rem);
  height: 0;
}

.rs-tabs nav {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--global-divider-color);
  background: var(--global-bg-color);
}

html .rs-tabs a {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0 0.4rem;
  border-bottom: 3px solid transparent;
  color: var(--global-text-color);
  font-size: 0.9rem;
  text-decoration: none;
}

html .rs-tabs a:hover,
html .rs-tabs a[aria-current] {
  border-bottom-color: var(--global-theme-color);
  color: var(--global-theme-color);
}

html .rs-tabs a[aria-current] {
  font-weight: 600;
}

.rs-direction {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "head head"
    "text side"
    "more side";
  grid-template-rows: auto auto 1fr;
  gap: 1rem 3rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--global-divider-color);
}

.rs-direction-head {
  grid-area: head;
}

html .rs-direction .rs-question {
  max-width: 60rem;
}

.rs-direction-text {
  grid-area: text;
}

.rs-direction-side {
  grid-area: side;
}

.rs-direction-more {
  grid-area: more;
}

html .rs-direction h2 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.25;
}

html .rs-direction h2 a {
  color: inherit;
}

.rs-direction-text p {
  margin: 0 0 1rem;
}

.rs-subdirections {
  margin: 0;
  padding-left: 1.1rem;
}

.rs-subdirections li {
  margin-bottom: 0.3rem;
}

html .rs-direction-text .rs-also {
  margin: 0.5rem 0 0;
}

.rs-direction-side .rs-figure {
  margin-bottom: 0.8rem;
}

.rs-direction-side .rs-figure img {
  max-height: 14rem;
}

html .rs-small-title {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 600;
}

.rs-selected {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rs-selected li {
  padding: 0.5rem 0;
  border-top: 1px solid var(--global-divider-color);
  font-size: 0.95rem;
  line-height: 1.4;
}

.rs-selected a {
  font-weight: 600;
}

.rs-selected-text {
  display: block;
  font-size: 0.92rem;
  line-height: 1.45;
}

.rs-direction-more {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0;
}

html a.rs-explore {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.4rem 1.2rem;
  border-radius: 6px;
  background: var(--global-theme-color);
  color: var(--global-bg-color);
  font-weight: 600;
  text-decoration: none;
}

html a.rs-explore:hover {
  text-decoration: underline;
}

.rs-demo-links {
  font-size: 0.9rem;
}

.rs-threads,
.rs-work-with-us {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--global-divider-color);
}

.rs-threads dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 3rem;
  margin: 0;
}

.rs-threads dt {
  font-weight: 600;
}

.rs-threads dd {
  margin: 0;
}

.rs-thread-papers {
  display: block;
  font-size: 0.9rem;
}

.rs-work-with-us p {
  max-width: 46rem;
}

/* ---------- Direction pages ---------- */

.rs-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.5rem;
  margin: -1rem 0 0.9rem;
  font-size: 0.9rem;
}

/* Table of contents, gap, and text add up to the container: no empty band between them. */
.rs-columns {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: 2.75rem;
}

.rs-toc > details {
  position: sticky;
  top: calc(var(--rs-nav-height, 3.5rem) + 1.5rem);
  max-height: calc(100vh - var(--rs-nav-height, 3.5rem) - 5rem);
  overflow-y: auto;
  font-size: 0.9rem;
}

.rs-toc summary {
  margin-bottom: 0.5rem;
  font-weight: 600;
  cursor: pointer;
}

.rs-toc-current {
  display: none;
}

.rs-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

html .rs-toc a {
  display: block;
  padding: 0.35rem 0 0.35rem 0.8rem;
  border-left: 2px solid var(--global-divider-color);
  color: var(--global-text-color);
  line-height: 1.35;
}

html .rs-toc ol ol a {
  padding-left: 1.7rem;
}

html .rs-toc a[aria-current] {
  border-left-color: var(--global-theme-color);
  color: var(--global-theme-color);
  font-weight: 600;
}

/* Comfortable lines for running text; figures, papers, and tracks may use the full column. */
.rs-body > p,
.rs-body > ul,
.rs-papers p,
.rs-papers .rs-more,
.rs-outlook {
  max-width: 47rem;
}

html .rs-body h2 {
  margin: 2.5rem 0 0.6rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--global-divider-color);
  font-size: 1.55rem;
  font-weight: 500;
}

html .rs-body > h3 {
  margin: 1.9rem 0 0.6rem;
  font-size: 1.2rem;
  font-weight: 600;
}

.rs-body > p {
  margin-bottom: 0.7rem;
}

.rs-body h2 + p > em:only-child {
  font-size: 1.1rem;
}

.rs-hero + p {
  margin-top: 0.9rem;
}

/* ---------- Top of a direction page ---------- */

.rs-detail {
  padding-bottom: 1.5rem;
}

.rs-lead {
  margin: 1.25rem 0 0;
}

.rs-lead-side {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 1.75rem;
}

.rs-lead .rs-figure {
  margin-bottom: 0;
}

.rs-threads-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem 1.75rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.rs-lead-side .rs-threads-list {
  grid-template-columns: minmax(0, 1fr);
  gap: 0.7rem;
  margin: 0;
}

.rs-threads-list li {
  padding-left: 0.9rem;
  border-left: 3px solid var(--global-theme-color);
  font-size: 0.92rem;
  line-height: 1.4;
}

html .rs-thread-name {
  display: block;
  font-size: 1rem;
  font-weight: 600;
}

.rs-thread-text {
  display: block;
}

.rs-thread-paper {
  display: block;
}

/* ---------- Publications ---------- */

.rs-papers {
  margin: 1rem 0 1.25rem;
  padding: 0;
  list-style: none;
}

.rs-papers > li {
  padding: 0.9rem 0;
  border-top: 1px solid var(--global-divider-color);
}

.rs-papers > li:first-child {
  border-top: 0;
  padding-top: 0;
}

.rs-papers p {
  margin: 0 0 0.35rem;
}

.rs-paper-title {
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.4;
}

/* Workshop papers and preprints. */
.rs-paper-minor .rs-paper-title {
  font-size: 1rem;
  font-weight: 500;
}

.rs-paper-meta,
.rs-paper-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.9rem;
  font-size: 0.92rem;
}

html .rs-page .rs-paper-meta .rs-venue {
  color: var(--global-text-color);
  font-size: 1em;
  font-weight: 600;
}

html .rs-page .rs-paper-meta .rs-award {
  font-size: 1em;
}

.rs-paper-name {
  font-style: italic;
}

.rs-earlier {
  padding-left: 0.9rem;
  border-left: 2px solid var(--global-divider-color);
  font-size: 0.92rem;
}

.rs-more {
  font-size: 0.92rem;
}

.rs-more summary {
  display: inline-block;
  padding: 0.2rem 0;
  color: var(--global-theme-color);
  cursor: pointer;
}

.rs-more summary::before {
  content: "+";
  display: inline-block;
  width: 1rem;
  font-weight: 600;
}

.rs-more[open] summary::before {
  content: "\2212";
}

.rs-more ul {
  margin: 0.25rem 0 0.5rem;
}

.rs-tracks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1.5rem 2rem;
}

html .rs-track-name {
  margin: 0 0 0.9rem;
  font-size: 1.02rem;
  font-weight: 600;
}

.rs-track ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rs-track li {
  position: relative;
  padding: 0 0 0.9rem 1.2rem;
  border-left: 2px solid var(--global-divider-color);
  font-size: 0.92rem;
  line-height: 1.45;
}

.rs-track li::before {
  content: "";
  position: absolute;
  top: 0.35rem;
  left: -0.4rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--global-theme-color);
}

.rs-track .rs-step-minor::before {
  top: 0.4rem;
  left: -0.34rem;
  width: 0.58rem;
  height: 0.58rem;
  border: 2px solid var(--global-theme-color);
  background: var(--global-bg-color);
}

html .rs-track .rs-step-minor a {
  font-weight: 500;
}

.rs-track li:last-child {
  padding-bottom: 0;
}

.rs-track p {
  margin: 0;
}

.rs-step-head a {
  font-weight: 600;
}

html .rs-track .rs-builds {
  margin-top: 0.3rem;
  color: var(--global-text-color-light);
}

/* ---------- End of a direction page ---------- */

.rs-outlook {
  margin: 0;
}

.rs-outlook div + div {
  margin-top: 0.8rem;
}

.rs-outlook dt {
  font-weight: 600;
}

.rs-outlook dd,
.rs-outlook dd p {
  margin: 0;
}

.rs-resources {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.5rem 2rem;
  margin-top: 1rem;
  font-size: 0.95rem;
}

html .rs-resources h3 {
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
  font-weight: 600;
}

.rs-resources ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rs-resources li {
  padding: 0.15rem 0;
  line-height: 1.4;
}

.rs-resources p {
  margin: 0.25rem 0 0;
}

.rs-pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--global-divider-color);
}

.rs-pager a {
  max-width: 20rem;
}

.rs-pager a:last-child {
  margin-left: auto;
  text-align: right;
}

html .rs-page .rs-pager span {
  display: block;
  color: var(--global-text-color-light);
  font-size: 0.82rem;
}

/* ---------- Interactive demos ---------- */

.rs-demo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1.1rem;
  border-radius: 8px;
  background: var(--global-card-bg-color);
}

.rs-demo-text {
  flex: 1 1 18rem;
}

.rs-demo p {
  margin: 0;
  line-height: 1.45;
}

.rs-demo-title {
  font-weight: 600;
}

html .rs-page .rs-demo-evidence {
  color: var(--global-text-color-light);
  font-size: 0.88rem;
}

html a.rs-demo-open {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.35rem 1rem;
  border: 1px solid var(--global-theme-color);
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
}

html a.rs-demo-open:hover {
  background: var(--aria-btn-hover-bg);
}

html a.rs-demo-open[aria-busy] {
  opacity: 0.6;
}

@media (max-width: 991.98px) {
  .rs-columns {
    display: block;
  }

  /* A slim bar that names the current section. Its list opens over the text, so nothing moves. */
  .rs-toc {
    position: sticky;
    z-index: 5;
    top: var(--rs-nav-height, 3.5rem);
    margin-bottom: 1rem;
    border-block: 1px solid var(--global-divider-color);
    background: var(--global-bg-color);
  }

  .rs-detail [id] {
    scroll-margin-top: calc(var(--rs-nav-height, 3.5rem) + 3.75rem);
  }

  .rs-toc > details {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .rs-toc summary {
    margin: 0;
    padding: 0.7rem 0;
    overflow: hidden;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rs-toc-current {
    display: inline;
    font-weight: 400;
  }

  .rs-toc-current:not(:empty)::before {
    content: ": ";
  }

  .rs-toc details > ol {
    position: absolute;
    right: 0;
    left: 0;
    max-height: calc(100vh - var(--rs-nav-height, 3.5rem) - 6rem);
    padding: 0.25rem 0 0.75rem;
    overflow-y: auto;
    border-bottom: 1px solid var(--global-divider-color);
    background: var(--global-bg-color);
    box-shadow: 0 12px 20px rgb(0 0 0 / 18%);
  }

  html .rs-toc a {
    padding-block: 0.6rem;
  }
}

@media (max-width: 991.98px) {
  .rs-map-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  /* Keyboard focus must not stop under the fixed footer. */
  html:has(.rs-page) {
    scroll-padding-bottom: 4rem;
  }
}

@media (max-width: 767.98px) {
  /* Research pages only: the fixed footer would cover part of a small screen. */
  html footer.fixed-bottom {
    position: static;
  }

  html body:has(.rs-page) {
    padding-bottom: 0;
  }

  .rs-page {
    margin-top: -1.5rem;
    padding-bottom: 1.5rem;
  }

  html .rs-page .post-title {
    font-size: 1.6rem;
  }

  html .rs-page .rs-statement {
    margin: 0.35rem 0 0.6rem;
    font-size: 1.35rem;
  }

  .rs-lede {
    font-size: 1rem;
    line-height: 1.5;
  }

  .rs-recent {
    flex-direction: column;
    gap: 0;
  }

  .rs-direction {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "text" "side" "more";
    grid-template-rows: none;
    gap: 0.6rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
  }

  .rs-direction-text p,
  .rs-subdirections {
    font-size: 0.97rem;
    line-height: 1.5;
  }

  .rs-subdirections li {
    margin-bottom: 0.2rem;
  }

  html .rs-direction h2 {
    font-size: 1.4rem;
  }

  html .rs-page .rs-question {
    font-size: 1.1rem;
  }

  .rs-threads dl {
    grid-template-columns: minmax(0, 1fr);
  }

  .rs-map-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.4rem;
  }

  html a.rs-node {
    min-height: 2.75rem;
    justify-content: center;
    padding: 0.4rem 0.9rem;
  }

  html a.rs-explore {
    justify-content: center;
    width: 100%;
  }

  .rs-lead-side {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  html .rs-body h2 {
    margin-top: 1.75rem;
    padding-top: 1.1rem;
    font-size: 1.35rem;
  }

  /* Larger touch targets without more height. */
  .rs-recent a,
  .rs-full-size,
  .rs-demo-links a,
  .rs-thread-papers a,
  .rs-paper-links a,
  .rs-resources li a {
    padding-block: 0.3rem;
  }

  .rs-demo-links,
  .rs-thread-papers {
    line-height: 1.7;
  }

  .rs-page .rs-figure img {
    max-height: none;
  }
}
