/* Carousel wrapper: holds the arrow buttons and the scrolling track */
.substack-carousel {
  position: relative;
  margin: 1.5em 0;
}
 
/* The track scrolls sideways and snaps to each card */
.substack-track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 0.25rem 0.25rem 1rem;
}
 
.md-typeset a.substack-card,
.substack-card {
  flex: 0 0 260px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  background: var(--md-default-bg-color, #fff);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
 
.substack-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
 
/* Cover image cropped to a consistent 16:9 box */
.substack-card img,
.substack-noimg {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin: 0;
}
 
.substack-noimg {
  background: var(--md-default-fg-color--lightest, #ddd);
}
 
.substack-text {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.8rem 0.9rem 1rem;
}
 
.substack-date {
  font-size: 0.7rem;
  opacity: 0.7;
}
 
.substack-title {
  font-weight: 700;
  line-height: 1.3;
}
 
/* Show at most three lines of the subtitle */
.substack-summary {
  font-style: italic;
  font-size: 0.75rem;
  opacity: 0.85;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
 
/* Round arrow buttons over the left and right edges */
.substack-nav {
  position: absolute;
  /* Middle of the cover image: track padding + half the image height
     (card width 260px at 16:9 gives an image 146px tall). */
  top: calc(0.25rem + 260px * 9 / 32);
  transform: translateY(-50%);
  z-index: 1;
  width: 2.2rem;
  height: 2.2rem;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
 
.substack-nav:hover { background: rgba(0, 0, 0, 0.75); }
/* Distance of the arrows from the carousel's left and right edges.
   Larger numbers move them further in over the cards. */
.substack-nav.prev { left: 0.5rem; }
.substack-nav.next { right: 0.5rem; }
 
/* Hide arrows when every card already fits (class set by substack.js) */
.substack-fits .substack-nav { display: none; }
 
/* Hide arrows on touch screens, where swiping works */
@media (hover: none) {
  .substack-nav { display: none; }
}