main {
  container-type: inline-size;
}

.system-image {
  margin: 1rem 0;
}
.system-image img {
  display: block;
  margin: 0 auto;
  border: solid 1px var(--border);
}
.system-image figcaption {
  font-weight: normal;
  display: block;
  text-align: left;
  font-size: 0.75rem;
  font-style: italic;
}

figure {
  padding: 0;
  margin: 0;
}

figcaption {
  margin-top: 0.25rem;
}
figcaption :first-child {
  margin-top: 0;
}
figcaption :last-child {
  margin-bottom: 0;
}

dl.meta-data {
  margin: 1rem 0;
  padding: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1rem;
}
dl.meta-data dt, dl.meta-data dd {
  margin: 0;
  padding: 0;
}
dl.meta-data dt:after {
  content: ":";
}

.description :first-child {
  margin-top: 0;
}
.description:has(cite) :nth-last-child(2) {
  margin-bottom: 0;
}
.description:has(cite) p:nth-last-child(2) {
  display: inline;
}
.description:not(:has(cite)) :last-child {
  margin-bottom: 0;
}

.playlist .description :nth-last-child(2) {
  margin-bottom: 0;
}

.intro {
  display: flow-root;
}

.videos figure {
  margin: 0.5rem 0 1rem;
  background: var(--background-fifth);
  position: relative;
}
.videos figcaption.description {
  background: var(--background);
  font-weight: normal;
  font-size: 1rem;
  text-align: left;
  padding-bottom: 0.5rem;
}
.videos iframe, .videos lite-youtube {
  max-width: 500px;
  margin: 0 auto;
  display: block;
}
.videos div.label {
  position: absolute;
  bottom: 0;
  left: 0;
  background: var(--primary);
  color: var(--primary-contrast);
  padding: 0.25rem 1rem;
  font-weight: bold;
}

h1, h2, h3, h4 {
  text-wrap: balance;
}

aside {
  margin-top: 1rem;
}

nav.page-nav ul {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  list-style: none;
  padding: 0;
  gap: 1rem 1ch;
}
nav.page-nav ul a, nav.page-nav ul .current span {
  display: flex;
  gap: 1ch;
  align-items: center;
  height: 100%;
  border-radius: 4px;
  text-wrap: balance;
}
nav.page-nav ul .previous {
  text-align: left;
}
nav.page-nav ul .previous a {
  justify-content: start;
}
nav.page-nav ul .current {
  display: none;
  text-align: center;
  justify-content: center;
}
nav.page-nav ul .current span {
  border: none;
}
nav.page-nav ul .next {
  text-align: right;
}
nav.page-nav ul .next a {
  justify-content: end;
}
nav.page-nav ul .all-examples {
  text-align: center;
  grid-column: 1/3;
  border: solid 1px var(--links);
}
nav.page-nav ul .all-examples a {
  justify-content: center;
}

@media (min-width: 500px) {
  figure.system-image {
    float: left;
    margin-top: 0;
    margin-right: 1rem;
    margin-bottom: 0;
  }
  dl.meta-data {
    margin-top: 0;
  }
  .videos.col-2, .videos.col-3 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1rem;
  }
  .videos.col-2 figure, .videos.col-3 figure {
    background: var(--background);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .videos.col-3 .playlist {
    grid-column: 1/3;
  }
}