.demo-gallery-link { display: flex; justify-content: flex-end; margin-top: 1.125rem; }
.demo-gallery-link a { font-size: .9375rem; color: #e4e4e7; text-underline-offset: .22em; }
.demo-gallery-link a:hover { text-decoration: underline; }

#demo-gallery {
  width: min(1040px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: clamp(.625rem, 2vw, 1rem);
  border: 1px solid #3f3f46;
  border-radius: 1rem;
  color: #fafafa;
  background: #18181b;
}
#demo-gallery::backdrop { background: rgb(9 9 11 / .85); }
.gallery-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.gallery-heading h3 { font-weight: 600; }
.gallery-button { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none; border: 1px solid #52525b; border-radius: 50%; background: #18181b; font-size: 1.4rem; line-height: 1; }
.gallery-button:hover { background: #3f3f46; }
.gallery-stage { position: relative; }
.gallery-media { display: grid; place-items: center; border-radius: .6rem; overflow: hidden; background: #09090b; }
.gallery-media > :is(img, video) { width: 100%; max-height: min(63dvh, 550px); object-fit: contain; }
.gallery-stage > button { position: absolute; top: 50%; transform: translateY(-50%); }
.gallery-prev { left: .5rem; }
.gallery-next { right: .5rem; }
.gallery-caption { margin: .625rem 0; color: #e4e4e7; font-size: .9375rem; }
.gallery-thumbs { display: flex; gap: .45rem; overflow-x: auto; padding: 3px; }
.gallery-thumbs button { position: relative; flex: 0 0 5.25rem; border: 2px solid #52525b; border-radius: .5rem; overflow: hidden; }
.gallery-thumbs button[aria-current="true"] { border-color: #a5b4fc; }
.gallery-thumbs img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.gallery-thumbs span { position: absolute; inset: auto .2rem .15rem auto; border-radius: .25rem; padding: 0 .25rem; background: #18181b; font-size: .75rem; }
#demo-gallery button:focus-visible { outline: 2px solid #c7d2fe; outline-offset: 2px; }

html:has(#demo-gallery[open]) { overflow: hidden; }
#demo-gallery { overscroll-behavior: contain; }
