/* Blog stories (fragments/components/stories.html): the lead block of the home page and the blog list, and story cards.
   Hover and keyboard focus match the cards (components.css): titles turn blue, photos zoom gently. */

.stories-lead {
  display: grid;
  gap: 24px;
}

.story {
  position: relative;
}

.story:has(.story__link:focus-visible) {
  outline: 2px solid var(--focus-ring);
  outline-offset: 4px;
  border-radius: var(--radius);
}

.story__media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background-color: var(--surface-2);
}

/* Photos fill the 16:9 frame and are trimmed from the top only, so the watermark in a bottom corner stays whole. */
.story__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 100%;
}

.story__empty {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--text-muted);
}

.story__empty .icon {
  width: 44px;
  height: 44px;
  opacity: .55;
}

/* A post that really has a video: a round play mark in the middle of the photo, clear of the corner watermark. */
.story__video {
  position: absolute;
  inset: 0;
  display: grid;
  margin: auto;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, .6);
  color: #ffffff;
}

.story__video .icon {
  width: 18px;
  height: 18px;
  margin-left: 2px;
}

.story__title {
  margin: 16px 0 0;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  transition: color .2s ease;
}

.story__link {
  color: inherit;
  text-decoration: none;
}

.story__link::after {
  content: '';
  position: absolute;
  inset: 0;
}

.story__link:focus-visible {
  outline: none;
}

.story__lock {
  width: .8em;
  height: .8em;
  margin-right: 4px;
  color: var(--text-muted);
  vertical-align: -.05em;
}

.story__desc {
  display: -webkit-box;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: .9375rem;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.story--lead .story__desc {
  -webkit-line-clamp: 3;
}

.story__date {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: .8125rem;
}

.stories-lead__list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.story--compact {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.stories-lead__rule {
  width: 100%;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.story--compact .story__media {
  flex: 0 0 120px;
  width: 120px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
}

.story--compact .story__title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 500;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.story--compact .story__desc {
  display: none;
}

.story--compact .story__date {
  margin-top: 4px;
}

.story--compact .story__video {
  width: 32px;
  height: 32px;
}

.story--compact .story__video .icon {
  width: 14px;
  height: 14px;
}

/* The small photo beside the lead keeps a smaller heart. */
.story--compact .card__like {
  top: 6px;
  right: 6px;
}

.story--compact .card__like .heart-blog {
  width: 28px;
  height: 28px;
  font-size: 14px;
}

/* Story cards: four, three, two or one per row (blog list, "More stories"). */
.story-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px 24px;
}

.story-grid .story__title {
  margin-top: 12px;
  font-size: 1.0625rem;
}

@media (min-width: 600px) {
  .story-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .story--lead .story__title {
    font-size: 1.5rem;
  }

  .story-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (hover: hover) {
  .story:hover .story__title {
    color: var(--link);
  }
}

.story:has(.story__link:focus-visible) .story__title {
  color: var(--link);
}

@media (prefers-reduced-motion: no-preference) {
  .story__img {
    transition: transform .35s ease;
  }

  .story:has(.story__link:focus-visible) .story__img {
    transform: scale(1.05);
  }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .story:hover .story__img {
    transform: scale(1.05);
  }
}

/* The blog list shows its three side stories as full cards below desktop width, like every story under them. */
@media (max-width: 1023px) {
  .stories-lead--cards .stories-lead__list {
    gap: 28px;
  }

  .stories-lead--cards .stories-lead__rule {
    display: none;
  }

  .stories-lead--cards .story--compact {
    display: block;
  }

  .stories-lead--cards .story--compact .story__media {
    width: auto;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg);
  }

  .stories-lead--cards .story--compact .story__title {
    margin-top: 12px;
    font-size: 1.0625rem;
    font-weight: 600;
  }

  .stories-lead--cards .story--compact .story__desc {
    display: -webkit-box;
  }

  .stories-lead--cards .story--compact .story__video {
    width: 44px;
    height: 44px;
  }

  .stories-lead--cards .story--compact .story__video .icon {
    width: 18px;
    height: 18px;
  }

  .stories-lead--cards .story--compact .card__like {
    top: 10px;
    right: 10px;
  }

  .stories-lead--cards .story--compact .card__like .heart-blog {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
}

/* Side by side, the small stories run from the top of the lead photo to the lead's date line, evenly spaced, with each
   line exactly midway between two stories. */
@media (min-width: 1024px) {
  .stories-lead {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 32px;
  }

  .stories-lead__list {
    justify-content: space-between;
    gap: 16px;
  }

  .story--compact .story__media {
    flex-basis: 42%;
    width: 42%;
    max-width: 220px;
  }

  .story--compact .story__title {
    font-size: 1.0625rem;
  }

  .story-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 28px 20px;
  }
}

/* On the blog list, a rule separates the lead block from the cards under it. */
.story-grid--after-lead {
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
