Shuttle through rotating carousel
Your task
An automated warehouse runs a shuttle across a rectangular floor. Every cell carries a repeating schedule string, and all of the schedules have the same length L. Character t of a cell's schedule is '.' when that cell is clear during minute t and '#' when a rotating carousel fills it, and the schedule repeats forever, so minute t reads character t mod L. The shuttle stands on the top left cell at minute 0. Between one minute and the next it either waits where it is or steps to an orthogonally adjacent cell, and it must be standing on a clear cell at every minute, minute 0 included. Return the earliest minute at which it can be standing on the bottom right cell, or -1 when no sequence of waits and steps ever puts it there. The floor has at least one cell and L is at least 1.
Examples
shuttle_transit_time(floor: list[list[str]]) -> intshuttle_transit_time([["..", ".#"], [".#", ".."]])3shuttle_transit_time([["...", "..."], ["...", "..."]])2shuttle_transit_time([["#."], [".."]])-1