/* User Provided Stylesheet */

/* Added to every page of the website (build_site.py). */

/* The home page's Topics: galleries of header figures, each linking to its notebook
   (topics_gallery). A grid of equal cards; each figure is cropped to a centered 2:1
   window, as in the theme's hover previews. */
.toc-gallery > p {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.75rem;
}
.toc-gallery > p > span {   /* the theme's wrapper for a link's hover preview */
  display: flex;
}
.toc-gallery a {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgb(128 128 128 / 0.3);
  border-radius: 0.4rem;
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.toc-gallery a:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
}
.toc-gallery picture {
  display: block;
  margin: 0;
}
.toc-gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 2;
  margin: 0;
  object-fit: cover;
  background: white;
}
.toc-gallery em,
.toc-gallery strong {
  padding: 0 0.5rem;
  overflow-wrap: normal;
  hyphens: auto;
}
.toc-gallery strong {
  padding-top: 0.35rem;
  padding-bottom: 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
}
.toc-gallery em {
  padding-top: 0.35rem;
  margin-bottom: -0.35rem;
  font-size: 0.7rem;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
}
@media (max-width: 640px) {
  .toc-gallery > p {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .toc-gallery strong { font-size: 0.78rem; }
}

/* The home page's front matter, folded (preview_card): the dropdown's title is the section's
   first paragraph, read as ordinary text and cut to a few lines until opened. */
.front-preview > summary {
  padding: 0.6rem 0.5rem 0.6rem 1rem;
  background: none;   /* one card: the preview reads on into the rest */
}
.front-preview .myst-dropdown-header-title {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.75;
}
.front-preview:not([open]) .myst-dropdown-header-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.front-preview:not([open]) > summary::after {
  content: 'Read more';
  display: block;
  margin-top: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-blue-700, #1d4ed8);
}
.front-preview > .myst-dropdown-body {
  padding: 0.25rem 1rem 0.5rem;
}

/* On a phone the theme puts the page outline, open, above the home page's text; there the
   menu already holds the contents, so it only delays the gallery. (Wider screens keep it in
   the margin.) */
@media (max-width: 1023px) {
  article:has(.toc-gallery) div:has(> .myst-outline-section) {
    display: none;
  }
}
