/* Donation amount picker: the gift form of Springline, an invented clean water charity, alone on white. A white card
   with a layered shadow; a One-time / Monthly switch, four amounts and Other on a sliding indicator, the impact line
   with rolling figures beside a water can that fills in proportion, and the Donate button that widens on a spring. */
:root {
  --page: #ffffff;          /* the page */
  --card: #ffffff;          /* the card */
  --ink: #0e1a2b;           /* the words */
  --muted: #7d8796;         /* the small words */
  --line: #e7ebf0;          /* thin lines and the tray of the pills */
  --tray: #f4f6f9;          /* the tray under the switch and the amounts */
  --accent: #1f6fe0;        /* the water blue of the brand, the indicator ring and the glow */
  --water-top: #6cc0ff;     /* the water at the surface */
  --water-deep: #1c5fd4;    /* the water at the bottom of the can */
  --button: #0e1a2b;        /* the Donate button */
  --button-ink: #ffffff;    /* the words on the button */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  color: inherit;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 12px;
  overflow: hidden;
}

/* ---------------------------------------------------------------- the card */
.gift {
  position: relative;
  width: min(340px, calc(100vw - 24px));
  margin: 0;
  padding: clamp(12px, 3.6vh, 20px) clamp(14px, 4.4vw, 18px) clamp(12px, 3.4vh, 18px);
  border-radius: 26px;
  background: var(--card);
  box-shadow:
    0 0 0 1px rgba(14, 26, 43, 0.06),
    0 1px 1px rgba(14, 26, 43, 0.04),
    0 4px 8px -2px rgba(14, 26, 43, 0.05),
    0 18px 36px -14px rgba(14, 26, 43, 0.14),
    0 44px 70px -40px rgba(31, 111, 224, 0.34);
  opacity: 0;
  user-select: none;
  -webkit-user-select: none;
}

/* the 1px edge that catches the light at the top */
.gift::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(14, 26, 43, 0.05) 40%, rgba(14, 26, 43, 0.02));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* a very fine grain on the card */
.gift::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  opacity: 0.03;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.gift__head {
  position: relative;
}

.gift__brand {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 10.5px;
  font-weight: 620;
  font-stretch: 112%;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.gift__drop {
  width: 13px;
  height: 13px;
  fill: var(--accent);
}

.gift__drop-shine {
  fill: none;
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 1.2;
  stroke-linecap: round;
}

.gift__title {
  margin: 4px 0 0;
  font-size: clamp(20px, 5.6vh, 25px);
  font-weight: 640;
  font-stretch: 94%;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

/* ---------------------------------------------------------------- One-time / Monthly */
.freq {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: clamp(10px, 2.8vh, 16px);
  padding: 3px;
  border-radius: 999px;
  background: var(--tray);
  box-shadow: inset 0 0 0 1px rgba(14, 26, 43, 0.04), inset 0 1px 2px rgba(14, 26, 43, 0.05);
}

.freq__thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(14, 26, 43, 0.06), 0 1px 2px rgba(14, 26, 43, 0.08), 0 4px 10px -4px rgba(14, 26, 43, 0.18);
}

.freq__opt {
  position: relative;
  height: clamp(28px, 7.4vh, 34px);
  border: 0;
  border-radius: 999px;
  background: none;
  font-size: 13px;
  font-weight: 560;
  font-stretch: 100%;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.3s, font-stretch 0.35s;
  -webkit-tap-highlight-color: transparent;
}

.freq__opt[aria-checked='true'] {
  color: var(--ink);
  font-stretch: 108%;
}

/* ---------------------------------------------------------------- the amounts */
.amounts {
  position: relative;
  display: flex;
  gap: 5px;
  margin-top: clamp(8px, 2.2vh, 12px);
}

/* the indicator that slides from one amount to the next: an element for the ticker, its ring for the CSS */
.amounts__ind {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  height: 100%;
  width: 60px;
  pointer-events: none;
}

.amounts__ind i {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(31, 111, 224, 0.02), rgba(31, 111, 224, 0.08));
  box-shadow: inset 0 0 0 1.5px var(--accent), inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 6px 14px -8px rgba(31, 111, 224, 0.55);
}

.amt {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: clamp(38px, 10.4vh, 46px);
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--tray);
  box-shadow: inset 0 0 0 1px rgba(14, 26, 43, 0.05);
  font-size: 14.5px;
  font-weight: 600;
  font-stretch: 96%;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background-color 0.25s, box-shadow 0.25s;
  -webkit-tap-highlight-color: transparent;
}

.amt__in {
  display: inline-block;
  transition: transform 0.35s cubic-bezier(0.34, 1.8, 0.5, 1), color 0.25s;
}

.amt[aria-checked='true'] {
  background: #fff;
  color: var(--accent);
}

.amt[aria-checked='true'] .amt__in {
  font-weight: 680;
}

.amt:active .amt__in {
  transform: scale(0.94);
}

@media (hover: hover) {
  .amt:hover {
    background: #eef1f6;
  }
  .amt[aria-checked='true']:hover {
    background: #fff;
  }
  .amt:hover .amt__in {
    transform: translateY(-1px);
  }
  .amt:active .amt__in {
    transform: scale(0.94);
  }
}

/* Other: a slot that widens, and the field that opens inside it */
.amt-slot {
  position: relative;
  display: flex;
  flex: 1.25 1 0;
  min-width: 0;
}

.amt--other {
  flex: 1 1 auto;
  font-size: 13px;
}

.amt__field {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 14px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 680;
  font-stretch: 96%;
  opacity: 0;
  visibility: hidden;
  cursor: text;
}

.amt__cur {
  opacity: 0.7;
}

.amt__input {
  width: 4.2ch;
  padding: 0;
  border: 0;
  outline: none;
  background: none;
  color: var(--accent);
  font-weight: 680;
  caret-color: var(--accent);
  -webkit-user-select: text;
  user-select: text;
}

.amt__input::placeholder {
  color: rgba(31, 111, 224, 0.4);
}

/* focus you can see, from the keyboard */
.freq__opt:focus-visible,
.amt:focus-visible,
.give:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.amt__field:focus-within {
  box-shadow: 0 0 0 3px rgba(31, 111, 224, 0.18);
}

/* ---------------------------------------------------------------- the impact */
.impact {
  display: flex;
  align-items: center;
  gap: clamp(10px, 3.4vw, 16px);
  margin-top: clamp(10px, 2.8vh, 16px);
  padding: clamp(8px, 2.2vh, 12px) 12px clamp(8px, 2.2vh, 12px) 8px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f7fafd, #f1f6fb);
  box-shadow: inset 0 0 0 1px rgba(31, 111, 224, 0.07), inset 0 1px 0 #fff;
}

.can {
  flex: none;
  width: clamp(58px, 17vh, 78px);
  aspect-ratio: 100 / 120;
}

.can svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.water-top {
  stop-color: var(--water-top);
}

.water-deep {
  stop-color: var(--water-deep);
}

.can__body {
  fill: url(#can-body);
}

.can__rim {
  fill: none;
  stroke: rgba(14, 26, 43, 0.22);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.can__handle {
  fill: none;
  stroke: rgba(14, 26, 43, 0.22);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.can__handle--in {
  stroke: rgba(14, 26, 43, 0.12);
}

.can__cap rect {
  fill: #dfe8f2;
  stroke: rgba(14, 26, 43, 0.22);
  stroke-width: 1.5;
}

.can__crest {
  fill: none;
  stroke: rgba(255, 255, 255, 0.75);
  stroke-width: 1.2;
  stroke-linecap: round;
}

.can__bubble {
  fill: none;
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 0.8;
  opacity: 0;
}

.can__marks path {
  fill: none;
  stroke: rgba(14, 26, 43, 0.2);
  stroke-width: 1.2;
  stroke-linecap: round;
}

.impact__text {
  min-width: 0;
}

.impact__label {
  margin: 0;
  font-size: 10.5px;
  font-weight: 600;
  font-stretch: 110%;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.impact__big {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin: 3px 0 0;
  font-size: clamp(24px, 6.8vh, 31px);
  font-weight: 680;
  font-stretch: 90%;
  letter-spacing: -0.02em;
  line-height: 1;
}

.impact__unit {
  font-size: 14px;
  font-weight: 560;
  font-stretch: 100%;
  letter-spacing: 0;
  color: var(--accent);
}

.impact__line {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}

.impact__month {
  display: inline-block;
  font-size: 13px;
  font-weight: 520;
  color: var(--muted);
  white-space: nowrap;
  vertical-align: bottom;
  overflow: hidden;
}

/* the rolling digits: a box 1ch wide, a column from 0 to 9 inside */
.roll {
  display: inline-flex;
}

.roll--small {
  color: var(--ink);
  font-weight: 600;
  vertical-align: -0.22em;
}

.digit {
  position: relative;
  display: inline-block;
  width: 1ch;
  height: 1.05em;
  overflow: hidden;
  -webkit-mask: linear-gradient(transparent, #000 16%, #000 84%, transparent);
  mask: linear-gradient(transparent, #000 16%, #000 84%, transparent);
}

.digit--sep {
  width: 0.26em;
  -webkit-mask: none;
  mask: none;
}

.digit__col {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.digit__col span {
  display: block;
  height: 1.05em;
  line-height: 1.05;
  text-align: center;
}

/* ---------------------------------------------------------------- Donate */
.give {
  position: relative;
  display: block;
  margin: clamp(10px, 2.8vh, 16px) auto 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.give__face {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  height: clamp(46px, 12.4vh, 54px);
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(180deg, #1b2a40, var(--button) 60%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3),
    0 1px 2px rgba(14, 26, 43, 0.25),
    0 10px 22px -10px rgba(14, 26, 43, 0.55),
    0 18px 30px -18px rgba(31, 111, 224, 0.7);
  color: var(--button-ink);
}

.give__glow {
  position: absolute;
  inset: -40% -10%;
  background: radial-gradient(closest-side, rgba(108, 192, 255, 0.7), rgba(31, 111, 224, 0) 70%);
  opacity: 0;
  pointer-events: none;
}

.give__sheen {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 46%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(160, 214, 255, 0.28) 50%, rgba(255, 255, 255, 0));
  transform: translateX(-120%);
  pointer-events: none;
}

.give__label {
  grid-area: 1 / 1;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.32em;
  padding: 0 26px;
  font-size: 15px;
  font-weight: 600;
  font-stretch: 104%;
  white-space: nowrap;
}

.give__sum {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.give__month {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
}

.give__label--done {
  opacity: 0;
}

.give__check {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: #8fd0ff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) {
  .give:hover .give__face {
    background: linear-gradient(180deg, #22344f, #13223a 60%);
  }
}

/* the hidden twin that measures the width the button is going to have */
.measure {
  position: absolute;
  left: 0;
  top: 0;
  visibility: hidden;
  pointer-events: none;
  padding: 0 26px;
  font-size: 15px;
  font-weight: 600;
  font-stretch: 104%;
  white-space: nowrap;
}

@media (max-height: 430px) {
  .impact__line {
    font-size: 11.5px;
  }
}
