/* Two columns on the homepage; one on a narrow screen. */
#content .applet-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  align-items: start;
  gap: 28px;
  list-style: none;
  padding: 0;
  margin: 20px 0 36px;
}
.applet-tile { border: 1px solid #ddd; border-radius: 5px; overflow: hidden; }
.applet-preview { position: relative; aspect-ratio: 1; margin: 0; background: white; }
.applet-picture { display: block; width: 100%; height: 100%; }
#content .applet-preview :is(img, video) {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.applet-description {
  position: absolute;
  inset: auto 0 0;
  box-sizing: border-box;
  max-height: 100%;
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  background: rgb(255 255 255 / 86%); /* A light caption over the moving picture. */
  color: #222;
  font-size: 16px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none; /* Clicking the description's background opens the applet. */
  transition: opacity .15s;
}
#content .applet-description a { color: #333; text-decoration: underline; }
.applet-tile:is(:hover, :focus-within) .applet-description { opacity: 1; }
.applet-tile:is(:hover, :focus-within) .applet-description a { pointer-events: auto; }
.applet-caption { margin: 0; padding: 12px 14px; background: #f7f7f7; border-top: 1px solid #ddd; }
#content .applet-title, #content .applet-title a { font-size: 18px; line-height: 1.35; }
.applet-picture:focus-visible { outline: 2px solid blue; outline-offset: -3px; }
.applet-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.animation-control { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.animation-control input {
  appearance: none;
  width: 38px;
  height: 22px;
  margin: 0;
  border-radius: 12px;
  background: #aaa;
  cursor: pointer;
}
.animation-control input::before {
  content: '';
  display: block;
  width: 16px;
  height: 16px;
  margin: 3px;
  border-radius: 50%;
  background: white;
}
.animation-control input:checked { background: #255dc5; }
.animation-control input:checked::before { transform: translateX(16px); }
@media (prefers-reduced-motion: reduce) { .applet-description { transition: none; } }
@media print {
  .animation-control { display: none; }
  .applet-description { position: static; opacity: 1; max-height: none; }
  .applet-preview { aspect-ratio: auto; }
}
