.cz-home-stories {
  --stories-rail: 760px;
  --stories-gutter: max(24px, env(safe-area-inset-left), env(safe-area-inset-right));
  --stories-gap: 16px;
  --stories-card-width: calc((100% - var(--stories-gap)) / 2);
  padding-block: clamp(64px, 8vw, 112px);
  background: #fff;
  color: #17181c;
}

.cz-home-stories__header,
.cz-home-stories__rail {
  width: min(var(--stories-rail), calc(100% - 2 * var(--stories-gutter)));
  margin-inline: auto;
}

.cz-home-stories__header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: clamp(28px, 4vw, 54px);
}

.cz-home-stories__eyebrow {
  margin: 0 0 14px;
  color: #94306c;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
}

.cz-home-stories__title {
  max-width: 800px;
  margin: 0;
  color: inherit;
  font-size: clamp(42px, 5.5vw, 78px);
  font-weight: 680;
  letter-spacing: -.062em;
  line-height: 1.01;
  text-wrap: balance;
}

.cz-home-stories__arrows:not([hidden]) {
  display: flex;
  gap: 8px;
  padding-block: 4px;
}

.cz-home-stories__arrows button {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid #d7d5da;
  border-radius: 50%;
  background: #fff;
  color: #17181c;
  cursor: pointer;
}

.cz-home-stories__arrows button:not([aria-disabled="true"]):hover {
  background: #f9edf5;
}

.cz-home-stories__arrows button[aria-disabled="true"] {
  color: #787580;
  cursor: default;
}

.cz-home-stories button:focus-visible,
.cz-home-stories__rail:focus-visible {
  outline: 2px solid #94306c;
  outline-offset: 3px;
}

.cz-home-stories__rail {
  overflow: auto hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.cz-home-stories__rail::-webkit-scrollbar { display: none; }

.cz-home-stories__track {
  display: flex;
  gap: var(--stories-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.cz-home-stories__item {
  flex: 0 0 var(--stories-card-width);
  min-width: 0;
  scroll-snap-align: start;
}

.cz-home-stories__card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: start;
  justify-content: end;
  overflow: hidden;
  aspect-ratio: 9 / 16;
  margin: 0;
  padding: clamp(16px, 2vw, 24px);
  border-radius: 20px;
  background: #27262c;
  color: #fff;
}

.cz-home-stories__card--lilac { background: #efc7ee; color: #24182a; }
.cz-home-stories__card--amber { background: #f8d995; color: #2b2017; }

.cz-home-stories__photo,
.cz-home-stories__card--photo::before {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.cz-home-stories__photo {
  z-index: -2;
  object-fit: cover;
}

.cz-home-stories__card--photo::before {
  z-index: -1;
  background: linear-gradient(180deg, rgb(0 0 0 / 26%) 0%, rgb(0 0 0 / 43%) 38%, rgb(0 0 0 / 87%) 69%, rgb(0 0 0 / 98%) 100%);
  content: "";
}

.cz-home-stories__stat {
  margin: 0 0 auto;
  padding: 7px 11px;
  border-radius: 10px;
  background: rgb(255 255 255 / 62%);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.3;
}

.cz-home-stories__card--photo .cz-home-stories__stat {
  background: rgb(14 13 18 / 81%);
}

.cz-home-stories__quote {
  margin: 24px 0 16px;
  padding: 0;
  border: 0;
  font-size: clamp(20px, 2vw, 29px);
  font-weight: 720;
  letter-spacing: -.035em;
  line-height: 1.1;
  text-transform: uppercase;
  text-wrap: pretty;
}

.cz-home-stories__quote p { margin: 0; }

.cz-home-stories__author {
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.3;
}

.cz-home-stories__author img {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.cz-home-stories__name,
.cz-home-stories__role {
  display: block;
}

.cz-home-stories__name { font-size: 14px; font-weight: 700; }
.cz-home-stories__role { margin-top: 2px; font-size: 12px; }
.cz-home-stories__card--photo .cz-home-stories__role { color: #ece8ee; }
.cz-home-stories__progress { display: none; }

@media (min-width: 1025px) {
  .cz-home-stories {
    --stories-rail: 1032px;
    --stories-card-width: calc((100% - 2 * var(--stories-gap)) / 3);
  }
}

@media (width <= 768px) {
  .cz-home-stories {
    --stories-gutter: max(20px, calc((100% - 544px) / 2), env(safe-area-inset-left), env(safe-area-inset-right));
    --stories-gap: 12px;
    --stories-card-width: min(78vw, 334px);
  }

  .cz-home-stories__header { display: block; }

  .cz-home-stories__title {
    max-width: 15ch;
    font-size: clamp(39px, 10.4vw, 64px);
    text-wrap: wrap;
  }

  .cz-home-stories__arrows:not([hidden]) { display: none; }

  .cz-home-stories__rail {
    width: min(544px, calc(100% - var(--stories-gutter)));
    margin-inline: var(--stories-gutter) 0;
  }

  .cz-home-stories__rail:focus-visible { outline-offset: -3px; }

  /* Reserve enough trailing space for the last portrait to snap to the leading edge. */
  .cz-home-stories__track::after {
    flex: 0 0 max(0px, calc(100% - var(--stories-card-width) - var(--stories-gap)));
    content: "";
  }

  .cz-home-stories__quote { font-size: clamp(20px, 5.65vw, 26px); }

  .cz-home-stories__progress:not([hidden]) {
    display: flex;
    align-items: center;
    margin: 12px var(--stories-gutter) 0;
  }

  .cz-home-stories__progress button {
    --stories-segment-width: 11px;
    display: grid;
    width: calc(var(--stories-segment-width) + 5px);
    height: 44px;
    padding: 0;
    place-items: center start;
    border: 0;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
  }

  .cz-home-stories__progress button::before {
    width: var(--stories-segment-width);
    height: 5px;
    border-radius: 5px;
    background: #a49da6;
    content: "";
  }

  .cz-home-stories__progress button[aria-current="true"] { --stories-segment-width: 28px; }

  .cz-home-stories__progress button[aria-current="true"]::before {
    background: #fb4d8d;
  }
}
