/* FROM — home, section 4: news and stories. A row of photo cards that runs off the right edge of the screen;
   drag, swipe or use the arrows. */

.news {
  padding: clamp(88px, 11vw, 160px) 0;
  background: var(--paper-warm);
  overflow: hidden;
}

.news__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}

.news__title {
  max-width: 14ch;
  margin: 0;
  font-size: clamp(36px, 4.6vw, 72px);
  line-height: 1.02;
  font-weight: 760;
  letter-spacing: -0.05em;
  text-wrap: balance;
}

.news__nav {
  display: flex;
  gap: 10px;
}

.news__arrow {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 0 0 1.5px var(--line);
  transition: background-color 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.news__arrow:hover:not(:disabled) {
  background: var(--ink);
  box-shadow: none;
  color: #fff;
}

.news__arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.news__arrow--prev .icon {
  transform: scaleX(-1);
}

/* ---------- The row ---------- */

/* Starts in line with the page, runs to the right edge of the screen. */
.news__track {
  --edge: max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter)));
  display: flex;
  gap: 20px;
  margin-top: clamp(40px, 5vw, 64px);
  padding: 4px var(--edge) 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--edge);
  scrollbar-width: none;
  cursor: grab;
}

.news__track::-webkit-scrollbar {
  display: none;
}

.news__track.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.news__track.is-dragging a {
  pointer-events: none;
}

.story-card {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  width: clamp(272px, 24vw, 340px);
  scroll-snap-align: start;
  color: var(--ink);
}

.story-card__photo {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 24px;
  overflow: hidden;
  background: var(--orange-tint);
}

.story-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.1s var(--ease-out);
  -webkit-user-drag: none;
  user-select: none;
}

.story-card:hover .story-card__photo img {
  transform: scale(1.05);
}

.story-card__tag {
  position: absolute;
  left: 14px;
  top: 14px;
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  font-size: 14px;
  font-weight: 650;
}

.story-card__title {
  margin: 18px 0 0;
  font-size: clamp(20px, 1.6vw, 23px);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.story-card__text {
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-3);
}

/* The arrow that slides in on hover, bottom-right of the photo. */
.story-card__go {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  transform: translateY(8px) scale(0.85);
  opacity: 0;
  transition: transform 0.4s var(--ease-out), opacity 0.3s;
}

.story-card:hover .story-card__go,
.story-card:focus-visible .story-card__go {
  transform: none;
  opacity: 1;
}

/* ---------- The lead story: twice as wide, words on the photo ---------- */

.story-card--lead {
  width: clamp(300px, 46vw, 660px);
}

.story-card--lead .story-card__photo {
  aspect-ratio: auto;
  flex: 1;
  min-height: 100%;
}

.story-card--lead .story-card__photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 13, 23, 0) 38%, rgba(7, 13, 23, 0.82) 100%);
}

.story-card--lead .story-card__body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: clamp(22px, 2.6vw, 36px);
  color: #fff;
}

.story-card--lead .story-card__title {
  max-width: 18ch;
  margin: 0;
  font-size: clamp(26px, 2.6vw, 40px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.story-card--lead .story-card__text {
  max-width: 44ch;
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.82);
}

.story-card--lead .story-card__go {
  top: 14px;
  bottom: auto;
}

/* ---------- Progress: how far along the row you are ---------- */

.news__progress {
  height: 3px;
  margin-top: 36px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.news__progress span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
  transform: scaleX(var(--p, 0.2));
  transform-origin: left;
  transition: transform 0.15s linear;
}

@media (max-width: 640px) {
  .news__nav {
    display: none;
  }

  .news__track {
    gap: 14px;
  }

  .story-card {
    width: 78vw;
  }

  .story-card--lead {
    width: 86vw;
  }

  .story-card--lead .story-card__photo {
    aspect-ratio: 4 / 5;
  }

  .story-card__go {
    opacity: 1;
    transform: none;
    width: 40px;
    height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .story-card__photo img {
    transition: none;
  }
}
