div.papers-gallery {
  display: inline-block;
}

div.gallery {
  border: 1px solid #ccc;
  height: 260px;
  overflow: scroll;
}

div.gallery:hover {
  border: 1px solid #777;
}

div.gallery img {
  display: block;
  margin-top: .25em;
  margin-left: auto;
  margin-right: auto;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 200px;
}

div.papers-gallery-item {
  padding: 0px;
  width: auto;
  max-height: 200px;
  margin: auto;
}
div.desc {
  padding: 1px;
  text-align: left;
  line-height: 75%;
  max-height: 60px;
}

.papers-gallery .papers-gallery-item {
  box-sizing: border-box;
}

.responsive {
  padding: 0 2px;
  float: left;
  width: 24.49999%;
}

@media only screen and (max-width: 1200px) {
  .responsive {
    width: 32.5%;
  }
}

@media only screen and (max-width: 1000px) {
  .responsive {
    width: 49.0%;
  }
}

@media only screen and (max-width: 600px) {
  .responsive {
    width: 100%;
  }
}

.clearfix:after {
  content: "";
  display: table;
  clear: both;
}

/* Tutorial gallery cards */
.tutorial-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.tutorial-gallery .sd-card {
  transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.tutorial-gallery .sd-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

/* Spacing between section headings and card grids */
.sd-container-fluid {
  margin-top: 0.75rem;
}

/* Notebook output: hide execution count / cell numbering */
.nbinput .prompt,
.nboutput .prompt,
div.nbinput div.prompt,
div.nboutput div.prompt {
  display: none;
}

/* Copy button only on input cells, not output */
.nboutput .highlight .copy-btn,
div.nboutput .highlight .copy-btn {
  display: none !important;
}

/* Responsive card grids for mobile */
@media only screen and (max-width: 768px) {
  .sd-row {
    flex-direction: column !important;
  }
  .sd-col {
    max-width: 100% !important;
    flex: 0 0 100% !important;
  }
  .sd-card {
    margin-bottom: 0.75rem;
  }
  .sd-card .sd-card-img-top {
    max-height: 200px;
    object-fit: contain;
  }
}

/* nbsphinx alert boxes */
.alert {
  font-size: 1em;
  border-radius: 4px;
  padding: 12px 16px;
  margin: 1em 0;
}

.alert-warning {
  border-top: 4px solid #d9534f;
  background-color: #fdf2f2;
}

.alert-info {
  border-top: 4px solid #5bc0de;
  background-color: #f0f8ff;
}

@media only screen and (max-width: 480px) {
  .sd-card .sd-card-body {
    padding: 0.75rem;
  }
  .sd-card .sd-card-body .sd-card-text {
    font-size: 0.9em;
  }
}
