/* Stories, from the Figma Continuum frame (Stories / from the team) and the "Stories block · states & spec" board:
   the 3 latest Substack posts HR picked, each card one link out. Layout follows the count: three cards, two halves,
   or one wide card. On mobile the cards become a swipeable row. Loading shows skeletons; with no posts the section
   is not rendered at all. */

.lp-stories__inner {
  display: flex;
  flex-direction: column;
  gap: 3rem;
  padding: 4rem 1rem;
}

.lp-stories__header {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.lp-stories__heading {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lp-stories__title {
  font-size: 1.875rem;
  line-height: 2.375rem;
  font-weight: 400;
  color: var(--lp-ui-text-primary);
}

.lp-stories__aside {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  max-width: 25rem;
}

.lp-stories__lead {
  font-size: 1.125rem;
  line-height: 1.75rem;
  color: var(--lp-ui-text-tertiary);
}

.lp-stories__all {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  color: var(--lp-ui-text-primary);
  text-decoration: none;
}

.lp-stories__all:hover {
  text-decoration: underline;
}

.lp-stories__all svg,
.lp-story__external {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.lp-stories__list {
  display: flex;
  gap: 1rem;
  margin: 0 -1rem;
  padding: 0 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 1rem;
  scrollbar-width: none;
}

.lp-stories__list::-webkit-scrollbar {
  display: none;
}

.lp-story {
  display: flex;
  flex: 0 0 17.5rem;
  flex-direction: column;
  gap: 1rem;
  color: inherit;
  text-decoration: none;
  scroll-snap-align: start;
}

.lp-stories__list.is-count-1 .lp-story {
  flex-basis: 100%;
}

.lp-story__cover {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius-ui-2xl);
  background: var(--lp-ui-bg-secondary);
}

.lp-story__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 300ms ease;
}

.lp-story__fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #FFFFFF 0%, #D5D9EB 45%, #6C9FE5 100%);
}

.lp-story__fallback svg {
  width: 7rem;
  height: auto;
}

.lp-story__body {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.lp-story__category {
  font-size: 0.75rem;
  line-height: 1.125rem;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--lp-ui-link);
}

.lp-story__title,
.lp-story__excerpt {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.lp-story__title {
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 500;
  color: var(--lp-ui-text-primary);
  transition: color 150ms ease;
}

.lp-story__excerpt {
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--lp-ui-text-tertiary);
}

.lp-story__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.625rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--lp-ui-text-quaternary);
}

.lp-story__external {
  color: var(--lp-ui-text-quaternary);
  transition: color 150ms ease;
}

.lp-story:hover .lp-story__title,
.lp-story:hover .lp-story__external {
  color: var(--lp-ui-link);
}

.lp-story:hover .lp-story__cover img {
  transform: scale(1.03);
}

.lp-story:focus-visible,
.lp-stories__all:focus-visible {
  outline: 3px solid color-mix(in oklab, var(--ring) 50%, transparent);
  outline-offset: 4px;
  border-radius: var(--radius-ui-2xl);
}

.lp-story--skeleton .lp-story__cover,
.lp-skeleton-line {
  background: var(--lp-ui-bg-quaternary);
  animation: lp-skeleton-pulse 1.4s ease-in-out infinite;
}

.lp-skeleton-line {
  height: 0.75rem;
  border-radius: 999px;
}

.lp-skeleton-line--title { width: 85%; height: 1rem; }
.lp-skeleton-line--short { width: 40%; }
.lp-skeleton-line--half { width: 60%; }

@keyframes lp-skeleton-pulse {
  50% { opacity: 0.5; }
}

.lp-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (min-width: 48rem) {
  .lp-stories__inner { padding: 6rem 1.5rem; }
  .lp-stories__title { font-size: 2.25rem; line-height: 2.75rem; letter-spacing: -0.02em; }

  .lp-stories__list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  .lp-stories__list.is-count-3 { grid-template-columns: repeat(3, 1fr); }

  .lp-stories__list.is-count-1 { grid-template-columns: 1fr; }

  .lp-stories__list.is-count-1 .lp-story {
    display: grid;
    grid-template-columns: 55fr 45fr;
    align-items: center;
    gap: 3rem;
  }
}

@media (min-width: 64rem) {
  .lp-stories__header { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 4rem; }
}

@media (max-width: 63.99rem) and (min-width: 48rem) {
  .lp-stories__list.is-count-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .lp-story__cover img { transition: none; }
  .lp-story:hover .lp-story__cover img { transform: none; }
  .lp-story--skeleton .lp-story__cover,
  .lp-skeleton-line { animation: none; }
}

/* Story popup, laid out like dicoding.com's employee story dialog (about-story-dialog): the cover on a soft stage on
   the left, the story on the right, each part fading up in turn. The full post stays on Substack. */

button.lp-story {
  width: 100%;
  color: inherit;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* The card is a button, so its parts are spans; these two need to be blocks. */
button.lp-story .lp-story__cover,
button.lp-story .lp-story__category {
  display: block;
}

.lp-story-dialog {
  display: grid;
}

.lp-story-dialog__media {
  padding: 0.5rem;
}

.lp-story-dialog__stage {
  display: grid;
  place-items: center;
  height: 20rem;
  padding: 1.25rem;
  border-radius: var(--radius-ui-2xl);
  background-image: linear-gradient(135deg, var(--utility-blue-light-100) 0%, var(--utility-indigo-100) 50%, var(--utility-purple-100) 100%);
}

.lp-story-dialog__stage img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-ui-2xl);
}

.lp-story-dialog__stage svg {
  width: 9rem;
  height: auto;
}

.lp-story-dialog__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  padding: 2rem 1rem;
}

.lp-story-dialog__title {
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 400;
  color: var(--lp-ui-text-primary);
}

.lp-story-dialog__excerpt {
  font-size: 1.125rem;
  line-height: 1.75rem;
  color: var(--lp-ui-text-secondary);
}

/* The opening paragraphs of the post, as plain text from the feed. The last lines fade out to show the story goes on
   at Substack. */
.lp-story-dialog__preview {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--lp-ui-border-secondary);
  font-size: 1rem;
  line-height: 1.625rem;
  color: var(--lp-ui-text-secondary);
  -webkit-mask-image: linear-gradient(to bottom, #000 65%, transparent);
  mask-image: linear-gradient(to bottom, #000 65%, transparent);
}

.lp-story-dialog__enter {
  animation: lp-story-dialog-enter 700ms ease-out both;
}

.lp-story-dialog__enter--1 { animation-delay: 40ms; }
.lp-story-dialog__enter--2 { animation-delay: 130ms; }
.lp-story-dialog__enter--3 { animation-delay: 220ms; }
.lp-story-dialog__enter--4 { animation-delay: 310ms; }
.lp-story-dialog__enter--5 { animation-delay: 400ms; }
.lp-story-dialog__enter--6 { animation-delay: 490ms; }

@keyframes lp-story-dialog-enter {
  from { opacity: 0; transform: translateY(0.75rem); filter: blur(4px); }
}

@media (min-width: 40rem) {
  .lp-story-dialog { grid-template-columns: 1fr 1fr; align-items: start; }
  .lp-story-dialog__media { position: sticky; top: 0; padding: 0.75rem; }
  .lp-story-dialog__stage { height: 35rem; padding: 2rem; border-radius: var(--radius-ui-4xl); }
  .lp-story-dialog__body { gap: 1.25rem; padding: 2.5rem 4rem 2.5rem 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .lp-story-dialog__enter { animation: none; }
}
