/* The plans, on the front page and the pricing page: four cards, one price
   each. Free, Štart and the month are quiet white cards; the year's plan
   closes the row on the brand's own colour and carries the badge and the box
   saying what it saves. It is third in the markup — the order a screen reader
   and a phone's swipe row read — and drawn last where the four stand side by
   side. It restates its colours through the tokens it reads rather than
   overriding each declaration, so the dark theme needs nothing of its own. */

@layer components {
  .home-plans {
    display: grid;
    gap: 1.25rem;
    margin-block-start: 3rem;

    @media (width >= 768px) {
      align-items: start;
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    @media (width >= 1024px) {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }
  }

  /* The card lays out as a column so the button sits at the foot, level
     across the row however many lines the list above it runs to. */
  .home-plan {
    --plan-ink: var(--color-ink);
    --plan-ink-quiet: var(--color-ink-secondary);
    --plan-mark: var(--color-brand);
    --plan-rule: var(--color-border-subtle);

    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    color: var(--plan-ink);
    display: grid;
    grid-template-rows: auto auto auto 1fr auto;
    padding: 1.75rem 1.5rem;
  }

  /* The year's price is the one being recommended, so it is the brand's card
     and, where the four stand in a row, the last of them. */
  .home-plan--featured {
    --plan-ink: var(--color-ink-inverted);
    --plan-ink-quiet: oklch(from var(--color-ink-inverted) l c h / 85%);
    --plan-mark: var(--color-ink-inverted);
    --plan-rule: oklch(from var(--color-ink-inverted) l c h / 35%);

    background: var(--color-brand-fill);
    border-color: transparent;
    box-shadow: var(--shadow-lifted);

    @media (width >= 1024px) {
      order: 1;
    }
  }

  .home-plan__name {
    align-items: center;
    background: var(--color-surface);
    border-radius: var(--radius-pill);
    color: var(--color-ink);
    display: flex;
    font-size: 0.8125rem;
    font-weight: 700;
    gap: 0.375rem;
    margin: 0 0 1.25rem;
    padding: 0.3125rem 0.875rem;
    width: fit-content;
  }

  /* The badge on the dark card is the brand as a surface, so it reads as the
     recommendation rather than as another white pill. */
  .home-plan--featured .home-plan__name {
    background: var(--color-surface);
    color: var(--color-brand);
  }

  .home-plan__price {
    align-items: baseline;
    display: flex;
    font-size: 2.5rem;
    font-weight: 700;
    gap: 0.375rem;
    letter-spacing: -0.02em;
    margin: 0 0 0.875rem;
  }

  .home-plan__period {
    color: var(--plan-ink-quiet);
    font-size: 0.875rem;
    font-weight: 400;
  }

  .home-plan__text {
    color: var(--plan-ink-quiet);
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 0 0 1.25rem;
  }

  /* What the year saves, in the one place on the dark card that is lighter
     than it: the figure first, the arithmetic under it. */
  .home-plan__save {
    background: oklch(from var(--color-ink-inverted) l c h / 14%);
    border-radius: var(--radius-md);
    margin: 0 0 1.25rem;
    padding: 0.75rem 0.875rem;

    & b {
      display: block;
      font-size: 0.9375rem;
      font-weight: 700;
    }

    & span {
      color: oklch(from var(--color-ink-inverted) l c h / 80%);
      display: block;
      font-size: 0.8125rem;
      line-height: 1.5;
      margin-block-start: 0.125rem;
    }
  }

  .home-plan__list {
    border-block-start: 1px solid var(--plan-rule);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 1.25rem 0 0;
  }

  .home-plan__item {
    display: flex;
    font-size: 0.875rem;
    gap: 0.625rem;
    line-height: 1.5;
  }

  .home-plan__mark {
    color: var(--plan-mark);
    flex-shrink: 0;
    margin-block-start: 0.125rem;
  }

  /* The featured card's marks sit in a ring, so they read as marks against
     the dark rather than as ticks floating on it. */
  .home-plan--featured .home-plan__mark {
    background: oklch(from var(--color-ink-inverted) l c h / 22%);
    block-size: 1.125rem;
    border-radius: var(--radius-pill);
    inline-size: 1.125rem;
    margin-block-start: 0;
    padding: 0.125rem;
  }

  /* The button takes its colour from the primitive it carries — outline on the
     quiet cards, the brand as a surface on the recommended one — so the plan
     only has to say it spans the card and sits at its foot. */
  .home-plan__cta {
    align-self: end;
    justify-content: center;
    width: 100%;
  }

  /* On the brand's card the button is the surface, the brand in its text. */
  .home-plan--featured .home-plan__cta {
    background: var(--color-surface);
    border-color: var(--color-surface);
    color: var(--color-brand);

    &:hover {
      background: var(--color-brand-tint);
    }
  }

  /* The footnote the PEPPOL lines' asterisk points at, quiet under the row. */
  .home-plan-footnote {
    color: var(--color-ink-muted);
    font-size: 0.8125rem;
    line-height: 1.6;
    margin-block: 1.25rem 0;
    text-align: center;

    a {
      color: var(--color-link);
    }
  }
}
