/* ============================================================
   PRICING — the blocks of bir.ch/pricing. Page-only for now; the overview decides
   what becomes a component (the logo strip repeats on other pages).
   Requires: tokens.css, page.css, surface.css, patterns.css, button.css, tabs.css

   .pricing-plans    the plan tabs (performance / hub) on top, one panel per tab below
   .spend            the «My monthly ad spend is up to» slider: a native range input; the bubble
                     with the amount rides the thumb (--p = position 0…1, set by the page script)
   .price-cards      Essential / Pro / Enterprise; the rows of the cards line up (subgrid), so
                     Enterprise needs no invisible «$» to keep its price level with the others
   .hub-steps        hub prices per gateway, one tile per events step
   ============================================================ */

.pricing-plans {
  display: grid;
  gap: var(--space-lg);
  /* switching a plan tab: the new panel floats up into place (the Toggle character); tunable in the Motion panel */
  --motion-dur: var(--duration-toggle);
  --motion-ease: var(--ease-toggle);
  --motion-rise: var(--space-sm);
}
.pricing-plans__tabs { justify-self: center; }
.pricing-panel { display: grid; gap: var(--section-space); }
/* the slider and billing tabs belong to the cards: 48 between them, not the section rhythm */
.pricing-plan { display: grid; gap: var(--space-lg); }
.pricing-panel[hidden] { display: none; }
/* ?plan=hub: an inline script marks <html> before the first paint, so the hub panel shows without a flash */
html[data-plan="hub"] #plan-performance { display: none; }
html[data-plan="hub"] #plan-hub { display: grid; }
.pricing-panel__top { display: grid; justify-items: center; gap: var(--space-lg); text-align: center; }
.pricing-block { display: grid; gap: var(--space); } /* the cards and their currency note */
.pricing-block--hub { justify-items: center; text-align: center; }
.pricing-block--hub > .hub-steps { width: 100%; text-align: left; }
.pricing-block--hub > .btn { margin-top: var(--space); } /* the note belongs to the tiles; the button is its own group (24 + 24 = 48) */
@media (hover: hover) { .pricing-block--hub > .btn:hover { background: var(--color-accent-purple); } } /* the hover of the final CTA's second button */
.pricing-note { text-align: center; }

/* ---------- Spend slider ---------- */
.spend { display: grid; gap: var(--space-sm); justify-items: center; width: 100%; padding-top: var(--space-md); } /* tabs → heading 32 more */
.spend__track {
  /* motion: the bubble glides between steps, the rail fills up to it, numbers rise into place —
     the Toggle motion tokens, tunable in the review tool's Motion panel; none with «reduce motion» */
  --motion-dur: var(--duration-toggle);
  --motion-ease: var(--ease-toggle);
  --motion-scale: 1.06; /* the bubble while it is held */
  --rail: color-mix(in oklch, var(--color-accent-indigo) 25%, var(--color-bg-white)); /* the empty part of the rail */
  --thumb: 8rem; /* one width for the grab area, the bubble, the dots' inset and the fill: fits the widest label «$500K+» */
  position: relative;
  width: calc(8 / 12 * 100%);
  padding-block: var(--space-xs);
}
/* the filled part of the rail: from the left end to the bubble's centre (half the thumb + p × the rest) */
.spend__fill {
  position: absolute;
  top: 50%;
  left: 0;
  width: calc(var(--thumb) / 2 + var(--p, 0) * (100% - var(--thumb)));
  height: var(--space-xs);
  border-radius: var(--radius-pill);
  background: var(--color-accent-indigo);
  transform: translateY(-50%);
  pointer-events: none;
  transition: width var(--motion-dur) var(--motion-ease);
}
.spend__input {
  display: block;
  width: 100%;
  height: var(--btn-h-xs);
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: grab;
}
.spend__input:active { cursor: grabbing; }
/* the rail: a light indigo bar with a dot per step (the dots are decorative, drawn by a gradient) */
.spend__input::-webkit-slider-runnable-track { height: var(--space-xs); border-radius: var(--radius-pill); background: var(--rail); }
.spend__input::-moz-range-track { height: var(--space-xs); border-radius: var(--radius-pill); background: var(--rail); }
/* the native thumb is invisible but wide: the bubble on top of it is what people see and grab */
.spend__input::-webkit-slider-thumb { appearance: none; width: var(--thumb); height: var(--btn-h-xs); margin-top: calc((var(--space-xs) - var(--btn-h-xs)) / 2); opacity: 0; }
.spend__input::-moz-range-thumb { width: var(--thumb); height: var(--btn-h-xs); opacity: 0; border: 0; }
.spend__input:focus-visible { outline: none; }
.spend__input:focus-visible ~ .spend__bubble { outline: var(--border-thick) solid var(--color-accent-purple); outline-offset: var(--border-thin); }
.spend__dots { position: absolute; inset: 0 calc(var(--thumb) / 2); pointer-events: none; } /* dot i sits where the thumb centres at step i */
.spend__dot {
  /* one rule for both parts of the rail: a dot is the colour under it, a little darker and
     more saturated; smaller than the rail, so it never touches the rail's edges */
  --under: var(--rail);
  --darken: 0.12;
  position: absolute;
  top: 50%;
  left: calc(var(--i) * 100%);
  width: var(--space-xxs);
  height: var(--space-xxs);
  border-radius: var(--radius-pill);
  background: oklch(from var(--under) calc(l - var(--darken)) calc(c + 0.05) h);
  transform: translate(-50%, -50%);
  transition: background-color var(--motion-dur) var(--motion-ease);
}
.spend__dot.is-past { --under: var(--color-accent-indigo); --darken: 0.2; } /* on the filled part: a bit darker still, to read on Indigo */
.spend__bubble {
  position: absolute;
  top: 50%;
  left: calc(var(--p, 0) * 100%);
  transform: translate(calc(var(--p, 0) * -100%), -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--thumb); /* fixed, so its centre is the thumb's at every step */
  height: var(--btn-h-xs);
  padding-inline: var(--space);
  border-radius: var(--radius-md);
  background: var(--color-accent-indigo);
  color: var(--color-text);
  pointer-events: none;
  white-space: nowrap;
  transition: left var(--motion-dur) var(--motion-ease), transform var(--motion-dur) var(--motion-ease), scale var(--motion-dur) var(--motion-ease), background-color var(--motion-dur) var(--motion-ease);
}
.spend__input:active ~ .spend__bubble { scale: var(--motion-scale); }
/* hover: the bubble turns Purple, as the plan-card buttons */
@media (hover: hover) { .spend__input:hover ~ .spend__bubble { background: var(--color-accent-purple); } }
/* numbers that rise into place need a box of their own to move (inline text does not transform) */
.spend__bubble [data-spend], .price-card [data-price] { display: inline-block; }
@media (prefers-reduced-motion: reduce) {
  .spend__fill, .spend__dot, .spend__bubble { transition: none; }
  .spend__input:active ~ .spend__bubble { scale: none; }
}
@media (max-width: 47.9375rem) {
  .spend__track { width: 100%; }
}

/* ---------- Plan cards ---------- */
.price-cards {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 2 * var(--grid-gap)) / 3);
  grid-template-rows: repeat(7, auto);
  justify-content: center;
  column-gap: var(--grid-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}
.price-card { display: grid; grid-row: span 7; grid-template-rows: subgrid; row-gap: var(--space-xs); align-content: start; } /* price rows 8 apart */
.price-card__name { margin-bottom: calc(var(--gap-heading-small) - var(--space-xs)); } /* H5 name → the old price: --gap-heading-small with the card's 8 row gap */
.price-card[hidden] { display: none; }
.price-card__name { display: flex; align-items: center; gap: var(--space-xs); }
.price-card--featured .price-card__name { color: var(--color-accent-purple); }
.price-card__badge { padding: var(--space-xxs) var(--space-xs); border-radius: var(--radius-sm); background: var(--color-accent-purple); color: var(--color-text); }
.price-card__was { text-decoration: line-through; align-self: end; }
.price-card__was[data-off] { visibility: hidden; } /* monthly billing: the crossed price keeps its row (as live) */
.price-card__price { display: flex; align-items: baseline; gap: var(--space-xs); }
.price-card__desc { padding-top: var(--space); }
.price-card__action {
  width: 100%;
  margin-top: var(--space-sm);
  background: var(--color-accent-indigo);
  color: var(--color-text);
  transition: background-color var(--duration-hover) var(--ease-hover);
}
/* hover: an existing token instead of live #202FFF */
@media (hover: hover) { .price-card__action:hover { opacity: 1; background: var(--color-accent-purple); } }
.price-card__terms { padding-top: var(--space-xs); } /* a little air under the button */
.price-card__terms a { color: inherit; }
.price-card__features { display: grid; align-content: start; gap: var(--space-sm); padding-top: var(--space); }
@media (max-width: 47.9375rem) {
  .price-cards { grid-auto-flow: row; grid-auto-columns: auto; grid-template-rows: none; row-gap: var(--grid-gap); }
  .price-card { grid-row: auto; grid-template-rows: none; }
}

/* ---------- Hub steps ---------- */
.hub-steps { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--grid-gap); margin: 0; padding: 0; list-style: none; }
.hub-step { display: grid; align-content: space-between; gap: var(--space-lg); }
@media (max-width: 61.9375rem) { .hub-steps { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 47.9375rem) { .hub-steps { grid-template-columns: repeat(2, 1fr); } }

.pricing-cases { display: grid; gap: var(--space); } /* case cards 24 apart, under the block's «Cases» head */
