/* CLAUDE 10-06: Media > Stock library (stocklib.js). DESIGN-SYSTEM.md tokens: surface #111113, surface-2 #161616,
   line #262626, accent #53fc18 (tint #15210f), text-faint #9a9a9a; 8 px controls, 10 px cards, 999 px pills. */
.sl,
.sl-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.sl [hidden] {
  display: none !important;
}
.sl-setup {
  margin: 0;
}

/* the Pixabay note */
.sl-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 6px 10px 12px;
  border: 1px solid #263026;
  border-radius: 10px;
  background: #121612;
}
.sl-note p {
  flex: 1;
  margin: 0;
  color: #b3beb1;
  font-size: 12px;
  line-height: 1.45;
}
.sl-x {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: -6px 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: #bdbdbd;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.sl-x:hover {
  background: #1b221b;
  color: #eef3ed;
}

/* search */
.sl-search input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  box-sizing: border-box;
}

/* category chips; one scrolling row on narrow screens */
.sl-shelves,
.sl-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sl-words {
  align-items: center;
}
.sl-words > span {
  color: #9a9a9a;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-right: 2px;
}
.sl-shelf,
.cc-chip {
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid #262626;
  border-radius: 999px;
  background: #161616;
  color: #bdbdbd;
  font: inherit;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    color 150ms ease,
    background-color 150ms ease,
    transform 120ms ease-out;
}
.sl-shelf[aria-pressed='true'] {
  border-color: #53fc18;
  background: #15210f;
  color: #eef3ed;
}
@media (hover: hover) and (pointer: fine) {
  .sl-shelf:hover,
  .cc-chip:hover {
    border-color: #53fc18;
    color: #eef3ed;
  }
}
.sl-shelf:active,
.cc-chip:active {
  transform: scale(0.97);
}

/* the grid: fixed 16:9 tiles, so nothing jumps while pictures load */
.sl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
}
.sl-grid:empty {
  display: none;
}
.sl-card {
  position: relative;
  min-width: 0;
}
.sl-add {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid #262626;
  border-radius: 10px;
  overflow: hidden;
  background: #111113;
  color: #eef3ed;
  cursor: pointer;
  -webkit-touch-callout: none;
  user-select: none;
  transition:
    border-color 150ms ease,
    transform 160ms ease-out;
}
.sl-media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 9px;
  background: #1b1b1d;
}
.sl-media img,
.sl-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sl-media img,
.sl-preview {
  opacity: 0;
  transition: opacity 150ms ease;
}
.sl-media img.ok {
  opacity: 1;
}
.sl-card.playing .sl-preview {
  opacity: 1;
}
@media (hover: hover) and (pointer: fine) {
  .sl-add:hover {
    border-color: #53fc18;
  }
}
.sl-add:active {
  transform: scale(0.97);
}
.sl-add:focus-visible {
  outline: 3px solid #6dff3d;
  outline-offset: 2px;
}
.sl-dur {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: #000000b3;
  color: #f3f3f3;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  pointer-events: none;
}
.sl-tag {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: #000000b3;
  color: #8dff66;
  font-size: 10px;
  line-height: 1.6;
  pointer-events: none;
}
.sl-card.playing .sl-tag,
.sl[data-shelf='green'] .sl-tag {
  opacity: 0;
}
/* the Premium pill (free plan only: pro.js sets html.pro-free) sits in the tile's corner */
.pro-free .sl-add[data-pro]::after {
  position: absolute;
  top: 5px;
  left: 5px;
  margin: 0;
  padding: 0 5px;
  font-size: 8px;
}
/* Favorites' star (yours.js), when it's there */
.sl-fav {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 1;
}

/* adding / added */
.sl-state {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  align-content: center;
  gap: 6px;
  border-radius: 9px;
  background: #0b0b0bcc;
  font-size: 12px;
  font-weight: 600;
}
.sl-card[data-state='adding'] .sl-state,
.sl-card[data-state='added'] .sl-state {
  display: grid;
}
.sl-card[data-state='adding'] .sl-add {
  cursor: progress;
}
.sl-state i {
  width: 18px;
  height: 18px;
  border: 2px solid #ffffff40;
  border-top-color: #53fc18;
  border-radius: 50%;
  animation: sl-spin 700ms linear infinite;
}
.sl-card[data-state='added'] .sl-state i {
  width: 10px;
  height: 18px;
  border: solid #53fc18;
  border-width: 0 2px 2px 0;
  border-radius: 0;
  transform: rotate(45deg) translate(-2px, -2px);
  animation: none;
}
.sl-card[data-state='added'] .sl-add {
  border-color: #53fc18;
}
@keyframes sl-spin {
  to {
    transform: rotate(360deg);
  }
}

/* loading tiles */
.sl-skel .sl-media {
  border: 1px solid #1f1f21;
  border-radius: 10px;
  background: linear-gradient(100deg, #161618 30%, #202023 50%, #161618 70%) 0 0 / 300% 100%;
  animation: sl-shimmer 1.2s ease-in-out infinite;
}
@keyframes sl-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sl-skel .sl-media {
    animation: none;
  }
  .sl-state i {
    animation-duration: 1.6s;
  }
}

/* empty, error and offline */
.sl-msg {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 18px 12px;
  border: 1px dashed #262626;
  border-radius: 10px;
  text-align: center;
}
.sl-msg p {
  margin: 0;
  color: #bdbdbd;
  font-size: 13px;
  line-height: 1.45;
}
.sl-more {
  justify-self: center;
  min-height: 40px;
  padding: 6px 18px;
  border: 1px solid #262626;
  border-radius: 8px;
  background: #161616;
  color: #eef3ed;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

/* phones and touch: 44 px targets, the categories in one row that scrolls sideways */
@media (max-width: 760px), (pointer: coarse) {
  .sl-shelves,
  .sl-words {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .sl-shelves::-webkit-scrollbar,
  .sl-words::-webkit-scrollbar {
    display: none;
  }
  .sl-shelf,
  .sl-words > * {
    flex: none;
    scroll-snap-align: start;
  }
  .sl-shelf,
  .cc-chip,
  .sl-x,
  .sl-more,
  .sl-search input {
    min-height: 44px;
  }
  .sl-x {
    width: 44px;
    height: 44px;
    margin: -10px -2px -10px 0;
  }
}
/* a phone's tool panel is ~210 px wide (the tool list takes the rest): two tiles a row */
@media (max-width: 760px) {
  .sl-grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 6px;
  }
}
