/* Uses the App Web CardOptimizationProgress layout and motion, adapted only for
   the blog's static card illustrations. */
.rewards-hero {
  box-sizing: border-box;
  max-width: 580px;
  margin: 0 auto 2rem;
  padding: 12px 0 0;
}

/* Copied from App Web's CardOptimizationProgress modal treatment. */
.rewards-hero .card-optimization-progress {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 2px 0;
}

.rewards-hero .card-optimization-progress--modal {
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.rewards-hero .card-optimization-progress__stack {
  position: relative;
  width: 340px;
  height: 148px;
  flex: 0 0 auto;
  perspective: 760px;
  --tilt-x: 0deg;
  --tilt-y: 0deg;
}

.rewards-hero .card-optimization-progress__card {
  position: absolute;
  top: 8px;
  left: calc(var(--card-index) * 47px);
  display: grid;
  place-items: center;
  width: 196px;
  height: 124px;
  overflow: hidden;
  border: 1px solid rgba(48, 57, 52, 0.22);
  border-radius: 14px;
  /* The short stacked shadows give the cards a tangible edge, without adding
     another enclosing surface around the illustration. */
  box-shadow:
    0 2px 0 rgba(16, 24, 20, 0.16),
    0 5px 0 rgba(16, 24, 20, 0.09),
    0 13px 24px rgba(20, 38, 27, 0.14);
  color: #fff;
  transform: translateY(var(--hover-lift, 0px)) rotate(calc((var(--card-index) - 1) * 2deg)) rotateX(calc(var(--physics-x, 0deg))) rotateY(calc(var(--physics-y, 0deg))) scale(calc(1 + var(--physics-scale, 0)));
  transform-origin: 50% 100%;
  transform-style: preserve-3d;
  touch-action: manipulation;
  will-change: left, transform;
  transition: left 500ms cubic-bezier(.22,.8,.32,1), transform 620ms cubic-bezier(.18,1.18,.35,1), opacity 320ms ease, box-shadow 420ms ease, filter 420ms ease;
  z-index: calc(10 - var(--card-index));
}

.rewards-hero .card-optimization-progress__copy {
  min-width: 0;
}

.rewards-hero .card-optimization-progress__copy strong {
  display: block;
  color: #171a18;
  font-size: clamp(12px, 2.4vw, 16px);
  letter-spacing: -0.015em;
  line-height: 1.35;
  white-space: nowrap;
}

.rewards-card-art::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
}

/* The card surfaces use the same visual language as the one-time-card product pages. */
.rewards-card-art--apple { color: rgba(31, 31, 31, 0.86); }
.rewards-card-art--apple::before {
  background:
    radial-gradient(circle at 12% 86%, rgba(171, 132, 255, 0.7), transparent 25%),
    radial-gradient(circle at 42% 72%, rgba(236, 112, 192, 0.52), transparent 27%),
    radial-gradient(circle at 60% 50%, rgba(255, 157, 79, 0.42), transparent 30%),
    radial-gradient(circle at 89% 51%, rgba(255, 215, 39, 0.63), transparent 30%),
    linear-gradient(120deg, #fffefd 0%, #faf8f2 42%, #fffef9 100%);
}

.rewards-card-art--citi::before {
  background:
    radial-gradient(ellipse at 52% 53%, rgba(120, 255, 207, 0.42) 0 13%, rgba(28, 213, 192, 0.25) 29%, transparent 48%),
    linear-gradient(180deg, #123b78 0%, #15558f 40%, #18b8c5 49%, #078d69 61%, #06463d 100%);
}

.rewards-card-art--wells::before {
  background:
    linear-gradient(90deg, transparent 0 35%, rgba(224, 188, 127, 0.3) 46%, rgba(224, 188, 127, 0.04) 60%, transparent 72%),
    radial-gradient(circle at 90% 11%, rgba(222, 27, 45, 0.55), transparent 43%),
    linear-gradient(135deg, #1d1d1d 0%, #33302f 50%, #8f1726 100%);
}

.rewards-card-network {
  position: absolute;
  right: 14px;
  bottom: 13px;
  z-index: 1;
  opacity: 0.76;
  filter: grayscale(1);
}

.rewards-card-selected-check {
  position: absolute;
  top: 11px;
  right: 11px;
  z-index: 2;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: #47ae4f;
  box-shadow: 0 3px 8px rgba(15, 59, 25, 0.28);
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  opacity: 0;
  transform: scale(0.72);
  transition: opacity 180ms ease, transform 320ms cubic-bezier(.2,1.25,.4,1);
}

.rewards-card-network--mastercard {
  width: 31px;
  height: 20px;
}

.rewards-card-network--mastercard i {
  position: absolute;
  top: 2px;
  width: 16px;
  height: 16px;
  border: 1.5px solid rgba(231, 235, 233, 0.86);
  border-radius: 50%;
}

.rewards-card-network--mastercard i:first-child { left: 2px; }
.rewards-card-network--mastercard i:last-child { right: 2px; }

.rewards-card-network--visa {
  color: rgba(238, 242, 241, 0.9);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-style: italic;
  font-weight: 900;
  letter-spacing: -0.08em;
}

.rewards-card-art--apple .rewards-card-network--mastercard i {
  border-color: rgba(79, 79, 79, 0.5);
}

.rewards-hero.is-optimizing .card-optimization-progress__card {
  /* One quiet sweep, then settle into the selected card. */
  animation: card-optimization-shuffle 980ms cubic-bezier(.45,0,.22,1) 1 both;
}

.rewards-hero.is-resolved .card-optimization-progress__card {
  animation: none;
}

.rewards-hero.is-resolved .rewards-card-art.is-selected {
  left: 50%;
  transform: translateX(-50%) translateY(calc(-22px + var(--hover-lift, 0px))) rotate(-3deg) rotateX(calc(var(--physics-x, 0deg))) rotateY(calc(var(--physics-y, 0deg))) scale(calc(1.16 + var(--physics-scale, 0)));
  box-shadow:
    0 3px 0 rgba(16, 24, 20, 0.16),
    0 7px 0 rgba(16, 24, 20, 0.08),
    0 22px 38px rgba(20, 38, 27, 0.24);
  filter: saturate(1.08) brightness(1.04);
}

.rewards-hero.is-resolved .rewards-card-art.is-selected .rewards-card-selected-check {
  opacity: 1;
  transform: scale(1);
}

.rewards-hero.is-resolved .rewards-card-art:not(.is-selected) {
  /* Recess the unselected cards without making their surfaces look transparent. */
  opacity: 1;
  filter: saturate(0.7) brightness(0.82);
  box-shadow:
    0 2px 0 rgba(16, 24, 20, 0.14),
    0 5px 0 rgba(16, 24, 20, 0.08),
    0 10px 18px rgba(20, 38, 27, 0.1);
}

@keyframes card-optimization-shuffle {
  0%, 100% { translate: 0 0; }
  52% { translate: 8px -7px; }
}

@media (max-width: 640px) {
  .rewards-hero {
    margin-bottom: 1.75rem;
    padding-top: 6px;
  }

  .rewards-hero .card-optimization-progress__stack {
    width: 280px;
    height: 124px;
  }

  .rewards-hero .card-optimization-progress__card {
    left: calc(var(--card-index) * 39px);
    width: 162px;
    height: 102px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rewards-hero .card-optimization-progress__card {
    animation: none;
    transition: none;
  }
}
