/* The one plan as a card: the landing's price section and onboarding's plan step. */

@layer components {
  /* The one plan as a card: a faint brand wash falling from its top edge. */
  .plan_card {
    max-width: 34rem;
    margin: 0 auto;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    text-align: left;
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--color-primary) 7%, transparent), transparent 45%),
      var(--color-bg-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
  }

  .plan_card_name {
    margin: 0;
    font-size: var(--text-2xl);
    font-weight: var(--font-weight-bold);
    line-height: 1.2;
    color: var(--color-text);

    /* The price and its period never split across lines in a narrow column. */
    .plan_card_price {
      white-space: nowrap;
    }

    small {
      font-size: var(--text-base);
      font-weight: var(--font-weight-normal);
      color: var(--color-text-light);
    }
  }

  /* Mensal/Anual as a segmented pill: the pressed half lifts on the paper, the other rests
     in the wash. The plan-switch controller swaps the cadence shown and the action's plan. */
  .plan_card_switch {
    display: inline-flex;
    margin-bottom: 1rem;
    padding: 3px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
  }

  .plan_card_switch_option {
    padding: 0.375rem 1.125rem;
    border: 0;
    border-radius: var(--radius-pill);
    background: none;
    color: var(--color-text-light);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    line-height: 1.4;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;

    &[aria-pressed="true"] {
      background: var(--color-bg-white);
      color: var(--color-text);
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    }
  }

  /* What the yearly price comes to a month, under it, so the two cadences compare. */
  .plan_card_yearly_note {
    margin: 0.25rem 0 0;
    font-size: var(--text-sm);
    color: var(--color-text-light);
  }

  .plan_card_body {
    margin: 0.375rem 0 1.25rem;
    font-size: var(--text-lg);
    line-height: var(--line-height-lg);
    color: var(--color-text-light);
  }

  .plan_card_action {
    margin-bottom: 1.75rem;
  }

  /* In onboarding the column has no shell of its own and the plan is the page's one card,
     the way a pricing page draws it, so it keeps the landing's box and lifts on a shadow. */
  .onboarding .plan_card {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
  }

  [data-theme="dark"] .onboarding .plan_card {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  }

  .plan_card_list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.625rem;

  }

  .plan_card_item {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    font-size: var(--text-base);
    line-height: var(--line-height-md);
    color: var(--color-text);
  }

  .plan_card_item_body {
    min-width: 0;
  }

  .plan_card_item_name {
    font-weight: var(--font-weight-semibold);
  }

  /* The (?) opens the two sentences as a note above the line, on a tap, on every screen; the
     dropdown controller toggles it and closes it on a tap elsewhere. */
  .plan_card_item_help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 0.375rem;
    padding: 0;
    vertical-align: 0.1em;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: var(--color-bg-white);
    color: var(--color-text-light);
    font: inherit;
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    cursor: pointer;

    &:hover,
    &:focus-visible {
      border-color: var(--color-primary);
      color: var(--color-primary);
    }
  }

  .plan_card_item_text {
    position: absolute;
    left: 0;
    bottom: calc(100% + 0.375rem);
    z-index: var(--z-popup);
    width: min(22rem, 100%);
    padding: 0.75rem 0.875rem;
    background: var(--color-bg-white);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.25);
    font-size: var(--text-sm);
    line-height: var(--line-height-md);
    color: var(--color-text);
  }

  /* A filled brand dot with a white check, the way the plan says yes. */
  .plan_card_check {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-top: 0.2em;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-on-brand);

    svg {
      width: 12px;
      height: 12px;
      stroke-width: 3;
    }
  }
}

/* The card's button is a pill wherever the card goes, the way the landing's buttons are. Outside
   the layer because the wizard button rule that squares it is unlayered too. */
.plan_card_action .btn {
  border-radius: var(--radius-pill);
}
