/* Take 05: Subscriptions have ruined software. */

:root {
  /* This tape's label colour: coral. */
  --tape: #f0a89c;
}

#happened .cuts {
  margin-top: 2.5rem;
}

.plan figcaption,
.costs figcaption {
  text-align: center;
}

.plan__controls,
.costs__controls {
  display: flex;
  justify-content: center;
  margin: 1.25rem 0 0;
}

/* Exhibit A: an account page. Each press goes one screen deeper into cancelling. */

.plan__window {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 0.75rem;
  max-width: 26rem;
  min-height: 13.5rem;
  margin: 0 auto;
  padding: 1.25rem min(clamp(1rem, 4vw, 1.75rem), 5vw) 1.5rem;
  border-radius: 0.6rem;
  background: var(--paper);
  color: var(--paper-ink);
  box-shadow: 0 1rem 2rem -1.25rem rgb(0 0 0 / 0.4);
}

.plan__osd {
  margin: 0;
  padding-bottom: 0.6rem;
  border-bottom: 1px dashed var(--paper-rule);
  font-size: 1rem;
  color: var(--paper-muted);
}

.plan__step {
  display: grid;
  gap: 0.4rem;
}

.plan__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: min(1.5rem, max(8vw, 1.25rem));
  font-stretch: 85%;
  font-weight: 750;
  line-height: 1.1;
}

.plan__price {
  margin: 0;
  font-family: var(--font-display);
  /* Capped by the screen width, so the fee fits a phone at large text sizes. */
  font-size: min(clamp(2.5rem, 1.8rem + 2.5vw, 3.25rem), 14vw);
  font-stretch: 85%;
  font-weight: 750;
  line-height: 1;
}

.plan__price span {
  font-size: 0.45em;
  color: var(--paper-muted);
}

.plan__price--fee {
  color: var(--paper-rec);
}

.plan__detail {
  margin: 0;
  color: var(--paper-muted);
}

/* Exhibit C: two running totals. Drag through the years and watch them part. */

.costs__screen {
  padding: max(clamp(1.25rem, 4vw, 2rem), 1.5rem) clamp(1rem, 4vw, 2rem);
}

.costs__osd {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin: 0 0 1.25rem;
  font-size: 1.125rem;
}

.costs__year {
  color: var(--stamp);
  text-shadow: 0 0 0.35em rgb(255 170 50 / 0.55);
}

.costs__rows {
  display: grid;
  gap: 1.25rem;
  margin: 0;
}

/* Name on top, then the bar and its total. When there isn't room for both,
   the total drops under the bar. */
.costs__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
}

.costs__name {
  flex: 1 0 100%;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-stretch: 85%;
  font-weight: 700;
}

.costs__row dd {
  margin: 0;
}

.costs__bar {
  flex: 1 1 10rem;
  height: 1.25rem;
  border-radius: 0.3rem;
  background: rgb(255 255 255 / 0.1);
  overflow: hidden;
}

.costs__fill {
  display: block;
  width: calc(var(--share, 0) * 100%);
  height: 100%;
  background: var(--tape);
  transition: width 250ms ease;
}

.costs__row--rent .costs__fill {
  background: var(--rec);
}

.costs__total {
  min-width: 5.5em;
  margin-left: auto;
  font-size: 1.25rem;
  text-align: right;
}

.costs__controls {
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.costs__label {
  font-weight: 700;
}

.costs__slider {
  flex: 1 1 14rem;
  max-width: 26rem;
  min-height: 2.75rem;
  accent-color: var(--rec);
}

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