.invoice-showcase__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacer--xl);
  align-items: center;
}

/* Benefits */
.invoice-showcase__benefits {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacer--lg);
}

.invoice-showcase__benefit {
  padding-left: var(--spacer);
  border-left: 1px solid var(--accent);
}

.invoice-showcase__benefit-title {
  margin-bottom: var(--spacer--sm);
  line-height: var(--h2-line-height);
  font-weight: var(--font-weight--semi);
}

.invoice-showcase__benefit-text {
  margin-bottom: 0;
  color: var(--text--muted);
}

/* Invoice card: always light, whatever the section background */
.invoice-showcase__invoice {
  --background: var(--white);
  --text: var(--black);

  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--spacer);
  min-width: 0;
  padding: var(--spacer--lg);
  overflow: hidden;
  background-color: var(--background);
  color: var(--text);
}

.invoice-showcase__invoice-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--spacer--sm);
  color: var(--gray--dark);
}

.invoice-showcase__invoice-title {
  color: var(--text);
  font-weight: var(--font-weight--semi);
}

.invoice-showcase__table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.invoice-showcase__table td {
  padding: var(--spacer--sm) var(--spacer--xs);
  border-bottom: 1px solid var(--gray--light);
  vertical-align: top;
}

.invoice-showcase__table tfoot td {
  padding-top: var(--spacer);
  border-bottom: 0;
  font-weight: var(--font-weight--semi);
}

.invoice-showcase__amount {
  text-align: right;
  white-space: nowrap;
}

.invoice-showcase__check {
  color: var(--green--dark);
}

.invoice-showcase__table tbody .invoice-showcase__check {
  padding-left: var(--spacer);
}

.invoice-showcase__table .is-rejected .invoice-showcase__check {
  color: var(--red--dark);
}

.invoice-showcase__table .is-rejected .invoice-showcase__amount {
  color: var(--gray);
}

.invoice-showcase__amount-value {
  position: relative;
}

.invoice-showcase__table .is-rejected .invoice-showcase__amount-value::after {
  content: "";
  position: absolute;
  top: 50%;
  right: calc(var(--spacer--xs) * -1);
  left: calc(var(--spacer--xs) * -1);
  height: 2px;
  background-color: var(--red--dark);
  transform-origin: left center;
}

.invoice-showcase__invoice-note {
  margin-bottom: 0;
  color: var(--gray);
}

/* Steps strip */
.invoice-showcase__steps {
  display: flex;
  flex-direction: column;
  gap: var(--spacer--sm);
  margin: var(--spacer--xl) 0 0;
  padding: 0;
  list-style: none;
}

.invoice-showcase__steps li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacer--sm);
  margin-bottom: 0;
}

.invoice-showcase__arrow {
  display: flex;
  color: var(--accent);
  transform: rotate(90deg);
}

.invoice-showcase__arrow svg {
  width: var(--body-font-size);
  height: auto;
  fill: currentColor;
}

.invoice-showcase__step {
  width: 100%;
  padding: var(--spacer--sm) var(--spacer);
  border: 1px solid var(--accent);
  border-radius: var(--border-radius--lg);
  text-align: center;
}

.invoice-showcase__steps li:last-child .invoice-showcase__step {
  background-color: var(--accent);
  color: var(--background);
}

@media (min-width: 640px) {
  .invoice-showcase__benefits {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .invoice-showcase__grid {
    grid-template-columns: 1fr 1.1fr;
    gap: var(--spacer--xxl);
  }

  .invoice-showcase__steps {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .invoice-showcase__steps li {
    flex-direction: row;
  }

  .invoice-showcase__arrow {
    transform: none;
  }

  .invoice-showcase__step {
    width: auto;
  }
}

/* Motion: everything above is the finished, static state. The script adds
   .is-armed only when it can animate, then .is-checked when the invoice is seen. */
.invoice-showcase__invoice.is-armed tbody tr {
  opacity: 0;
  transform: translateX(calc(var(--spacer) * -1));
  transition:
    opacity 0.5s ease calc(var(--row) * 220ms + 300ms),
    transform 0.5s ease calc(var(--row) * 220ms + 300ms);
}

.invoice-showcase__invoice.is-armed .is-rejected .invoice-showcase__amount-value::after {
  transform: scaleX(0);
  transition: transform 0.5s ease calc(var(--row) * 220ms + 800ms);
}

.invoice-showcase__invoice.is-armed::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background-color: var(--green);
  opacity: 0;
  pointer-events: none;
}

.invoice-showcase__invoice.is-checked tbody tr {
  opacity: 1;
  transform: none;
}

.invoice-showcase__invoice.is-checked .is-rejected .invoice-showcase__amount-value::after {
  transform: scaleX(1);
}

.invoice-showcase__invoice.is-checked::after {
  animation: invoice-showcase-scan 1.8s ease-in-out 0.2s forwards;
}

@keyframes invoice-showcase-scan {
  0% {
    top: var(--spacer--xxl);
    opacity: 1;
  }

  85% {
    opacity: 1;
  }

  100% {
    top: calc(100% - var(--spacer--xl));
    opacity: 0;
  }
}

.invoice-showcase__steps.is-armed .invoice-showcase__step {
  opacity: 0;
  translate: 0 calc(var(--spacer--sm) * -1);
  border-color: var(--gray--dark);
  transition:
    opacity 0.4s ease calc(var(--row) * 300ms + 300ms),
    translate 0.4s ease calc(var(--row) * 300ms + 300ms),
    border-color 0.5s ease calc(var(--row) * 300ms + 300ms),
    background-color 0.5s ease calc(var(--row) * 300ms + 300ms),
    color 0.5s ease calc(var(--row) * 300ms + 300ms);
}

/* Each arrow follows its step, halfway to the next one. Everything moves the
   way the arrows point: down on mobile, right on desktop. `translate` is used
   instead of `transform` so the mobile rotate(90deg) on the arrow is kept. */
.invoice-showcase__steps.is-armed .invoice-showcase__arrow {
  opacity: 0;
  translate: 0 calc(var(--spacer--sm) * -1);
  transition:
    opacity 0.4s ease calc(var(--row) * 300ms + 450ms),
    translate 0.4s ease calc(var(--row) * 300ms + 450ms);
}

@media (min-width: 1024px) {
  .invoice-showcase__steps.is-armed .invoice-showcase__step,
  .invoice-showcase__steps.is-armed .invoice-showcase__arrow {
    translate: calc(var(--spacer--sm) * -1) 0;
  }
}

.invoice-showcase__steps.is-checked .invoice-showcase__step,
.invoice-showcase__steps.is-checked .invoice-showcase__arrow {
  opacity: 1;
  translate: none;
}

.invoice-showcase__steps.is-armed li:last-child .invoice-showcase__step {
  background-color: transparent;
  color: inherit;
}

.invoice-showcase__steps.is-checked .invoice-showcase__step {
  border-color: var(--accent);
}

.invoice-showcase__steps.is-checked li:last-child .invoice-showcase__step {
  background-color: var(--accent);
  color: var(--background);
}
