/* Styling of the plans page alone: the plan cards and the cycle switcher and the offers (decision 389) */
/* Loads after site.css on this page alone so the shared styling is lighter for the other pages */
/* The billing cycle button appears when the script works and without it the two prices stay visible together */
.cycle {
  display: none;
}

.cycle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-block-size: var(--touch);
  min-inline-size: var(--sp-20);
  padding: 0 var(--sp-5);
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  cursor: pointer;
  transition:
    background-color var(--dur-1) var(--ease),
    color var(--dur-1) var(--ease),
    box-shadow var(--dur-1) var(--ease);
}

.cycle-btn[aria-pressed='true'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}

.cycle-save,
.plan-flag {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--chip-h);
  padding-inline: var(--sp-2);
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  white-space: nowrap;
}

.plan-grid {
  display: grid;
  gap: var(--sp-5);
  inline-size: 100%;
  max-inline-size: var(--plan-max);
}

.plan {
  display: grid;
  grid-row: span var(--plan-rows);
  grid-template-rows: subgrid;
  row-gap: var(--sp-5);
  padding: var(--sp-6);
  border: var(--line) solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg);
}

.plan--featured {
  border: var(--line-2) solid var(--accent);
  background: var(--surface);
  box-shadow: var(--shadow-3);
}

.plan-head {
  display: grid;
  align-content: start;
  gap: var(--sp-1);
}

.plan-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
}

.plan-name {
  font-size: var(--fs-xl);
}

.plan-for {
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

.plan-price {
  display: grid;
  align-content: start;
  gap: var(--sp-4);
}

.price {
  display: grid;
  gap: var(--sp-1);
}

.price-num {
  font-size: var(--fs-price);
  font-weight: var(--fw-black);
  line-height: var(--lh-flat);
}

.price-unit {
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

.plan-cta {
  inline-size: 100%;
}

.plan-list {
  display: grid;
  align-content: start;
  gap: var(--sp-3);
  padding-block-start: var(--sp-5);
  border-block-start: var(--line) solid var(--border);
  font-size: var(--fs-sm);
}

.plan-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: var(--sp-3);
}

/* Channels and message balance under the announcements management line in a smaller font (decision 420) */
.plan-line-note {
  display: block;
  font-size: var(--fs-2xs);
  color: var(--text-muted);
}

/* Four cards or more in a narrow row: the small line is hidden so the cards stay in the first screen (decision 404) and its details are in the help center */
.plans-hero .plan-grid:has(> .plan:nth-child(4)) .plan-line-note {
  display: none;
}

@media (min-width: 60rem) {
  .plan-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-inline-size: none;
  }
}

/* Plans page: the cycle switcher and the three cards in the middle of the first screen with no visible heading above them */
/* The card in its previous design shortened: the name and its badge beside it and then the price large and its unit under it and then the button and then the plan lines */
.plans-hero {
  display: grid;
  align-content: center;
  min-block-size: calc(100svh - var(--header-h));
  padding-block: var(--sp-6);
}

.plans-hero-body {
  display: grid;
  justify-items: center;
  gap: var(--sp-6);
}

.plans-hero .plan-grid {
  text-align: start;
}

.plans-hero .plan {
  position: relative;
  row-gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-6);
  transition:
    border-color var(--dur-2) var(--ease),
    background-color var(--dur-2) var(--ease);
}

.plans-hero .price-num {
  font-size: var(--fs-card-price);
}

.plans-hero .plan-price {
  gap: var(--sp-2);
}

.plans-hero .plan-list {
  gap: var(--sp-2);
  padding-block-start: var(--sp-4);
}

/* The free months in the yearly price are a calm orange pill under the price */
.price-save {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-block-size: var(--chip-h);
  padding-inline: var(--sp-2);
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
}

/* On desktop the cards are one row and the featured one is raised a little in its place, and three cards are a stack as follows */
@media (min-width: 60rem) {
  .plans-hero .plan-grid {
    max-inline-size: var(--plans-max);
    gap: var(--sp-5);
  }

  .plans-hero .plan--featured {
    z-index: var(--z-raised);
    translate: 0 calc(-1 * var(--plan-lift));
    scale: var(--plan-scale);
  }

  /* Three stacked cards (decision 407): the featured one in front and its two neighbors smaller and darker, hiding behind its edges */
  /* The card under the mouse or the one with focus rises to the front and the featured one goes back behind it and the third stays at the back */
  /* The motion is offset and scale and opacity alone with a curve that starts calm and ends calm so the card does not jump at the start of the motion */
  /* And the layer order changes shortly after the motion starts: the card comes out from behind the featured one's edge and then goes above it and does not jump over it */
  .plans-hero .plan-grid:has(> .plan:nth-child(3):last-child) {
    /* The overlap is in the back card's padding alone so the start of its text does not disappear under the featured one: the offset minus half of what the scale takes off the width */
    /* And the smallest scale keeps the back card's button at the minimum touch height */
    --stack-shift: 8%;
    --stack-back: 0.92;
    --stack-lift: var(--sp-2);
    --stack-speed: 620ms;
    --stack-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --stack-layer: 140ms;
    grid-template-columns: repeat(3, minmax(0, 23rem));
    justify-content: center;
    column-gap: 0;
  }

  .plans-hero .plan-grid:has(> .plan:nth-child(3):last-child) > .plan {
    --stack-x: 0%;
    --stack-y: 0px;
    --stack-scale: var(--stack-back);
    --stack-dim: 0.42;
    z-index: 1;
    translate: var(--stack-x) var(--stack-y);
    scale: var(--stack-scale);
    transition:
      translate var(--stack-speed) var(--stack-ease),
      scale var(--stack-speed) var(--stack-ease),
      z-index 0s linear var(--stack-layer),
      border-color var(--stack-speed) var(--stack-ease),
      background-color var(--stack-speed) var(--stack-ease);
  }

  /* The shadow of the two neighbors falls on what is behind them when they come forward, and the featured one has its ring and its shadow */
  .plans-hero .plan-grid:has(> .plan:nth-child(3):last-child) > .plan:not(.plan--featured) {
    box-shadow: 0 var(--sp-6) var(--sp-12) calc(-1 * var(--sp-3)) rgb(var(--shadow-rgb) / 0.55);
  }

  .plans-hero .plan-grid:has(> .plan:nth-child(3):last-child) > .plan:first-child {
    --stack-x: calc(var(--flip) * var(--stack-shift));
  }

  .plans-hero .plan-grid:has(> .plan:nth-child(3):last-child) > .plan:last-child {
    --stack-x: calc(-1 * var(--flip) * var(--stack-shift));
  }

  /* The middle one is above the outer one if it is not the featured one so the stack stays ordered from front to back */
  .plans-hero .plan-grid:has(> .plan:nth-child(3):last-child) > .plan:nth-child(2) {
    z-index: 2;
  }

  .plans-hero .plan-grid:has(> .plan:nth-child(3):last-child) > .plan--featured {
    --stack-scale: 1;
    --stack-dim: 0;
    z-index: 3;
  }

  .plans-hero .plan-grid:has(> .plan:nth-child(3):last-child) > .plan::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--hero-deep-2);
    opacity: var(--stack-dim);
    pointer-events: none;
    transition: opacity var(--stack-speed) var(--stack-ease);
  }

  .plans-hero .plan-grid:has(> .plan:nth-child(3):last-child) > .plan:focus-within {
    --stack-scale: 1;
    --stack-y: calc(-1 * var(--stack-lift));
    --stack-dim: 0;
    z-index: 4;
  }

  .plans-hero .plan-grid:has(> .plan:nth-child(3):last-child):has(> .plan:not(.plan--featured):focus-within) > .plan--featured {
    --stack-scale: var(--stack-back);
    --stack-dim: 0.42;
    z-index: 2;
  }
}

@media (min-width: 60rem) and (hover: hover) {
  .plans-hero .plan-grid:has(> .plan:nth-child(3):last-child) > .plan:hover {
    --stack-scale: 1;
    --stack-y: calc(-1 * var(--stack-lift));
    --stack-dim: 0;
    z-index: 4;
  }

  .plans-hero .plan-grid:has(> .plan:nth-child(3):last-child):has(> .plan:not(.plan--featured):hover) > .plan--featured {
    --stack-scale: var(--stack-back);
    --stack-dim: 0.42;
    z-index: 2;
  }
}

/* The number of plans is from the catalogue that platform staff edit (decision 379): the styling counts the cards itself so the generator output does not change with their count */
/* Four or five cards are one row at the whole container width with smaller cards that stay in the first screen, and six or more are two rows or more */
/* And the featured one is raised in its place from the catalogue order, and on the phone a card under a card as it is */
.plan-name {
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

@media (min-width: 60rem) {
  .plans-hero .plan-grid:has(> .plan:nth-child(4)) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-inline-size: none;
    gap: var(--sp-4);
  }

  .plans-hero .plan-grid:has(> .plan:nth-child(5)) {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--sp-3);
  }

  .plans-hero .plan-grid:has(> .plan:nth-child(6)) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--sp-4);
  }

  .plans-hero .plan-grid:has(> .plan:nth-child(7)) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .plans-hero .plan-grid:has(> .plan:nth-child(9)) {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--sp-3);
  }

  .plans-hero .plan-grid:has(> .plan:nth-child(4)) .plan {
    row-gap: var(--sp-3);
    padding: var(--sp-4);
  }

  .plans-hero .plan-grid:has(> .plan:nth-child(4)) .plan-name {
    font-size: var(--fs-lg);
  }

  .plans-hero .plan-grid:has(> .plan:nth-child(4)) .plan-for,
  .plans-hero .plan-grid:has(> .plan:nth-child(4)) .plan-list {
    font-size: var(--fs-xs);
    line-height: var(--lh-ui);
  }

  .plans-hero .plan-grid:has(> .plan:nth-child(4)) .price-num {
    font-size: var(--fs-2xl);
  }

  .plans-hero .plan-grid:has(> .plan:nth-child(4)) .plan-list {
    gap: var(--sp-2);
    padding-block-start: var(--sp-3);
  }
}

.plan--featured .plan-flag {
  background: var(--accent);
  color: var(--on-accent);
}

/* The new design of the plans page (decision 404): the cards on a deep panel like the first screen on the home page with no space above them */
/* The featured one is a bright white card with an orange ring standing out from the panel and the rest are light glass with white ink, so the order reads at first glance */
.plans-hero {
  align-content: start;
  min-block-size: 0;
  padding-block: var(--sp-2) var(--sp-16);
}

.plans-hero-body {
  position: relative;
  isolation: isolate;
  gap: var(--sp-6);
  padding: var(--sp-5) clamp(1rem, 0.2rem + 3vw, 3.5rem) clamp(2rem, 1rem + 3vw, 3.5rem);
  border-radius: var(--r-device);
  background-color: var(--hero-deep);
  background-image:
    radial-gradient(60% 55% at 50% 0%, var(--hero-glow-1), transparent 72%),
    radial-gradient(38% 45% at 8% 92%, var(--hero-glow-2), transparent 70%),
    linear-gradient(180deg, var(--hero-deep), var(--hero-deep-2));
  color: var(--on-deep);
  --focus: var(--on-deep);
}

/* On desktop above the cards there is room in which the front card rises without touching the cycle switcher (decision 407) */
@media (min-width: 60rem) {
  .plans-hero-body {
    gap: var(--sp-8);
  }
}

.plans-hero-body::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background-image: radial-gradient(circle at center, var(--on-deep-dots) var(--line), transparent var(--line-2));
  background-size: var(--grid-dot) var(--grid-dot);
  -webkit-mask-image: radial-gradient(70% 60% at 50% 15%, var(--mask-on), transparent 80%);
  mask-image: radial-gradient(70% 60% at 50% 15%, var(--mask-on), transparent 80%);
  pointer-events: none;
}

/* The cycle switcher is glass on the panel and the selected one's background is a white pill sliding between the two buttons, and the free months pill is a filled orange with dark ink */
.plans-hero .cycle-save,
.plans-hero .price-save,
.plans-hero .plan-flag {
  background: var(--accent);
  color: var(--on-accent);
}

/* The direction of horizontal motion in the panel: the switcher pill and the offset of the stack cards toward the middle */
.plans-hero {
  --flip: 1;
}

[dir='rtl'] .plans-hero {
  --flip: -1;
}

.js .plans-hero .cycle {
  position: relative;
  grid-auto-columns: minmax(0, 1fr);
  background: var(--on-deep-fill);
  box-shadow: inset 0 0 0 var(--line) var(--on-deep-line);
}

.js .plans-hero .cycle::before {
  content: '';
  position: absolute;
  inset-block: var(--sp-1);
  inset-inline-start: var(--sp-1);
  inline-size: calc(50% - var(--sp-1) - var(--sp-1) / 2);
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  transition: translate var(--dur-3) var(--ease);
}

[data-billing='yearly'] .plans-hero .cycle::before {
  translate: calc(var(--flip) * (100% + var(--sp-1))) 0;
}

.plans-hero .cycle-btn {
  position: relative;
  z-index: 1;
  color: var(--on-deep-muted);
}

.plans-hero .cycle-btn[aria-pressed='true'] {
  color: var(--text);
}

/* The selected one carries its own surface after the sliding pill reaches it so its text reads on its surface, and the unselected one is emptied at once */
.js .plans-hero .cycle-btn {
  box-shadow: none;
  transition:
    background-color 0s linear,
    color var(--dur-1) var(--ease);
}

.js .plans-hero .cycle-btn[aria-pressed='true'] {
  background: var(--surface);
  transition:
    background-color 0s linear var(--dur-3),
    color var(--dur-1) var(--ease);
}

/* Non featured cards are a filled deep surface above the panel with white ink: they do not show through what is behind them when they overlap in the stack (decision 407) */
.plans-hero .plan:not(.plan--featured) {
  --text: var(--on-deep);
  --text-muted: var(--on-deep-muted);
  --border: var(--on-deep-line);
  --border-strong: var(--on-deep-line);
  --focus: var(--on-deep);
  border-color: var(--on-deep-line);
  background: color-mix(in srgb, var(--hero-deep) 90%, var(--on-deep));
  color: var(--on-deep);
}

.plans-hero .plan:not(.plan--featured) .plan-discount-label {
  color: var(--accent-on-deep);
}

/* The free plan's button on glass is glass with a light border and white text */
.plans-hero .plan:not(.plan--featured) .btn--secondary {
  border-color: color-mix(in srgb, var(--on-deep) 40%, transparent);
  background: transparent;
  color: var(--on-deep);
}

.plans-hero .plan:not(.plan--featured) .btn--secondary:hover {
  background: var(--on-deep-fill);
}

@media (hover: hover) {
  .plans-hero .plan:not(.plan--featured):hover {
    border-color: color-mix(in srgb, var(--on-deep) 32%, transparent);
    background: color-mix(in srgb, var(--hero-deep) 86%, var(--on-deep));
  }
}

/* The featured one has the bright page surface with an orange ring and its ink is the page ink in both modes */
.plans-hero .plan--featured {
  border: 0;
  background: var(--surface);
  background-image: none;
  color: var(--text);
  box-shadow:
    0 0 0 var(--line-2) var(--accent),
    0 var(--sp-6) var(--sp-16) calc(-1 * var(--sp-4)) rgb(var(--shadow-rgb) / 0.6);
}

.plans-hero .plan--featured .plan-discount-label {
  color: var(--accent-text);
}

/* The plan lines with a check mark in a dim circle */
.plans-hero .plan-list .icon {
  inline-size: 1.25rem;
  block-size: 1.25rem;
  padding: 0.2rem;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.plans-hero .plan:not(.plan--featured) .plan-list .icon {
  background: var(--on-deep-fill);
  color: var(--accent-on-deep);
}

/* A short desktop screen: the cards are narrower vertically so they fit the first screen even if their lines get long in English (decision 404) */
@media (min-width: 60rem) and (max-height: 50rem) {
  .plans-hero-body {
    gap: var(--sp-6);
    padding-block-start: var(--sp-2);
  }

  .plans-hero .plan {
    row-gap: var(--sp-3);
    padding-block: var(--sp-4);
  }

  .plans-hero .plan-list {
    gap: var(--sp-1);
    padding-block-start: var(--sp-3);
    line-height: var(--lh-ui);
  }

  .plans-hero .plan-grid:has(> .plan:nth-child(4)) .plan-list {
    gap: var(--sp-1);
    padding-block-start: var(--sp-2);
  }
}


/* More of what a card line counts can be bought from the add-on store: a small green plus after the line text (decision 440) */
/* The plus is drawn in ink that reads on its green: white on the deep green over a light card, and deep ink on the bright green over the deep panel */
.plan-more {
  --plus-fill: #0b7a4c;
  --plus-ink: #ffffff;
  display: inline-grid;
  place-items: center;
  inline-size: 1.15rem;
  block-size: 1.15rem;
  margin-inline-start: 0.4em;
  border-radius: 999px;
  background: var(--plus-fill);
  color: var(--plus-ink);
  vertical-align: -0.2em;
}

.plans-hero .plan:not(.plan--featured) .plan-more,
.plans-hero .plan-more-legend .plan-more {
  --plus-fill: #34d399;
  --plus-ink: #06281f;
}

/* The plus glyph alone: the check circle of the card lines does not apply to it */
.plans-hero .plan-grid .plan .plan-list .plan-more .icon,
.plan-more .icon {
  inline-size: 0.72rem;
  block-size: 0.72rem;
  padding: 0;
  margin: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  stroke-width: 3;
}

/* The legend of the plus under the cards, once */
.plan-more-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

/* Under the cards on the deep panel the legend takes the panel's quiet ink */
.plans-hero .plan-more-legend {
  color: var(--on-deep-muted);
}

.plan-more-legend .plan-more {
  margin: 0;
}
