.stories {
  container-type: inline-size;
}
.stories title {
  text-align: center;
}
.stories .wrapper {
  position: relative;
}
.stories .wrapper .button {
  position: absolute;
  background-color: rgba(0, 85, 116, 0.8);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  transform: translateY(-50%);
  transition: all 0.3s ease;
  z-index: 10;
  top: 50%;
  border: solid 1px rgba(255, 255, 255, 0.3);
  box-shadow: rgba(0, 0, 0, 0.1) 0 0 4px;
}
.stories .wrapper .button svg {
  width: 24px;
  height: 24px;
}
.stories .wrapper .button:hover {
  background-color: #005574;
}
.stories .wrapper .button.prev {
  left: 10px;
}
.stories .wrapper .button.next {
  right: 10px;
}
.stories .story-grid {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.stories .story-grid::-webkit-scrollbar {
  display: none;
}
.stories .story-grid .story-item {
  flex: 0 0 100%;
  scroll-snap-align: start;
  overflow: hidden;
  position: relative;
  border-radius: 0.5rem;
  display: flex;
  color: white;
  text-decoration: none;
  padding: 1em;
  background: #005574;
  transition: all 0.3s ease;
}
.stories .story-grid .story-item:has(picture)::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  background: linear-gradient(to top, rgba(4, 62, 83, 0.8), rgba(4, 62, 83, 0));
}
.stories .story-grid .story-item picture {
  transition: transform 0.3s ease;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
}
.stories .story-grid .story-item picture img {
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
  object-fit: cover;
}
.stories .story-grid .story-item .content {
  z-index: 4;
  position: relative;
  align-self: end;
}
.stories .story-grid .story-item:has(picture):hover picture {
  transform: scale(1.05);
}
.stories .story-grid .story-item:has(picture):hover::after {
  opacity: 0.9;
}
.stories .story-grid .story-item:not(:has(picture)):hover {
  background-color: #007aa7;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

@media (min-width: 768px) {
  .stories .story-grid {
    display: grid;
    grid-gap: 1em;
    grid-auto-columns: minmax(400px, 1fr);
    grid-auto-columns: calc(33cqw - .5em);
    grid-template-rows: 1fr 1fr 1fr;
    grid-auto-flow: column;
    overflow-x: auto;
  }
  @container (width > 950px) {
    .stories .story-grid {
      grid-auto-columns: calc(25cqw - 1em);
    }
  }
  .stories .story-grid .story-item .description {
    display: none;
  }
  .stories .story-grid .story-item:first-child {
    grid-row: span 3;
    grid-column: span 2;
  }
  .stories .story-grid .story-item:first-child .description {
    display: block;
  }
  .stories .story-grid .story-item:nth-child(4n+2), .stories .story-grid .story-item:nth-child(4n+5) {
    grid-row: span 2;
  }
}