/* The grid view: snippets of work in a mosaic (mosaic.js). */

.work-mosaic { display: none; }
.work.is-grid .work-stack { display: none; }
.work.is-grid .work-mosaic {
  /* A bento: twelve columns, tiles of uneven widths and heights, packed. */
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 58px;
  gap: 18px;
  /* Break the text column, but keep a margin from the window edges. */
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding: 0 32px 8px;
  box-sizing: border-box;
}

.mo-tile {
  display: block;
  min-width: 0;
  cursor: pointer;
  outline: none;
  opacity: 0;
  transform: translateY(14px);
}
.work-mosaic.is-in .mo-tile {
  opacity: 1;
  transform: none;
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: calc(var(--i) * 45ms);
}

.mo-shot {
  position: relative;
  height: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 30px -14px rgba(20, 20, 40, 0.3), 0 1px 3px rgba(20, 20, 40, 0.06);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.mo-tile:hover .mo-shot,
.mo-tile:focus-visible .mo-shot { transform: translateY(-3px); box-shadow: 0 18px 38px -16px rgba(20, 20, 40, 0.36), 0 1px 3px rgba(20, 20, 40, 0.06); }
.mo-tile:focus-visible .mo-shot { outline: 2px solid var(--ink, #111); outline-offset: 3px; }

/* A desktop screen on its backdrop: inset at the top and sides, running
   off the bottom edge. */
.mo-bg {
  padding: 32px 32px 0;
  display: flex;
  flex-direction: column;
  /* A screen shorter than its tile sits on the bottom edge; a taller one
     shows its top and runs off. */
  justify-content: safe flex-end;
}
.mo-bg > div, .mo-bg > img {
  border-radius: 8px 8px 0 0 !important;
  box-shadow: 0 12px 34px -12px rgba(20, 20, 40, 0.32), 0 1px 3px rgba(20, 20, 40, 0.08) !important;
  margin: 0 !important;
}
.mo-bg > img { width: 100%; }
.mo-bg > * { flex: none; }
/* A whole frame floating in the middle of its backdrop, padded evenly. */
.mo-bg.mo-whole { padding: 32px; justify-content: center; align-items: center; }
.mo-bg.mo-whole > img {
  width: auto !important; height: auto; max-width: 100%; max-height: 100%;
  flex: 0 1 auto; min-height: 0;
  border-radius: 10px !important;
}

/* A close-up: one piece of a screen as a card of its own, floating on the
   backdrop rather than running off it. */
.mo-close { padding: 32px; justify-content: center; align-items: center; }
.mo-bg > .mo-chunk {
  position: relative;
  overflow: hidden;
  border-radius: 12px !important;
  box-shadow: 0 16px 40px -14px rgba(20, 20, 40, 0.34), 0 1px 3px rgba(20, 20, 40, 0.08) !important;
}
.mo-chunk { background: #fff; }
.mo-chunk-in { position: absolute; top: 0; bottom: 0; overflow: hidden; }
.mo-chunk-in > div { position: absolute; border-radius: 0 !important; box-shadow: none !important; margin: 0 !important; }

/* Otherwise the screens bring their own frame inside a sheet; here the tile is the frame. */
.mo-shot:not(.mo-bg) > div { border-radius: 0 !important; box-shadow: none !important; margin: 0 !important; }
.mo-shot > img { display: block; width: 100%; height: auto; }

/* The Lucky Card pieces fill whatever box they are given. */
.mo-tall > div, .mo-square > div, .mo-wide > div { position: absolute; inset: 0; }


@media (max-width: 1100px) {
  .work.is-grid .work-mosaic { grid-auto-rows: 40px; gap: 14px; }
  .mo-bg { padding: 22px 22px 0; }
  .mo-close { padding: 22px; }
  .mo-bg.mo-whole { padding: 22px; }
}
@media (max-width: 640px) {
  /* One column; each tile takes a shape of its own instead. */
  .work.is-grid .work-mosaic { display: block; padding: 0 16px 8px; }
  .mo-tile { margin-bottom: 16px; grid-column: auto !important; grid-row: auto !important; }
  .mo-shot { height: auto; aspect-ratio: 4 / 3; }
  .mo-shot.mo-tall { aspect-ratio: 4 / 5; }
  .mo-shot.mo-square { aspect-ratio: 1 / 1; }
  .mo-bg { padding: 18px 18px 0; }
  .mo-close { padding: 18px; }
  .mo-bg.mo-whole { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .mo-tile, .work-mosaic.is-in .mo-tile { opacity: 1; transform: none; transition: none; }
}
