/* Studio tray: see tray.js for the markup. Uses the Level Lab design tokens
   from base.css (--space-1, --content-gap, --radius-lg, --border-width,
   --color-*, --font-*). Cards are all one size, and always square, so a page
   is a whole number of them. */

.studio-tray { position: relative; display: flex; align-items: center; touch-action: none; }
/* The arrows float over the faded edges, so showing one never moves the
   cards. */
.studio-tray > .studio-tray-prev,
.studio-tray > .studio-tray-next { position: absolute; top: 50%; z-index: 1; height: var(--studio-card-size, 90px); transform: translateY(-50%); } /* as tall as a card */
.studio-tray > .studio-tray-prev { left: 0; }
.studio-tray > .studio-tray-next { right: 0; }
.studio-tray > .off { display: none; }

.studio-tray-list {
  --studio-tray-fade: 60px; /* tray.js reads it to page past the fades */
  --fade-l: 0px;
  --fade-r: 0px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
  mask-image: linear-gradient(to right, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
}
.studio-tray-list.more-left { --fade-l: var(--studio-tray-fade); }
.studio-tray-list.more-right { --fade-r: var(--studio-tray-fade); }

.studio-tray-track {
  display: flex;
  gap: var(--content-gap);
  transition: transform 0.35s ease;
}

.studio-card {
  position: relative;
  touch-action: none; /* tray.js decides between a swipe and a drag */
  flex: 0 0 auto;
  /* Always square: the height follows the width, whatever a game sets the
     width to (--studio-card-size, 90px unless a game changes it), and what's
     inside can't stretch it (words that don't fit are cut short: below). */
  width: var(--studio-card-size, 90px);
  height: auto;
  aspect-ratio: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-1);
  background: var(--color-background);
  color: var(--color-text);
  border: var(--border-width) var(--border-style, solid) var(--color-border);
  border-radius: var(--radius-lg);
  font: inherit;
  font-size: var(--font-size);
  line-height: var(--line-height);
  text-align: center;
  cursor: grab;
  transition: border-color 0.15s ease;
}
@media (hover: hover) {
  :where(html:not([data-pointer='touch'])) .studio-card:hover { border-color: var(--color-accent); } /* see base.css */
}
.studio-card:active { cursor: grabbing; }
/* Chosen in Tap (tray.js): every tap on the board places one */
.studio-card.held {
  border-color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 22%, var(--color-background));
  box-shadow: inset 0 0 0 1px var(--color-accent);
}
/* A card that's chosen with a tap, not dragged (Track Lab's Ride views), and
   the one that's on */
.studio-card.studio-card-choice { cursor: pointer; touch-action: manipulation; }
.studio-card.active { border-color: var(--color-accent); box-shadow: inset 0 0 0 1px var(--color-accent); }
.studio-card .icon { width: 50px; height: 50px; display: block; margin: 0 auto; pointer-events: none; }
/* Every line of words on a card is one line, and one too long for the card
   is cut short with "…" rather than spilling out or making the card wider:
   the name, a small line under it (.sub), and any other words a game puts
   straight in the card (low weight, so a game's own rule for them wins). */
.studio-card .name, .studio-card .sub, :where(.studio-card > span) { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studio-card .name { display: block; font-weight: var(--font-weight-bold); margin-top: var(--space-1); }
.studio-card .sub { display: block; }
