/* The pricing switch: dark plans on a black page, the plan picked edged in moving colour. */
:root {
  --page: #000000;          /* the page */
  --card: #121216;
  --edge: #24242b;
  --ink: #f4f3ef;
  --muted: #8e8d96;
  --accent: #b7f36b;        /* yearly, and the ticks */
  --pick-a: #b7f36b;        /* the colours that run round the plan picked */
  --pick-b: #6bd8f3;
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
}

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

/* 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;
}

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

.plans__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.plans__title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ---------------------------------------------------------------- the switch */
.bill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.bill__opt {
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 650 15px 'Familjen Grotesk Variable', system-ui, sans-serif;
  cursor: pointer;
  transition: color 0.3s;
}

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

.bill__track {
  position: relative;
  width: 52px;
  height: 30px;
  border-radius: 15px;
  background: #24242b;
  cursor: pointer;
  transition: background-color 0.35s;
}

.bill.is-year .bill__track {
  background: #3b4a22;
}

.bill__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 12px;
  background: var(--ink);
  transform-origin: 50% 50%;
}

/* the chip with the months saved: quiet while monthly, lit while yearly */
.bill__save {
  padding: 4px 9px;
  border-radius: 8px;
  background: #1d1d22;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  transition: background-color 0.3s, color 0.3s;
}

.bill.is-year .bill__save {
  background: var(--accent);
  color: #182006;
}

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

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

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

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px 20px 20px;
  border: 1px solid var(--edge);
  border-radius: 22px;
  background: var(--card);
}

/* the plan picked: a ring of colour turning round its edge */
.card.is-pick {
  border-color: transparent;
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    conic-gradient(from var(--turn, 0deg), var(--pick-a), var(--pick-b), #24242b 40%, #24242b 60%, var(--pick-a)) border-box;
}

.card__label {
  position: absolute;
  top: -11px;
  right: 18px;
  padding: 3px 9px;
  border-radius: 7px;
  background: var(--pick-a);
  color: #182006;
  font-size: 12px;
  font-weight: 700;
}

.card__name {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

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

.price {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 4px;
  height: 52px;
  margin-top: 16px;
}

.price__amount {
  position: relative;
  display: inline-block;
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

/* the line that strikes the old price */
.price__strike {
  position: absolute;
  left: -4px;
  right: -4px;
  top: 52%;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.price__per {
  color: var(--muted);
  font-size: 14px;
}

/* the line under the price: a slot its words roll through, so the plans never change height */
.price__year {
  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;
}

.price__year.is-year {
  color: var(--accent);
}

.price__year span {
  display: inline-block;
}

.card__list {
  display: grid;
  gap: 9px;
  margin: 16px 0 20px;
  padding: 0;
  list-style: none;
  font-size: 14.5px;
}

.card__list li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card__list svg {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card__go {
  margin-top: auto;
  padding: 11px 16px;
  border: 1px solid #34343d;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font: 700 15px 'Familjen Grotesk Variable', system-ui, sans-serif;
  cursor: pointer;
  transition: background-color 0.25s, transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.is-pick .card__go {
  border-color: transparent;
  background: var(--pick-a);
  color: #182006;
}

.card__go:active {
  transform: scale(0.96);
}

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

html[data-using='pointer'] .card__go: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) {
  .cards {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 80%;
    margin: 0 -16px;
    padding: 14px 16px 6px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 16px;
    scrollbar-width: none;
  }

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

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

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