/* The potted pricing: the plans of a plant care app on a white page, each one a succulent in its pot under a
   tinted arch. The plants, the pots and the flowers are drawn by the script on a canvas, from the colours below. */
:root {
  --page: #ffffff;          /* the page */
  --card: #f7f4ec;          /* the plans */
  --edge: #ebe5d6;          /* their edge */
  --ink: #1f2a20;           /* titles and prices */
  --muted: #6c7366;         /* the quieter words */
  --accent: #2f6a3c;        /* the plan chosen and its button */
  --accent-ink: #f6f3e8;    /* the words on it */
  --save: #2c7a3f;          /* what paying yearly saves */
  --save-tint: #e2efd8;
  --track: #efebe1;         /* the billing switch */
  --sky-0: #e5eedf;         /* the arch behind each pot */
  --sky-1: #f4e8da;
  --sky-2: #eae7f2;
  --leaf-0: #86ad98;        /* the leaves of each plant, their tips and the blush at the very end */
  --tip-0: #c4dccb;
  --blush-0: #e58c80;
  --leaf-1: #4c8550;
  --tip-1: #a6cb7c;
  --blush-1: #c4a15c;
  --leaf-2: #8b89b0;
  --tip-2: #cbc5e0;
  --blush-2: #b35f8a;
  --pot-0: #c66a40;         /* the pots: terracotta, a green glaze, cream stoneware */
  --pot-1: #3e6e62;
  --pot-2: #e6ddcb;
  --soil: #4b3628;
  --stalk: #94a56c;         /* the flower stalks */
  --bloom-0: #ff7a52;       /* the flowers of each plant and their hearts */
  --bloom-1: #ffae3b;
  --bloom-2: #e8579b;
  --heart: #ffd76a;
}

* {
  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: 'Instrument 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;
}

/* one column as wide as the page: the plans sliding side by side on a phone never widen it */
.stage {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 32px 0;
  overflow: hidden;
}

.garden {
  width: min(900px, 100%);
  padding: 0 16px;
}

.garden__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  margin-bottom: 20px;
}

.garden__title {
  margin: 0;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: 30px;
  font-weight: 560;
  font-variation-settings: 'opsz' 72, 'SOFT' 100, 'WONK' 0;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

/* ---------------------------------------------------------------- the billing switch */
.bill {
  position: relative;
  display: flex;
  padding: 4px;
  border-radius: 999px;
  background: var(--track);
}

.bill__thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(40, 34, 20, 0.12), 0 4px 12px -4px rgba(40, 34, 20, 0.22);
}

.bill__opt {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 600 15px 'Instrument Sans Variable', system-ui, sans-serif;
  cursor: pointer;
  transition: color 0.3s;
}

.bill__opt[aria-checked='true'] {
  color: var(--ink);
}

.bill__free {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--save-tint);
  color: var(--save);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

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

/* ---------------------------------------------------------------- the plans */
.pots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 12px 12px 16px;
  border: 1px solid var(--edge);
  border-radius: 26px;
  background: var(--card);
  transition: border-color 0.35s, box-shadow 0.35s;
}

.plan.is-pick {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 18px 40px -22px rgba(31, 60, 36, 0.45);
}

/* the arch the pot stands under */
.plan__window {
  position: relative;
  height: 214px;
  overflow: hidden;
  border-radius: 110px 110px 16px 16px / 84px 84px 16px 16px;
  background: var(--sky);
  cursor: pointer;
}

.plan__window canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.plan__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 14px 8px 0;
}

.plan__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.plan__name {
  margin: 0;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: 23px;
  font-weight: 600;
  font-variation-settings: 'opsz' 48, 'SOFT' 100, 'WONK' 1;
  letter-spacing: -0.01em;
}

.plan__label {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.plan__for {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  height: 50px;
  margin-top: 12px;
}

.price__amount {
  display: inline-flex;
  align-items: baseline;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: 46px;
  font-weight: 620;
  font-variation-settings: 'opsz' 96, 'SOFT' 60, 'WONK' 0;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
}

.price__cur {
  margin-right: 3px;
  font-size: 0.62em;
  align-self: flex-start;
  margin-top: 0.08em;
}

/* every digit is its own slot, so a digit that changes can drop in on its own */
.price__digits {
  display: inline-flex;
  overflow: hidden;
  padding: 0.06em 0;
}

.price__digits span {
  display: inline-block;
}

.price__per {
  display: inline-block;
  height: 18px;
  overflow: hidden;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 18px;
}

.price__per span,
.plan__line span {
  display: inline-block;
}

/* the line under the price: a slot its words roll through, so the plans never change height */
.plan__line {
  height: 18px;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
  transition: color 0.3s;
}

.plan__line.is-year {
  color: var(--save);
}

.plan__list {
  display: grid;
  gap: 8px;
  margin: 14px 0 18px;
  padding: 0;
  list-style: none;
  font-size: 14.5px;
}

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

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

/* ---------------------------------------------------------------- the button of each plan */
.choose {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  margin-top: auto;
  padding: 0 18px;
  border: 1px solid #d9d2c1;
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font: 650 15px 'Instrument Sans Variable', system-ui, sans-serif;
  cursor: pointer;
  transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

.choose__tick {
  display: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.is-pick .choose {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.is-pick .choose__tick {
  display: block;
}

@media (hover: hover) {
  .plan:not(.is-pick) .choose:hover {
    border-color: var(--ink);
  }
}

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

html[data-using='pointer'] .choose:focus-visible,
html[data-using='pointer'] .bill__opt:focus-visible {
  outline: none;
}

/* on a phone the plans sit side by side and slide under the finger, one at a time */
@media (max-width: 760px) {
  .garden__title {
    font-size: 26px;
  }

  .pots {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 82%;
    margin: 0 -16px;
    padding: 4px 16px 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 16px;
    scrollbar-width: none;
  }

  .pots::-webkit-scrollbar {
    display: none;
  }

  .plan {
    scroll-snap-align: center;
  }
}

/* schermi bassi (la casella dell'anteprima sul telefono, 341 per 410): l'arco più basso, il prezzo e la lista più
   stretti, così un piano si vede tutto, dal vaso al pulsante */
@media (max-height: 520px) {
  .stage {
    padding: 12px 0;
  }

  .garden__head {
    gap: 8px 16px;
    margin-bottom: 10px;
  }

  .garden__title {
    font-size: 21px;
  }

  .bill {
    padding: 3px;
  }

  .bill__thumb {
    top: 3px;
    bottom: 3px;
  }

  .bill__opt {
    height: 30px;
    padding: 0 12px;
    font-size: 13px;
  }

  .bill__free {
    padding: 2px 7px;
    font-size: 11px;
  }

  .plan {
    padding: 8px 8px 10px;
    border-radius: 20px;
  }

  .plan__window {
    height: clamp(96px, 27vh, 214px);
    border-radius: 90px 90px 12px 12px / 60px 60px 12px 12px;
  }

  .plan__body {
    padding: 8px 6px 0;
  }

  .plan__name {
    font-size: 19px;
  }

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

  .price {
    height: 36px;
    margin-top: 6px;
  }

  .price__amount {
    font-size: 33px;
  }

  .price__per {
    font-size: 13px;
  }

  .plan__line {
    margin-top: 2px;
    font-size: 12.5px;
  }

  .plan__list {
    gap: 4px;
    margin: 8px 0 10px;
    font-size: 13px;
  }

  .plan__list svg {
    width: 14px;
    height: 14px;
  }

  .choose {
    height: 38px;
    font-size: 14px;
  }
}
