/* The staking card of Halden, a made-up crypto wallet: one card alone on white, a single violet accent. */
:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --bordo: #e9e8ef;
  --tinta: #f5f4f8;          /* the chips, the segmented control, the slider track */
  --testo: #121117;
  --testo-2: #5d5b69;
  --testo-3: #9b99a8;
  --accento: #5b4cf5;        /* the single accent: the fill, the thumb, the button, the tick */
  --accento-chiaro: #eeecff;
  --ombra: 22, 20, 40;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { font-size: clamp(10px, min(3.6vw, 3.05vh), 17px); }
body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.stage { height: 100vh; display: grid; place-items: center; padding: 2vh 4vw; }

/* the card: a body, a 1px edge that catches light at the top, three soft shadows */
.card {
  position: relative;
  width: min(23em, 92vw);
  padding: 1.35em 1.35em 1.25em;
  border-radius: 1.5em;
  background: var(--carta);
  box-shadow:
    0 1px 1px rgba(var(--ombra), .05),
    0 6px 14px -6px rgba(var(--ombra), .10),
    0 24px 48px -24px rgba(var(--ombra), .22);
  display: grid;
  gap: 1.05em;
  isolation: isolate;
  overflow: clip; /* the thread of light runs past the corner: it must never widen the page */
}
.card__edge {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2;
  padding: 1px;
  background: linear-gradient(180deg, rgba(91, 76, 245, .30), var(--bordo) 22%, var(--bordo) 80%, #e2e1e9);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
/* the thread of light that runs along the top edge */
.card__glow {
  position: absolute; top: 0; left: 0; width: 38%; height: 1px; z-index: 3; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(91, 76, 245, .9), transparent);
  opacity: .0;
}

/* header */
.head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .65em; }
.mark {
  width: 2.2em; height: 2.2em; border-radius: .7em; display: grid; place-items: center;
  background: var(--testo);
}
.mark svg { width: 1.3em; height: 1.3em; display: block; fill: none; stroke: #fff; stroke-width: 1.5; stroke-linejoin: round; }
.mark svg path + path { stroke: #a79dff; }
.head__title { font-size: 1em; font-weight: 640; letter-spacing: -.01em; line-height: 1.15; }
.head__sub { font-size: .74em; color: var(--testo-3); font-weight: 500; line-height: 1.3; }
.avail { font-size: .72em; color: var(--testo-2); text-align: right; line-height: 1.3; }
.avail__lab { display: block; color: var(--testo-3); }
.avail__val { font-weight: 600; color: var(--testo); font-variant-numeric: tabular-nums; }

/* the amount */
.amount { display: grid; gap: .15em; }
.amount__big { display: flex; align-items: baseline; gap: .3em; font-size: 2.35em; font-weight: 600; letter-spacing: -.035em; line-height: 1; font-stretch: 92%; }
.amount__unit { font-size: .42em; font-weight: 560; letter-spacing: 0; color: var(--testo-3); font-stretch: 100%; }
.amount__usd { font-size: .8em; color: var(--testo-2); font-weight: 500; }
.approx { color: var(--testo-3); }

/* the rolling digits: each digit is a window over a column 0-9 */
.roll { display: inline-flex; font-variant-numeric: tabular-nums; white-space: nowrap; }
.roll .ch { display: inline-block; position: relative; height: 1.15em; line-height: 1.15em; overflow: hidden; vertical-align: bottom;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent); }
.roll .col { display: block; will-change: transform; }
.roll .col span { display: block; height: 1.15em; text-align: center; }
.roll .fix { display: inline-block; height: 1.15em; line-height: 1.15em; vertical-align: bottom; }

/* the slider */
.slider { position: relative; height: 1.9em; cursor: pointer; touch-action: none; outline: none; }
.slider__track {
  position: absolute; left: 0; right: 0; top: 50%; height: .42em; margin-top: -.21em;
  border-radius: 999px; background: var(--tinta);
  box-shadow: inset 0 1px 1px rgba(var(--ombra), .06);
}
.slider__fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 25%; border-radius: inherit;
  background: linear-gradient(90deg, #8b80ff, var(--accento));
}
.slider__tick {
  position: absolute; left: var(--at); top: 50%; width: 2px; height: 2px; margin: -1px 0 0 -1px;
  border-radius: 1px; background: rgba(var(--ombra), .22);
}
.thumb { position: absolute; top: 50%; left: 25%; width: 0; height: 0; }
.thumb__body {
  position: absolute; left: -.8em; top: -.8em; width: 1.6em; height: 1.6em; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(var(--ombra), .08), 0 2px 6px rgba(var(--ombra), .16), 0 8px 16px -8px rgba(91, 76, 245, .45);
}
.thumb__body::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: .5em; height: .5em; margin: -.25em 0 0 -.25em;
  border-radius: 50%; background: var(--accento);
}
.slider:focus-visible .thumb__body { box-shadow: 0 0 0 3px var(--accento-chiaro), 0 0 0 4px var(--accento), 0 2px 6px rgba(var(--ombra), .16); }

/* the quick amounts */
.chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4em; margin-top: -.35em; }
.chip {
  height: 2em; border-radius: .65em; font-size: .76em; font-weight: 580; color: var(--testo-2);
  background: var(--tinta); display: grid; place-items: center;
  transition: background-color .2s, color .2s;
}
.chip.is-on { background: var(--accento-chiaro); color: var(--accento); }
@media (hover: hover) { .chip:hover { color: var(--testo); } .chip.is-on:hover { color: var(--accento); } }
.chip:focus-visible, .seg__opt:focus-visible, .stake:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }

/* the lock period */
.period { display: grid; gap: .45em; }
.label { font-size: .72em; color: var(--testo-3); font-weight: 560; }
.seg { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: .22em; border-radius: .8em; background: var(--tinta); }
.seg__pill {
  position: absolute; left: .22em; top: .22em; bottom: .22em; width: calc((100% - .44em) / 3);
  border-radius: .62em; background: #fff;
  box-shadow: 0 1px 2px rgba(var(--ombra), .10), 0 3px 8px -4px rgba(var(--ombra), .18);
}
.seg__opt {
  position: relative; z-index: 1; height: 2.1em; border-radius: .62em;
  font-size: .8em; font-weight: 560; color: var(--testo-3);
  display: grid; place-items: center;
  transition: color .25s;
}
.seg__opt.is-on { color: var(--testo); }
@media (hover: hover) { .seg__opt:hover { color: var(--testo-2); } .seg__opt.is-on:hover { color: var(--testo); } }

/* the numbers */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5em; }
.stat { display: grid; gap: .2em; padding: .65em .7em .6em; border-radius: .85em; border: 1px solid var(--bordo); }
.stat dt { font-size: .68em; color: var(--testo-3); font-weight: 560; }
.stat dd { font-size: .98em; font-weight: 620; letter-spacing: -.01em; display: flex; align-items: baseline; }
.stat--apy { background: var(--accento-chiaro); border-color: transparent; }
.stat--apy dd { color: var(--accento); }
.pct { font-size: .8em; margin-left: .08em; }
.plus { color: var(--testo-3); margin-right: .06em; font-weight: 500; }

/* the button: three faces stacked in the same place, each centred on its own, so a hidden one never widens it */
.go { display: grid; justify-items: center; gap: .55em; }
.stake {
  position: relative; width: 100%; height: 2.9em; border-radius: 999px;
  background: var(--accento); color: #fff;
  font-size: .9em; font-weight: 620;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 6px 16px -8px rgba(91, 76, 245, .8);
  overflow: hidden;
}
.stake::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .16), transparent 55%);
}
@media (hover: hover) { .stake:hover { filter: brightness(1.07); } }
.chip:active, .seg__opt:active { transform: scale(.96); }
.chip, .seg__opt { transition: background-color .2s, color .2s, transform .15s; }
.stake__face { position: absolute; inset: 0; display: grid; place-items: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stake__face--busy, .stake__face--done { opacity: 0; }
.ring, .tick { width: 1.3em; height: 1.3em; display: block; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ring circle { stroke-dasharray: .28 1; }
.tick path { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
.earned { font-size: .74em; color: var(--testo-2); font-weight: 500; opacity: 0; font-variant-numeric: tabular-nums; height: 1.3em; }
.earned__val { color: var(--accento); font-weight: 620; }

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