/* The odometer pricing: the plans of a backup service on a white page. Everything is quiet and light except the
   prices, which stand on the dark wheels of a mechanical counter (drawn by the script on a canvas). */
:root {
  --page: #ffffff;          /* the page */
  --sheet: #ffffff;         /* the card holding the plans */
  --ink: #15171c;           /* titles, the plan chosen, the button */
  --muted: #6b6f79;         /* the quieter words */
  --line: #e6e7eb;          /* hairlines and the plans' edges */
  --row: #f8f8f9;           /* a plan not chosen */
  --track: #f1f1f3;         /* the billing control */
  --wheel: #1a1c21;         /* the wheels of the euros */
  --digit: #f6f3ec;         /* their digits */
  --cent-wheel: #efebe2;    /* the wheels of the cents */
  --cent-digit: #1a1c21;    /* their digits */
  --window: #0b0c0f;        /* the frame between the wheels */
  --save: #0b7a55;          /* what paying yearly saves */
  --save-tint: #e2f3eb;
}

* {
  box-sizing: border-box;
}

/* quick taps never become a double tap that zooms the page */
html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
}

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

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

.stage {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 32px 16px;
}

/* ---------------------------------------------------------------- the card */
.picker {
  position: relative;
  width: min(440px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--sheet);
  box-shadow:
    0 1px 2px rgba(21, 23, 28, 0.04),
    0 18px 40px -22px rgba(21, 23, 28, 0.22);
}

.picker__title {
  margin: 0;
  font-size: 22px;
  font-weight: 680;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.picker__sub {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.35;
}

/* ---------------------------------------------------------------- monthly or yearly */
.billing {
  position: relative;
  height: 44px;
  margin-top: 18px;
  padding: 4px;
  border-radius: 13px;
  background: var(--track);
}

.billing__thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: 36px;
  border-radius: 10px;
  background: #ffffff;
  box-shadow:
    0 1px 2px rgba(21, 23, 28, 0.1),
    0 3px 10px -4px rgba(21, 23, 28, 0.18);
}

.billing__row {
  position: absolute;
  inset: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.billing__row--ink {
  pointer-events: none;
  clip-path: inset(0 50% 0 0 round 10px);
}

.billing__opt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: 640 14.5px 'Sofia Sans Variable', system-ui, sans-serif;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.billing__row--ink .billing__opt {
  color: var(--ink);
}

.billing__save {
  padding: 2px 7px 3px;
  border-radius: 6px;
  background: var(--save-tint);
  color: var(--save);
  font-size: 12px;
  font-weight: 720;
  line-height: 1.2;
}

.billing__opt:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .billing__opt[aria-checked='false']:hover {
    color: color-mix(in srgb, var(--muted), var(--ink) 45%);
  }
}

/* ---------------------------------------------------------------- the plans */
.plans {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.plan {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  column-gap: 12px;
  align-items: center;
  padding: 14px 14px 14px 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--row);
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease, transform 0.16s ease-out;
}

.plan:active {
  transform: scale(0.99);
}

.plan[aria-checked='true'] {
  border-color: var(--ink);
  background: var(--sheet);
  box-shadow: inset 0 0 0 0.5px var(--ink), 0 6px 18px -12px rgba(21, 23, 28, 0.35);
}

@media (hover: hover) and (pointer: fine) {
  .plan[aria-checked='false']:hover {
    border-color: color-mix(in srgb, var(--line), var(--ink) 22%);
    background: var(--sheet);
  }

  .plan[aria-checked='false']:hover .plan__box {
    border-color: color-mix(in srgb, #c5c7cd, var(--ink) 35%);
  }
}

.plan:focus-visible {
  box-shadow: 0 0 0 2px var(--sheet), 0 0 0 4px var(--ink);
}

/* the box ticked for the plan chosen: a rounded square, never a dot */
.plan__box {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid #c5c7cd;
  border-radius: 7px;
  background: var(--sheet);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.plan[aria-checked='true'] .plan__box {
  border-color: var(--ink);
  background: var(--ink);
}

.plan__box svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.plan__who {
  min-width: 0;
}

.plan__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 8px;
}

.plan__name {
  font-size: 16.5px;
  font-weight: 680;
  line-height: 1.2;
  letter-spacing: -0.005em;
}

.plan__tag {
  padding: 2px 7px 3px;
  border-radius: 6px;
  background: var(--ink);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 680;
  line-height: 1.2;
  white-space: nowrap;
}

.plan__desc {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.3;
}

.plan__price {
  display: flex;
  align-items: center;
  gap: 4px;
}

.plan__cur {
  font-size: 15px;
  font-weight: 650;
}

.plan__per {
  color: var(--muted);
  font-size: 13px;
  font-weight: 560;
}

/* what comes with the plan: open only on the plan chosen. All the lists open to the same height, so while one
   closes and the other opens the card never changes size */
.plan__more {
  grid-column: 2 / -1;
  height: 0;
  overflow: hidden;
}

.plan__list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 12px 0 2px;
  list-style: none;
  font-size: 14px;
  line-height: 1.25;
}

.plan__list li {
  display: flex;
  align-items: center;
  gap: 9px;
}

.plan__list svg {
  flex: none;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--save);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------------------------------------------------------------- the wheels */
/* a window in the card: the canvas draws the wheels, the frame between them shows through the gaps, and a sheet of
   glass on top gives them a little light from above */
.wheels {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 6px;
  background: var(--window);
  box-shadow: 0 0 0 1px rgba(21, 23, 28, 0.9), 0 1px 0 1px rgba(255, 255, 255, 0.6);
}

.wheels canvas {
  display: block;
}

.wheels::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04) 46%, rgba(255, 255, 255, 0) 52%);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.55), inset 0 -1px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.wheels--big {
  border-radius: 9px;
}

/* ---------------------------------------------------------------- what is due */
.due {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.due__words {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.due__title {
  font-size: 16px;
  font-weight: 680;
}

/* the line under it: a slot its words roll through */
.due__then {
  display: grid;
  height: 18px;
  overflow: hidden;
}

.due__then-in {
  display: block;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 18px;
  white-space: nowrap;
}

.due__then-in b {
  color: var(--save);
  font-weight: 680;
}

.due__amount {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
}

.due__cur {
  font-size: 24px;
  font-weight: 650;
}

/* ---------------------------------------------------------------- the button */
.go {
  position: relative;
  display: block;
  width: 100%;
  height: 54px;
  margin-top: 18px;
  padding: 0 20px;
  border: 0;
  border-radius: 15px;
  background: var(--ink);
  color: #ffffff;
  font: 680 16px 'Sofia Sans Variable', system-ui, sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s ease, transform 0.16s ease-out;
}

@media (hover: hover) and (pointer: fine) {
  .go:hover {
    background: color-mix(in srgb, var(--ink), #ffffff 14%);
  }
}

.go:active {
  transform: scale(0.975);
}

.go:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.go__face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.go__spin {
  display: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.go.is-busy .go__spin {
  display: block;
}

.go.is-busy {
  cursor: progress;
}

@media (max-width: 420px) {
  .picker {
    padding: 20px 18px;
    border-radius: 24px;
  }

  .plan {
    padding: 13px 12px 13px 14px;
    column-gap: 10px;
  }

  .due {
    gap: 12px;
  }
}

/* schermi bassi (la casella dell'anteprima sul telefono, 341 per 410): spazi, righe e pulsante più stretti, così la
   carta si vede tutta, dal titolo al pulsante. Fino a 760 px d'altezza: la rete del visore allunga la finestra della
   demo per rimpicciolirla, e la carta deve restare stretta anche lì */
@media (max-height: 760px) {
  .stage {
    padding: 8px 12px;
  }

  .picker {
    padding: 14px 16px;
    border-radius: 20px;
  }

  .picker__title {
    font-size: 18px;
  }

  .picker__sub {
    margin-top: 2px;
    font-size: 13px;
  }

  .billing {
    height: 36px;
    margin-top: 10px;
    padding: 3px;
    border-radius: 11px;
  }

  .billing__thumb {
    top: 3px;
    left: 3px;
    width: calc(50% - 3px);
    height: 30px;
    border-radius: 8px;
  }

  .billing__row {
    inset: 3px;
  }

  .billing__opt {
    height: 30px;
    font-size: 13.5px;
  }

  .billing__save {
    font-size: 11px;
  }

  .plans {
    gap: 6px;
    margin-top: 10px;
  }

  .plan {
    padding: 8px 12px 8px 14px;
    border-radius: 14px;
  }

  .plan__name {
    font-size: 15px;
  }

  .plan__desc {
    margin-top: 0;
    font-size: 12.5px;
  }

  .plan__list {
    gap: 4px;
    padding: 7px 0 0;
    font-size: 13px;
  }

  .due {
    margin-top: 10px;
    padding-top: 10px;
  }

  .due__title {
    font-size: 15px;
  }

  .go {
    height: 42px;
    margin-top: 10px;
    border-radius: 12px;
    font-size: 15px;
  }
}
