/* Original demo media: preserve aspect ratios and keep galleries readable. */
.md-typeset .uz-demo {
  /* Do not inherit the theme's shrink-to-fit width while lazy images load. */
  width: 100%;
  max-width: 720px;
  margin: 1.2rem auto;
}
.md-typeset .uz-demo img {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: auto;
  border-radius: .35rem;
  border: 1px solid var(--md-default-fg-color--lightest);
}
.md-typeset .uz-demo figcaption {
  margin-top: .35rem;
  color: var(--md-default-fg-color--light);
  font-size: .72rem;
  line-height: 1.5;
  text-align: center;
}
.md-typeset .uz-demo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .8rem;
  margin-top: .8rem;
}
.md-typeset .uz-demo-grid .uz-demo {
  max-width: none;
  margin: 0;
  min-width: 0;
}
.md-typeset .uz-demo-grid img {
  aspect-ratio: 16 / 10;
  object-fit: contain;
  background: var(--md-code-bg-color);
}
/* Comparison groups and instruction-linked recordings share reserved media frames. */
.md-typeset .uz-media-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .8rem;
  width: 100%;
  margin: 1.2rem 0;
}
.md-typeset .uz-media-grid[data-columns="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.md-typeset .uz-media-grid[data-columns="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.md-typeset .uz-media-grid > :is(.uz-media-card, .uz-demo) {
  display: block;
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--uz-border);
  border-radius: .35rem;
  overflow: hidden;
  background: var(--uz-surface);
  box-sizing: border-box;
}
.md-typeset .uz-media-frame {
  display: block;
  width: 100%;
  aspect-ratio: var(--uz-media-ratio, 16 / 9);
  overflow: hidden;
  background: #101820;
}
.md-typeset .uz-media-frame :is(img, video) {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  object-fit: contain;
  box-sizing: border-box;
}
.md-typeset .uz-media-grid figcaption,
.md-typeset .uz-demo-grid figcaption {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 4.4em;
  margin: 0;
  padding: .4em .6em;
  font-size: .7rem;
  line-height: 1.45;
  text-align: center;
  box-sizing: border-box;
}
.md-typeset .uz-media-single {
  display: block;
  width: 100%;
  max-width: 720px;
  margin: 1.2rem auto;
}
.md-typeset .uz-media-single > .uz-media-card {
  display: block;
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
}
.md-typeset .uz-doc-figure {
  display: block;
  width: 100%;
  max-width: 720px;
  margin: 1.2rem auto;
}
.md-typeset .uz-doc-figure img {
  display: block;
  width: 100%;
  height: auto;
  box-sizing: border-box;
}
.md-typeset .uz-doc-figure figcaption {
  max-width: none;
  margin: .4rem 0 0;
  color: var(--md-default-fg-color--light);
  font-size: .72rem;
  line-height: 1.6;
}
.md-typeset .uz-doc-figure--wide { max-width: none; }
@media (max-width: 959px) {
  .md-typeset .uz-media-grid,
  .md-typeset .uz-demo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 599px) {
  .md-typeset .uz-media-grid[data-columns="3"] { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 359px) {
  .md-typeset .uz-media-grid,
  .md-typeset .uz-media-grid[data-columns="2"],
  .md-typeset .uz-demo-grid { grid-template-columns: minmax(0, 1fr); }
}
