/* Cards that only link onward: three in a row where they fit, and their buttons on one
   line, however long the text above them is. */
.md-typeset .grid.cards.link-cards {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
}

.md-typeset .grid.cards.link-cards > ul > li {
  display: flex;
  flex-direction: column;
}

.md-typeset .grid.cards.link-cards > ul > li > :last-child {
  margin-top: auto;
}

/* The workflow on the overview page: the stages in a row with their tools on the arrows,
   every stage below feeding the evaluations. One column on a narrow screen. */
.md-typeset .pipeline {
  --pipeline-color: var(--md-typeset-a-color);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr) auto) minmax(0, 1fr);
  gap: 0.4rem 0.2rem;
  margin: 1.6rem 0 2rem;
}

.md-typeset .pipeline-stage {
  background: color-mix(in srgb, var(--pipeline-color) 10%, transparent);
  border: 0.1rem solid color-mix(in srgb, var(--pipeline-color) 55%, transparent);
  border-radius: 0.5rem;
  padding: 0.8rem 0.4rem;
  text-align: center;
}

.md-typeset .pipeline-stage p {
  margin: 0.3rem 0;
}

.md-typeset .pipeline-stage strong {
  font-size: 0.9rem;
}

.md-typeset .pipeline-stage code {
  background: none;
  font-size: 0.68rem;
  padding: 0;
}

.md-typeset .pipeline .twemoji {
  color: var(--pipeline-color);
}

.md-typeset .pipeline-arrow {
  align-items: center;
  align-self: center;
  color: var(--pipeline-color);
  display: flex;
  flex-direction: column;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0 0.3rem;
}

.md-typeset .pipeline-arrow::after {
  content: "→";
  font-size: 1.5rem;
  line-height: 1;
}

.md-typeset .pipeline-link {
  align-items: center;
  color: var(--pipeline-color);
  display: flex;
  flex-direction: column;
  font-size: 0.68rem;
  font-weight: 700;
  justify-content: flex-end;
  line-height: 1.3;
  text-align: center;
}

.md-typeset .pipeline-link::after {
  content: "↓";
  font-size: 1.2rem;
  line-height: 1.2;
}

.md-typeset .pipeline-link-dataset { grid-column: 3; }
.md-typeset .pipeline-link-training { grid-column: 5; }
.md-typeset .pipeline-link-rollout { grid-column: 7; }
.md-typeset .pipeline-end { grid-column: 3 / -1; }

/* The architectures on the models page, built from the same parts: one row each, with the
   processor of MeshGraphNets over the three middle stages of MGN-T. */
.md-typeset .pipeline.architecture {
  grid-template-columns: repeat(4, minmax(0, 1fr) auto) minmax(0, 1fr);
}

.md-typeset .architecture-title {
  font-size: 0.9rem;
  font-weight: 700;
  grid-column: 1 / -1;
  margin-top: 0.6rem;
}

.md-typeset .architecture-title p {
  margin: 0;
}

.md-typeset .architecture-span {
  grid-column: 3 / 8;
}

.md-typeset .architecture-global {
  --pipeline-color: #e8710a;
}

.md-typeset .pipeline.architecture .pipeline-stage {
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
  justify-content: center;
  line-height: 1.35;
}

.md-typeset .pipeline.architecture .pipeline-stage strong {
  font-size: 0.8rem;
}

@media screen and (max-width: 59.99em) {
  .md-typeset .pipeline .pipeline-stage {
    padding-left: 0.2rem;
    padding-right: 0.2rem;
  }

  .md-typeset .pipeline-stage code {
    font-size: 0.58rem;
  }

  .md-typeset .pipeline.architecture .pipeline-stage strong {
    font-size: 0.7rem;
  }

  .md-typeset .pipeline.architecture .pipeline-arrow {
    padding: 0 0.1rem;
  }
}

@media screen and (max-width: 44.99em) {
  .md-typeset .pipeline,
  .md-typeset .pipeline.architecture {
    grid-template-columns: minmax(0, 1fr);
  }

  .md-typeset .architecture-span {
    grid-column: 1;
  }

  .md-typeset .pipeline-arrow::after {
    content: "↓";
  }

  .md-typeset .pipeline-link {
    display: none;
  }

  .md-typeset .pipeline-end {
    grid-column: 1;
    margin-top: 0.4rem;
  }
}

/* Figures centered: a paragraph that holds images (also a row of them, e.g. the plates),
   and the caption in italics right under it. Running text and tables stay left-aligned. */
.md-typeset p:has(> img) {
  text-align: center;
}

.md-typeset p:has(> img) + p:has(> em:only-child) {
  text-align: center;
}
