/* Gallery (gallery.md, written by make_examples.py): a grid of figures, as
   the seaborn example gallery. Hovering a figure shows what it is; clicking
   it opens its page with the code. */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  grid-auto-rows: 200px;
  grid-auto-flow: dense;
  gap: 14px;
  margin: 1.5rem 0;
}

.gallery-item {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid #e3e6ea;
  border-radius: 6px;
  background: #fff;
  text-decoration: none !important;
}

/* wide figures take two columns; the big ready-made figures, two columns and two rows */
.gallery-item.wide {
  grid-column: span 2;
}
.gallery-item.large {
  grid-column: span 2;
  grid-row: span 2;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
  box-sizing: border-box;
  transition: transform 0.2s ease;
}

.gallery-item .gallery-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 1px 6px;
  border-radius: 8px;
  background: #1f77b4;
  color: #fff;
  font-size: 0.7rem;
}

/* what the figure shows, over the figure when hovering (or focusing it with the keyboard) */
.gallery-item .gallery-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
  background: linear-gradient(to top, rgba(20, 30, 45, 0.92) 55%, rgba(20, 30, 45, 0.55));
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.gallery-item .gallery-overlay strong {
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.gallery-item .gallery-overlay span {
  font-size: 0.8rem;
  line-height: 1.35;
}
.gallery-item .gallery-overlay em {
  margin-top: 8px;
  font-size: 0.75rem;
  opacity: 0.8;
}
.gallery-item:hover .gallery-overlay,
.gallery-item:focus .gallery-overlay {
  opacity: 1;
}
.gallery-item:hover img {
  transform: scale(1.03);
}

/* phones: one column; wide and large figures take the row */
@media (max-width: 520px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
  .gallery-item.wide,
  .gallery-item.large {
    grid-column: span 1;
  }
}

/* the page of one figure */
.gallery-figure img {
  max-width: 100%;
  border: 1px solid #e3e6ea;
  border-radius: 6px;
}

/* the names in the code that link to their documentation (sphinx-codeautolink) */
.sphinx-codeautolink-a {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.sphinx-codeautolink-a:hover {
  text-decoration: underline solid;
}
