/* Keep Furo's reading width and type scale, as on the DECAF documentation. */
.sidebar-brand {
  align-items: flex-start;
}

.sidebar-logo-container {
  margin: 0 0 1rem;
}

.sidebar-logo {
  display: block;
  width: 13rem;
  max-width: 100%;
  box-sizing: border-box;
  padding: .4rem;
  border-radius: .2rem;
}

.sidebar-brand-text {
  text-align: left;
}

article :is(h1, h2, h3, h4) {
  scroll-margin-top: 4rem;
}

article h1 {
  margin-bottom: 1rem;
}

.start-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: .75rem;
  margin: 1.25rem 0 2rem;
}

.start-cards > .start-card {
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--color-background-border);
  background: var(--color-background-secondary);
}

.start-card:focus-within,
.start-card:hover {
  border-left-color: var(--color-brand-primary);
}

.start-card .rubric {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.start-card p:last-child {
  margin-bottom: 0;
}

/* A semantic, responsive flow diagram that also works without JavaScript. */
.workflow-overview {
  margin: 1.5rem 0;
}

.workflow-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-flow > li {
  position: relative;
  margin: 0;
  padding: .8rem .6rem;
  border-top: 3px solid var(--color-brand-primary);
  background: var(--color-background-secondary);
  text-align: center;
  font-size: .85rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.workflow-flow strong,
.workflow-flow span {
  display: block;
}

.workflow-flow strong {
  margin-bottom: .5rem;
}

.workflow-flow span {
  color: var(--color-foreground-secondary);
}

.workflow-flow > li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -.95rem;
  width: .4rem;
  height: .4rem;
  border-top: 2px solid var(--color-brand-primary);
  border-right: 2px solid var(--color-brand-primary);
  transform: rotate(45deg);
}

.workflow-overview figcaption {
  margin-top: .8rem;
  color: var(--color-foreground-secondary);
  font-size: .85rem;
}

/* Factory names link from the generation flow to their tutorial contracts. */
.ezga-factory-flow {
  margin: 1.25rem 0;
}

.ezga-factory-steps {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ezga-factory-steps > li {
  position: relative;
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: .75rem;
  margin: 0;
  padding: .65rem .85rem;
  border-left: 3px solid var(--color-brand-primary);
  background: var(--color-background-secondary);
  font-size: .85rem;
  line-height: 1.5;
}

.ezga-factory-steps > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(50% - .2rem);
  bottom: -.7rem;
  width: .35rem;
  height: .35rem;
  border-right: 2px solid var(--color-brand-primary);
  border-bottom: 2px solid var(--color-brand-primary);
  transform: rotate(45deg);
}

.ezga-factory-role {
  color: var(--color-foreground-secondary);
}

.ezga-factory-steps strong,
.ezga-factory-steps a {
  display: block;
}

.ezga-factory-steps code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.ezga-factory-steps > .ezga-factory-worker {
  border: 1px solid var(--color-brand-primary);
  border-left-width: 3px;
}

.ezga-factory-outcomes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-top: 1rem;
  font-size: .85rem;
}

.ezga-factory-outcomes > * {
  padding: .5rem .75rem;
  border: 1px solid var(--color-background-border);
}

.ezga-factory-flow figcaption {
  margin-top: .75rem;
  color: var(--color-foreground-secondary);
  font-size: .85rem;
}

@media (max-width: 40rem) {
  .ezga-factory-steps > li,
  .ezga-factory-outcomes {
    grid-template-columns: 1fr;
  }

  .ezga-factory-steps > li {
    gap: .2rem;
  }
}

article .highlight {
  border: 1px solid var(--color-background-border);
  border-radius: .2rem;
}

article table.docutils th {
  text-align: left;
}

article :is(a, button, summary, input, select):focus-visible {
  outline: 2px solid var(--color-brand-primary);
  outline-offset: 3px;
}

@media (max-width: 40rem) {
  .start-cards {
    grid-template-columns: 1fr;
  }

  article h1 {
    font-size: 2rem;
  }

  .workflow-flow {
    grid-template-columns: 1fr;
  }

  .workflow-flow > li {
    padding: .8rem 1rem;
  }

  .workflow-flow > li:not(:last-child)::after {
    top: auto;
    right: calc(50% - .2rem);
    bottom: -.95rem;
    transform: rotate(135deg);
  }
}
/* Long API identifiers need smaller headings than prose page titles. */
.api-reference-object > h1 {
  font-size: clamp(1.35rem, 2vw, 1.75rem);
}

/* Compact tutorial signatures can wrap while keeping the API link visible. */
article table.tutorial-api-summary td:first-child {
  width: 46%;
  white-space: normal;
  overflow-wrap: anywhere;
}

article table.tutorial-api-summary td:first-child code,
article .tutorial-api-function code {
  white-space: normal;
  overflow-wrap: anywhere;
}

article .tutorial-api-signature {
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
  font-family: var(--font-stack--monospace);
  font-size: var(--font-size--small);
  overflow-wrap: anywhere;
}

@media (max-width: 40rem) {
  article table.tutorial-api-summary,
  article table.tutorial-api-summary tbody,
  article table.tutorial-api-summary tr {
    display: block;
  }

  article table.tutorial-api-summary colgroup {
    display: none;
  }

  article table.tutorial-api-summary td,
  article table.tutorial-api-summary td:first-child {
    display: block;
    width: auto;
  }
}
