.featured-carousel {
  --featured-carousel-accent: #352d39;
  /* Match the Oculama theme's $cream and $maroon Sass colors. */
  --featured-carousel-text: #ffeecc;
  --featured-carousel-link: #b74166;
  display: grid;
  grid-template-areas: "stories";
  gap: 1rem;
  max-width: 72rem;
  margin: 1rem auto 2rem;
  overflow: hidden;
  border: 0.45rem solid var(--featured-carousel-accent);
  border-radius: 15px;
  background: #211e2c;
  color: var(--featured-carousel-text);
}

.featured-carousel--ready {
  grid-template-columns: minmax(0, 4fr) minmax(12rem, 1fr);
  grid-template-areas: "stories choices";
  gap: 0;
}

.featured-carousel__stories {
  grid-area: stories;
  display: grid;
  align-content: start;
  gap: 1rem;
  min-width: 0;
}

.featured-carousel__story,
.featured-carousel__choices button {
  border: 1px solid #49435b;
  background: #211e2c;
  color: var(--featured-carousel-text);
}

.featured-carousel__story {
  overflow: hidden;
  border-radius: 0.75rem;
  background: var(--featured-carousel-accent);
}

/* Share a grid cell so the tallest story sets the height for every slide. */
.featured-carousel--ready .featured-carousel__stories {
  align-content: stretch;
}

.featured-carousel--ready .featured-carousel__story {
  grid-area: 1 / 1;
  min-width: 0;
  border: 0;
  border-radius: 0;
}

/* Stack the outgoing image below the incoming image within the artwork area. */
.featured-carousel__art {
  display: block;
  position: relative;
  overflow: hidden;
}

.featured-carousel__art img {
  position: relative;
}

.featured-carousel__art .featured-carousel__outgoing-image {
  position: absolute;
  inset: 0;
}

.featured-carousel__art img,
.featured-carousel__thumbnail img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

.featured-carousel__art img {
  aspect-ratio: 11 / 4;
}

@media (prefers-reduced-motion: no-preference) {
  .featured-carousel__story--entering .featured-carousel__art img:not(.featured-carousel__outgoing-image) {
    animation: featured-carousel-art-enter 700ms ease-out both;
  }
}

@keyframes featured-carousel-art-enter {
  from {
    transform: translateX(-105%);
  }
  to {
    transform: translateX(0);
  }
}

/* Fit the heading below the artwork by tightening the caption spacing. */
.featured-carousel__caption {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  padding: 0.95rem clamp(1rem, 3vw, 1.75rem);
  text-align: center;
  overflow-wrap: anywhere;
}

.featured-carousel__title {
  margin: 0;
  color: inherit;
  font-size: clamp(1.125rem, 2vw, 1.65rem);
  line-height: 1.15;
}

.featured-carousel__caption p:first-child {
  margin-block-start: 0;
}

.featured-carousel__caption p:last-child {
  margin-block-end: 0;
}

.featured-carousel__caption a {
  color: var(--featured-carousel-caption-link-color, inherit);
  text-decoration: underline;
}

.featured-carousel__read-more {
  --featured-carousel-caption-link-color: var(--featured-carousel-link);
  font-weight: 700;
}

/* Apply the carousel palette over the front-page link styles. */
.is-front .content-container .featured-carousel .featured-carousel__caption a:any-link {
  color: var(--featured-carousel-caption-link-color, inherit);
}

.featured-carousel__choices {
  grid-area: choices;
  display: grid;
  grid-auto-rows: 1fr;
  border-inline-start: 1px solid #49435b;
}

.featured-carousel__choices button {
  display: grid;
  position: relative;
  min-width: 0;
  min-height: 3.5rem;
  padding: 0.25rem;
  border: 0;
  border-radius: 0;
  cursor: pointer;
}

.featured-carousel__choices button + button {
  border-block-start: 1px solid #49435b;
}

.featured-carousel__choices button:hover {
  background: #302b40;
}

.featured-carousel__choices button[aria-selected="true"] {
  background: var(--featured-carousel-accent);
  box-shadow: inset 0.15rem 0 #a195a4;
}

/* Fill the selector row without letting image dimensions size the rail. */
.featured-carousel__thumbnail {
  position: relative;
  overflow: hidden;
  border-radius: 0.25rem;
  background: #15131d;
}

.featured-carousel__thumbnail img {
  position: absolute;
  inset: 0;
  height: 100%;
}

.featured-carousel__thumbnail,
.featured-carousel__thumbnail-title {
  grid-area: 1 / 1;
}

/* Keep the title readable while dimming only the artwork. */
.featured-carousel__thumbnail-title {
  position: relative;
  align-self: end;
  padding: 0.5rem 0.35rem 0.2rem;
  background: linear-gradient(transparent, rgba(15, 12, 19, 0.92));
  color: var(--featured-carousel-text);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-shadow:
    -1px -1px #000,
    1px -1px #000,
    -1px 1px #000,
    1px 1px #000;
  overflow-wrap: anywhere;
}

.featured-carousel__choices button[aria-selected="false"]:not(:hover):not(:focus-visible) .featured-carousel__thumbnail img {
  opacity: 0.5;
}

.featured-carousel :focus-visible {
  outline: 2px solid #ffcf82;
  outline-offset: -3px;
}

.featured-carousel__choices button:focus-visible {
  outline-color: var(--featured-carousel-text);
}

.featured-carousel [hidden] {
  display: none;
}

.featured-carousel--ready .featured-carousel__story[hidden] {
  display: block;
  visibility: hidden;
}

/* Stack the selectors below the feature when the side rail would crowd it. */
@media (max-width: 700px) {
  .featured-carousel__caption {
    padding-block: 1.2rem;
  }

  .featured-carousel--ready {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "stories"
      "choices";
  }

  .featured-carousel__choices {
    border-block-start: 1px solid #49435b;
    border-inline-start: 0;
  }

  .featured-carousel__thumbnail img {
    object-fit: contain;
  }
}
