/* =============================================================================
   PHOTO STORY STRIP (photoStrip in src/_includes/rd/strip.njk, behaviour in /js/rd-strip.js)
   Three tall photo cards, one per beat: a big word and one vivid line on a soft navy gradient.
   A thin line under the cards fills as the strip scrolls through view. Phones get a sideways
   scroll-snap row with the next card peeking in. Nothing moves on its own.
   The cards share grid rows (subgrid), so the big words line up even when one line wraps.
   ============================================================================= */

.rd.rd-strip {
  --rd-strip-photo: clamp(200px, 29vw, 380px);  /* the photo above the words */
  --rd-strip-gap: 24px;
  --rd-strip-bleed: 24px;                       /* the page gutter the phone row runs into */
  --rd-strip-p: 1;                              /* how full the line is: set by the script, full without it */
}

/* ---------- The row of cards ---------- */
.rd .rd-strip__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--rd-strip-gap); }
.rd .rd-strip__card {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: calc(var(--rd-strip-photo) + 100px);
  padding: 0 24px 22px;
  border-radius: var(--rd-radius-xl);
  background: var(--rd-navy);
  box-shadow: 0 1px 2px rgba(3, 23, 79, .06), 0 14px 30px -16px rgba(3, 23, 79, .32);
  transition: transform .45s var(--rd-ease), box-shadow .45s var(--rd-ease);
}
@supports (grid-template-rows: subgrid) {
  .rd .rd-strip__list { grid-template-rows: var(--rd-strip-photo) auto auto; row-gap: 0; }
  /* justify-content goes back to normal: in a grid it would push the words' column to the right */
  .rd .rd-strip__card { display: grid; grid-row: span 3; grid-template-rows: subgrid; justify-content: normal; min-height: 0; }
  .rd .rd-strip__word { grid-row: 2; align-self: end; }
  .rd .rd-strip__line { grid-row: 3; }
}

/* The photo fills the card, and a soft navy gradient rises from the foot so the words read on any frame */
.rd .rd-strip__img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.rd .rd-strip__card::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to top, rgba(3, 23, 79, .9) 0%, rgba(3, 23, 79, .68) 22%, rgba(3, 23, 79, .22) 46%, rgba(3, 23, 79, 0) 62%);
}

.rd .rd-strip__word {
  margin: 0 0 6px;
  font-size: clamp(24px, 2.7vw, 34px); font-weight: 700; line-height: 1.08; letter-spacing: -.02em;
  color: #fff; text-wrap: balance;
  text-shadow: 0 1px 14px rgba(3, 23, 79, .35);
}
.rd .rd-strip__line {
  font-size: 16px; font-weight: 500; line-height: 1.45;
  color: rgba(255, 255, 255, .92); text-wrap: pretty;
  text-shadow: 0 1px 10px rgba(3, 23, 79, .35);
}

/* A gentle lift on hover, for pointers that can hover */
@media (hover: hover) and (pointer: fine) {
  .rd .rd-strip__card:hover { transform: translateY(-6px); box-shadow: 0 2px 6px rgba(3, 23, 79, .08), 0 26px 46px -20px rgba(3, 23, 79, .45); }
}

/* ---------- The progress line ---------- */
.rd .rd-strip__progress { position: relative; height: 4px; margin-top: 22px; overflow: hidden; border-radius: 999px; background: var(--rd-line); }
.rd .rd-strip__fill {
  position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--rd-emerald), var(--rd-green));
  transform: translateX(calc((var(--rd-strip-p) - 1) * 100%));
  transition: transform .15s linear;
  will-change: transform;
}

/* ---------- The quiet line of facts, and an optional link ---------- */
.rd .rd-strip__foot { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 28px; margin-top: 16px; }
.rd .rd-strip__note { font-size: 15px; line-height: 1.55; color: var(--rd-muted); text-wrap: pretty; }
.rd .rd-strip__link { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; line-height: 1.4; color: var(--rd-navy); text-decoration: none; }
.rd .rd-strip__link .rd-icon { transition: transform .2s var(--rd-ease); }
.rd .rd-strip__link:hover { text-decoration: underline; text-underline-offset: 3px; }
.rd .rd-strip__link:hover .rd-icon { transform: translateX(3px); }
.rd.rd-strip--center .rd-strip__foot { justify-content: center; text-align: center; }

/* ---------- Tablets: smaller type in the narrower cards ---------- */
@media (max-width: 960px) {
  .rd.rd-strip { --rd-strip-gap: 16px; }
  .rd .rd-strip__card { padding: 0 18px 18px; }
  .rd .rd-strip__line { font-size: 14.5px; }
}

/* ---------- Phones: a sideways scroll-snap row, the next card peeking in at the edge ---------- */
@media (max-width: 720px) {
  .rd.rd-strip { --rd-strip-photo: 250px; --rd-strip-gap: 14px; }
  .rd .rd-strip__list {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: min(78%, 290px);
    margin: -8px calc(var(--rd-strip-bleed) * -1) -20px;
    padding: 8px var(--rd-strip-bleed) 20px;
    scroll-padding-inline: var(--rd-strip-bleed);
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .rd .rd-strip__list::-webkit-scrollbar { display: none; }
  .rd .rd-strip__list:focus-visible { outline-offset: -2px; }
  .rd .rd-strip__card { scroll-snap-align: start; padding: 0 20px 18px; }
  .rd .rd-strip__word { font-size: 28px; }
  .rd .rd-strip__line { font-size: 15px; }
  .rd .rd-strip__foot { margin-top: 14px; }
  .rd .rd-strip__note, .rd .rd-strip__link { font-size: 14.5px; }
}

/* ---------- Reduced motion: the line shows full and the cards hold still ---------- */
@media (prefers-reduced-motion: reduce) {
  .rd .rd-strip__fill { transform: none; transition: none; }
  .rd .rd-strip__card:hover { transform: none; }
}
